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.
This commit is contained in:
angelblue05 2016-09-14 00:23:32 -05:00
parent 1c450cb257
commit 936126f5bf
2 changed files with 23 additions and 1 deletions

View file

@ -159,7 +159,7 @@ class Embydb_Functions():
query = ' '.join(( query = ' '.join((
"SELECT emby_id, parent_id", "SELECT emby_id, parent_id, media_folder",
"FROM emby", "FROM emby",
"WHERE kodi_id = ?", "WHERE kodi_id = ?",
"AND media_type = ?" "AND media_type = ?"

View file

@ -1052,6 +1052,28 @@ class TVShows(Items):
studios = API.get_studios() studios = API.get_studios()
studio = " / ".join(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 ##### ##### GET THE FILE AND PATH #####
playurl = API.get_file_path() playurl = API.get_file_path()