From 1e1787e9e9c74982da146c944b644dcfc5c9907e Mon Sep 17 00:00:00 2001 From: Alhaziel01 Date: Sat, 27 Nov 2021 11:58:20 +0100 Subject: [PATCH] Playback Monitor as a service, Global search fix other minimal fix --- channels/ilcorsaronero.py | 5 ++- channels/mediasetplay.py | 53 +++++++++++++++++++++---------- channels/paramount.py | 13 +++----- channels/raiplay.py | 14 ++++---- core/item.py | 6 ++++ core/support.py | 4 +-- lib/sqlitedict.py | 4 +-- platformcode/launcher.py | 3 +- platformcode/platformtools.py | 49 ++++++++++++++-------------- platformcode/xbmc_videolibrary.py | 11 +++---- service.py | 10 +++--- specials/globalsearch.py | 19 +++++++---- specials/search.py | 9 ++++-- 13 files changed, 114 insertions(+), 86 deletions(-) diff --git a/channels/ilcorsaronero.py b/channels/ilcorsaronero.py index 3b159ed1..2cbb1573 100644 --- a/channels/ilcorsaronero.py +++ b/channels/ilcorsaronero.py @@ -59,8 +59,7 @@ def movies(item): def itemlistHook(itemlist): args = item.args args[0] += 1 - support.nextPage(itemlist, item, next_page=item.url, "movies") - # itemlist.append(item.clone(title=support.typo(support.config.getLocalizedString(30992), 'color kod bold'), args=args, thumbnail=support.thumb())) + support.nextPage(itemlist, item, 'movies', next_page=item.url, total_pages=15) return itemlist return locals() @@ -73,7 +72,7 @@ def search(item, text): item.url += text + '.html' try: return movies(item) - # Cattura la eccezione così non interrompe la ricerca globle se il canale si rompe! + # Cattura l' eccezione così non interrompe la ricerca globle se il canale si rompe! except: import sys for line in sys.exc_info(): diff --git a/channels/mediasetplay.py b/channels/mediasetplay.py index 9574dcf3..6935df0b 100644 --- a/channels/mediasetplay.py +++ b/channels/mediasetplay.py @@ -2,12 +2,14 @@ # ------------------------------------------------------------ # Canale per Mediaset Play # ------------------------------------------------------------ +import functools from platformcode import logger, config import uuid, datetime, xbmc import requests, sys -from core import support +from core import jsontools, support, httptools + if sys.version_info[0] >= 3: from urllib.parse import urlencode, quote else: @@ -23,6 +25,7 @@ loginData = {"client_id": clientid, "platform": "pc", "appName": "web//mediasetp sessionUrl = "https://api.one.accedo.tv/session?appKey=59ad346f1de1c4000dfd09c5&uuid={uuid}&gid=default" session = requests.Session() +session.request = functools.partial(session.request, timeout=httptools.HTTPTOOLS_DEFAULT_DOWNLOAD_TIMEOUT) session.headers.update({'Content-Type': 'application/json', 'User-Agent': support.httptools.get_user_agent(), 'Referer': host}) entry = 'https://api.one.accedo.tv/content/entry/{id}?locale=it' @@ -75,19 +78,26 @@ def live(item): stations = res['stations'] for it in stations.values(): + logger.debug(jsontools.dump(it)) plot = '' title = it['title'] url = 'https:' + it['mediasetstation$pageUrl'] - if 'plus' in title.lower() or 'premium' in title.lower(): continue + if 'SVOD' in it['mediasetstation$channelsRights']: continue + thumb = it.get('thumbnails',{}).get('channel_logo-100x100',{}).get('url','') if it['callSign'] in allguide: guide = allguide[it['callSign']] - plot = '[B]{}[/B]\n{}\n\nA Seguire:\n[B]{}[/B]\n{}'.format(guide['currentListing']['mediasetlisting$epgTitle'], - guide['currentListing']['description'], - guide['nextListing']['mediasetlisting$epgTitle'], - guide['nextListing']['description'],) - - itemlist.append(item.clone(title=support.typo(title, 'bold'), fulltitle=title, callSign=it['callSign'], urls=guide['tuningInstruction']['urn:theplatform:tv:location:any'], plot=plot, url=url, action='play', forcethumb=True)) + plot = '[B]{}[/B]\n{}'.format(guide.get('currentListing', {}).get('mediasetlisting$epgTitle', ''),guide.get('currentListing', {}).get('description', '')) + if 'nextListing' in guide.keys(): + plot += '\n\nA Seguire:\n[B]{}[/B]\n{}'.format(guide.get('nextListing', {}).get('mediasetlisting$epgTitle', ''),guide.get('nextListing', {}).get('description', '')) + itemlist.append(item.clone(title=title, + fulltitle=title, callSign=it['callSign'], + urls=guide['tuningInstruction']['urn:theplatform:tv:location:any'], + plot=plot, + url=url, + action='findvideos', + thumbnail=thumb, + forcethumb=True)) itemlist.sort(key=lambda it: support.channels_order.get(it.fulltitle, 999)) support.thumb(itemlist, mode='live') @@ -103,7 +113,7 @@ def search(item, text): except: import sys for line in sys.exc_info(): - logger.error("%s" % line) + support.logger.error("%s" % line) return [] @@ -131,7 +141,7 @@ def movies(item): else: contentType = 'movie' video_id = it['guid'] - action = 'play' + action = 'findvideos' for k, v in it['thumbnails'].items(): if 'image_vertical' in k and not thumb: thumb = v['url'].replace('.jpg', '@3.jpg') @@ -140,7 +150,7 @@ def movies(item): if thumb and fanart: break - itemlist.append(item.clone(title=support.typo(title, 'bold'), + itemlist.append(item.clone(title=title, fulltitle=title, contentTitle=title, contentSerieName=contentSerieName, @@ -172,14 +182,14 @@ def epmenu(item): for s in item.seriesid: itemlist.append( item.clone(seriesid = s['id'], - title=support.typo(s['title'], 'bold'))) + title=s['title'])) if len(itemlist) == 1: return epmenu(itemlist[0]) else: res = requests.get(epUrl.format(item.seriesid)).json()['entries'] for it in res: itemlist.append( item.clone(seriesid = '', - title=support.typo(it['description'], 'bold'), + title=it['description'], subbrand=it['mediasetprogram$subBrandId'], action='episodes')) itemlist = sorted(itemlist, key=lambda it: it.title, reverse=True) @@ -195,15 +205,18 @@ def episodes(item): except: # per i test, xbmc.getLocalizedString non è supportato for month in range(21, 33): months.append('dummy') + # i programmi tv vanno ordinati per data decrescente, gli episodi delle serie per data crescente + order = 'desc' if '/programmi-tv/' in item.url else 'asc' + itemlist = [] - res = requests.get('https://feed.entertainment.tv.theplatform.eu/f/PR1GhC/mediaset-prod-all-programs-v2?byCustomValue={subBrandId}{' + item.subbrand +'}&sort=:publishInfo_lastPublished|asc,tvSeasonEpisodeNumber').json()['entries'] + res = requests.get('https://feed.entertainment.tv.theplatform.eu/f/PR1GhC/mediaset-prod-all-programs-v2?byCustomValue={subBrandId}{' + item.subbrand +'}&sort=:publishInfo_lastPublished|' + order + ',tvSeasonEpisodeNumber').json()['entries'] for it in res: thumb = '' titleDate = '' if 'mediasetprogram$publishInfo_lastPublished' in it: date = datetime.date.fromtimestamp(it['mediasetprogram$publishInfo_lastPublished'] / 1000) - titleDate =' [{} {}]'.format(date.day, months[date.month]) + titleDate =' [{} {}]'.format(date.day, months[date.month-1]) title = '[B]{}[/B]{}'.format(it['title'], titleDate) for k, v in it['thumbnails'].items(): if 'image_keyframe' in k and not thumb: @@ -215,15 +228,21 @@ def episodes(item): thumbnail=thumb, forcethumb=True, contentType='episode', - action='play', + action='findvideos', video_id=it['guid'])) return itemlist +def findvideos(item): + logger.debug() + return support.server(item, itemlist=[item.clone(server='directo', action='play')]) + + def play(item): logger.debug() item.no_return=True + # support.dbg() mpd = config.getSetting('mpd', item.channel) @@ -238,6 +257,8 @@ def play(item): if Format in it['format']: item.url = requests.head(it['publicUrls'][0]).headers['Location'] pid = it['releasePids'][0] + if mpd and 'widevine' in it['assetTypes']: + break if mpd: item.manifest = 'mpd' diff --git a/channels/paramount.py b/channels/paramount.py index e7ec1379..11501ede 100644 --- a/channels/paramount.py +++ b/channels/paramount.py @@ -64,7 +64,7 @@ def live(item): logger.debug() itemlist=[] for key, value in liveDict().items(): - itemlist.append(item.clone(title=support.typo(key,'bold'), contentTitle=key, fulltitle=key, show=key, url=value['url'], plot=value['plot'], action='play', forcethumb=True, no_return=True)) + itemlist.append(item.clone(title=key, contentTitle=key, fulltitle=key, show=key, url=value['url'], plot=value['plot'], action='findvideos', forcethumb=True, no_return=True)) return support.thumb(itemlist, mode='live') @@ -92,7 +92,7 @@ def movies(item): continue if item.text.lower() in title.lower(): itemlist.append( - item.clone(title=support.typo(title,'bold'), + item.clone(title=title, fulltitle = title, show = title, contentTitle = title if item.contentType == 'movie' else '', @@ -137,10 +137,10 @@ def episodes(item): s = support.match(se, patron=r'S\s*(?P\d+)').match e = support.match(se, patron=r'E\s*(?P\d+)').match if not e: e = support.match(it['meta']['subHeader'], patron=r'(\d+)').match - title = support.typo((s + 'x' if s else 'Episodio ') + e.zfill(2) + ' - ' + it['meta']['subHeader'],'bold') + title = (s + 'x' if s else 'Episodio ') + e.zfill(2) + ' - ' + it['meta']['subHeader'] else: s = e = '0' - title = support.typo(it['meta']['header']['title'],'bold') + title = it['meta']['header']['title'] itemlist.append( item.clone(title=title, season=int(s) if s else '', @@ -170,9 +170,4 @@ def play(item): url = 'https://media.mtvnservices.com/pmt/e1/access/index.html?uri=' + mgid + '&configtype=edge&ref=' + item.url ID, rootUrl = support.match(url, patron=[r'"id":"([^"]+)",',r'brightcove_mediagenRootURL":"([^"]+)"']).matches item.url = jsontools.load(support.match(rootUrl.replace('&device={device}','').format(uri = ID)).data)['package']['video']['item'][0]['rendition'][0]['src'] - - if item.livefilter: - d = liveDict()[item.livefilter] - item = item.clone(title=support.typo(item.livefilter, 'bold'), fulltitle=item.livefilter, url=d['url'], plot=d['plot'], action='play', forcethumb=True, no_return=True) - support.thumb(item, mode='live') return [item] \ No newline at end of file diff --git a/channels/raiplay.py b/channels/raiplay.py index 5b7e6ebc..28dd28c8 100644 --- a/channels/raiplay.py +++ b/channels/raiplay.py @@ -19,8 +19,8 @@ host = support.config.get_channel_url() @support.menu def mainlist(item): - top = [('Dirette {bold}', ['/dirette', 'live', '/palinsesto/onAir.json']), - ('Replay {bold}', ['/guidatv', 'replayMenu', '/guidatv.json'])] + top = [('Dirette {bullet bold}', ['/dirette', 'live', '/palinsesto/onAir.json']), + ('Replay {bullet bold}', ['/guidatv', 'replayMenu', '/guidatv.json'])] menu = [('Film {bullet bold}', ['/film', 'menu', '/tipologia/film/index.json']), ('Serie TV {bullet bold}', ['/serietv', 'menu', '/tipologia/serietv/index.json']), @@ -58,7 +58,7 @@ def menu(item): thumb = item.thumbnail if 'RaiPlay Slider Generi Block' in it['type']: action = 'menu' - thumb = support.thumb('genres') + thumb = support.thumb('genre') itemlist.append(item.clone(title=support.typo(it['name'], 'bold'), data=it.get('contents', item.data), thumbnail=thumb, action=action)) return itemlist @@ -141,7 +141,7 @@ def live(item): current = it['currentItem'] next = it['nextItem'] plot = '[B]{}[/B]\n{}\n\nA Seguire: [B]{}[/B]\n{}'.format(current['name'], current['description'], next['name'], next['description']) - itemlist.append(item.clone(title=title, fulltitle=title, fanart=fanart, plot=plot, url=url, videoUrl=url + '.json', action='play')) + itemlist.append(item.clone(title=title, fulltitle=title, fanart=fanart, plot=plot, url=url, videoUrl=url + '.json', action='findvideos')) itemlist.sort(key=lambda it: support.channels_order.get(it.fulltitle, 999)) support.thumb(itemlist, mode='live') return itemlist @@ -207,7 +207,7 @@ def replay(item): plot = info['description'], url = getUrl(it['weblink']), videoUrl = getUrl(it['path_id']), - action = 'play', + action = 'findvideos', forcethumb = True) @@ -225,7 +225,7 @@ def replay(item): return [Item(title='Non ci sono Replay per questo Canale')] return itemlist -def play(item): +def findvideos(item): logger.debug() res = requests.get(item.videoUrl).json() @@ -283,7 +283,7 @@ def addinfo(items, item): plot=info.get('description', '')) if 'Genere' not in key.get('sub_type', '') and ('layout' not in key or key['layout'] == 'single'): - it.action = 'play' + it.action = 'findvideos' it.contentTitle = it.fulltitle else: it.action = 'episodes' diff --git a/core/item.py b/core/item.py index d2982105..76113d59 100644 --- a/core/item.py +++ b/core/item.py @@ -283,6 +283,12 @@ class Item(object): def __str__(self): return '\r\t' + self.tostring('\r\t') + def __eq__(self, other): + if type(other) == Item: + return self.__dict__ == other.__dict__ + else: + return False + def set_parent_content(self, parentContent): """ Fill the contentDetails fields with the information of the item "parent" diff --git a/core/support.py b/core/support.py index 724de7aa..1bc265ec 100755 --- a/core/support.py +++ b/core/support.py @@ -1882,9 +1882,9 @@ def get_jwplayer_mediaUrl(data, srvName, onlyHttp=False, dataIsBlock=False): def itemlistdb(itemlist=None): from core import db if itemlist: - db['itemlist']['itemlist'] = itemlist + db['control']['itemlist'] = itemlist else: - itemlist = db['itemlist'].get('itemlist',[]) + itemlist = db['control'].get('itemlist',[]) db.close() return itemlist diff --git a/lib/sqlitedict.py b/lib/sqlitedict.py index 2e0db32b..f4974ebc 100644 --- a/lib/sqlitedict.py +++ b/lib/sqlitedict.py @@ -38,8 +38,6 @@ from threading import Thread __version__ = '1.7.0.dev0' -import xbmc -kodi_monitor = xbmc.Monitor() major_version = sys.version_info[0] if major_version < 3: # py <= 2.x @@ -443,7 +441,7 @@ class SqliteMultithread(Thread): self._sqlitedict_thread_initialized = True res = None - while not kodi_monitor.abortRequested(): + while True: req, arg, res, outer_stack = self.reqs.get() if req == '--close--': assert res, ('--close-- without return queue', res) diff --git a/platformcode/launcher.py b/platformcode/launcher.py index 682bf09a..0fce6bd2 100644 --- a/platformcode/launcher.py +++ b/platformcode/launcher.py @@ -115,7 +115,8 @@ def run(item=None): platformtools.itemlistUpdate(Item(channel='setting', action='report_menu'), True) finally: # db need to be closed when not used, it will cause freezes - from core import db + from core import db, videolibrarydb + videolibrarydb.close() db.close() diff --git a/platformcode/platformtools.py b/platformcode/platformtools.py index cd99d74a..6954271f 100644 --- a/platformcode/platformtools.py +++ b/platformcode/platformtools.py @@ -533,7 +533,7 @@ def getCurrentView(item=None, parent_item=None): or (item.channel in ['videolibrary'] and parent_item.action in ['list_tvshows']): return 'tvshow', 'tvshows' - elif parent_item.action in ['episode', 'get_episodes'] or item.contentType == 'episode': + elif parent_item.action in ['episodes', 'get_episodes'] or item.contentType == 'episode': return 'episode', 'tvshows' elif parent_item.action in ['get_seasons']: @@ -546,11 +546,11 @@ def getCurrentView(item=None, parent_item=None): elif parent_item.action in ['filterchannels']: return 'channels', addons - elif item.action: + else: return 'menu', addons - else: - return None, None + # else: + # return None, None def setViewMode(item, parent_item): @@ -1387,12 +1387,14 @@ def setPlayer(item, xlistitem, mediaUrl, view, strm): item.options = {'strm':False} # logger.debug("item:\n" + item.tostring('\n')) - # Moved del conector "torrent" here + # Get Media Url for play Torrent if item.server == "torrent": - playTorrent(item, xlistitem, mediaUrl) - return + mediaUrl = playTorrent(item, mediaUrl) + if not mediaUrl: + return + # If it is a strm file, play is not necessary - elif strm: + if strm: xbmcplugin.setResolvedUrl(int(sys.argv[1]), True, xlistitem) if item.subtitle: xbmc.sleep(2000) @@ -1408,13 +1410,11 @@ def setPlayer(item, xlistitem, mediaUrl, view, strm): logger.info("mediaUrl=" + mediaUrl) if player_mode in [0,1]: - # preventBusy(item) - if player_mode in [1]: - # logger.dbg() + if player_mode in [1] and item.server != "torrent": item.played_time = resumePlayback(getPlayedTime(item)) from core import db - db['playitem']['item'] = item + db['control']['playItem'] = item db.close() logger.info('Player Mode:',['Direct', 'Bookmark'][player_mode]) @@ -1484,8 +1484,9 @@ def torrentClientInstalled(showTuple=False): return torrentOptions -def playTorrent(item, xlistitem, mediaUrl): +def playTorrent(item, mediaUrl): logger.debug() + # logger.dbg() import time from servers import torrent @@ -1493,14 +1494,14 @@ def playTorrent(item, xlistitem, mediaUrl): if len(torrentOptions) == 0: from platformcode import elementum_download elementum_download.download() - return playTorrent(item, xlistitem, mediaUrl) + return playTorrent(item, mediaUrl) elif len(torrentOptions) > 1: selection = dialogSelect(config.getLocalizedString(70193), [opcion[0] for opcion in torrentOptions]) else: selection = 0 if selection >= 0: - preventBusy() + # preventBusy() mediaUrl = urllib.quote_plus(item.url) torr_client = torrentOptions[selection][0] @@ -1514,14 +1515,14 @@ def playTorrent(item, xlistitem, mediaUrl): if torr_client in ['elementum'] and item.downloadFilename: torrent.elementum_download(item) else: - time.sleep(3) - xbmc.executebuiltin("PlayMedia(" + torrentOptions[selection][1] % mediaUrl + ")") - - torrent.mark_auto_as_watched(item) - - if not item.globalsearch: - while isPlaying() and not xbmc.Monitor().abortRequested(): - time.sleep(3) + import xbmcaddon + addon = xbmcaddon.Addon(id='plugin.video.elementum') + if addon.getSetting('download_storage') == '0': + addon.setSetting('download_storage', '1') + xbmc.sleep(3000) + mediaUrl = torrentOptions[selection][1] % mediaUrl + return mediaUrl + return '' def resumePlayback(played_time): @@ -1557,7 +1558,7 @@ def resumePlayback(played_time): self.set_values(False) self.close() - if played_time and played_time > 30: + if played_time: Dialog = ResumePlayback('ResumePlayback.xml', config.getRuntimePath(), played_time=played_time) Dialog.show() t = 0 diff --git a/platformcode/xbmc_videolibrary.py b/platformcode/xbmc_videolibrary.py index 62401b41..e7111353 100644 --- a/platformcode/xbmc_videolibrary.py +++ b/platformcode/xbmc_videolibrary.py @@ -12,7 +12,7 @@ if PY3: else: import urllib2 # Usamos el nativo de PY2 que es más rápido -from core import filetools, jsontools, videolibrarydb +from core import filetools, jsontools, support, videolibrarydb from platformcode import config, logger, platformtools from core import scrapertools from xml.dom import minidom @@ -118,13 +118,10 @@ def mark_auto_as_watched(): # If it is configured to mark as seen if config.getSetting("mark_as_watched", "videolibrary"): from core import db - item = db['playitem'].get('item') + item = db['control'].get('playItem') db.close() - imdb_id = xbmc.Player().getVideoInfoTag().getIMDBNumber() - if item.infoLabels['imdb_id'] == imdb_id: - # mark_as_watched_subThread(item) - threading.Thread(target=mark_as_watched_subThread, args=[item]).start() - logger.debug('EXIT MONITOR') + threading.Thread(target=mark_as_watched_subThread, args=[item]).start() + logger.debug('EXIT MONITOR') def sync_trakt_addon(path_folder): diff --git a/service.py b/service.py index 44704481..e2ce61e5 100644 --- a/service.py +++ b/service.py @@ -19,11 +19,10 @@ except: librerias = xbmc.translatePath(os.path.join(config.getRuntimePath(), 'lib')) sys.path.insert(0, librerias) -from core import filetools, httptools, jsontools, scrapertools, db, support +from core import filetools, httptools, scrapertools, db, videolibrarydb from lib import schedule from platformcode import logger, platformtools, updater, xbmc_videolibrary from specials import videolibrary -from servers import torrent # if this service need to be reloaded because an update changed it needsReload = False @@ -243,8 +242,10 @@ if __name__ == "__main__": logger.error(traceback.format_exc()) if needsReload: - join_threads() db.close() + videolibrarydb.close() + join_threads() + logger.info('Relaunching service.py') xbmc.executeJSONRPC( '{"jsonrpc": "2.0", "id":1, "method": "Addons.SetAddonEnabled", "params": { "addonid": "plugin.video.kod", "enabled": false }}') @@ -254,7 +255,8 @@ if __name__ == "__main__": break if monitor.waitForAbort(1): # every second - join_threads() # db need to be closed when not used, it will cause freezes db.close() + videolibrarydb.close() + join_threads() break diff --git a/specials/globalsearch.py b/specials/globalsearch.py index 1c7ae91b..8771989d 100644 --- a/specials/globalsearch.py +++ b/specials/globalsearch.py @@ -10,6 +10,7 @@ from core import channeltools, scrapertools, support from platformcode import platformtools, config, logger from threading import Thread from collections import OrderedDict +from specials.search import save_search if sys.version_info[0] >= 3: PY3 = True @@ -69,7 +70,7 @@ PREV = 507 class SearchWindow(xbmcgui.WindowXML): - def start(self, item, moduleDict={}, searchActions=[], thActions=None): + def start(self, item, thActions=None): logger.debug() self.exit = False @@ -119,8 +120,12 @@ class SearchWindow(xbmcgui.WindowXML): if not self.item.text: self.item.text = platformtools.dialogInput(default=last_search, heading='') if self.item.text: channeltools.setChannelSetting('Last_searched', self.item.text, 'search') - from specials.search import save_search - save_search(self.item.text) + if self.item.mode == 'all': + save_search(self.item.text) + else: + if self.item.context: + del self.item.context # needed for preventing same content twice in saved search + if not self.item.saved: save_search(self.item.clone(channel='search', action='new_search').__dict__) def getActionsThread(self): logger.debug() @@ -147,7 +152,7 @@ class SearchWindow(xbmcgui.WindowXML): # wait and return as getActionsThread load lastLen = len(self.searchActions) if self.thActions: - while self.thActions.is_alive(): + while self.thActions.is_alive() or lastLen < len(self.searchActions): while len(self.searchActions) == lastLen: if not self.thActions.is_alive(): return @@ -322,7 +327,7 @@ class SearchWindow(xbmcgui.WindowXML): self.PROGRESS.setPercent(percent) self.MAINTITLE.setText('{} | {}/{} [{}"]'.format(self.mainTitle,self.count, len(self.searchActions), int(time.time() - self.time))) - if percent == 100: + if percent == 100 and not self.thActions.is_alive(): if len(self.channels['valid']) or len(self.channels) == 2: self.setFocusId(RESULTS) elif not len(self.channels['valid']) and not len(self.channels): @@ -608,7 +613,7 @@ class SearchWindow(xbmcgui.WindowXML): self.actors() elif search == 'persons': item = self.item.clone(mode='person_', discovery=self.persons[pos]) - new_search(item, self.moduleDict, self.searchActions) + new_search(item) if close_action: self.close() else: @@ -616,7 +621,7 @@ class SearchWindow(xbmcgui.WindowXML): if self.mode == 'movie': item.contentTitle = self.RESULTS.getSelectedItem().getLabel() else: item.contentSerieName = self.RESULTS.getSelectedItem().getLabel() - new_search(item, self.moduleDict, self.searchActions) + new_search(item) if close_action: self.close() diff --git a/specials/search.py b/specials/search.py index 0e453dd2..f94aa011 100644 --- a/specials/search.py +++ b/specials/search.py @@ -191,6 +191,7 @@ def saved_search(item): return itemlist def get_saved_searches(): + # logger.dbg() current_saved_searches_list = config.getSetting("saved_searches_list", "search") if not current_saved_searches_list: current_saved_searches_list = [] @@ -209,9 +210,11 @@ def get_saved_searches(): thumbnail=thumb('search'))) else: item = Item().fromjson(json.dumps(saved_search_item)) - if item.action == 'Search': - item.action = 'new_search' - if item.type: item.mode = 'search/'+item.type + item.saved = True + item.channel = 'globalsearch' if config.getSetting('new_search') else 'classicsearch' + item.folder = False if config.getSetting('new_search') else True + if item.type: item.mode = 'search/' + item.type + if item.action == 'Search': item.action = 'new_search' saved_searches_list.append(item) return saved_searches_list