Fix Episodio Successivo

This commit is contained in:
Alhaziel01
2021-03-29 20:11:51 +02:00
parent 58084388e6
commit 87adb67877

View File

@@ -28,7 +28,7 @@ def mark_auto_as_watched(item):
time_limit = time.time() + 30
while not platformtools.is_playing() and time.time() < time_limit:
pass
time.sleep(1)
marked = False
@@ -37,8 +37,11 @@ def mark_auto_as_watched(item):
show_server = True
percentage = float(config.get_setting("watched_setting")) / 100
time_from_end = config.get_setting('next_ep_seconds')
if item.contentType != 'movie' and config.get_setting('next_ep') < 3:
next_dialogs = ['NextDialog.xml', 'NextDialogExtended.xml', 'NextDialogCompact.xml']
next_ep_type = config.get_setting('next_ep_type')
ND = next_dialogs[next_ep_type]
try: next_episode = next_ep(item)
except: next_episode = False
logger.debug(next_episode)
@@ -53,6 +56,7 @@ def mark_auto_as_watched(item):
item.played_time = 0 # Fix for Slow Devices
mark_time = total_time * percentage
difference = total_time - actual_time
# Mark as Watched
if actual_time > mark_time and not marked:
@@ -65,31 +69,19 @@ def mark_auto_as_watched(item):
show_server = False
from specials import videolibrary
videolibrary.mark_content_as_watched2(item)
break
# Silent sync with Trakt
if sync and config.get_setting("trakt_sync"): sync_trakt_kodi()
# check for next Episode
if next_episode and sync:
while platformtools.is_playing():
actual_time = xbmc.Player().getTime()
total_time = xbmc.Player().getTotalTime()
time_from_end = config.get_setting('next_ep_seconds')
difference = total_time - actual_time
if time_from_end >= difference:
if not next_episode:
break
next_dialogs = ['NextDialog.xml', 'NextDialogExtended.xml', 'NextDialogCompact.xml']
next_ep_type = config.get_setting('next_ep_type')
ND = next_dialogs[next_ep_type]
nextdialog = NextDialog(ND, config.get_runtime_path())
while platformtools.is_playing() and not nextdialog.is_exit():
xbmc.sleep(100)
if nextdialog.continuewatching:
next_episode.next_ep = True
xbmc.Player().stop()
nextdialog.close()
# break
# check for next Episode
if next_episode and sync and time_from_end >= difference:
nextdialog = NextDialog(ND, config.get_runtime_path())
while platformtools.is_playing() and not nextdialog.is_exit():
xbmc.sleep(100)
if nextdialog.continuewatching:
next_episode.next_ep = True
xbmc.Player().stop()
nextdialog.close()
break
# if item.options['continue']:
if actual_time < mark_time:
@@ -97,6 +89,9 @@ def mark_auto_as_watched(item):
else: item.played_time = 0
platformtools.set_played_time(item)
# Silent sync with Trakt
if sync and config.get_setting("trakt_sync"): sync_trakt_kodi()
while platformtools.is_playing():
xbmc.sleep(100)