Fix ImportError

This commit is contained in:
tomkat83 2017-01-24 16:54:51 +01:00
parent 579b52905e
commit 0a987e86b4

View file

@ -9,7 +9,7 @@ from datetime import datetime
import artwork import artwork
from utils import tryEncode, tryDecode, settings, window, kodiSQL, \ from utils import tryEncode, tryDecode, settings, window, kodiSQL, \
CatchExceptions, KODIVERSION CatchExceptions
import plexdb_functions as plexdb import plexdb_functions as plexdb
import kodidb_functions as kodidb import kodidb_functions as kodidb
@ -268,7 +268,7 @@ class Movies(Items):
% (itemid, title)) % (itemid, title))
# Update the movie entry # Update the movie entry
if KODIVERSION >= 17: if v.KODIVERSION >= 17:
# update new ratings Kodi 17 # update new ratings Kodi 17
ratingid = self.kodi_db.get_ratingid(movieid) ratingid = self.kodi_db.get_ratingid(movieid)
self.kodi_db.update_ratings(movieid, self.kodi_db.update_ratings(movieid,
@ -315,7 +315,7 @@ class Movies(Items):
##### OR ADD THE MOVIE ##### ##### OR ADD THE MOVIE #####
else: else:
log.info("ADD movie itemid: %s - Title: %s" % (itemid, title)) log.info("ADD movie itemid: %s - Title: %s" % (itemid, title))
if KODIVERSION >= 17: if v.KODIVERSION >= 17:
# add new ratings Kodi 17 # add new ratings Kodi 17
ratingid = self.kodi_db.create_entry_rating() ratingid = self.kodi_db.create_entry_rating()
self.kodi_db.add_ratings(ratingid, self.kodi_db.add_ratings(ratingid,
@ -556,7 +556,7 @@ class TVShows(Items):
if update_item: if update_item:
log.info("UPDATE tvshow itemid: %s - Title: %s" log.info("UPDATE tvshow itemid: %s - Title: %s"
% (itemid, title)) % (itemid, title))
if KODIVERSION >= 17: if v.KODIVERSION >= 17:
# update new ratings Kodi 17 # update new ratings Kodi 17
ratingid = self.kodi_db.get_ratingid(showid) ratingid = self.kodi_db.get_ratingid(showid)
self.kodi_db.update_ratings(showid, self.kodi_db.update_ratings(showid,
@ -596,7 +596,7 @@ class TVShows(Items):
##### OR ADD THE TVSHOW ##### ##### OR ADD THE TVSHOW #####
else: else:
log.info("ADD tvshow itemid: %s - Title: %s" % (itemid, title)) log.info("ADD tvshow itemid: %s - Title: %s" % (itemid, title))
if KODIVERSION >= 17: if v.KODIVERSION >= 17:
# add new ratings Kodi 17 # add new ratings Kodi 17
ratingid = self.kodi_db.create_entry_rating() ratingid = self.kodi_db.create_entry_rating()
self.kodi_db.add_ratings(ratingid, self.kodi_db.add_ratings(ratingid,
@ -879,7 +879,7 @@ class TVShows(Items):
log.info("UPDATE episode itemid: %s" % (itemid)) log.info("UPDATE episode itemid: %s" % (itemid))
# Update the movie entry # Update the movie entry
if KODIVERSION >= 16: if v.KODIVERSION >= 16:
# Kodi Jarvis, Krypton # Kodi Jarvis, Krypton
query = ' '.join(( query = ' '.join((
"UPDATE episode", "UPDATE episode",
@ -912,7 +912,7 @@ class TVShows(Items):
else: else:
log.info("ADD episode itemid: %s - Title: %s" % (itemid, title)) log.info("ADD episode itemid: %s - Title: %s" % (itemid, title))
# Create the episode entry # Create the episode entry
if KODIVERSION >= 16: if v.KODIVERSION >= 16:
# Kodi Jarvis, Krypton # Kodi Jarvis, Krypton
query = ( query = (
''' '''
@ -1230,7 +1230,7 @@ class Music(Items):
checksum=checksum) checksum=checksum)
# Process the artist # Process the artist
if KODIVERSION >= 16: if v.KODIVERSION >= 16:
query = ' '.join(( query = ' '.join((
"UPDATE artist", "UPDATE artist",
@ -1326,7 +1326,7 @@ class Music(Items):
checksum=checksum) checksum=checksum)
# Process the album info # Process the album info
if KODIVERSION >= 17: if v.KODIVERSION >= 17:
# Kodi Krypton # Kodi Krypton
query = ' '.join(( query = ' '.join((
@ -1339,7 +1339,7 @@ class Music(Items):
kodicursor.execute(query, (artistname, year, genre, bio, thumb, kodicursor.execute(query, (artistname, year, genre, bio, thumb,
rating, lastScraped, "album", studio, rating, lastScraped, "album", studio,
albumid)) albumid))
elif KODIVERSION == 16: elif v.KODIVERSION == 16:
# Kodi Jarvis # Kodi Jarvis
query = ' '.join(( query = ' '.join((
@ -1352,7 +1352,7 @@ class Music(Items):
kodicursor.execute(query, (artistname, year, genre, bio, thumb, kodicursor.execute(query, (artistname, year, genre, bio, thumb,
rating, lastScraped, "album", studio, rating, lastScraped, "album", studio,
albumid)) albumid))
elif KODIVERSION == 15: elif v.KODIVERSION == 15:
# Kodi Isengard # Kodi Isengard
query = ' '.join(( query = ' '.join((
@ -1599,7 +1599,7 @@ class Music(Items):
log.info("Failed to add album. Creating singles.") log.info("Failed to add album. Creating singles.")
kodicursor.execute("select coalesce(max(idAlbum),0) from album") kodicursor.execute("select coalesce(max(idAlbum),0) from album")
albumid = kodicursor.fetchone()[0] + 1 albumid = kodicursor.fetchone()[0] + 1
if KODIVERSION >= 16: if v.KODIVERSION >= 16:
# Kodi Jarvis # Kodi Jarvis
query = ( query = (
''' '''
@ -1609,7 +1609,7 @@ class Music(Items):
''' '''
) )
kodicursor.execute(query, (albumid, genre, year, "single")) kodicursor.execute(query, (albumid, genre, year, "single"))
elif KODIVERSION == 15: elif v.KODIVERSION == 15:
# Kodi Isengard # Kodi Isengard
query = ( query = (
''' '''
@ -1689,7 +1689,7 @@ class Music(Items):
artist_edb = plex_db.getItem_byId(artist_eid) artist_edb = plex_db.getItem_byId(artist_eid)
artistid = artist_edb[0] artistid = artist_edb[0]
finally: finally:
if KODIVERSION >= 17: if v.KODIVERSION >= 17:
# Kodi Krypton # Kodi Krypton
query = ( query = (
''' '''
@ -1764,11 +1764,11 @@ class Music(Items):
result = kodicursor.fetchone() result = kodicursor.fetchone()
if result and result[0] != album_artists: if result and result[0] != album_artists:
# Field is empty # Field is empty
if KODIVERSION >= 16: if v.KODIVERSION >= 16:
# Kodi Jarvis, Krypton # Kodi Jarvis, Krypton
query = "UPDATE album SET strArtists = ? WHERE idAlbum = ?" query = "UPDATE album SET strArtists = ? WHERE idAlbum = ?"
kodicursor.execute(query, (album_artists, albumid)) kodicursor.execute(query, (album_artists, albumid))
elif KODIVERSION == 15: elif v.KODIVERSION == 15:
# Kodi Isengard # Kodi Isengard
query = "UPDATE album SET strArtists = ? WHERE idAlbum = ?" query = "UPDATE album SET strArtists = ? WHERE idAlbum = ?"
kodicursor.execute(query, (album_artists, albumid)) kodicursor.execute(query, (album_artists, albumid))