From 48f2d335e3df7fc0c82297d963dec33c4bebd768 Mon Sep 17 00:00:00 2001 From: mac12m99 Date: Fri, 31 May 2019 21:35:33 +0200 Subject: [PATCH] checkHost -> part1 --- channels/fastsubita.py | 3 ++- core/support.py | 19 +++++++++++++++++-- 2 files changed, 19 insertions(+), 3 deletions(-) diff --git a/channels/fastsubita.py b/channels/fastsubita.py index c8f575f7..242c6bad 100644 --- a/channels/fastsubita.py +++ b/channels/fastsubita.py @@ -140,7 +140,7 @@ def pelicuals_tv(item): contentLanguage='Sub-ITA', infoLabels=infoLabels, folder=True)) - + support.checkHost(item, itemlist) tmdb.set_infoLabels_itemlist(itemlist, seekTmdb=True) # Paginazione @@ -237,6 +237,7 @@ def lista_serie(item): folder=True)) # ii += 1 + support.checkHost(item, itemlist) tmdb.set_infoLabels_itemlist(itemlist, seekTmdb=True) if len(series) >= p * PERPAGE: diff --git a/core/support.py b/core/support.py index 94c93a52..ad9d2f75 100644 --- a/core/support.py +++ b/core/support.py @@ -8,7 +8,7 @@ import urlparse import xbmcaddon from channelselector import thumb -from core import httptools, scrapertoolsV2, servertools, tmdb +from core import httptools, scrapertoolsV2, servertools, tmdb, channeltools from core.item import Item from lib import unshortenit from platformcode import logger, config @@ -225,7 +225,7 @@ def scrape(item, patron = '', listGroups = [], headers="", blacklist="", data="" it.__setattr__(lg, match[listGroups.index(lg)]) itemlist.append(it) - + checkHost(item, itemlist) if (item.contentType == "episode" and (action != "findvideos" and action != "play")) \ or (item.contentType == "movie" and action != "play"): tmdb.set_infoLabels_itemlist(itemlist, seekTmdb=True) @@ -243,6 +243,21 @@ def scrape(item, patron = '', listGroups = [], headers="", blacklist="", data="" return itemlist +def checkHost(item, itemlist): + # nel caso non ci siano risultati puo essere che l'utente abbia cambiato manualmente l'host, pertanto lo riporta + # al valore di default (fixa anche il problema del cambio di host da parte nostra) + if len(itemlist) == 0: + # trovo il valore di default + defHost = None + for s in channeltools.get_channel_json(item.channel)['settings']: + if s['id'] == 'channel_host': + defHost = s['default'] + break + # lo confronto con quello attuale + if config.get_setting('channel_host', item.channel) != defHost: + config.set_setting('channel_host', defHost, item.channel) + + def dooplay_get_links(item, host): # get links from websites using dooplay theme and dooplay_player # return a list of dict containing these values: url, title and server