diff --git a/core/autoplay.py b/core/autoplay.py index 1d219823..a780d8fe 100644 --- a/core/autoplay.py +++ b/core/autoplay.py @@ -29,6 +29,8 @@ def start(itemlist, item): if item.global_search or item.from_action or item.contentAction: # from_action means that's a special function calling this (ex: add to videolibrary) return itemlist + if len(itemlist) == 1 or len(itemlist) > 1 and not itemlist[1].server: + return itemlist logger.debug() global PLAYED diff --git a/platformcode/launcher.py b/platformcode/launcher.py index a43f2e96..f080eaa6 100644 --- a/platformcode/launcher.py +++ b/platformcode/launcher.py @@ -477,27 +477,8 @@ def play_from_library(item): @type item: item @param item: item with information """ - + if not item.next_ep: platformtools.fakeVideo() item.action = item.next_action if item.next_action else 'findvideos' - logger.debug('Executing channel', item.channel, 'method', item.action) - if item.action == 'findvideos': - from specials import videolibrary - p_dialog = platformtools.dialog_progress_bg(config.get_localized_string(20000), config.get_localized_string(60683)) - p_dialog.update(0) - item.fakevideo = True - itemlist = videolibrary.findvideos(item) - p_dialog.update(100) - p_dialog.close() - - if not itemlist: - platformtools.dialog_notification(config.get_localized_string(20000), config.get_localized_string(60347)) - elif len(itemlist) == 1 or len(itemlist) > 1 and not itemlist[1].server: - run(itemlist[0].clone(no_return=True)) - else: - platformtools.serverWindow(item, itemlist) - - else: - platformtools.fakeVideo() - return run(item) + return run(item) diff --git a/platformcode/platformtools.py b/platformcode/platformtools.py index 62189d19..92892344 100644 --- a/platformcode/platformtools.py +++ b/platformcode/platformtools.py @@ -1801,14 +1801,15 @@ def serverWindow(item, itemlist): try: self.list = self.getControl(6) self.exit = self.getControl(5) - self.first = self.getControl(8) - self.second = self.getControl(7) - self.first.setVisible(False) - self.second.setVisible(False) self.exit.setNavigation(self.exit, self.exit, self.list, self.list) except: pass + try: self.getControl(7).setVisible(False) + except: pass + try: self.getControl(8).setVisible(False) + except: pass + self.exit.setLabel(config.get_localized_string(60396)) for item in itemlist: @@ -1826,40 +1827,23 @@ def serverWindow(item, itemlist): from core.support import typo for videoitem in self.itemlist: - videoitem.thumbnail = config.get_online_server_thumb(videoitem.server) - quality = ' [' + videoitem.quality + ']' if videoitem.quality else '' if videoitem.server: + videoitem.thumbnail = config.get_online_server_thumb(videoitem.server) + quality = ' [' + videoitem.quality + ']' if videoitem.quality else '' color = scrapertools.find_single_match(videoitem.alive, r'(FF[^\]]+)') color = typo(' •', 'bold color 0x{}'.format(color)) if color else '' - it = xbmcgui.ListItem('{}{}{}'.format(videoitem.serverName, quality, color)) - logger.debug('{}{}{}'.format(videoitem.serverName, quality, color)) - - it.setLabel2(videoitem.ch_name) - it.setArt({'thumb': videoitem.thumbnail}) - items.append(it) - self.list.reset() - self.list.addItems(items) - self.setFocus(self.list) + title = '{}{}{}'.format(videoitem.serverName, quality, color) else: - self.actions.append(videoitem) - - for n, action in enumerate(self.actions): - label = '' - if 'library' in action.action: - label = config.get_localized_string(30131) - elif 'download' in action.action: - label = config.get_localized_string(30153) - if n == 0: - self.first.setLabel(label) - self.exit.setNavigation(self.first, self.first, self.list, self.list) - self.first.setNavigation(self.exit, self.exit, self.list, self.list) - self.first.setVisible(True) - elif n == 1: - self.second.setLabel(label) - self.first.setNavigation(self.exit, self.second, self.list, self.list) - self.second.setNavigation(self.first, self.exit, self.list, self.list) - self.second.setVisible(True) - + logger.debug(videoitem) + title = videoitem.title + it = xbmcgui.ListItem(title) + if videoitem.ch_name: + it.setLabel2(videoitem.ch_name) + it.setArt({'thumb': videoitem.thumbnail}) + items.append(it) + self.list.reset() + self.list.addItems(items) + self.setFocus(self.list) def onClick(self, control): if control == 6: @@ -1881,11 +1865,11 @@ def serverWindow(item, itemlist): from core import db while not xbmc.Monitor().abortRequested(): played = True + if config.get_setting('next_ep') == 3: + # xbmc.sleep(500) + if is_playing(): + return if not is_playing(): - # if config.get_setting('next_ep') == 3: - # xbmc.sleep(500) - # if is_playing(): - # return if config.get_setting('autoplay') or reopen: xbmc.sleep(200) if not db['controls'].get('reopen', False): @@ -1896,14 +1880,13 @@ def serverWindow(item, itemlist): selection = ServerWindow('Servers.xml', config.get_runtime_path()).start(item, itemlist) if selection == -1: - if item.fakevideo: - return fakeVideo() - else: return + return else: from platformcode.launcher import run run(selection) reopen = True + if not selection.server: return db.close() import threading threading.Thread(target=monitor, args=[itemlist]).start()