Attempt to fix resume from widget not working

This commit is contained in:
croneter 2018-05-24 19:28:50 +02:00
parent 8fbca537f4
commit a6bc0b9e69

View file

@ -586,9 +586,7 @@ class TVShows(Items):
path = "%s%s/" % (toplevelpath, itemid) path = "%s%s/" % (toplevelpath, itemid)
toppathid = self.kodi_db.get_path(toplevelpath) toppathid = self.kodi_db.get_path(toplevelpath)
pathid = self.kodi_db.add_video_path(path, pathid = self.kodi_db.add_video_path(path)
date_added=api.date_created(),
id_parent_path=toppathid)
# UPDATE THE TVSHOW ##### # UPDATE THE TVSHOW #####
if update_item: if update_item:
LOG.info("UPDATE tvshow itemid: %s - Title: %s", itemid, title) LOG.info("UPDATE tvshow itemid: %s - Title: %s", itemid, title)
@ -852,9 +850,11 @@ class TVShows(Items):
# Set plugin path - do NOT use "intermediate" paths for the show # Set plugin path - do NOT use "intermediate" paths for the show
# as with direct paths! # as with direct paths!
filename = api.file_name(force_first_media=True) filename = api.file_name(force_first_media=True)
path = 'plugin://%s.tvshows/%s/' % (v.ADDON_ID, series_id) # If we don't set this path, Widget resume won't work
filename = ('%s?plex_id=%s&plex_type=%s&mode=play&filename=%s' path = 'plugin://%s.tvshows/' % v.ADDON_ID
% (path, itemid, v.PLEX_TYPE_EPISODE, filename)) filename = ('%s%s/?plex_id=%s&plex_type=%s&mode=play&filename=%s'
% (path, series_id, itemid, v.PLEX_TYPE_EPISODE,
filename))
playurl = filename playurl = filename
# Root path tvshows/ already saved in Kodi DB # Root path tvshows/ already saved in Kodi DB
pathid = self.kodi_db.add_video_path(path) pathid = self.kodi_db.add_video_path(path)
@ -891,15 +891,14 @@ class TVShows(Items):
query = ''' query = '''
UPDATE episode UPDATE episode
SET c00 = ?, c01 = ?, c03 = ?, c04 = ?, c05 = ?, c09 = ?, SET c00 = ?, c01 = ?, c03 = ?, c04 = ?, c05 = ?, c09 = ?,
c10 = ?, c12 = ?, c13 = ?, c14 = ?, c15 = ?, c16 = ?, c10 = ?, c12 = ?, c13 = ?, c14 = ?,
c18 = ?, c19 = ?, idFile=?, idSeason = ?, c19 = ?, idFile=?, idSeason = ?, userrating = ?
userrating = ?
WHERE idEpisode = ? WHERE idEpisode = ?
''' '''
kodicursor.execute(query, (title, plot, ratingid, writer, kodicursor.execute(query, (title, plot, ratingid, writer,
premieredate, runtime, director, season, episode, title, premieredate, runtime, director, season, episode, title,
airs_before_season, airs_before_episode, playurl, pathid, pathid, fileid,
fileid, seasonid, userdata['UserRating'], episodeid)) seasonid, userdata['UserRating'], episodeid))
else: else:
# Kodi Jarvis # Kodi Jarvis
query = ''' query = '''
@ -940,15 +939,13 @@ class TVShows(Items):
"tvdb") "tvdb")
query = ''' query = '''
INSERT INTO episode( idEpisode, idFile, c00, c01, c03, c04, INSERT INTO episode( idEpisode, idFile, c00, c01, c03, c04,
c05, c09, c10, c12, c13, c14, idShow, c15, c16, c18, c05, c09, c10, c12, c13, c14, idShow, c19,
c19, idSeason, userrating) idSeason, userrating)
VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
?, ?)
''' '''
kodicursor.execute(query, (episodeid, fileid, title, plot, kodicursor.execute(query, (episodeid, fileid, title, plot,
rating_id, writer, premieredate, runtime, director, season, rating_id, writer, premieredate, runtime, director, season,
episode, title, showid, airs_before_season, episode, title, showid, pathid, seasonid,
airs_before_episode, playurl, pathid, seasonid,
userdata['UserRating'])) userdata['UserRating']))
else: else:
# Kodi Jarvis # Kodi Jarvis