diff --git a/platformcode/platformtools.py b/platformcode/platformtools.py index de56abd0..abaa3e74 100644 --- a/platformcode/platformtools.py +++ b/platformcode/platformtools.py @@ -1776,12 +1776,7 @@ def set_played_time(item): def prevent_busy(item): logger.debug() if not item.autoplay and not item.window: - if item.action == 'play_from_library': xbmcplugin.setResolvedUrl(int(sys.argv[1]), True, xbmcgui.ListItem(path=os.path.join(config.get_runtime_path(), "resources", "kod.mp4"))) - else: xbmc.Player().play(os.path.join(config.get_runtime_path(), "resources", "kod.mp4")) - # first wait the fake video to start - while not is_playing(): - xbmc.sleep(10) - # then wait a little more + if item.globalsearch: xbmc.Player().play(os.path.join(config.get_runtime_path(), "resources", "kod.mp4")) + else: xbmcplugin.setResolvedUrl(int(sys.argv[1]), True, xbmcgui.ListItem(path=os.path.join(config.get_runtime_path(), "resources", "kod.mp4"))) xbmc.sleep(200) - # and then stop it xbmc.Player().stop() diff --git a/platformcode/xbmc_videolibrary.py b/platformcode/xbmc_videolibrary.py index 43222a83..2b933588 100644 --- a/platformcode/xbmc_videolibrary.py +++ b/platformcode/xbmc_videolibrary.py @@ -26,11 +26,10 @@ def mark_auto_as_watched(item): actual_time = 0 total_time = 0 - time_limit = time.time() + 30 + time_limit = time.time() + 10 while not platformtools.is_playing() and time.time() < time_limit: time.sleep(1) - marked = False sync = False next_episode = None @@ -38,6 +37,7 @@ def mark_auto_as_watched(item): percentage = float(config.get_setting("watched_setting")) / 100 time_from_end = config.get_setting('next_ep_seconds') + if item.contentType != 'movie' and 0 < config.get_setting('next_ep') < 3: next_dialogs = ['NextDialog.xml', 'NextDialogExtended.xml', 'NextDialogCompact.xml'] next_ep_type = config.get_setting('next_ep_type') @@ -46,7 +46,8 @@ def mark_auto_as_watched(item): except: next_episode = False logger.debug(next_episode) - while platformtools.is_playing(): + while not xbmc.Monitor().abortRequested(): + if not platformtools.is_playing(): break try: actual_time = xbmc.Player().getTime() except: pass try: total_time = xbmc.Player().getTotalTime() @@ -113,6 +114,7 @@ def mark_auto_as_watched(item): threading.Thread(target=mark_as_watched_subThread, args=[item]).start() + def sync_trakt_addon(path_folder): """ Updates the values ​​of episodes seen if diff --git a/specials/globalsearch.py b/specials/globalsearch.py index 7d2692c4..fce4723b 100644 --- a/specials/globalsearch.py +++ b/specials/globalsearch.py @@ -789,7 +789,7 @@ class SearchWindow(xbmcgui.WindowXML): def play(self, server=None): - server.globalsearch = True platformtools.prevent_busy(server) server.window = True + server.globalsearch = True return run(server)