diff --git a/core/tmdb.py b/core/tmdb.py index 92cd2c43..f099f485 100644 --- a/core/tmdb.py +++ b/core/tmdb.py @@ -393,18 +393,18 @@ def set_infoLabels_item(item, seekTmdb=True, search_language=def_lang): if search_type == 'tv': # Serial search by title and filtering your results if necessary searched_title = scrapertools.unescape(item.infoLabels['tvshowtitle']) - # searched_title = searched_title.split('-')[0].strip() - otmdb = Tmdb(searched_text=searched_title, search_type=search_type, - search_language=search_language, filtro=item.infoLabels.get('filtro', {}), - year=item.infoLabels['year']) else: # Movie search by title ... # if item.infoLabels['year'] or item.infoLabels['filtro']: # ...and year or filter searched_title = scrapertools.unescape(item.infoLabels['title']) - # searched_title = searched_title.split('-')[0].strip() + # from core.support import dbg;dbg() + otmdb = Tmdb(searched_text=searched_title, search_type=search_type, search_language=search_language, + filtro=item.infoLabels.get('filtro', {}), year=item.infoLabels['year']) + if not item.infoLabels['tmdb_id'] and not item.infoLabels['imdb_id'] and not item.infoLabels['tvdb_id']\ + and not item.infoLabels['freebase_mid'] and not item.infoLabels['freebase_id'] and not item.infoLabels['tvrage_id']: otmdb = Tmdb(searched_text=searched_title, search_type=search_type, search_language=search_language, - filtro=item.infoLabels.get('filtro', {}), year=item.infoLabels['year']) + filtro=item.infoLabels.get('filtro', {})) if otmdb is not None: if otmdb.get_id() and config.get_setting("tmdb_plus_info", default=False): # If the search has been successful and you are not looking for a list of items, diff --git a/platformcode/launcher.py b/platformcode/launcher.py index 96b52db8..238da5a0 100644 --- a/platformcode/launcher.py +++ b/platformcode/launcher.py @@ -441,24 +441,24 @@ def findvideos(item): p_dialog = platformtools.dialog_progress_bg(config.get_localized_string(20000), config.get_localized_string(60683)) p_dialog.update(0) - # First checks if channel has a "findvideos" function - if hasattr(channel, 'findvideos'): - itemlist = getattr(channel, item.action)(item) + try: + # First checks if channel has a "findvideos" function + if hasattr(channel, 'findvideos'): + itemlist = getattr(channel, item.action)(item) - # If not, uses the generic findvideos function - else: - logger.debug('No channel "findvideos" method, executing core method') - itemlist = servertools.find_video_items(item) + # If not, uses the generic findvideos function + else: + logger.debug('No channel "findvideos" method, executing core method') + itemlist = servertools.find_video_items(item) - itemlist = limit_itemlist(itemlist) + itemlist = limit_itemlist(itemlist) + except: + itemlist = [] + platformtools.dialog_notification(config.get_localized_string(20000), config.get_localized_string(60347)) p_dialog.update(100) p_dialog.close() - # If there is only one server play it immediately - # if len(itemlist) == 1 or len(itemlist) > 1 and not itemlist[1].server: - # play(itemlist[0].clone(no_return=True)) - # else: platformtools.serverWindow(item, itemlist) def play_from_library(item): diff --git a/platformcode/platformtools.py b/platformcode/platformtools.py index 4f0d8df8..270a77b4 100644 --- a/platformcode/platformtools.py +++ b/platformcode/platformtools.py @@ -336,7 +336,7 @@ def render_items(itemlist, parent_item): if not item.title: item.title = '' # If there is no action or it is findvideos / play, folder = False because no listing will be returned - if item.action in ['play', '']: + if item.action in ['play', 'findvideos', '']: item.folder = False if item.fanart == "": item.fanart = parent_item.fanart @@ -1716,6 +1716,7 @@ def serverWindow(item, itemlist): ENTER = 7 EXIT = 10 BACKSPACE = 92 + xbmc.executebuiltin('Dialog.Close(all,true)') class ServerWindow(xbmcgui.WindowXMLDialog): def start(self, item, itemlist): @@ -1795,6 +1796,7 @@ def serverWindow(item, itemlist): if itemlist: reopen = False + from core import db while not xbmc.Monitor().abortRequested(): played = True if not is_playing(): @@ -1803,8 +1805,8 @@ def serverWindow(item, itemlist): if is_playing(): return if config.get_setting('autoplay') or reopen: - played_time = get_played_time(item) - if not played_time and played: + xbmc.sleep(200) + if not db['controls'].get('reopen', False): return selection = ServerWindow('Servers.xml', config.get_runtime_path()).start(item, itemlist) @@ -1818,3 +1820,4 @@ def serverWindow(item, itemlist): from platformcode.launcher import run run(selection) reopen = True + db.close() diff --git a/platformcode/xbmc_videolibrary.py b/platformcode/xbmc_videolibrary.py index efab70e8..bec58178 100644 --- a/platformcode/xbmc_videolibrary.py +++ b/platformcode/xbmc_videolibrary.py @@ -86,9 +86,13 @@ def mark_auto_as_watched(item): break # if item.options['continue']: + from core import db if actual_time < mark_time and mark_time: item.played_time = actual_time - else: item.played_time = 0 + db['controls']['reopen'] = True + else: + item.played_time = 0 + db['controls']['reopen'] = False platformtools.set_played_time(item) # Silent sync with Trakt @@ -107,14 +111,13 @@ def mark_auto_as_watched(item): run(next_episode) # db need to be closed when not used, it will cause freezes - from core import db db.close() # from core.support import dbg;dbg() # If it is configured to mark as seen if config.get_setting("mark_as_watched", "videolibrary"): threading.Thread(target=mark_as_watched_subThread, args=[item]).start() - + logger.debug('EXIT MONITOR') def sync_trakt_addon(path_folder): """