From 0c0832421b34b9b7cf32ccffa048ab37e259cc04 Mon Sep 17 00:00:00 2001 From: im85288 Date: Sun, 27 Sep 2015 22:06:22 +0100 Subject: [PATCH] rotten tomatoes removed --- resources/lib/LibraryMonitor.py | 89 ------------------------------- resources/lib/LibrarySync.py | 5 +- resources/lib/ReadKodiDB.py | 50 +---------------- resources/lib/WriteKodiVideoDB.py | 11 ++-- 4 files changed, 6 insertions(+), 149 deletions(-) delete mode 100644 resources/lib/LibraryMonitor.py diff --git a/resources/lib/LibraryMonitor.py b/resources/lib/LibraryMonitor.py deleted file mode 100644 index 01a8bc58..00000000 --- a/resources/lib/LibraryMonitor.py +++ /dev/null @@ -1,89 +0,0 @@ -#!/usr/bin/python -# -*- coding: utf-8 -*- - -from traceback import print_exc -import xbmc -import xbmcgui -import threading -import Utils as utils -from ReadKodiDB import ReadKodiDB -from ClientInformation import ClientInformation - -class LibraryMonitor(threading.Thread): - - event = None - exit = False - liPath = None - liPathLast = None - WINDOW = xbmcgui.Window(10000) - - clientInfo = ClientInformation() - addonName = clientInfo.getAddonName() - - def __init__(self, *args): - - self.event = threading.Event() - threading.Thread.__init__(self, *args) - - def logMsg(self, msg, lvl=1): - - className = self.__class__.__name__ - utils.logMsg("%s %s" % (self.addonName, className), msg, int(lvl)) - - def stop(self): - self.logMsg("LibraryMonitor - stop called",0) - self.exit = True - self.event.set() - - def run(self): - self.logMsg("LIBRARY MONITOR running ") - WINDOW = self.WINDOW - lastListItemLabel = None - - while (self.exit != True): - - # monitor listitem props when videolibrary is active - if (xbmc.getCondVisibility("[Window.IsActive(videolibrary) | Window.IsActive(movieinformation)] + !Window.IsActive(fullscreenvideo)")): - - self.liPath = xbmc.getInfoLabel("ListItem.Path") - liLabel = xbmc.getInfoLabel("ListItem.Label") - if ((liLabel != lastListItemLabel) and xbmc.getCondVisibility("!Container.Scrolling")): - - self.liPathLast = self.liPath - lastListItemLabel = liLabel - - # update the listitem stuff - try: - self.setRatingsInfo() - except Exception as e: - self.logMsg("ERROR in LibraryMonitor ! --> " + str(e), 0) - - else: - #reset window props - WINDOW.clearProperty("EmbySkinHelper.ListItemRottenTomatoes") - WINDOW.clearProperty('EmbySkinHelper.ListItemRottenTomatoesSummary') - WINDOW.clearProperty('EmbySkinHelper.ListItemMetaScore') - - xbmc.sleep(150) - - def setRatingsInfo(self): - WINDOW = self.WINDOW - - embyId = self.liPath.split("/")[-2] - criticrating = ReadKodiDB().getCriticRatingByEmbyId(embyId) - if criticrating: - WINDOW.setProperty('EmbySkinHelper.ListItemRottenTomatoes', criticrating) - else: - WINDOW.clearProperty('EmbySkinHelper.ListItemRottenTomatoes') - - criticratingsummary = ReadKodiDB().getCriticRatingSummaryByEmbyId(embyId) - if criticratingsummary: - WINDOW.setProperty('EmbySkinHelper.ListItemRottenTomatoesSummary', criticratingsummary) - else: - WINDOW.clearProperty('EmbySkinHelper.ListItemRottenTomatoesSummary') - - metascore = ReadKodiDB().getMetaScoreRatingByEmbyId(embyId) - if metascore: - WINDOW.setProperty('EmbySkinHelper.ListItemMetaScore', metascore) - else: - WINDOW.clearProperty('EmbySkinHelper.ListItemMetaScore') diff --git a/resources/lib/LibrarySync.py b/resources/lib/LibrarySync.py index 7ae14370..7a53caf4 100644 --- a/resources/lib/LibrarySync.py +++ b/resources/lib/LibrarySync.py @@ -137,12 +137,9 @@ class LibrarySync(threading.Thread): cursor = connection.cursor() #Add the special emby table - cursor.execute("CREATE TABLE IF NOT EXISTS emby(emby_id TEXT, kodi_id INTEGER, media_type TEXT, checksum TEXT, parent_id INTEGER, kodi_file_id INTEGER, rotten_tomatoes TEXT, rotten_tomatoes_summary TEXT, metascore TEXT)") + cursor.execute("CREATE TABLE IF NOT EXISTS emby(emby_id TEXT, kodi_id INTEGER, media_type TEXT, checksum TEXT, parent_id INTEGER, kodi_file_id INTEGER)") try: cursor.execute("ALTER TABLE emby ADD COLUMN kodi_file_id INTEGER") - cursor.execute("ALTER TABLE emby ADD COLUMN rotten_tomatoes TEXT") - cursor.execute("ALTER TABLE emby ADD COLUMN rotten_tomatoes_summary TEXT") - cursor.execute("ALTER TABLE emby ADD COLUMN metascore TEXT") except: pass connection.commit() diff --git a/resources/lib/ReadKodiDB.py b/resources/lib/ReadKodiDB.py index 9e96e117..29655b94 100644 --- a/resources/lib/ReadKodiDB.py +++ b/resources/lib/ReadKodiDB.py @@ -129,52 +129,4 @@ class ReadKodiDB(): cursor.execute("SELECT kodi_id, emby_id, checksum FROM emby WHERE media_type='song'") allsongs = cursor.fetchall() #this will return a list with tuples of all items returned from the database - return allsongs - - def getCriticRatingByEmbyId(self, id, connection=None, cursor=None): - if not connection: - connection = utils.KodiSQL() - cursor = connection.cursor() - closeCon = True - else: - closeCon = False - cursor.execute("SELECT rotten_tomatoes FROM emby WHERE emby_id=?",(id,)) - result = cursor.fetchone() - if closeCon: - connection.close() - if result: - return result[0] - else: - return None - - def getCriticRatingSummaryByEmbyId(self, id, connection=None, cursor=None): - if not connection: - connection = utils.KodiSQL() - cursor = connection.cursor() - closeCon = True - else: - closeCon = False - cursor.execute("SELECT rotten_tomatoes_summary FROM emby WHERE emby_id=?",(id,)) - result = cursor.fetchone() - if closeCon: - connection.close() - if result: - return result[0] - else: - return None - - def getMetaScoreRatingByEmbyId(self, id, connection=None, cursor=None): - if not connection: - connection = utils.KodiSQL() - cursor = connection.cursor() - closeCon = True - else: - closeCon = False - cursor.execute("SELECT metascore FROM emby WHERE emby_id=?",(id,)) - result = cursor.fetchone() - if closeCon: - connection.close() - if result: - return result[0] - else: - return None \ No newline at end of file + return allsongs \ No newline at end of file diff --git a/resources/lib/WriteKodiVideoDB.py b/resources/lib/WriteKodiVideoDB.py index 5a1a3e46..9b515b30 100644 --- a/resources/lib/WriteKodiVideoDB.py +++ b/resources/lib/WriteKodiVideoDB.py @@ -107,9 +107,6 @@ class WriteKodiVideoDB(): tagline = API().getTagline(MBitem) votecount = MBitem.get('VoteCount') rating = MBitem.get('CommunityRating') - criticrating = MBitem.get('CriticRating') - criticratingsummary = MBitem.get('CriticRatingSummary') - metascorerating = MBitem.get('Metascore') writer = " / ".join(people.get('Writer')) year = MBitem.get('ProductionYear') imdb = API().getProvider(MBitem, "imdb") @@ -181,8 +178,8 @@ class WriteKodiVideoDB(): cursor.execute(query, (title, plot, shortplot, tagline, votecount, rating, writer, year, imdb, sorttitle, runtime, mpaa, genre, director, title, studio, trailerUrl, country, movieid)) # Update the checksum in emby table and critic ratings - query = "UPDATE emby SET checksum = ?, rotten_tomatoes = ?, rotten_tomatoes_summary = ?, metascore = ? WHERE emby_id = ?" - cursor.execute(query, (checksum, criticrating, criticratingsummary, metascorerating, embyId)) + query = "UPDATE emby SET checksum = ? WHERE emby_id = ?" + cursor.execute(query, (checksum, embyId)) ##### OR ADD THE MOVIE ##### else: @@ -223,8 +220,8 @@ class WriteKodiVideoDB(): self.AddTagToMedia(movieid, viewTag, "movie", cursor) # Create the reference in emby table - query = "INSERT INTO emby(emby_id, kodi_id, kodi_file_id, media_type, checksum, rotten_tomatoes, rotten_tomatoes_summary, metascore) values(?, ?, ?, ?, ?, ?, ?, ?)" - cursor.execute(query, (embyId, movieid, fileid, "movie", checksum, criticrating, criticratingsummary, metascorerating)) + query = "INSERT INTO emby(emby_id, kodi_id, kodi_file_id, media_type, checksum) values(?, ?, ?, ?, ?)" + cursor.execute(query, (embyId, movieid, fileid, "movie", checksum)) # Update or insert actors