diff --git a/channels.json b/channels.json index 2e4cce11..479c9c33 100644 --- a/channels.json +++ b/channels.json @@ -43,7 +43,8 @@ "streamingcommunity": "https://streamingcommunity.net", "streamtime": "https://t.me/s/StreamTime", "toonitalia": "https://toonitalia.pro", - "vvvvid": "https://www.vvvvid.it" + "vvvvid": "https://www.vvvvid.it", + "paramount": "https://www.paramountnetwork.it" }, "findhost": { "altadefinizione01": "https://altadefinizione01-nuovo.info", diff --git a/channels/animesaturn.py b/channels/animesaturn.py index e303929f..e4696377 100644 --- a/channels/animesaturn.py +++ b/channels/animesaturn.py @@ -60,7 +60,7 @@ def newest(categoria): def submenu(item): data = support.match(item.url + item.args).data action = 'filter' - patronMenu = r'
(?P[^<]+)[^>]+>[^>]+>\s*<select id="(?P<parameter>[^"]+)"[^>]+>(?P<url>.*?)</select>' + patronMenu = r'<h5 class="[^"]+">(?P<title>[^<]+)[^>]+>[^>]+>\s*<select id="(?P<parameter>[^"]+)"[^>]+>(?P<data>.*?)</select>' def itemlistHook(itemlist): itemlist.insert(0, item.clone(title=support.typo('Tutti','bold'), url=item.url + item.args, action='peliculas')) return itemlist[:-1] @@ -69,7 +69,7 @@ def submenu(item): def filter(item): itemlist = [] - matches = support.match(item.url, patron=r'<option value="(?P<value>[^"]+)"[^>]*>(?P<title>[^<]+)').matches + matches = support.match(item.data if item.data else item.url, patron=r'<option value="(?P<value>[^"]+)"[^>]*>(?P<title>[^<]+)').matches for value, title in matches: itemlist.append(item.clone(title= support.typo(title,'bold'), url='{}{}&{}%5B0%5D={}'.format(host, item.args, item.parameter, value), action='peliculas', args='filter')) support.thumb(itemlist, genre=True) @@ -95,7 +95,7 @@ def peliculas(item): deflang= 'Sub-ITA' action = 'check' page = None - post = "page=" + str(item.page if item.page else 1) if item.page and item.page > 1 else None + post = "page=" + str(item.page if item.page else 1) if item.page and int(item.page) > 1 else None if item.args == 'top': data = item.other diff --git a/channels/paramount.py b/channels/paramount.py index f1d33281..aed03c53 100644 --- a/channels/paramount.py +++ b/channels/paramount.py @@ -6,8 +6,7 @@ import inspect from core import support, jsontools from platformcode import autorenumber, logger -# host = support.config.get_channel_url() -host = 'https://www.paramountnetwork.it' +host = support.config.get_channel_url() headers = [['Referer', host]] @@ -64,7 +63,7 @@ def live(item): def peliculas(item): logger.debug() def load_more(url): - second_url = host if url.startswith('/') else '' + url.replace('\u002F','/').replace('%5C','/') + second_url = host if url.startswith('/') else '' + url.replace('\u002F','/').replace('\\u002F','/').replace('%5C','/') new_data = support.match(host + second_url).data.replace('\x01','l').replace('\x02','a') return jsontools.load(new_data)['items'] diff --git a/channels/raiplay.py b/channels/raiplay.py index e1b5bf8a..f66ef901 100644 --- a/channels/raiplay.py +++ b/channels/raiplay.py @@ -53,7 +53,7 @@ def learning(item): json = current_session.get(item.url).json()['contents'] for key in json: itemlist.append(item.clone(title = support.typo(key['name'],'bold'), fulltitle = key['name'], - show = key['name'], url = key['contents'], action = 'peliculas')) + show = key['name'], data = key['contents'], action = 'peliculas')) return itemlist @@ -82,9 +82,14 @@ def replay_menu(item): # create day and month list days = [] months = [] - days.append(xbmc.getLocalizedString(17)) - for day in range(11, 17): days.append(xbmc.getLocalizedString(day)) - for month in range(21, 33): months.append(xbmc.getLocalizedString(month)) + try: + days.append(xbmc.getLocalizedString(17)) + for day in range(11, 17): days.append(xbmc.getLocalizedString(day)) + for month in range(21, 33): months.append(xbmc.getLocalizedString(month)) + except: # per i test, xbmc.getLocalizedString non รจ supportato + days.append('dummy') + for day in range(11, 17): days.append('dummy') + for month in range(21, 33): months.append('dummy') # make menu itemlist = [] @@ -184,8 +189,8 @@ def peliculas(item): pagination = 40 if not item.search else '' # load json - if type(item.url) in [dict, list]: - json = item.url + if item.data: + json = item.data for key in json: if item.search.lower() in key['name'].lower(): keys.append(key) diff --git a/channels/serietvsubita.json b/channels/serietvsubita.json index b087171f..2cd33c2f 100644 --- a/channels/serietvsubita.json +++ b/channels/serietvsubita.json @@ -1,7 +1,7 @@ { "id": "serietvsubita", "name": "Serie TV Sub ITA", - "active": true, + "active": false, "language": ["ita"], "thumbnail": "serietvsubita.png", "banner": "serietvsubita.png", diff --git a/channels/streamingcommunity.py b/channels/streamingcommunity.py index 8dbcee33..2891b180 100644 --- a/channels/streamingcommunity.py +++ b/channels/streamingcommunity.py @@ -4,7 +4,7 @@ # ------------------------------------------------------------ import json, requests, sys -from core import support +from core import support, channeltools from platformcode import logger if sys.version_info[0] >= 3: from concurrent import futures @@ -190,5 +190,21 @@ def episodios(item): def findvideos(item): - itemlist = [item.clone(title = 'StreamingCommunity', server='streamingcommunity_server')] - return support.server(item, item.url) \ No newline at end of file + video_urls = [] + headers = {'User-Agent': 'Mozilla/5.0 (Windows; U; Windows NT 5.1; en-GB; rv:1.8.1.14) Gecko/20080404 Firefox/2.0.0.14', + 'content-type': 'application/json;charset=UTF-8', + 'Referer': 'https://streamingcommunity.net'} + data = support.match(item, headers=headers).data.replace('"','"').replace('\\','') + url = support.match(data, patron=r'video_url"\s*:\s*"([^"]+)"').match + def videourls(res): + newurl = '{}/{}'.format(url, res) + if requests.head(newurl, headers=headers).status_code == 200: + video_urls.append(["m3u8 {} [StreamingCommunity]".format(res), newurl]) + + with futures.ThreadPoolExecutor() as executor: + for res in ['480p', '720p', '1080p']: + executor.submit(videourls, res) + if not video_urls: video_urls = [["m3u8 [StreamingCommunity]", url]] + else: video_urls.sort(key=lambda url: int(support.match(url[0], patron=r'(\d+)p').match)) + itemlist = [item.clone(title = channeltools.get_channel_parameters(item.channel)['title'], server='directo', video_urls=video_urls, thumbnail=channeltools.get_channel_parameters(item.channel)["thumbnail"], forcethumb=True)] + return support.server(item, itemlist=itemlist) \ No newline at end of file diff --git a/core/autoplay.py b/core/autoplay.py index af904cad..4f3c3dff 100644 --- a/core/autoplay.py +++ b/core/autoplay.py @@ -153,11 +153,13 @@ def start(itemlist, item): autoplay_list.append(autoplay_elem) # We order according to priority - if priority == 0: autoplay_list.sort(key=lambda orden: (orden['indice_quality'], orden['indice_server'])) # Servers and qualities + if priority == 0: autoplay_list.sort(key=lambda orden: ((orden['indice_server'], orden['indice_quality']))) # Servers and qualities elif priority == 1: autoplay_list.sort(key=lambda orden: (orden['indice_quality'], orden['indice_server'])) # Qualities and servers elif priority == 2: autoplay_list.sort(key=lambda orden: (orden['indice_server'])) # Servers only elif priority == 3: autoplay_list.sort(key=lambda orden: (orden['indice_quality'])) # Only qualities + logger.debug('PRIORITY',priority, autoplay_list) + # if quality priority is active if priority == 0 and config.get_setting('quality_priority'): max_quality = autoplay_list[0]["indice_quality"] if autoplay_list and "indice_quality" in autoplay_list[0] else 0 diff --git a/core/support.py b/core/support.py index 70c2b14c..92eb46d4 100755 --- a/core/support.py +++ b/core/support.py @@ -320,16 +320,18 @@ def scrapeBlock(item, args, block, patron, headers, action, pagination, debug, t if type(parsedTitle.get('season')) == list: longtitle += str(parsedTitle.get('season')[0]) + '-' + str(parsedTitle.get('season')[-1]) + infolabels['season'] = parsedTitle.get('season')[0] else: longtitle += str(parsedTitle.get('season')) + infolabels['season'] = parsedTitle.get('season') if type(parsedTitle.get('episode')) == list: longtitle += 'x' + str(parsedTitle.get('episode')[0]).zfill(2) + '-' + str(parsedTitle.get('episode')[-1]).zfill(2) + infolabels['episode'] = parsedTitle.get('episode')[0] else: longtitle += 'x' + str(parsedTitle.get('episode')).zfill(2) + infolabels['episode'] = parsedTitle.get('episode') - infolabels['season'] = parsedTitle.get('season') - infolabels['episode'] = parsedTitle.get('episode') elif parsedTitle.get('season') and type(parsedTitle.get('season')) == list: longtitle += s + config.get_localized_string(30140) + " " +str(parsedTitle.get('season')[0]) + '-' + str(parsedTitle.get('season')[-1]) elif parsedTitle.get('season'): @@ -1161,25 +1163,26 @@ def server(item, data='', itemlist=[], headers='', AutoPlay=True, CheckLinks=Tru # s = servertools.get_server_from_url(videoitem.url) # videoitem.server = s[2] if s else 'directo' # videoitem.title = s[0] if s else config.get_localized_string(30137) - srv_param = servertools.get_server_parameters(videoitem.server.lower()) - if not srv_param: # do not exists or it's empty - findS = servertools.get_server_from_url(videoitem.url) - info(findS) - if not findS: - if item.channel == 'community': - findS= (config.get_localized_string(30137), videoitem.url, 'directo') - else: - videoitem.url = unshortenit.unshorten_only(videoitem.url)[0] - findS = servertools.get_server_from_url(videoitem.url) - if not findS: - info(videoitem, 'Non supportato') - return - videoitem.server = findS[2] - videoitem.title = findS[0] - videoitem.url = findS[1] + if not videoitem.video_urls: srv_param = servertools.get_server_parameters(videoitem.server.lower()) + if not srv_param: # do not exists or it's empty + findS = servertools.get_server_from_url(videoitem.url) + info(findS) + if not findS: + if item.channel == 'community': + findS= (config.get_localized_string(30137), videoitem.url, 'directo') + else: + videoitem.url = unshortenit.unshorten_only(videoitem.url)[0] + findS = servertools.get_server_from_url(videoitem.url) + if not findS: + info(videoitem, 'Non supportato') + return + videoitem.server = findS[2] + videoitem.title = findS[0] + videoitem.url = findS[1] + srv_param = servertools.get_server_parameters(videoitem.server.lower()) - if srv_param.get('active', False): + if videoitem.video_urls or srv_param.get('active', False): item.title = typo(item.contentTitle.strip(), 'bold') if item.contentType == 'movie' or (config.get_localized_string(30161) in item.title) else item.title quality = videoitem.quality if videoitem.quality else item.quality if item.quality else '' @@ -1188,7 +1191,7 @@ def server(item, data='', itemlist=[], headers='', AutoPlay=True, CheckLinks=Tru videoitem.channel = item.channel videoitem.fulltitle = item.fulltitle videoitem.show = item.show - videoitem.thumbnail = item.thumbnail + if not videoitem.video_urls: videoitem.thumbnail = item.thumbnail videoitem.contentType = item.contentType videoitem.infoLabels = item.infoLabels videoitem.quality = quality @@ -1200,13 +1203,13 @@ def server(item, data='', itemlist=[], headers='', AutoPlay=True, CheckLinks=Tru # non threaded for webpdb # dbg() - # thL = [getItem(videoitem) for videoitem in itemlist if videoitem.url] + # thL = [getItem(videoitem) for videoitem in itemlist if videoitem.url or videoitem.video_urls] # for it in thL: # if it and not config.get_setting("black_list", server=it.server.lower()): # verifiedItemlist.append(it) - # + with futures.ThreadPoolExecutor() as executor: - thL = [executor.submit(getItem, videoitem) for videoitem in itemlist if videoitem.url] + thL = [executor.submit(getItem, videoitem) for videoitem in itemlist if videoitem.url or videoitem.video_urls] for it in futures.as_completed(thL): if it.result() and not config.get_setting("black_list", server=it.result().server.lower()): verifiedItemlist.append(it.result()) diff --git a/lib/unshortenit.py b/lib/unshortenit.py index 0bcb8c87..2cda8301 100644 --- a/lib/unshortenit.py +++ b/lib/unshortenit.py @@ -31,7 +31,7 @@ class UnshortenIt(object): _linkbucks_regex = r'linkbucks\.com|any\.gs|cash4links\.co|cash4files\.co|dyo\.gs|filesonthe\.net|goneviral\.com|megaline\.co|miniurls\.co|qqc\.co|seriousdeals\.net|theseblogs\.com|theseforums\.com|tinylinks\.co|tubeviral\.com|ultrafiles\.net|urlbeat\.net|whackyvidz\.com|yyv\.co' _adfocus_regex = r'adfoc\.us' _lnxlu_regex = r'lnx\.lu' - _shst_regex = r'sh\.st|festyy\.com|ceesty\.com' + _shst_regex = r'sh\.st|shorte\.st|sh\.st|clkmein\.com|viid\.me|xiw34\.com|corneey\.com|gestyy\.com|cllkme\.com|festyy\.com|destyy\.com|ceesty\.com' _hrefli_regex = r'href\.li' _anonymz_regex = r'anonymz\.com' _shrink_service_regex = r'shrink-service\.it' @@ -381,41 +381,43 @@ class UnshortenIt(object): def _unshorten_shst(self, uri): try: - r = httptools.downloadpage(uri, timeout=self._timeout) - html = r.data - session_id = re.findall(r'sessionId\:(.*?)\"\,', html) - if len(session_id) > 0: - session_id = re.sub(r'\s\"', '', session_id[0]) - - http_header = dict() - http_header["Content-Type"] = "application/x-www-form-urlencoded" - http_header["Host"] = "sh.st" - http_header["Referer"] = uri - http_header["Origin"] = "http://sh.st" - http_header["X-Requested-With"] = "XMLHttpRequest" - - if config.is_xbmc(): - import xbmc - xbmc.sleep(5 * 1000) - else: - time.sleep(5 * 1000) - - payload = {'adSessionId': session_id, 'callback': 'c'} - r = httptools.downloadpage( - 'http://sh.st/shortest-url/end-adsession?' + - urlencode(payload), - headers=http_header, - timeout=self._timeout) - response = r.data[6:-2].decode('utf-8') - - if r.code == 200: - resp_uri = json.loads(response)['destinationUrl'] - if resp_uri is not None: - uri = resp_uri - else: - return uri, 'Error extracting url' - else: - return uri, 'Error extracting url' + # act like a crawler + r = httptools.downloadpage(uri, timeout=self._timeout, headers=[['User-Agent', '']]) + uri = r.url + # html = r.data + # session_id = re.findall(r'sessionId\:(.*?)\"\,', html) + # if len(session_id) > 0: + # session_id = re.sub(r'\s\"', '', session_id[0]) + # + # http_header = dict() + # http_header["Content-Type"] = "application/x-www-form-urlencoded" + # http_header["Host"] = "sh.st" + # http_header["Referer"] = uri + # http_header["Origin"] = "http://sh.st" + # http_header["X-Requested-With"] = "XMLHttpRequest" + # + # if config.is_xbmc(): + # import xbmc + # xbmc.sleep(5 * 1000) + # else: + # time.sleep(5 * 1000) + # + # payload = {'adSessionId': session_id, 'callback': 'c'} + # r = httptools.downloadpage( + # 'http://sh.st/shortest-url/end-adsession?' + + # urlencode(payload), + # headers=http_header, + # timeout=self._timeout) + # response = r.data[6:-2].decode('utf-8') + # + # if r.code == 200: + # resp_uri = json.loads(response)['destinationUrl'] + # if resp_uri is not None: + # uri = resp_uri + # else: + # return uri, 'Error extracting url' + # else: + # return uri, 'Error extracting url' return uri, r.code diff --git a/platformcode/config.py b/platformcode/config.py index f26ae0f0..a16f992f 100644 --- a/platformcode/config.py +++ b/platformcode/config.py @@ -468,4 +468,4 @@ def verify_directories_created(): def get_online_server_thumb(server): - return "https://raw.github.com/kodiondemand/media/master/resources/servers/" + server.lower() + '.png' \ No newline at end of file + return "https://raw.github.com/kodiondemand/media/master/resources/servers/" + server.lower().replace('_server','') + '.png' \ No newline at end of file diff --git a/platformcode/launcher.py b/platformcode/launcher.py index 1c21c47e..022cea2d 100644 --- a/platformcode/launcher.py +++ b/platformcode/launcher.py @@ -450,14 +450,15 @@ def play_from_library(item): import xbmcgui, xbmcplugin, xbmc from time import sleep + # logger.debug("item: \n" + item.tostring('\n')) + platformtools.prevent_busy(item) + itemlist=[] item.fromLibrary = True item.window = True logger.debug() - # logger.debug("item: \n" + item.tostring('\n')) - platformtools.prevent_busy(item) - # Modify the action (currently the video library needs "findvideos" since this is where the sources are searched + # Modify the action (currently the video library needs "findvideos" since this is where the sources are searched item.action = "findvideos" window_type = config.get_setting("window_type", "videolibrary") diff --git a/platformcode/platformtools.py b/platformcode/platformtools.py index 10e84a28..61aa1d0b 100644 --- a/platformcode/platformtools.py +++ b/platformcode/platformtools.py @@ -51,7 +51,7 @@ def dialog_yesno(heading, message, nolabel=config.get_localized_string(70170), y dialog = xbmcgui.Dialog() # customlabel only work on kodi 19 if PY3 and customlabel: - return dialog.yesno(heading, message, customlabel, nolabel=nolabel, yeslabel=yeslabel, autoclose=autoclose) + return dialog.yesnocustom(heading, message, customlabel=customlabel, nolabel=nolabel, yeslabel=yeslabel, autoclose=autoclose) else: return dialog.yesno(heading, message, nolabel=nolabel, yeslabel=yeslabel, autoclose=autoclose) @@ -1433,6 +1433,9 @@ def prevent_busy(item): if not item.autoplay and not item.window: if item.globalsearch: xbmc.Player().play(os.path.join(config.get_runtime_path(), "resources", "kod.mp4")) else: xbmcplugin.setResolvedUrl(int(sys.argv[1]), True, xbmcgui.ListItem(path=os.path.join(config.get_runtime_path(), "resources", "kod.mp4"))) - xbmc.sleep(500) + xbmc.sleep(100) xbmc.Player().stop() - xbmc.sleep(500) \ No newline at end of file + # xbmc.executebuiltin('Action(Stop)') + # xbmc.sleep(500) + # xbmc.Player().stop() + # xbmc.sleep(500) \ No newline at end of file diff --git a/platformcode/xbmc_config_menu.py b/platformcode/xbmc_config_menu.py index 973185f6..1f4eb411 100644 --- a/platformcode/xbmc_config_menu.py +++ b/platformcode/xbmc_config_menu.py @@ -402,24 +402,17 @@ class SettingsWindow(xbmcgui.WindowXMLDialog): label=c["label"], font=self.font, textColor=c["color"], focusTexture=os.path.join(self.mediapath, 'Controls', 'MenuItemFO.png'), noFocusTexture=os.path.join(self.mediapath, 'Controls', 'MenuItemNF.png')) - elif xbmcgui.__version__ in ["3.0", "3.0.0"]: - control = xbmcgui.ControlRadioButton(0, -100, self.controls_width + 20, - self.height_control, label=c["label"], font=self.font, - textColor=c["color"], - focusOnTexture=os.path.join(self.mediapath, 'Controls', 'radiobutton-focus.png'), - noFocusOnTexture=os.path.join(self.mediapath, 'Controls', 'radiobutton-focus.png'), - focusOffTexture=os.path.join(self.mediapath, 'Controls', 'radiobutton-nofocus.png'), - noFocusOffTexture=os.path.join(self.mediapath, 'Controls', 'radiobutton-nofocus.png')) else: control = xbmcgui.ControlRadioButton(0, -100, self.controls_width + 20, self.height_control, label=c["label"], font=self.font, textColor=c["color"], - focusTexture='', - noFocusTexture='', + focusTexture=os.path.join(self.mediapath, 'Controls', 'MenuItemFO.png'), + noFocusTexture=os.path.join(self.mediapath, 'Controls', 'MenuItemNF.png'), focusOnTexture=os.path.join(self.mediapath, 'Controls', 'radiobutton-focus.png'), noFocusOnTexture=os.path.join(self.mediapath, 'Controls', 'radiobutton-focus.png'), focusOffTexture=os.path.join(self.mediapath, 'Controls', 'radiobutton-nofocus.png'), noFocusOffTexture=os.path.join(self.mediapath, 'Controls', 'radiobutton-nofocus.png')) + image = xbmcgui.ControlImage(0, -100, self.controls_width + 10, self.height_control, os.path.join(self.mediapath, 'Controls', 'MenuItemFO.png')) self.addControl(image) self.addControl(control) diff --git a/resources/skins/Default/720p/ChannelSettings.xml b/resources/skins/Default/720p/ChannelSettings.xml index ebb5d276..664b284b 100644 --- a/resources/skins/Default/720p/ChannelSettings.xml +++ b/resources/skins/Default/720p/ChannelSettings.xml @@ -44,9 +44,9 @@ <!-- CLOSE BUTTON --> <control type="button" id="10003"> <right>30</right> - <top>25</top> - <width>30</width> - <height>30</height> + <top>20</top> + <width>40</width> + <height>40</height> <texturefocus colordiffuse="FFFFFFFF">close.png</texturefocus> <texturenofocus colordiffuse="55FFFFFF">close.png</texturenofocus> </control> diff --git a/servers/streamingcommunity_server.json b/servers/streamingcommunity_server.json deleted file mode 100644 index ef7afc58..00000000 --- a/servers/streamingcommunity_server.json +++ /dev/null @@ -1,41 +0,0 @@ -{ - "active": true, - "find_videos": { - "ignore_urls": [], - "patterns": [ - { - "pattern": "https://streamingcommunity.net/[^/]+/([A-Za-z0-9]+)", - "url": "https://streamingcommunity.net/watch/\\1" - } - ] - }, - "free": true, - "id":"streamingcommunity_server", - "name": "StreamingCommunity", - "settings": [ - { - "default": false, - "enabled": true, - "id": "black_list", - "label": "@70708", - "type": "bool", - "visible": true - }, - { - "default": 0, - "enabled": true, - "id": "favorites_servers_list", - "label": "@60655", - "lvalues": [ - "No", - "1", - "2", - "3", - "4", - "5" - ], - "type": "list", - "visible": false - } - ] -} diff --git a/servers/streamingcommunity_server.py b/servers/streamingcommunity_server.py deleted file mode 100644 index 4fa9acbd..00000000 --- a/servers/streamingcommunity_server.py +++ /dev/null @@ -1,39 +0,0 @@ -# -*- coding: utf-8 -*- -import requests, sys -from core import httptools, support -from platformcode import config, logger - -if sys.version_info[0] >= 3: from concurrent import futures -else: from concurrent_py2 import futures - -headers = {'User-Agent': 'Mozilla/5.0 (Windows; U; Windows NT 5.1; en-GB; rv:1.8.1.14) Gecko/20080404 Firefox/2.0.0.14', - 'content-type': 'application/json;charset=UTF-8', - 'Referer': 'https://streamingcommunity.net'} - -def test_video_exists(page_url): - global data - logger.debug('page url=', page_url) - response = httptools.downloadpage(page_url, headers=headers) - - if response.code == 404: - return False, config.get_localized_string(70449) % 'StreamingCommunity' - else: - data = response.data - return True, "" - - -def get_video_url(page_url, premium=False, user="", password="", video_password=""): - logger.debug("url=" + page_url) - video_urls = [] - url = support.match(data.replace('"','"').replace('\\',''), patron=r'video_url"\s*:\s*"([^"]+)"').match - def videourls(res): - newurl = '{}/{}'.format(url, res) - if requests.head(newurl, headers=headers).status_code == 200: - video_urls.append(["m3u8 {} [StreamingCommunity]".format(res), newurl]) - - with futures.ThreadPoolExecutor() as executor: - for res in ['480p', '720p', '1080p']: - executor.submit(videourls, res) - if not video_urls: video_urls = [["m3u8 [StreamingCommunity]", url]] - else: video_urls.sort(key=lambda url: int(support.match(url[0], patron=r'(\d+)p').match)) - return video_urls diff --git a/specials/globalsearch.py b/specials/globalsearch.py index 66ccc96f..3dad2a2b 100644 --- a/specials/globalsearch.py +++ b/specials/globalsearch.py @@ -344,7 +344,7 @@ class SearchWindow(xbmcgui.WindowXML): if item.server: color = scrapertools.find_single_match(item.alive, r'(FF[^\]]+)') it.setProperties({'channel': channeltools.get_channel_parameters(item.channel).get('title', ''), - 'thumb': "https://raw.githubusercontent.com/kodiondemand/media/master/resources/servers/%s.png" % item.server.lower(), + 'thumb': config.get_online_server_thumb(item.server), 'servername': servertools.get_server_parameters(item.server.lower()).get('name', item.server), 'color': color if color else 'FF0082C2'}) diff --git a/specials/setting.py b/specials/setting.py index d3d7eb78..2f847944 100644 --- a/specials/setting.py +++ b/specials/setting.py @@ -349,7 +349,7 @@ def cb_servers_favorites(server_names, dict_values): dict_favorites[dict_name[server_parameters['name']]] = server config.set_setting("favorites_servers_list", dict_name[server_parameters['name']], server=server) else: - config.set_setting("favorites_servers_list", 0, server=server) + config.set_setting("favorites_servers_list", 999, server=server) progreso.update(old_div((i * 100), n), config.get_localized_string(60559) % server_parameters['name']) i += 1 diff --git a/tests/test_generic.py b/tests/test_generic.py index bc39d682..078160b5 100644 --- a/tests/test_generic.py +++ b/tests/test_generic.py @@ -62,6 +62,7 @@ validUrlRegex = re.compile( r'(?:/?|[/?]\S+)$', re.IGNORECASE) chBlackList = ['url', 'mediasetplay'] +srvBalcklist = ['mega', 'hdmario', 'torrent', 'youtube'] chNumRis = { 'altadefinizione01': { 'Film': 20 @@ -141,8 +142,7 @@ chNumRis = { servers = [] channels = [] -# channel_list = channelselector.filterchannels("all") if 'KOD_TST_CH' not in os.environ else [Item(channel=os.environ['KOD_TST_CH'], action="mainlist")] -channel_list = [Item(channel='tantifilm', action="mainlist")] +channel_list = channelselector.filterchannels("all") if 'KOD_TST_CH' not in os.environ else [Item(channel=os.environ['KOD_TST_CH'], action="mainlist")] logger.info([c.channel for c in channel_list]) ret = [] @@ -198,8 +198,10 @@ for chItem in channel_list: if itPlay: tmp.append(itPlay[0]) serversFound[it.title] = tmp - servers.extend( - {'name': srv.server.lower(), 'server': srv} for srv in serversFound[it.title] if srv.server) + for srv in serversFound[it.title]: + if srv.server: + srv.foundOn = ch + ' --> ' + it.title + ' --> ' + resIt.title + servers.append({'name': srv.server.lower(), 'server': srv}) break except: import traceback @@ -304,6 +306,9 @@ class GenericServerTest(unittest.TestCase): module = __import__('servers.%s' % self.name, fromlist=["servers.%s" % self.name]) page_url = self.server.url print('testing ' + page_url) + print('Found on ' + self.server.foundOn) + print() + self.assert_(hasattr(module, 'test_video_exists'), self.name + ' has no test_video_exists') if module.test_video_exists(page_url)[0]: @@ -327,7 +332,10 @@ class GenericServerTest(unittest.TestCase): print(headers) if 'magnet:?' in directUrl: # check of magnet links not supported continue - page = downloadpage(directUrl, headers=headers, only_headers=True, use_requests=True, verify=False) + if directUrl.split('.')[-1] == 'm3u8': # m3u8 is a text file and HEAD may be forbidden + page = downloadpage(directUrl, headers=headers, use_requests=True, verify=False) + else: + page = downloadpage(directUrl, headers=headers, only_headers=True, use_requests=True, verify=False) self.assertTrue(page.success, self.name + ' scraper returned an invalid link') self.assertLess(page.code, 400, self.name + ' scraper returned a ' + str(page.code) + ' link') contentType = page.headers['Content-Type']