From 936126f5bf688c86ed49fa3b3feac9079cb447a2 Mon Sep 17 00:00:00 2001 From: angelblue05 Date: Wed, 14 Sep 2016 00:23:32 -0500 Subject: [PATCH] Add series pooling Temporary solution until series pooling tv show ids are returned with the server's api. The server currently only returns one series. The only way to get series pooling working is by running a manual sync. --- resources/lib/embydb_functions.py | 2 +- resources/lib/itemtypes.py | 22 ++++++++++++++++++++++ 2 files changed, 23 insertions(+), 1 deletion(-) diff --git a/resources/lib/embydb_functions.py b/resources/lib/embydb_functions.py index 4a1090f0..8c2d8b65 100644 --- a/resources/lib/embydb_functions.py +++ b/resources/lib/embydb_functions.py @@ -159,7 +159,7 @@ class Embydb_Functions(): query = ' '.join(( - "SELECT emby_id, parent_id", + "SELECT emby_id, parent_id, media_folder", "FROM emby", "WHERE kodi_id = ?", "AND media_type = ?" diff --git a/resources/lib/itemtypes.py b/resources/lib/itemtypes.py index 9be93f0a..3844e692 100644 --- a/resources/lib/itemtypes.py +++ b/resources/lib/itemtypes.py @@ -1052,6 +1052,28 @@ class TVShows(Items): studios = API.get_studios() studio = " / ".join(studios) + # Verify series pooling + if tvdb: + query = "SELECT idShow FROM tvshow WHERE C12 = ?" + kodicursor.execute(query, (tvdb,)) + try: + showid = kodicursor.fetchone()[0] + except TypeError: + pass + else: + emby_other = emby_db.getItem_byKodiId(showid, "tvshow") + if viewid == emby_other[2]: + log.info("Applying series pooling for %s", title) + + emby_other_item = emby_db.getItem_byId(emby_other[0]) + showid = emby_other_item[0] + pathid = emby_other_item[2] + log.info("showid: %s pathid: %s" % (showid, pathid)) + # Create the reference in emby table + emby_db.addReference(itemid, showid, "Series", "tvshow", pathid=pathid, + checksum=checksum, mediafolderid=viewid) + update_item = True + ##### GET THE FILE AND PATH ##### playurl = API.get_file_path()