Fix TV show paths not updating

This commit is contained in:
tomkat83 2016-10-26 20:53:20 +02:00
parent a96a20d37d
commit c35ba0edef

View file

@ -668,6 +668,9 @@ class TVShows(Items):
# Add top path # Add top path
toppathid = self.kodi_db.addPath(toplevelpath) toppathid = self.kodi_db.addPath(toplevelpath)
# add/retrieve pathid and fileid
# if the path or file already exists, the calls return current value
pathid = self.kodi_db.addPath(path)
# UPDATE THE TVSHOW ##### # UPDATE THE TVSHOW #####
if update_item: if update_item:
log.info("UPDATE tvshow itemid: %s - Title: %s" log.info("UPDATE tvshow itemid: %s - Title: %s"
@ -684,8 +687,15 @@ class TVShows(Items):
kodicursor.execute(query, (title, plot, rating, premieredate, genre, title, kodicursor.execute(query, (title, plot, rating, premieredate, genre, title,
tvdb, mpaa, studio, sorttitle, showid)) tvdb, mpaa, studio, sorttitle, showid))
# Update the checksum in emby table # Add reference is idempotent; the call here updates also fileid
emby_db.updateReference(itemid, checksum) # and pathid when item is moved or renamed
emby_db.addReference(itemid,
showid,
"Series",
"tvshow",
pathid=pathid,
checksum=checksum,
mediafolderid=viewid)
##### OR ADD THE TVSHOW ##### ##### OR ADD THE TVSHOW #####
else: else:
@ -698,10 +708,7 @@ class TVShows(Items):
"WHERE idPath = ?" "WHERE idPath = ?"
)) ))
kodicursor.execute(query, (toplevelpath, "tvshows", "metadata.local", 1, toppathid)) kodicursor.execute(query, (toplevelpath, "tvshows", "metadata.local", 1, toppathid))
# Add path
pathid = self.kodi_db.addPath(path)
# Create the tvshow entry # Create the tvshow entry
query = ( query = (
''' '''