Fix widget resume

This commit is contained in:
angelblue05 2016-02-26 06:55:24 -06:00
parent e30e20104d
commit 03ac28272e
1 changed files with 20 additions and 0 deletions

View File

@ -586,6 +586,8 @@ class Movies(Items):
resume = API.adjustResume(userdata['Resume']) resume = API.adjustResume(userdata['Resume'])
total = round(float(runtime), 6) total = round(float(runtime), 6)
self.logMsg("%s New resume point: %s" % (itemid, resume))
kodi_db.addPlaystate(fileid, resume, total, playcount, dateplayed) kodi_db.addPlaystate(fileid, resume, total, playcount, dateplayed)
emby_db.updateReference(itemid, checksum) emby_db.updateReference(itemid, checksum)
@ -1501,6 +1503,7 @@ class TVShows(Items):
checksum = API.getChecksum() checksum = API.getChecksum()
userdata = API.getUserData() userdata = API.getUserData()
runtime = API.getRuntime() runtime = API.getRuntime()
dateadded = API.getDateCreated()
# Get Kodi information # Get Kodi information
emby_dbitem = emby_db.getItem_byId(itemid) emby_dbitem = emby_db.getItem_byId(itemid)
@ -1528,11 +1531,28 @@ class TVShows(Items):
resume = API.adjustResume(userdata['Resume']) resume = API.adjustResume(userdata['Resume'])
total = round(float(runtime), 6) total = round(float(runtime), 6)
self.logMsg("%s New resume point: %s" % (itemid, resume))
kodi_db.addPlaystate(fileid, resume, total, playcount, dateplayed) kodi_db.addPlaystate(fileid, resume, total, playcount, dateplayed)
if not self.directpath and not resume: if not self.directpath and not resume:
# Make sure there's no other bookmarks created by widget. # Make sure there's no other bookmarks created by widget.
filename = kodi_db.getFile(fileid) filename = kodi_db.getFile(fileid)
kodi_db.removeFile("plugin://plugin.video.emby.tvshows/", filename) kodi_db.removeFile("plugin://plugin.video.emby.tvshows/", filename)
if not self.directpath and resume:
# Create additional entry for widgets. This is only required for plugin/episode.
filename = kodi_db.getFile(fileid)
temppathid = kodi_db.getPath("plugin://plugin.video.emby.tvshows/")
tempfileid = kodi_db.addFile(filename, temppathid)
query = ' '.join((
"UPDATE files",
"SET idPath = ?, strFilename = ?, dateAdded = ?",
"WHERE idFile = ?"
))
self.kodicursor.execute(query, (temppathid, filename, dateadded, tempfileid))
kodi_db.addPlaystate(tempfileid, resume, total, playcount, dateplayed)
emby_db.updateReference(itemid, checksum) emby_db.updateReference(itemid, checksum)
def remove(self, itemid): def remove(self, itemid):