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

View file

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