From 788343ed6b330e6d8d7f649255c502d3070fb1cb Mon Sep 17 00:00:00 2001 From: Alhaziel Date: Wed, 29 May 2019 16:13:52 +0200 Subject: [PATCH 01/10] Added Channel config Def --- core/support.py | 13 +++++++++++++ specials/autorenumber.py | 4 +--- 2 files changed, 14 insertions(+), 3 deletions(-) diff --git a/core/support.py b/core/support.py index 3aa022a2..cfa6f33a 100644 --- a/core/support.py +++ b/core/support.py @@ -589,3 +589,16 @@ def log(stringa1="", stringa2="", stringa3="", stringa4="", stringa5=""): filename = frame[0].f_code.co_filename filename = os.path.basename(filename) logger.info("[" + filename + "] - [" + inspect.stack()[1][3] + "] " + str(stringa1) + str(stringa2) + str(stringa3) + str(stringa4) + str(stringa5)) + + +def channel_config(item, itemlist): + from channelselector import get_thumb + itemlist.append( + Item(channel='setting', + action="channel_config", + title=typo("Configurazione Canale color kod bold"), + config=item.channel, + folder=False, + thumbnail=get_thumb('setting_0.png')) + ) + diff --git a/specials/autorenumber.py b/specials/autorenumber.py index 43ec65ef..35b00022 100644 --- a/specials/autorenumber.py +++ b/specials/autorenumber.py @@ -106,9 +106,8 @@ def write_data(channel, show, data): -def renumber(itemlist, item='', typography=''): +def renumber(itemlist, item='', typography=''): log() - if item: try: dict_series = jsontools.get_node_from_file(item.channel, TAG_TVSHOW_RENUMERATE) @@ -128,7 +127,6 @@ def renumber(itemlist, item='', typography=''): data = tvdb.otvdb_global.get_list_episodes(ID,page) if data: for episodes in data['data']: - log(episodes.infoLabels) if episodes['airedSeason'] >= S: if E == 0: epList.append([0, SP]) From 9aedaa171bdaf7ab275da16b807e5ae43dc2b363 Mon Sep 17 00:00:00 2001 From: mac12m99 Date: Wed, 29 May 2019 18:54:52 +0200 Subject: [PATCH 02/10] deltabit: common workaround kodi 18 --- servers/deltabit.py | 1 + 1 file changed, 1 insertion(+) diff --git a/servers/deltabit.py b/servers/deltabit.py index ab20f44c..9ac15b7b 100644 --- a/servers/deltabit.py +++ b/servers/deltabit.py @@ -30,6 +30,7 @@ def get_video_url(page_url, premium=False, user="", password="", video_password= sources = scrapertools.find_single_match(data, 'sources: \[([^\]]+)\]') for media_url in scrapertools.find_multiple_matches(sources, '"([^"]+)"'): + media_url = media_url.replace('https:', 'http:') ext = scrapertools.get_filename_from_url(media_url)[-4:] video_urls.append(["%s [deltabit]" % (ext), media_url]) return video_urls From 8b5236ad9c961a05103a3dc63af8856bed557ce4 Mon Sep 17 00:00:00 2001 From: mac12m99 Date: Wed, 29 May 2019 21:04:07 +0200 Subject: [PATCH 03/10] fix crash on settings server --- core/channeltools.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/core/channeltools.py b/core/channeltools.py index af001487..db25ce37 100644 --- a/core/channeltools.py +++ b/core/channeltools.py @@ -134,6 +134,8 @@ def get_channel_json(channel_name): channel_path = filetools.join(config.get_runtime_path(), "channels", channel_name + ".json") if not os.path.isfile(channel_path): channel_path = filetools.join(config.get_runtime_path(), "specials", channel_name + ".json") + if not os.path.isfile(channel_path): + channel_path = filetools.join(config.get_runtime_path(), "servers", channel_name + ".json") if filetools.isfile(channel_path): # logger.info("channel_data=" + channel_path) channel_json = jsontools.load(filetools.read(channel_path)) From a897428753e8ccc71e896ff2d52726602460586f Mon Sep 17 00:00:00 2001 From: mac12m99 Date: Wed, 29 May 2019 21:08:54 +0200 Subject: [PATCH 04/10] little fix on side_menu --- specials/side_menu.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/specials/side_menu.py b/specials/side_menu.py index 1de8ef50..a8c27aa8 100644 --- a/specials/side_menu.py +++ b/specials/side_menu.py @@ -85,7 +85,7 @@ def get_start_page(): config.get_localized_string(59976): 'latino', config.get_localized_string(70171): 'torrent', } - category = dictCategory[config.get_setting("category")] + category = dictCategory[config.get_localized_string(config.get_setting("category"))] custom_start= config.get_setting("custom_start") #if category != 'definido': From 74528bb0d7ad3ce643bf8eaeffeeeacb037cddda Mon Sep 17 00:00:00 2001 From: Alhaziel Date: Wed, 29 May 2019 21:13:50 +0200 Subject: [PATCH 05/10] Code Cleanup --- channels/animeworld.py | 245 ++++++++--------------------------------- core/support.py | 2 +- 2 files changed, 45 insertions(+), 202 deletions(-) diff --git a/channels/animeworld.py b/channels/animeworld.py index ee8d71cf..f025fc56 100644 --- a/channels/animeworld.py +++ b/channels/animeworld.py @@ -5,18 +5,15 @@ import re import time import urllib - import urlparse -import channelselector -from channelselector import thumb from core import httptools, scrapertoolsV2, servertools, tmdb, support, jsontools +from core.support import log from core.item import Item from platformcode import logger, config from specials import autoplay, autorenumber -__channel__ = 'animeworld' -host = config.get_setting("channel_host", __channel__) +host = config.get_setting("channel_host", 'animeworld') headers = [['Referer', host]] IDIOMAS = {'Italiano': 'Italiano'} @@ -29,7 +26,7 @@ checklinks_number = config.get_setting('checklinks_number', 'animeworld') def mainlist(item): - logger.info(__channel__+" mainlist") + log() itemlist =[] @@ -42,26 +39,14 @@ def mainlist(item): support.menu(itemlist, 'Ultimi Aggiunti bold', 'video', host+'/newest', args=["anime"]) support.menu(itemlist, 'Ultimi Episodi bold', 'video', host+'/updated', args=["novita'"]) support.menu(itemlist, 'Cerca...', 'search') - - - autoplay.init(item.channel, list_servers, list_quality) - autoplay.show_option(item.channel, itemlist) - - itemlist.append( - Item(channel='setting', - action="channel_config", - title=support.typo("Configurazione Canale color lime"), - config=item.channel, - folder=False, - thumbnail=channelselector.get_thumb('setting_0.png')) - ) - + support.aplay(item, itemlist, list_servers, list_quality) + support.channel_config(item, itemlist) return itemlist # Crea menu dei generi ================================================= def generi(item): - support.log(item.channel+" generi") + log() itemlist = [] patron_block = r'\sGeneri\s*
    (.*?)
' patron = r'' @@ -80,64 +65,29 @@ def generi(item): # Crea Menu Filtro ====================================================== def build_menu(item): + log() itemlist = [] - itemlist.append(Item( - channel=item.channel, - action="video", - title="[B]Tutti[/B]", - url=item.url)) - - data = httptools.downloadpage(item.url).data - data = re.sub(r'\n|\t','',data) - data = re.sub(r'>\s*<','><',data) - - block = scrapertoolsV2.find_single_match(data, r'
(.*?) (.*?)<\/ul>', re.DOTALL).findall(block) - - for title, html in matches: - itemlist.append( - Item(channel=item.channel, - action='build_sub_menu', - contentType="tvshow", - title='[B] > ' + title + '[/B]', - fulltitle=title, - show=title, - url=item.url, - html=html, - thumbnail=item.thumbnail, - fanart=item.fanart)) - - # Elimina FLingua dal Menu - itemlist.pop(6) - itemlist.pop(6) - - itemlist = thumb(itemlist) - + support.menu(itemlist, 'Tutti bold submenu', 'video', item.url) + matches = support.match(item,r'