Fix widget detection modification

This commit is contained in:
angelblue05 2018-03-05 01:15:08 -06:00
parent f2befb8d5e
commit 76dde9f8dd

View file

@ -56,7 +56,8 @@ class PlaybackUtils(object):
kodi_version = xbmc.getInfoLabel('System.BuildVersion') kodi_version = xbmc.getInfoLabel('System.BuildVersion')
if kodi_version and "Git:" in kodi_version and int(kodi_version.split('Git:')[1].split("-")[0]) <= 20171119: if kodi_version and "Git:" in kodi_version and kodi_version.split('Git:')[1].split("-")[0] == '20171119':
#TODO: To be reviewed once Leia is out.
log.info("Build does not require workaround for widgets?") log.info("Build does not require workaround for widgets?")
return False return False
@ -121,6 +122,9 @@ class PlaybackUtils(object):
log.info("seektime detected (percent): %s", seektime_percent) log.info("seektime detected (percent): %s", seektime_percent)
listitem.setProperty('StartPercent', str(seektime_percent)) listitem.setProperty('StartPercent', str(seektime_percent))
# Prevent manually mark as watched in Kodi monitor
window('emby.skip.%s' % item_id, value="true")
# Stack: [(url, listitem), (url, ...), ...] # Stack: [(url, listitem), (url, ...), ...]
self.stack[0][1].setPath(self.stack[0][0]) self.stack[0][1].setPath(self.stack[0][0])
try: try:
@ -350,12 +354,19 @@ class PlaybackUtils(object):
db_id = item_db[0] if item_db else None db_id = item_db[0] if item_db else None
pbutils = PlaybackUtils(item) pbutils = PlaybackUtils(item)
pbutils.set_playlist(play_url, item_id, listitem, seektime if item_ids.index(item_id) == 1 else None, db_id) pbutils.set_playlist(play_url, item_id, listitem, seektime if item_ids.index(item_id) == 0 else None, db_id)
if item_ids.index(item_id) == 0 and seektime:
if item_ids.index(item_id) == 1 and seektime:
log.info("Seektime detected: %s", self.API.adjust_resume(seektime)) log.info("Seektime detected: %s", self.API.adjust_resume(seektime))
listitem.setProperty('StartOffset', str(self.API.adjust_resume(seektime))) listitem.setProperty('StartOffset', str(self.API.adjust_resume(seektime)))
'''
seektime_percent = ((seektime/self.API.get_runtime()) * 100) - 0.40
log.info("seektime detected (percent): %s", seektime_percent)
listitem.setProperty('StartPercent', str(seektime_percent))
'''
index = max(pbutils.playlist.getposition(), 0) + 1 # Can return -1 index = max(pbutils.playlist.getposition(), 0) + 1 # Can return -1
for stack in pbutils.stack: for stack in pbutils.stack:
@ -375,3 +386,4 @@ class PlaybackUtils(object):
if started: if started:
return True return True