Resume fix

Forgot to remove old piece of code that interfered with resume point on
homescreen. Also added another verification to removed any Kodi created
bookmark as it messes with plugin paths bookmark.
This commit is contained in:
angelblue05 2015-07-21 01:12:06 -05:00
parent cbebcbd818
commit c61a17d48d
2 changed files with 30 additions and 6 deletions

View file

@ -58,10 +58,6 @@ class PlaybackUtils():
# To avoid negative bookmark # To avoid negative bookmark
seekTime = seekTime - jumpBackSec seekTime = seekTime - jumpBackSec
if userData.get("PlaybackPositionTicks") != 0:
reasonableTicks = int(userData.get("PlaybackPositionTicks")) / 1000
seekTime = reasonableTicks / 10000
itemsToPlay = [] itemsToPlay = []
# Check for intros # Check for intros
if seekTime == 0: if seekTime == 0:
@ -137,6 +133,7 @@ class PlaybackUtils():
elif resume_result < 0: elif resume_result < 0:
# User cancelled dialog # User cancelled dialog
xbmc.log("Emby player -> User cancelled resume dialog.") xbmc.log("Emby player -> User cancelled resume dialog.")
xbmcplugin.setResolvedUrl(int(sys.argv[1]), False, listItem)
return return
if result.get("Type")=="Episode": if result.get("Type")=="Episode":

View file

@ -153,9 +153,22 @@ class WriteKodiVideoDB():
filename = "plugin://plugin.video.emby/movies/%s/?filename=%s&id=%s&mode=play" % (embyId, fileext, embyId) filename = "plugin://plugin.video.emby/movies/%s/?filename=%s&id=%s&mode=play" % (embyId, fileext, embyId)
path = "plugin://plugin.video.emby/movies/%s/" % embyId path = "plugin://plugin.video.emby/movies/%s/" % embyId
# Remove Kodi bookmark - messes with plugin path bookmark # If the bookmark was created from widget
cursor.execute("SELECT idFile as fileid FROM files WHERE strFilename = ?", (fileext,)) cursor.execute("SELECT idFile as fileid FROM files WHERE strFilename = ?", (fileext,))
try: # Remove Kodi bookmark - messes with plugin path bookmark
result = cursor.fetchone()[0]
self.setKodiResumePoint(result, 0, 0, cursor)
except: pass
# If the bookmark was created within the library
plugindummy = "plugin://plugin.video.emby/"
cursor.execute("SELECT idPath FROM path WHERE strPath = ?", (plugindummy,))
try: try:
pathiddummy = cursor.fetchone()[0]
except: pass
else:
cursor.execute("SELECT idFile as fileid FROM files WHERE strFilename = ? and idPath = ?", (filename, pathiddummy,))
try: # Remove Kodi bookmark - creates a ghost bookmark for widgets
result = cursor.fetchone()[0] result = cursor.fetchone()[0]
self.setKodiResumePoint(result, 0, 0, cursor) self.setKodiResumePoint(result, 0, 0, cursor)
except: pass except: pass
@ -586,12 +599,26 @@ class WriteKodiVideoDB():
filename = "plugin://plugin.video.emby/tvshows/%s/?filename=%s&id=%s&mode=play" % (seriesId, fileext, embyId) filename = "plugin://plugin.video.emby/tvshows/%s/?filename=%s&id=%s&mode=play" % (seriesId, fileext, embyId)
path = "plugin://plugin.video.emby/tvshows/%s/" % seriesId path = "plugin://plugin.video.emby/tvshows/%s/" % seriesId
# If the bookmark was created from widget
cursor.execute("SELECT idFile as fileid FROM files WHERE strFilename = ?", (fileext,)) cursor.execute("SELECT idFile as fileid FROM files WHERE strFilename = ?", (fileext,))
try: # Remove Kodi bookmark - messes with plugin path bookmark try: # Remove Kodi bookmark - messes with plugin path bookmark
result = cursor.fetchone()[0] result = cursor.fetchone()[0]
self.setKodiResumePoint(result, 0, 0, cursor) self.setKodiResumePoint(result, 0, 0, cursor)
except: pass except: pass
# If the bookmark was created within the library
plugindummy = "plugin://plugin.video.emby/"
cursor.execute("SELECT idPath FROM path WHERE strPath = ?", (plugindummy,))
try:
pathiddummy = cursor.fetchone()[0]
except: pass
else:
cursor.execute("SELECT idFile as fileid FROM files WHERE strFilename = ? and idPath = ?", (filename, pathiddummy,))
try: # Remove Kodi bookmark - creates a ghost bookmark for widgets
result = cursor.fetchone()[0]
self.setKodiResumePoint(result, 0, 0, cursor)
except: pass
# Validate the path in database # Validate the path in database
cursor.execute("SELECT idPath as pathid FROM path WHERE strPath = ?", (path,)) cursor.execute("SELECT idPath as pathid FROM path WHERE strPath = ?", (path,))
try: try: