Add-on paths: Fix resume if playback not initiated with PKC

This commit is contained in:
croneter 2019-01-04 14:39:33 +01:00
parent df24ab88c9
commit 1f35caba54

View file

@ -496,7 +496,23 @@ class Episode(TvShowMixin, ItemBase):
parent_id, parent_id,
userdata['UserRating'], userdata['UserRating'],
kodi_id) kodi_id)
self.kodidb.set_resume(kodi_fileid,
api.resume_point(),
api.runtime(),
userdata['PlayCount'],
userdata['LastPlayedDate'],
v.PLEX_TYPE_EPISODE)
self.plexdb.add_episode(plex_id=plex_id,
checksum=api.checksum(),
section_id=section_id,
show_id=show_id,
grandparent_id=grandparent_id,
season_id=season_id,
parent_id=parent_id,
kodi_id=kodi_id,
kodi_fileid=kodi_fileid,
kodi_pathid=kodi_pathid,
last_sync=self.last_sync)
# OR ADD THE EPISODE ##### # OR ADD THE EPISODE #####
else: else:
LOG.info("ADD episode plex_id: %s - %s", plex_id, api.title()) LOG.info("ADD episode plex_id: %s - %s", plex_id, api.title())
@ -543,15 +559,12 @@ class Episode(TvShowMixin, ItemBase):
kodi_pathid, kodi_pathid,
parent_id, parent_id,
userdata['UserRating']) userdata['UserRating'])
streams = api.mediastreams()
self.kodidb.modify_streams(kodi_fileid, streams, api.runtime())
self.kodidb.set_resume(kodi_fileid, self.kodidb.set_resume(kodi_fileid,
api.resume_point(), api.resume_point(),
api.runtime(), api.runtime(),
userdata['PlayCount'], userdata['PlayCount'],
userdata['LastPlayedDate'], userdata['LastPlayedDate'],
None) # Do send None, we check here None) # Do send None to avoid episode loop
self.plexdb.add_episode(plex_id=plex_id, self.plexdb.add_episode(plex_id=plex_id,
checksum=api.checksum(), checksum=api.checksum(),
section_id=section_id, section_id=section_id,
@ -572,12 +585,15 @@ class Episode(TvShowMixin, ItemBase):
% (path, show_id, plex_id, v.PLEX_TYPE_EPISODE, % (path, show_id, plex_id, v.PLEX_TYPE_EPISODE,
filename)) filename))
kodi_pathid = self.kodidb.add_path(path) kodi_pathid = self.kodidb.add_path(path)
kodi_fileid = self.kodidb.add_file(filename, second_kodi_fileid = self.kodidb.add_file(filename,
kodi_pathid, kodi_pathid,
api.date_created()) api.date_created())
self.kodidb.set_resume(kodi_fileid, self.kodidb.set_resume(second_kodi_fileid,
api.resume_point(), api.resume_point(),
api.runtime(), api.runtime(),
userdata['PlayCount'], userdata['PlayCount'],
userdata['LastPlayedDate'], userdata['LastPlayedDate'],
None) # Do send None - 2nd entry None) # Do send None - 2nd entry
self.kodidb.modify_streams(kodi_fileid,
api.mediastreams(),
api.runtime())