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 played = False
last_played = None last_played = None
resume = 0 resume = 0
user_rating = 0
try: try:
userdata = self.item['UserData'] 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]) kodiversion = int(xbmc.getInfoLabel("System.BuildVersion")[:2])
@ -23,11 +23,9 @@ class Kodidb_Functions():
def __init__(self, cursor): def __init__(self, cursor):
self.cursor = cursor self.cursor = cursor
self.artwork = artwork.Artwork() self.artwork = artwork.Artwork()
def createTag(self, name): def createTag(self, name):
# This will create and return the tag_id # This will create and return the tag_id
if self.kodiversion in (15, 16, 17): if self.kodiversion in (15, 16, 17):
# Kodi Isengard, Jarvis, Krypton # Kodi Isengard, Jarvis, Krypton
@ -48,7 +46,7 @@ class Kodidb_Functions():
query = "INSERT INTO tag(tag_id, name) values(?, ?)" query = "INSERT INTO tag(tag_id, name) values(?, ?)"
self.cursor.execute(query, (tag_id, name)) 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: else:
# Kodi Helix # Kodi Helix
query = ' '.join(( query = ' '.join((
@ -68,13 +66,13 @@ class Kodidb_Functions():
query = "INSERT INTO tag(idTag, strTag) values(?, ?)" query = "INSERT INTO tag(idTag, strTag) values(?, ?)"
self.cursor.execute(query, (tag_id, name)) 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 return tag_id
def updateTag(self, oldtag, newtag, kodiid, mediatype): def updateTag(self, oldtag, newtag, kodiid, mediatype):
# TODO: Move to video nodes eventually # 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): if self.kodiversion in (15, 16, 17):
# Kodi Isengard, Jarvis, Krypton # Kodi Isengard, Jarvis, Krypton
@ -88,7 +86,7 @@ class Kodidb_Functions():
"AND tag_id = ?" "AND tag_id = ?"
)) ))
self.cursor.execute(query, (newtag, kodiid, mediatype, oldtag,)) 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 # The new tag we are going to apply already exists for this item
# delete current tag instead # delete current tag instead
query = ' '.join(( query = ' '.join((
@ -111,7 +109,7 @@ class Kodidb_Functions():
"AND idTag = ?" "AND idTag = ?"
)) ))
self.cursor.execute(query, (newtag, kodiid, mediatype, oldtag,)) 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 # The new tag we are going to apply already exists for this item
# delete current tag instead # delete current tag instead
query = ' '.join(( query = ' '.join((

View file

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

View file

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

View file

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