This commit is contained in:
angelblue05 2016-10-12 05:43:19 -05:00 committed by GitHub
parent c124fbff3f
commit 6ad3a548f8
8 changed files with 41 additions and 54 deletions

View File

@ -28,7 +28,6 @@ class API(object):
played = False
last_played = None
resume = 0
user_rating = 0
try:
userdata = self.item['UserData']

View File

@ -15,7 +15,7 @@ log = logging.getLogger("EMBY."+__name__)
#################################################################################################
class Kodidb_Functions():
class Kodidb_Functions(object):
kodiversion = int(xbmc.getInfoLabel("System.BuildVersion")[:2])
@ -23,11 +23,9 @@ class Kodidb_Functions():
def __init__(self, cursor):
self.cursor = cursor
self.artwork = artwork.Artwork()
def createTag(self, name):
# This will create and return the tag_id
if self.kodiversion in (15, 16, 17):
# Kodi Isengard, Jarvis, Krypton
@ -48,7 +46,7 @@ class Kodidb_Functions():
query = "INSERT INTO tag(tag_id, name) values(?, ?)"
self.cursor.execute(query, (tag_id, name))
log.debug("Create tag_id: %s name: %s" % (tag_id, name))
log.debug("Create tag_id: %s name: %s", tag_id, name)
else:
# Kodi Helix
query = ' '.join((
@ -68,13 +66,13 @@ class Kodidb_Functions():
query = "INSERT INTO tag(idTag, strTag) values(?, ?)"
self.cursor.execute(query, (tag_id, name))
log.debug("Create idTag: %s name: %s" % (tag_id, name))
log.debug("Create idTag: %s name: %s", tag_id, name)
return tag_id
def updateTag(self, oldtag, newtag, kodiid, mediatype):
# TODO: Move to video nodes eventually
log.debug("Updating: %s with %s for %s: %s" % (oldtag, newtag, mediatype, kodiid))
log.debug("Updating: %s with %s for %s: %s", oldtag, newtag, mediatype, kodiid)
if self.kodiversion in (15, 16, 17):
# Kodi Isengard, Jarvis, Krypton
@ -88,7 +86,7 @@ class Kodidb_Functions():
"AND tag_id = ?"
))
self.cursor.execute(query, (newtag, kodiid, mediatype, oldtag,))
except Exception as e:
except Exception:
# The new tag we are going to apply already exists for this item
# delete current tag instead
query = ' '.join((
@ -111,7 +109,7 @@ class Kodidb_Functions():
"AND idTag = ?"
))
self.cursor.execute(query, (newtag, kodiid, mediatype, oldtag,))
except Exception as e:
except Exception:
# The new tag we are going to apply already exists for this item
# delete current tag instead
query = ' '.join((

View File

@ -6,7 +6,6 @@ import logging
import xbmc
import api
import artwork
##################################################################################################
@ -110,7 +109,7 @@ class KodiItems(object):
self.cursor.execute(query, (path, media_type, scraper, 1, path_id))
def remove_path(self, path_id):
kodicursor.execute("DELETE FROM path WHERE idPath = ?", (path_id,))
self.cursor.execute("DELETE FROM path WHERE idPath = ?", (path_id,))
def add_file(self, filename, path_id):
@ -333,18 +332,14 @@ class KodiItems(object):
if media_type == "movie":
query = (
'''
INSERT OR REPLACE INTO writerlinkmovie(
idWriter, idMovie)
INSERT OR REPLACE INTO writerlinkmovie(idWriter, idMovie)
VALUES (?, ?)
'''
)
elif media_type == "episode":
query = (
'''
INSERT OR REPLACE INTO writerlinkepisode(
idWriter, idEpisode)
INSERT OR REPLACE INTO writerlinkepisode(idWriter, idEpisode)
VALUES (?, ?)
'''
)
@ -355,9 +350,7 @@ class KodiItems(object):
elif type_ == "Artist":
query = (
'''
INSERT OR REPLACE INTO artistlinkmusicvideo(
idArtist, idMVideo)
INSERT OR REPLACE INTO artistlinkmusicvideo(idArtist, idMVideo)
VALUES (?, ?)
'''
)
@ -514,9 +507,7 @@ class KodiItems(object):
studio_id = self._get_studio(studio)
query = (
'''
INSERT OR REPLACE INTO studio_link(
studio_id, media_id, media_type)
INSERT OR REPLACE INTO studio_link(studio_id, media_id, media_type)
VALUES (?, ?, ?)
''')
self.cursor.execute(query, (studio_id, kodi_id, media_type))

View File

@ -221,5 +221,5 @@ class KodiMovies(KodiItems):
))
self.cursor.execute(query, (movie_id,))
def remove_boxset(self, set_id):
def remove_boxset(self, kodi_id):
self.cursor.execute("DELETE FROM sets WHERE idSet = ?", (kodi_id,))

View File

@ -267,7 +267,7 @@ class KodiMusic(KodiItems):
VALUES (?, ?, ?, ?, ?)
'''
)
self.cursor.execute(query, (albumid, args))
self.cursor.execute(query, (args))
def add_single_14(self, *args):
# TODO: Remove Helix code when Krypton is RC
@ -278,7 +278,7 @@ class KodiMusic(KodiItems):
VALUES (?, ?, ?, ?)
'''
)
self.cursor.execute(query, (albumid, genre, year, dateadded))
self.cursor.execute(query, (args))
def add_song(self, *args):
query = (
@ -313,7 +313,7 @@ class KodiMusic(KodiItems):
VALUES (?, ?, ?, ?, ?)
'''
)
kodicursor.execute(query, (kodi_id, song_id, 1, index, artist))
self.cursor.execute(query, (kodi_id, song_id, 1, index, artist))
else:
query = (
'''

View File

@ -8,7 +8,6 @@ from ntpath import dirname
import api
import embydb_functions as embydb
import kodidb_functions as kodidb
import _kodi_tvshows
from _common import Items
from utils import window, settings, language as lang, catch_except