diff --git a/platformcode/launcher.py b/platformcode/launcher.py index ea280e5d..ca231441 100644 --- a/platformcode/launcher.py +++ b/platformcode/launcher.py @@ -435,6 +435,18 @@ def play_from_library(item): @type item: item @param item: item with information """ + + def get_played_time(item): + if item.contentType == 'movie': nfo_path = item.nfo + else: nfo_path = item.strm_path.replace('strm','nfo') + if nfo_path and filetools.isfile(nfo_path): + from core import videolibrarytools + head_nfo, item_nfo = videolibrarytools.read_nfo(nfo_path) + sleep(1) + played_time = platformtools.get_played_time(item_nfo) + else: played_time = 0 + return played_time + import xbmcgui, xbmcplugin, xbmc from time import sleep @@ -463,18 +475,6 @@ def play_from_library(item): itemlist = videolibrary.findvideos(item) p_dialog.update(100, ''); sleep(0.5); p_dialog.close() played = False - while platformtools.is_playing(): - played = True - sleep(1) - if item.contentType == 'movie': nfo_path = item.nfo - else: nfo_path = item.strm_path.replace('strm','nfo') - if nfo_path and filetools.isfile(nfo_path): - from core import videolibrarytools - head_nfo, item_nfo = videolibrarytools.read_nfo(nfo_path) - played_time = platformtools.get_played_time(item_nfo) - else: played_time = 0 - if not played_time and played: - return # The number of links to show is limited if config.get_setting("max_links", "videolibrary") != 0: itemlist = limit_itemlist(itemlist) @@ -482,9 +482,16 @@ def play_from_library(item): if config.get_setting("replace_VD", "videolibrary") == 1: itemlist = reorder_itemlist(itemlist) # from core.support import dbg;dbg() if len(itemlist) > 0: + reopen = False while not xbmc.Monitor().abortRequested(): + played = True # The user chooses the mirror if not platformtools.is_playing(): + # from core.support import dbg;dbg() + if config.get_setting('autoplay') or reopen: + played_time = get_played_time(item) + if not played_time and played: + return options = [] selection_implementation = 0 for item in itemlist: @@ -508,4 +515,6 @@ def play_from_library(item): else: item = videolibrary.play(itemlist[selection + selection_implementation])[0] platformtools.play_video(item) - # if (platformtools.is_playing() and item.action) or item.server == 'torrent' or config.get_setting('autoplay'): break \ No newline at end of file + reopen = True + # if (platformtools.is_playing() and item.action) or item.server == 'torrent' or config.get_setting('autoplay'): break + diff --git a/platformcode/platformtools.py b/platformcode/platformtools.py index b9052e73..f07cf4b6 100644 --- a/platformcode/platformtools.py +++ b/platformcode/platformtools.py @@ -1007,7 +1007,7 @@ def get_video_seleccionado(item, seleccion, video_urls): def set_player(item, xlistitem, mediaurl, view, strm): logger.debug() - item.options = {'strm':False, 'continue':False} + item.options = {'strm':False} # logger.debug("item:\n" + item.tostring('\n')) # Moved del conector "torrent" here @@ -1034,7 +1034,6 @@ def set_player(item, xlistitem, mediaurl, view, strm): prevent_busy(item) if player_mode in [1]: item.played_time = resume_playback(get_played_time(item)) - item.options['continue'] = True logger.info('Player Mode:',['Direct', 'Bookmark'][player_mode]) # Add the listitem to a playlist diff --git a/platformcode/xbmc_videolibrary.py b/platformcode/xbmc_videolibrary.py index daca5e91..229cf0f7 100644 --- a/platformcode/xbmc_videolibrary.py +++ b/platformcode/xbmc_videolibrary.py @@ -34,6 +34,7 @@ def mark_auto_as_watched(item): marked = False + sync = True next_episode = None show_server = True @@ -60,7 +61,10 @@ def mark_auto_as_watched(item): if actual_time > mark_time and not marked: logger.info("Marked as Watched") item.playcount = 1 - if item.options['strm'] : marked = True + marked = True + item.played_time = 0 + platformtools.set_played_time(item) + if item.options['strm'] : sync = True show_server = False from specials import videolibrary videolibrary.mark_content_as_watched2(item) @@ -68,7 +72,7 @@ def mark_auto_as_watched(item): break # check for next Episode - if next_episode and marked and time_from_end >= difference: + if next_episode and sync and time_from_end >= difference: nextdialog = NextDialog(ND, config.get_runtime_path()) nextdialog.show() while platformtools.is_playing() and not nextdialog.is_exit(): @@ -80,14 +84,14 @@ def mark_auto_as_watched(item): break xbmc.sleep(1000) - if item.options['continue']: - if 120 < actual_time < (total_time / 100) * 80: - item.played_time = actual_time - else: item.played_time = 0 - platformtools.set_played_time(item) + # if item.options['continue']: + if actual_time < mark_time: + item.played_time = actual_time + else: item.played_time = 0 + platformtools.set_played_time(item) # Silent sync with Trakt - if marked and config.get_setting("trakt_sync"): sync_trakt_kodi() + if sync and config.get_setting("trakt_sync"): sync_trakt_kodi() while platformtools.is_playing(): xbmc.sleep(100)