Store Plex library in our database for reference

This commit is contained in:
tomkat83 2017-02-01 12:33:37 +01:00
parent 86434bab34
commit 2055879458
2 changed files with 12 additions and 8 deletions

View file

@ -727,7 +727,6 @@ class TVShows(Items):
@CatchExceptions(warnuser=True) @CatchExceptions(warnuser=True)
def add_updateEpisode(self, item, viewtag=None, viewid=None): def add_updateEpisode(self, item, viewtag=None, viewid=None):
""" """
viewtag and viewid are irrelevant!
""" """
# Process single episode # Process single episode
kodicursor = self.kodicursor kodicursor = self.kodicursor
@ -1227,6 +1226,7 @@ class Music(Items):
v.PLEX_TYPE_ARTIST, v.PLEX_TYPE_ARTIST,
artistid, artistid,
v.KODI_TYPE_ARTIST, v.KODI_TYPE_ARTIST,
view_id=viewid,
checksum=checksum) checksum=checksum)
# Process the artist # Process the artist
@ -1323,6 +1323,7 @@ class Music(Items):
v.PLEX_TYPE_ALBUM, v.PLEX_TYPE_ALBUM,
albumid, albumid,
v.KODI_TYPE_ALBUM, v.KODI_TYPE_ALBUM,
view_id=viewid,
checksum=checksum) checksum=checksum)
# Process the album info # Process the album info
@ -1396,7 +1397,8 @@ class Music(Items):
plex_db.addReference(parentId, plex_db.addReference(parentId,
v.PLEX_TYPE_ARTIST, v.PLEX_TYPE_ARTIST,
parentId, parentId,
v.KODI_TYPE_ARTIST) v.KODI_TYPE_ARTIST,
view_id=viewid)
plex_db.updateParentId(itemid, parentId) plex_db.updateParentId(itemid, parentId)
else: else:
# Update plex reference with the artistid # Update plex reference with the artistid
@ -1574,7 +1576,8 @@ class Music(Items):
plex_db.addReference("%salbum%s" % (itemid, albumid), plex_db.addReference("%salbum%s" % (itemid, albumid),
v.PLEX_TYPE_ALBUM, v.PLEX_TYPE_ALBUM,
albumid, albumid,
v.KODI_TYPE_ALBUM) v.KODI_TYPE_ALBUM,
view_id=viewid)
else: else:
# No album Id associated to the song. # No album Id associated to the song.
log.error("Song itemid: %s has no albumId associated." log.error("Song itemid: %s has no albumId associated."
@ -1653,7 +1656,8 @@ class Music(Items):
v.KODI_TYPE_SONG, v.KODI_TYPE_SONG,
kodi_pathid=pathid, kodi_pathid=pathid,
parent_id=albumid, parent_id=albumid,
checksum=checksum) checksum=checksum,
view_id=viewid)
# Link song to album # Link song to album
query = ( query = (

View file

@ -1230,8 +1230,8 @@ class LibrarySync(Thread):
self.GetUpdatelist(seasons, self.GetUpdatelist(seasons,
itemType, itemType,
'add_updateSeason', 'add_updateSeason',
None, viewName,
tvShowId) # send showId instead of viewid viewId)
log.debug("Analyzed all seasons of TV show with Plex Id %s" log.debug("Analyzed all seasons of TV show with Plex Id %s"
% tvShowId) % tvShowId)
@ -1257,8 +1257,8 @@ class LibrarySync(Thread):
self.GetUpdatelist(episodes, self.GetUpdatelist(episodes,
itemType, itemType,
'add_updateEpisode', 'add_updateEpisode',
None, viewName,
None) viewId)
log.debug("Analyzed all episodes of TV show with Plex Id %s" log.debug("Analyzed all episodes of TV show with Plex Id %s"
% view['id']) % view['id'])