diff --git a/channels/altadefinizione01.py b/channels/altadefinizione01.py index f117eae5..962297e1 100644 --- a/channels/altadefinizione01.py +++ b/channels/altadefinizione01.py @@ -5,8 +5,8 @@ import re import urlparse -from channels import filtertools, autoplay, support -from core import servertools, httptools, tmdb, scrapertoolsV2 +from specials import filtertools, autoplay +from core import servertools, httptools, tmdb, scrapertoolsV2, support from core.item import Item from platformcode import logger, config diff --git a/channels/altadefinizione01_club.json b/channels/altadefinizione01_club.json index 62672c18..19890b5b 100644 --- a/channels/altadefinizione01_club.json +++ b/channels/altadefinizione01_club.json @@ -14,7 +14,7 @@ { "id": "modo_grafico", "type": "bool", - "label": "Buscar información extra", + "label": "Cerca informazioni extra", "default": true, "enabled": true, "visible": true diff --git a/channels/altadefinizione01_club.py b/channels/altadefinizione01_club.py index 8ab09f31..e54d3179 100644 --- a/channels/altadefinizione01_club.py +++ b/channels/altadefinizione01_club.py @@ -5,13 +5,9 @@ # -*- last change: 04/05/2019 -from channels import autoplay, support, filtertools +from specials import autoplay, filtertools from channelselector import get_thumb -from core import httptools -from core import channeltools -from core import scrapertools -from core import servertools -from core import tmdb +from core import httptools, channeltools, scrapertools, servertools, tmdb, support from core.item import Item from platformcode import config, logger diff --git a/channels/altadefinizione01_link.json b/channels/altadefinizione01_link.json index c43a2939..e56d2b1a 100644 --- a/channels/altadefinizione01_link.json +++ b/channels/altadefinizione01_link.json @@ -16,7 +16,7 @@ { "id": "modo_grafico", "type": "bool", - "label": "Buscar información extra", + "label": "Cerca informazioni extra", "default": true, "enabled": true, "visible": true diff --git a/channels/altadefinizione01_link.py b/channels/altadefinizione01_link.py index 7b26cf89..3626719b 100644 --- a/channels/altadefinizione01_link.py +++ b/channels/altadefinizione01_link.py @@ -6,13 +6,9 @@ # -*- last change: 04/05/2019 -from channels import autoplay, support, filtertools +from specials import autoplay, filtertools from channelselector import get_thumb -from core import httptools -from core import channeltools -from core import scrapertools -from core import servertools -from core import tmdb +from core import httptools, channeltools, scrapertools, servertools, tmdb, support from core.item import Item from platformcode import config, logger diff --git a/channels/altadefinizioneclick.py b/channels/altadefinizioneclick.py index d6b570a6..8cdeaa69 100644 --- a/channels/altadefinizioneclick.py +++ b/channels/altadefinizioneclick.py @@ -5,8 +5,8 @@ import re -from channels import autoplay, filtertools, support -from core import servertools +from specials import autoplay, filtertools +from core import servertools, support from core.item import Item from platformcode import logger, config diff --git a/channels/altadefinizionehd.py b/channels/altadefinizionehd.py index 1d56c404..2187c1a4 100644 --- a/channels/altadefinizionehd.py +++ b/channels/altadefinizionehd.py @@ -7,7 +7,7 @@ import re from core import httptools, scrapertools, servertools, tmdb from platformcode import logger, config from core.item import Item -from channels import autoplay +from specials import autoplay from channelselector import thumb diff --git a/channels/animeleggendari.py b/channels/animeleggendari.py index 0cd8d2ff..853aadf7 100644 --- a/channels/animeleggendari.py +++ b/channels/animeleggendari.py @@ -5,9 +5,9 @@ import re -from channels import filtertools, autoplay, support, autorenumber -from channels.support import log, menu -from core import servertools, httptools, scrapertoolsV2, scrapertools, tmdb +from specials import filtertools, autoplay, autorenumber +from core.support import log, menu +from core import servertools, httptools, scrapertoolsV2, scrapertools, tmdb, support from platformcode import logger, config from core.item import Item from lib.js2py.host import jsfunctions diff --git a/channels/animesaturn.py b/channels/animesaturn.py index c0a3d675..7d164821 100644 --- a/channels/animesaturn.py +++ b/channels/animesaturn.py @@ -8,9 +8,9 @@ import re import time import urlparse -import channelselector -from channels import autoplay, support, filtertools -from core import httptools, tmdb, scrapertools, servertools +import channelselector, filtertools +from core import httptools, tmdb, scrapertools, servertools, support +from specials import autoplay from core.item import Item from platformcode import logger, config __channel__ = "animesaturn" diff --git a/channels/animespace.py b/channels/animespace.py index a77405b7..e19fdfac 100644 --- a/channels/animespace.py +++ b/channels/animespace.py @@ -13,9 +13,9 @@ from channelselector import get_thumb from core import tmdb from core.item import Item from platformcode import logger, config -from channels import autoplay -from channels import filtertools -from channels import renumbertools +from specials import autoplay +from specials import filtertools +from specials import renumbertools host = "https://animespace.tv/" diff --git a/channels/animesubita.py b/channels/animesubita.py index 167e7084..cb77da59 100644 --- a/channels/animesubita.py +++ b/channels/animesubita.py @@ -7,10 +7,9 @@ import re, urllib, urlparse -from core import servertools, httptools, scrapertools, tmdb +from core import servertools, httptools, scrapertools, tmdb, support from platformcode import logger, config from core.item import Item -from channels import support diff --git a/channels/animeworld.py b/channels/animeworld.py index f79980a1..7ee895d2 100644 --- a/channels/animeworld.py +++ b/channels/animeworld.py @@ -4,10 +4,10 @@ # ---------------------------------------------------------- import re, urlparse -from core import httptools, scrapertoolsV2, servertools, tmdb, tvdb +from core import httptools, scrapertoolsV2, servertools, tmdb, tvdb, support from core.item import Item from platformcode import logger, config -from channels import autoplay, filtertools, support, autorenumber +from specials import autoplay, filtertools, autorenumber from channelselector import thumb diff --git a/channels/casacinema.py b/channels/casacinema.py index 46b06a34..fa0c794a 100644 --- a/channels/casacinema.py +++ b/channels/casacinema.py @@ -5,8 +5,8 @@ # ------------------------------------------------------------ import re, urlparse -from core import scrapertools, scrapertoolsV2, httptools, servertools, tmdb -from channels import autoplay, filtertools, support +from core import scrapertools, scrapertoolsV2, httptools, servertools, tmdb, support +from specials import autoplay, filtertools from core.item import Item from platformcode import logger, config from channelselector import thumb, get_thumb diff --git a/channels/casacinemaInfo.py b/channels/casacinemaInfo.py index 1c198b7d..38fa29d3 100644 --- a/channels/casacinemaInfo.py +++ b/channels/casacinemaInfo.py @@ -4,8 +4,8 @@ # ------------------------------------------------------------ import re, urlparse, base64 -from core import scrapertoolsV2, httptools, servertools, tmdb -from channels import autoplay, support +from core import scrapertoolsV2, httptools, servertools, tmdb, support +from specials import autoplay from core.item import Item from platformcode import logger, config diff --git a/channels/cineblog01.py b/channels/cineblog01.py index ba16123f..3ded6e1f 100644 --- a/channels/cineblog01.py +++ b/channels/cineblog01.py @@ -6,8 +6,8 @@ import re import urlparse -from channels import autoplay, filtertools, support -from core import scrapertoolsV2, httptools, servertools, tmdb +from specials import autoplay, filtertools +from core import scrapertoolsV2, httptools, servertools, tmdb, support from core.item import Item from lib import unshortenit from platformcode import logger, config diff --git a/channels/cinemalibero.py b/channels/cinemalibero.py index 8b18fd60..c00f9709 100644 --- a/channels/cinemalibero.py +++ b/channels/cinemalibero.py @@ -6,9 +6,8 @@ import base64 import re import urlparse -from channels import autoplay, support -from channels import filtertools -from core import scrapertools, servertools, httptools +from specials import autoplay, filtertools +from core import scrapertools, servertools, httptools, support from platformcode import logger, config from core.item import Item from lib import unshortenit diff --git a/channels/cinemastreaming.py b/channels/cinemastreaming.py index ce7834c4..0120d3e6 100644 --- a/channels/cinemastreaming.py +++ b/channels/cinemastreaming.py @@ -4,8 +4,8 @@ # ------------------------------------------------------------ import re -from channels import filtertools, support, autoplay -from core import scrapertools, servertools, httptools, scrapertoolsV2 +from specials import filtertools, autoplay +from core import scrapertools, servertools, httptools, scrapertoolsV2, support from core.item import Item host = 'https://cinemastreaming.icu' diff --git a/channels/community.py b/channels/community.py index 53123d10..5ab15928 100644 --- a/channels/community.py +++ b/channels/community.py @@ -15,8 +15,8 @@ from channelselector import get_thumb from core import tmdb from core.item import Item from platformcode import logger, config, platformtools -from channels import autoplay -from channels import filtertools +from specials import autoplay +from specials import filtertools list_data = {} diff --git a/channels/eurostreaming.json b/channels/eurostreaming.json index d63dde60..e4641e02 100644 --- a/channels/eurostreaming.json +++ b/channels/eurostreaming.json @@ -19,7 +19,7 @@ { "id": "modo_grafico", "type": "bool", - "label": "Buscar información extra", + "label": "Cerca informazioni extra", "default": true, "enabled": true, "visible": true diff --git a/channels/eurostreaming.py b/channels/eurostreaming.py index 841f9c21..70ebc4ee 100644 --- a/channels/eurostreaming.py +++ b/channels/eurostreaming.py @@ -17,8 +17,8 @@ import re -from channels import autoplay, filtertools, support -from core import scrapertoolsV2, httptools, servertools, tmdb +from specials import autoplay, filtertools +from core import scrapertoolsV2, httptools, servertools, tmdb, support from core.item import Item from platformcode import logger, config diff --git a/channels/fastsubita.py b/channels/fastsubita.py index b3d10bef..194cefc4 100644 --- a/channels/fastsubita.py +++ b/channels/fastsubita.py @@ -6,7 +6,7 @@ import re, urlparse -from channels import autoplay, filtertools +from specials import autoplay, filtertools from core import scrapertools, servertools, httptools, tmdb from core.item import Item from platformcode import config, logger diff --git a/channels/filmigratis.py b/channels/filmigratis.py index 9252686f..82e9bca8 100644 --- a/channels/filmigratis.py +++ b/channels/filmigratis.py @@ -7,8 +7,8 @@ import re import urlparse from channelselector import get_thumb -from channels import filtertools, support, autoplay -from core import scrapertools, servertools, httptools, tmdb +from specials import filtertools, autoplay +from core import scrapertools, servertools, httptools, tmdb, support from platformcode import logger, config from core.item import Item diff --git a/channels/filmpertutti.py b/channels/filmpertutti.py index 646fce27..bca50d7e 100644 --- a/channels/filmpertutti.py +++ b/channels/filmpertutti.py @@ -5,8 +5,8 @@ import re import urlparse -from channels import autoplay, support -from core import scrapertoolsV2, servertools, httptools, tmdb +from specials import autoplay +from core import scrapertoolsV2, servertools, httptools, tmdb, support from core.item import Item from lib import unshortenit from platformcode import config, logger diff --git a/channels/filmsenzalimiti.py b/channels/filmsenzalimiti.py index 6b51f642..a0103af7 100644 --- a/channels/filmsenzalimiti.py +++ b/channels/filmsenzalimiti.py @@ -7,9 +7,8 @@ import re import urlparse from channelselector import get_thumb -from channels import autoplay -from channels import filtertools, support -from core import scrapertools, servertools, httptools +from specials import filtertools, autoplay +from core import scrapertools, servertools, httptools, support from platformcode import logger, config from core.item import Item from platformcode import config diff --git a/channels/filmsenzalimiticc.py b/channels/filmsenzalimiticc.py index 0fd0b10f..d54afbdd 100644 --- a/channels/filmsenzalimiticc.py +++ b/channels/filmsenzalimiticc.py @@ -6,8 +6,8 @@ import base64 import re import urlparse -from channels import autoplay -from channels import filtertools +from specials import autoplay +from specials import filtertools from core import scrapertools, servertools, httptools from platformcode import logger, config from core.item import Item diff --git a/channels/guardaserieclick.py b/channels/guardaserieclick.py index b013f92e..71915f5d 100644 --- a/channels/guardaserieclick.py +++ b/channels/guardaserieclick.py @@ -6,11 +6,10 @@ import re -from core import httptools, scrapertools, servertools +from core import httptools, scrapertools, servertools, support from core.item import Item from core import tmdb from platformcode import logger, config -from channels import support host = "http://www.guardaserie.watch" diff --git a/channels/ilgeniodellostreaming.py b/channels/ilgeniodellostreaming.py index 3a24cc2e..77bcc496 100644 --- a/channels/ilgeniodellostreaming.py +++ b/channels/ilgeniodellostreaming.py @@ -8,8 +8,8 @@ import re, urlparse from platformcode import config, logger from core import scrapertools, servertools, httptools from core.item import Item -from channels import autoplay -from channels import filtertools +from specials import autoplay +from specials import filtertools from core import tmdb __channel__ = "ilgeniodellostreaming" diff --git a/channels/italiafilmhd.py b/channels/italiafilmhd.py index fd15b1c3..ba41d390 100644 --- a/channels/italiafilmhd.py +++ b/channels/italiafilmhd.py @@ -7,11 +7,10 @@ import base64 import re import urlparse -from channels import autoplay -from channels import filtertools, support -from core import scrapertools, servertools, httptools +from specials import autoplay +from specials import filtertools +from core import scrapertools, servertools, httptools, tmdb, support from core.item import Item -from core import tmdb from platformcode import logger, config IDIOMAS = {'Italiano': 'IT'} diff --git a/channels/itastreaming.py b/channels/itastreaming.py index bf40844f..79a5318c 100644 --- a/channels/itastreaming.py +++ b/channels/itastreaming.py @@ -7,12 +7,9 @@ import base64 import re import urlparse -from core import scrapertools, httptools -from core import servertools +from core import scrapertools, httptools, servertools, tmdb, support from core.item import Item -from core import tmdb from platformcode import logger, config -from channels import support diff --git a/channels/mondoserietv.py b/channels/mondoserietv.py index 272e25ac..a7649b10 100644 --- a/channels/mondoserietv.py +++ b/channels/mondoserietv.py @@ -7,8 +7,8 @@ import re import urllib -from channels import autoplay -from channels import filtertools +from specials import autoplay +from specials import filtertools from core import scrapertools, servertools, httptools, scrapertoolsV2 from core.item import Item from core import tmdb diff --git a/channels/piratestreaming.py b/channels/piratestreaming.py index 0c80d520..d7b3c11f 100644 --- a/channels/piratestreaming.py +++ b/channels/piratestreaming.py @@ -6,8 +6,8 @@ import re import urlparse -from channels import autoplay -from channels import filtertools +from specials import autoplay +from specials import filtertools from core import httptools, scrapertools, servertools from core.item import Item from core import tmdb diff --git a/channels/seriehd.py b/channels/seriehd.py index e98887a5..2f167ac6 100644 --- a/channels/seriehd.py +++ b/channels/seriehd.py @@ -4,9 +4,9 @@ # ------------------------------------------------------------ import urlparse -from channels import autoplay, filtertools, support -from channels.support import menu, log -from core import scrapertoolsV2, servertools, httptools, tmdb +from specials import autoplay, filtertools +from core.support import menu, log +from core import scrapertoolsV2, servertools, httptools, tmdb, support from core.item import Item from platformcode import logger, config from channelselector import thumb diff --git a/channels/serietvonline.py b/channels/serietvonline.py index 40360979..adc05134 100644 --- a/channels/serietvonline.py +++ b/channels/serietvonline.py @@ -4,11 +4,11 @@ # ---------------------------------------------------------- import re -from core import httptools, scrapertoolsV2, servertools, tmdb +from core import httptools, scrapertoolsV2, servertools, tmdb, support from core.item import Item from lib import unshortenit from platformcode import logger, config -from channels import autoplay, support +from specials import autoplay from channelselector import thumb host = "https://serietvonline.live" diff --git a/channels/serietvsubita.py b/channels/serietvsubita.py index 4cb682d0..b8515ef6 100644 --- a/channels/serietvsubita.py +++ b/channels/serietvsubita.py @@ -8,8 +8,8 @@ import re import time import channelselector -from channels import autoplay, support, filtertools -from core import httptools, tmdb, scrapertools, servertools +from specials import autoplay, filtertools +from core import httptools, tmdb, scrapertools, servertools, support from core.item import Item from platformcode import logger, config __channel__ = "serietvsubita" diff --git a/channels/serietvu.py b/channels/serietvu.py index fa0a7091..c4dedb4f 100644 --- a/channels/serietvu.py +++ b/channels/serietvu.py @@ -6,8 +6,8 @@ import re import channelselector -from channels import autoplay, support, filtertools -from core import httptools, tmdb, scrapertools, servertools +from specials import autoplay, filtertools +from core import httptools, tmdb, scrapertools, servertools, support from core.item import Item from platformcode import logger, config __channel__ = 'serietvu' diff --git a/channels/streamingaltadefinizione.py b/channels/streamingaltadefinizione.py index 748c225d..5e190e68 100644 --- a/channels/streamingaltadefinizione.py +++ b/channels/streamingaltadefinizione.py @@ -1,7 +1,13 @@ -from channels import support, autoplay +# -*- coding: utf-8 -*- +# ------------------------------------------------------------ +# Canale per Streaming Altadefinizione +# ------------------------------------------------------------ + +from core import support +from specials import autoplay from core.item import Item -host = 'https://www.streamingaltadefinizione.world/' +host = 'https://www.streamingaltadefinizione.space' list_servers = ['verystream', 'openload', 'wstream'] list_quality = ['1080p', 'HD', 'DVDRIP', 'SD', 'CAM'] diff --git a/channels/support.py b/channels/support.py index a6cbc968..4a00dee6 100644 --- a/channels/support.py +++ b/channels/support.py @@ -7,7 +7,7 @@ import urllib from lib import unshortenit from platformcode import logger, config from channelselector import thumb -from channels import autoplay +from specials import autoplay def hdpass_get_servers(item): diff --git a/channels/tantifilm.py b/channels/tantifilm.py index d706f154..c82d92e5 100644 --- a/channels/tantifilm.py +++ b/channels/tantifilm.py @@ -6,9 +6,9 @@ import re import urlparse -from channels import support, autorenumber -from channels.support import menu, log, aplay -from core import scrapertoolsV2, httptools, tmdb +from specials import autorenumber +from core.support import menu, log, aplay +from core import scrapertoolsV2, httptools, tmdb, support from core.item import Item from platformcode import config, logger diff --git a/channels/thumbzilla.json b/channels/thumbzilla.json index fcce22f8..bf9e0378 100644 --- a/channels/thumbzilla.json +++ b/channels/thumbzilla.json @@ -14,7 +14,7 @@ { "id": "modo_grafico", "type": "bool", - "label": "Buscar información extra", + "label": "Cerca informazioni extra", "default": true, "enabled": true, "visible": true diff --git a/channels/toonitalia.py b/channels/toonitalia.py index 7af084db..6b881f03 100644 --- a/channels/toonitalia.py +++ b/channels/toonitalia.py @@ -7,8 +7,8 @@ import re import urlparse -from channels import autoplay, filtertools, support -from core import scrapertools, scrapertoolsV2, httptools, tmdb, servertools +from specials import autoplay, filtertool +from core import scrapertools, scrapertoolsV2, httptools, tmdb, servertoolss, support from core.item import Item from platformcode import logger, config diff --git a/channels/vedohd.py b/channels/vedohd.py index c42dd0db..2e21ae8e 100644 --- a/channels/vedohd.py +++ b/channels/vedohd.py @@ -6,8 +6,8 @@ import re import urlparse -from channels import autoplay, support -from core import scrapertoolsV2, httptools, servertools +from specials import autoplay +from core import scrapertoolsV2, httptools, servertools, support from core.item import Item from platformcode import logger from channelselector import thumb diff --git a/channels/xms.json b/channels/xms.json index 64e505cd..4c3088f3 100644 --- a/channels/xms.json +++ b/channels/xms.json @@ -14,7 +14,7 @@ { "id": "modo_grafico", "type": "bool", - "label": "Buscar información extra", + "label": "Cerca informazioni extra", "default": true, "enabled": true, "visible": true diff --git a/channelselector.py b/channelselector.py index 87323a90..66c09c56 100644 --- a/channelselector.py +++ b/channelselector.py @@ -27,11 +27,11 @@ def getmainlist(view="thumb_"): thumbnail=get_thumb("channels.png", view), view=view, category=config.get_localized_string(30119), viewmode="thumbnails")) - itemlist.append(Item(title=config.get_localized_string(70527), channel="alfavorites", action="mainlist", + itemlist.append(Item(title=config.get_localized_string(70527), channel="kodfavorites", action="mainlist", thumbnail=get_thumb("mylink.png", view), view=view, category=config.get_localized_string(70527), viewmode="thumbnails")) - itemlist.append(Item(title=config.get_localized_string(30103), channel="search", action="mainlist", + itemlist.append(Item(title=config.get_localized_string(30103), channel="search", path='special', action="mainlist", thumbnail=get_thumb("search.png", view), category=config.get_localized_string(30119), viewmode="list", context=[{"title": config.get_localized_string(70286), "channel": "search", "action": "opciones", diff --git a/core/channeltools.py b/core/channeltools.py index 5595ddaa..39d6b60b 100644 --- a/core/channeltools.py +++ b/core/channeltools.py @@ -133,6 +133,8 @@ def get_channel_json(channel_name): channel_json = None try: 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 filetools.isfile(channel_path): # logger.info("channel_data=" + channel_path) channel_json = jsontools.load(filetools.read(channel_path)) @@ -149,7 +151,7 @@ def get_channel_json(channel_name): def get_channel_controls_settings(channel_name): # logger.info("channel_name=" + channel_name) dict_settings = {} - + # import web_pdb; web_pdb.set_trace() list_controls = get_channel_json(channel_name).get('settings', list()) for c in list_controls: diff --git a/core/support.py b/core/support.py new file mode 100644 index 00000000..bff31475 --- /dev/null +++ b/core/support.py @@ -0,0 +1,534 @@ +# support functions that are needed by many channels, to no repeat the same code +import base64, urlparse, re, os, inspect +from core import httptools, scrapertoolsV2, servertools, tmdb +from core.item import Item +import urllib + +from lib import unshortenit +from platformcode import logger, config +from channelselector import thumb +from specials import autoplay + + +def hdpass_get_servers(item): + # Carica la pagina + data = httptools.downloadpage(item.url).data.replace('\n', '') + patron = r']+><\/iframe>' + url = scrapertoolsV2.find_single_match(data, patron).replace("?alta", "") + url = url.replace("&download=1", "") + if 'https' not in url: + url = 'https:' + url + + if 'hdpass' or 'hdplayer' in url: + data = httptools.downloadpage(url).data + + start = data.find('
') + end = data.find('
', start) + data = data[start:end] + + patron_res = '
(.*?)
' + patron_mir = '
(.*?)
' + patron_media = r'' + + res = scrapertoolsV2.find_single_match(data, patron_res) + + itemlist = [] + + for res_url, res_video in scrapertoolsV2.find_multiple_matches(res, '([^<]+?)'): + + data = httptools.downloadpage(urlparse.urljoin(url, res_url)).data.replace('\n', '') + + mir = scrapertoolsV2.find_single_match(data, patron_mir) + + for mir_url, server in scrapertoolsV2.find_multiple_matches(mir, '([^<]+?)'): + + data = httptools.downloadpage(urlparse.urljoin(url, mir_url)).data.replace('\n', '') + for media_label, media_url in scrapertoolsV2.find_multiple_matches(data, patron_media): + itemlist.append(Item(channel=item.channel, + action="play", + title=item.title+" ["+color(server, 'orange')+"]"+" - "+color(res_video, 'limegreen'), + fulltitle=item.fulltitle, + quality=res_video, + show=item.show, + thumbnail=item.thumbnail, + contentType=item.contentType, + server=server, + url=url_decode(media_url))) + log("video -> ", res_video) + + return itemlist + + +def url_decode(url_enc): + lenght = len(url_enc) + if lenght % 2 == 0: + len2 = lenght / 2 + first = url_enc[0:len2] + last = url_enc[len2:lenght] + url_enc = last + first + reverse = url_enc[::-1] + return base64.b64decode(reverse) + + last_car = url_enc[lenght - 1] + url_enc[lenght - 1] = ' ' + url_enc = url_enc.strip() + len1 = len(url_enc) + len2 = len1 / 2 + first = url_enc[0:len2] + last = url_enc[len2:len1] + url_enc = last + first + reverse = url_enc[::-1] + reverse = reverse + last_car + return base64.b64decode(reverse) + + +def color(text, color): + return "[COLOR " + color + "]" + text + "[/COLOR]" + + +def scrape(item, patron = '', listGroups = [], headers="", blacklist="", data="", patron_block="", + patronNext="", action="findvideos", addVideolibrary = True): + # patron: the patron to use for scraping page, all capturing group must match with listGroups + # listGroups: a list containing the scraping info obtained by your patron, in order + # accepted values are: url, title, thumb, quality, year, plot, duration, genre, rating + + # header: values to pass to request header + # blacklist: titles that you want to exclude(service articles for example) + # data: if you want to pass data manually, maybe because you need some custom replacement + # patron_block: patron to get parts of the page (to scrape with patron attribute), + # if you need a "block inside another block" you can create a list, please note that all matches + # will be packed as string + # patronNext: patron for scraping next page link + # action: if you want results perform an action different from "findvideos", useful when scraping film by genres + # url_host: string to prepend to scrapedurl, useful when url don't contain host + # example usage: + # import support + # itemlist = [] + # patron = 'blablabla' + # headers = [['Referer', host]] + # blacklist = 'Request a TV serie!' + # return support.scrape(item, itemlist, patron, ['thumb', 'quality', 'url', 'title', 'year', 'plot'], + # headers=headers, blacklist=blacklist) + + itemlist = [] + + if not data: + data = httptools.downloadpage(item.url, headers=headers).data.replace("'", '"') + data = re.sub('\n|\t', ' ', data) + # replace all ' with " and eliminate newline, so we don't need to worry about + log('DATA =', data) + + block = data + + if patron_block: + if type(patron_block) == str: + patron_block = [patron_block] + + for n, regex in enumerate(patron_block): + blocks = scrapertoolsV2.find_multiple_matches(block, regex) + block = "" + for b in blocks: + block += "\n" + b + log('BLOCK ', n, '=', block) + else: + block = data + if patron and listGroups: + matches = scrapertoolsV2.find_multiple_matches(block, patron) + log('MATCHES =', matches) + + known_keys = ['url', 'title', 'episode', 'thumb', 'quality', 'year', 'plot', 'duration', 'genere', 'rating'] #by greko aggiunto episode + for match in matches: + if len(listGroups) > len(match): # to fix a bug + match = list(match) + match.extend([''] * (len(listGroups) - len(match))) + + scraped = {} + for kk in known_keys: + val = match[listGroups.index(kk)] if kk in listGroups else '' + if val and (kk == "url" or kk == 'thumb') and 'http' not in val: + val = scrapertoolsV2.find_single_match(item.url, 'https?://[a-z0-9.-]+') + val + scraped[kk] = val + + title = scrapertoolsV2.decodeHtmlentities(scraped["title"]).strip() + plot = scrapertoolsV2.htmlclean(scrapertoolsV2.decodeHtmlentities(scraped["plot"])) + + if scraped["quality"] and scraped["episode"]: # by greko aggiunto episode + longtitle = '[B]' + title + '[/B] - [B]' + scraped["episode"] + '[/B][COLOR blue][' + scraped["quality"] + '][/COLOR]' # by greko aggiunto episode + elif scraped["episode"]: # by greko aggiunto episode + longtitle = '[B]' + title + '[/B] - [B]' + scraped["episode"] + '[/B]' # by greko aggiunto episode + else: + longtitle = '[B]' + title + '[/B]' + + if item.infoLabels["title"] or item.fulltitle: # if title is set, probably this is a list of episodes or video sources + infolabels = item.infoLabels + else: + infolabels = {} + if scraped["year"]: + infolabels['year'] = scraped["year"] + if scraped["plot"]: + infolabels['plot'] = plot + if scraped["duration"]: + matches = scrapertoolsV2.find_multiple_matches(scraped["duration"],r'([0-9])\s*?(?:[hH]|:|\.|,|\\|\/|\||\s)\s*?([0-9]+)') + for h, m in matches: + scraped["duration"] = int(h) * 60 + int(m) + if not matches: + scraped["duration"] = scrapertoolsV2.find_single_match(scraped["duration"], r'(\d+)') + infolabels['duration'] = int(scraped["duration"]) * 60 + if scraped["genere"]: + genres = scrapertoolsV2.find_multiple_matches(scraped["genere"], '[A-Za-z]+') + infolabels['genere'] = ", ".join(genres) + if scraped["rating"]: + infolabels['rating'] = scrapertoolsV2.decodeHtmlentities(scraped["rating"]) + + if scraped["title"] not in blacklist: + it = Item( + channel=item.channel, + action=action, + contentType=item.contentType, + title=longtitle, + fulltitle=title, + show=title, + quality=scraped["quality"], + url=scraped["url"], + infoLabels=infolabels, + thumbnail=scraped["thumb"], + args=item.args + ) + + for lg in list(set(listGroups).difference(known_keys)): + it.__setattr__(lg, match[listGroups.index(lg)]) + + itemlist.append(it) + + if (item.contentType == "episode" and (action != "findvideos" and action != "play")) \ + or (item.contentType == "movie" and action != "play"): + tmdb.set_infoLabels_itemlist(itemlist, seekTmdb=True) + else: + for it in itemlist: + it.infoLabels = item.infoLabels + + if patronNext: + nextPage(itemlist, item, data, patronNext, 2) + + if addVideolibrary and (item.infoLabels["title"] or item.fulltitle): + item.fulltitle = item.infoLabels["title"] + videolibrary(itemlist, item) + + return itemlist + + +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 + + data = httptools.downloadpage(item.url).data.replace("'", '"') + patron = r'
  • ([^<>]+)(?:([^<>]+))?' + matches = scrapertoolsV2.find_multiple_matches(data, patron) + + ret = [] + + for type, post, nume, title, server in matches: + postData = urllib.urlencode({ + "action": "doo_player_ajax", + "post": post, + "nume": nume, + "type": type + }) + dataAdmin = httptools.downloadpage(host + 'wp-admin/admin-ajax.php', post=postData,headers={'Referer': item.url}).data + link = scrapertoolsV2.find_single_match(dataAdmin, "([^<>]+).*?([^<>]+).*?([0-9]{4}).*?

    ([^<>]+)' + patronNext = '') if not match else match + + if not match: + from lib import jsunpack + + try: + data = scrapertoolsV2.find_single_match(data.replace('\n', ''), r"(eval\s?\(function\(p,a,c,k,e,d.*?)") + data = jsunpack.unpack(data) + + logger.debug("##### play /link/ unpack ##\n%s\n##" % data) + except: + logger.debug("##### The content is yet unpacked ##\n%s\n##" % data) + + data = scrapertoolsV2.find_single_match(data, r'var link(?:\s)?=(?:\s)?"([^"]+)";') + data, c = unshortenit.unwrap_30x_only(data) + else: + data = match + if data.startswith('/'): + data = urlparse.urljoin("http://swzz.xyz", data) + if not "vcrypt" in data: + data = httptools.downloadpage(data).data + logger.debug("##### play /link/ data ##\n%s\n##" % data) + else: + data = item.url + + return data + + +def menu(itemlist, title='', action='', url='', contentType='movie', args=[]): + # Function to simplify menu creation + + frame = inspect.stack()[1] + filename = frame[0].f_code.co_filename + filename = os.path.basename(filename).replace('.py','') + + # Call typo function + title = typo(title) + + if contentType == 'movie': extra = 'movie' + else: extra = 'tvshow' + + itemlist.append(Item( + channel = filename, + title = title, + action = action, + url = url, + extra = extra, + args = args, + contentType = contentType + )) + + # Apply auto Thumbnails at the menus + from channelselector import thumb + thumb(itemlist) + + return itemlist + + +def typo(string, typography=''): + + kod_color = '0xFF65B3DA' #'0xFF0081C2' + + + # Check if the typographic attributes are in the string or outside + if typography: + string = string + ' ' + typography + if config.get_localized_string(30992) in string: + string = string + ' >' + + # If there are no attributes, it applies the default ones + attribute = ['[]','()','{}','submenu','color','bold','italic','_','--','[B]','[I]','[COLOR]'] + + movie_word_list = ['film', 'serie', 'tv', 'anime', 'cinema', 'sala'] + search_word_list = ['cerca'] + categories_word_list = ['genere', 'categoria', 'categorie', 'ordine', 'lettera', 'anno', 'alfabetico', 'a-z', 'menu'] + + if not any(word in string for word in attribute): + if any(word in string.lower() for word in search_word_list): + string = '[COLOR '+ kod_color +']' + string + '[/COLOR]' + elif any(word in string.lower() for word in categories_word_list): + string = ' > ' + string + elif any(word in string.lower() for word in movie_word_list): + string = '[B]' + string + '[/B]' + + # Otherwise it uses the typographical attributes of the string + else: + if '[]' in string: + string = '[' + re.sub(r'\s\[\]','',string) + ']' + if '()' in string: + string = '(' + re.sub(r'\s\(\)','',string) + ')' + if '{}' in string: + string = '{' + re.sub(r'\s\{\}','',string) + '}' + if 'submenu' in string: + string = ' > ' + re.sub(r'\ssubmenu','',string) + if 'color' in string: + color = scrapertoolsV2.find_single_match(string,'color ([a-z]+)') + if color == 'kod' or '': color = kod_color + string = '[COLOR '+ color +']' + re.sub(r'\scolor\s([a-z]+)','',string) + '[/COLOR]' + if 'bold' in string: + string = '[B]' + re.sub(r'\sbold','',string) + '[/B]' + if 'italic' in string: + string = '[I]' + re.sub(r'\sitalic','',string) + '[/I]' + if '_' in string: + string = ' ' + re.sub(r'\s_','',string) + if '--' in string: + string = ' - ' + re.sub(r'\s--','',string) + + return string + + +def match(item, patron='', patron_block='', headers='', url=''): + matches = [] + url = url if url else item.url + data = httptools.downloadpage(url, headers=headers).data.replace("'", '"') + data = re.sub('\n|\t', '', data) + log('DATA= ', data) + + if patron_block: + block = scrapertoolsV2.find_single_match(data, patron_block) + log('BLOCK= ',block) + else: + block = data + + if patron: + matches = scrapertoolsV2.find_multiple_matches(block, patron) + log('MATCHES= ',matches) + + return matches, data + + +def videolibrary(itemlist, item, typography=''): + if item.contentType != 'episode': + action = 'add_pelicula_to_library' + extra = 'findvideos' + contentType = 'movie' + else: + action = 'add_serie_to_library' + extra = 'episodios' + contentType = 'tvshow' + if not typography: typography = 'color kod bold' + title = typo(config.get_localized_string(30161) + ' ' + typography) + if inspect.stack()[1][3] == 'findvideos' and contentType == 'movie' or inspect.stack()[1][3] != 'findvideos' and contentType != 'movie': + if config.get_videolibrary_support() and len(itemlist) > 0: + itemlist.append( + Item(channel=item.channel, + title=title, + contentType=contentType, + contentSerieName=item.fulltitle if contentType == 'tvshow' else '', + url=item.url, + action=action, + extra=extra, + contentTitle=item.fulltitle)) + + +def nextPage(itemlist, item, data, patron, function_level=1): + # Function_level is useful if the function is called by another function. + # If the call is direct, leave it blank + + next_page = scrapertoolsV2.find_single_match(data, patron) + + if next_page != "": + if 'http' not in next_page: + next_page = scrapertoolsV2.find_single_match(item.url, 'https?://[a-z0-9.-]+') + next_page + log('NEXT= ', next_page) + itemlist.append( + Item(channel=item.channel, + action=inspect.stack()[function_level][3], + contentType=item.contentType, + title=typo(config.get_localized_string(30992), 'color kod bold'), + url=next_page, + args=item.args, + thumbnail=thumb())) + + return itemlist + +def server(item, data='', headers='', AutoPlay=True, CheckLinks=True): + + __comprueba_enlaces__ = config.get_setting('comprueba_enlaces', item.channel) + log(__comprueba_enlaces__ ) + __comprueba_enlaces_num__ = config.get_setting('comprueba_enlaces_num', item.channel) + log(__comprueba_enlaces_num__ ) + + if not data: + data = httptools.downloadpage(item.url, headers=headers).data + + itemlist = servertools.find_video_items(data=str(data)) + + for videoitem in itemlist: + videoitem.title = "".join([item.title, ' ', typo(videoitem.title, 'color kod []')]) + videoitem.fulltitle = item.fulltitle + videoitem.show = item.show + videoitem.thumbnail = item.thumbnail + videoitem.channel = item.channel + videoitem.contentType = item.contentType + + if __comprueba_enlaces__ and CheckLinks: + itemlist = servertools.check_list_links(itemlist, __comprueba_enlaces_num__) + + if AutoPlay == True: + autoplay.start(itemlist, item) + + return itemlist + + +def aplay(item, itemlist, list_servers='', list_quality=''): + if inspect.stack()[1][3] == 'mainlist': + autoplay.init(item.channel, list_servers, list_quality) + autoplay.show_option(item.channel, itemlist) + else: + autoplay.start(itemlist, item) + + +def log(stringa1="", stringa2="", stringa3="", stringa4="", stringa5=""): + # Function to simplify the log + # Automatically returns File Name and Function Name + + frame = inspect.stack()[1] + 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)) diff --git a/default.py b/default.py index 8c7d9da7..bd7fd3e0 100644 --- a/default.py +++ b/default.py @@ -11,6 +11,10 @@ import xbmc from platformcode import config, logger logger.info("init...") +if os.path.isfile(os.path.join(config.get_data_path(), 'alfavorites-default.json')): + os.rename(os.path.join(config.get_data_path(), 'alfavorites-default.json'), os.path.join(config.get_data_path(), 'kodfavorites-default.json')) +if os.path.isfile(os.path.join(config.get_data_path(), 'alfa_db.sqlite')): + os.rename(os.path.join(config.get_data_path(), 'alfa_db.sqlite'), os.path.join(config.get_data_path(), 'kod_db.sqlite')) librerias = xbmc.translatePath(os.path.join(config.get_runtime_path(), 'lib')) sys.path.append(librerias) diff --git a/channels/help.json b/platformcode/help.json similarity index 100% rename from channels/help.json rename to platformcode/help.json diff --git a/channels/help.py b/platformcode/help.py similarity index 96% rename from channels/help.py rename to platformcode/help.py index a42d10e1..5061b6f5 100644 --- a/channels/help.py +++ b/platformcode/help.py @@ -93,19 +93,19 @@ def faq(item): if item.extra == "onoff_canales": respuesta = platformtools.dialog_yesno(config.get_localized_string(60457), config.get_localized_string(60458)) if respuesta == 1: - from channels import setting + from specials import setting setting.conf_tools(Item(extra='channels_onoff')) elif item.extra == "trakt_sync": respuesta = platformtools.dialog_yesno(config.get_localized_string(60457), config.get_localized_string(60459)) if respuesta == 1: - from channels import videolibrary + from specials import videolibrary videolibrary.channel_config(Item(channel='videolibrary')) elif item.extra == "tiempo_enlaces": respuesta = platformtools.dialog_yesno(config.get_localized_string(60457), config.get_localized_string(60460)) if respuesta == 1: - from channels import videolibrary + from specials import videolibrary videolibrary.channel_config(Item(channel='videolibrary')) elif item.extra == "prob_busquedacont": @@ -128,7 +128,7 @@ def faq(item): config.get_localized_string(60465)) if respuesta == 1: itemlist = [] - from channels import setting + from specials import setting new_item = Item(channel="setting", action="submenu_tools", folder=True) itemlist.extend(setting.submenu_tools(new_item)) return itemlist @@ -142,7 +142,7 @@ def faq(item): elif item.extra == "buscador_juntos": respuesta = platformtools.dialog_yesno(config.get_localized_string(60457), config.get_localized_string(60466)) if respuesta == 1: - from channels import search + from specials import search search.settings("") elif item.extra == "report_error": diff --git a/channels/infoplus.py b/platformcode/infoplus.py similarity index 99% rename from channels/infoplus.py rename to platformcode/infoplus.py index 77fdcea5..75ea411c 100644 --- a/channels/infoplus.py +++ b/platformcode/infoplus.py @@ -1229,7 +1229,7 @@ def busqueda_global(item, infoLabels, org_title=False): new_item.extra = infoLabels.get("originaltitle", "") new_item.category = item.contentType - from channels import search + from specials import search return search.do_search(new_item, cat) @@ -2188,7 +2188,7 @@ class images(xbmcgui.WindowDialog): class Trailer(xbmcgui.WindowXMLDialog): def Start(self, item, trailers): self.item = item - from channels import trailertools + from specials import trailertools self.video_url, self.windows = trailertools.buscartrailer(self.item.clone(), trailers=trailers) self.doModal() diff --git a/platformcode/launcher.py b/platformcode/launcher.py index 58a25079..55da26c5 100644 --- a/platformcode/launcher.py +++ b/platformcode/launcher.py @@ -56,7 +56,7 @@ def run(item=None): category = dictCategory[config.get_setting("category")] item = Item(channel="news", action="novedades", extra=category, mode = 'silent') else: - from channels import side_menu + from specials import side_menu item= Item() item = side_menu.check_user_home(item) item.start = True @@ -140,21 +140,22 @@ def run(item=None): # updater.update_channel(item.channel) # Checks if channel exists - channel_file = os.path.join(config.get_runtime_path(), - 'channels', item.channel + ".py") - if not os.path.isfile(channel_file): - channel_file = os.path.join(config.get_runtime_path(), - 'special_channels', item.channel + ".py") - logger.info("channel_file=%s" % channel_file) + if os.path.isfile(os.path.join(config.get_runtime_path(), 'channels', item.channel + ".py")): + CHANNELS = 'channels' + else: + CHANNELS ='specials' + channel_file = os.path.join(config.get_runtime_path(), CHANNELS, item.channel + ".py") + + logger.info("channel_file= " + channel_file) channel = None if os.path.exists(channel_file): try: - channel = __import__('channels.%s' % item.channel, None, - None, ["channels.%s" % item.channel]) + channel = __import__(CHANNELS + item.channel, None, None, [CHANNELS + item.channel]) except ImportError: - exec("import channels." + item.channel + " as channel") + importer = "import " + CHANNELS + "." + item.channel + " as channel" + exec(importer) logger.info("Running channel %s | %s" % (channel.__name__, channel.__file__)) @@ -226,7 +227,7 @@ def run(item=None): # Special action for downloading all episodes from a serie elif item.action == "download_all_episodes": - from channels import downloads + from specials import downloads item.action = item.extra del item.extra downloads.save_download(item) @@ -247,7 +248,7 @@ def run(item=None): tecleado = platformtools.dialog_input(last_search) if tecleado is not None: if last_search_active and not tecleado.startswith("http"): - from channels import search + from specials import search search.save_search(tecleado) itemlist = channel.search(item, tecleado) @@ -256,8 +257,9 @@ def run(item=None): platformtools.render_items(itemlist, item) - # For all other actions + # For all other actions else: + # import web_pdb; web_pdb.set_trace() logger.info("Executing channel '%s' method" % item.action) itemlist = getattr(channel, item.action)(item) if config.get_setting('trakt_sync'): @@ -294,8 +296,7 @@ def run(item=None): import traceback logger.error(traceback.format_exc()) - patron = 'File "' + os.path.join(config.get_runtime_path(), "channels", "").replace("\\", - "\\\\") + '([^.]+)\.py"' + patron = 'File "' + os.path.join(config.get_runtime_path(), CHANNELS, "").replace("\\", "\\\\") + '([^.]+)\.py"' canal = scrapertools.find_single_match(traceback.format_exc(), patron) platformtools.dialog_ok( @@ -305,8 +306,7 @@ def run(item=None): import traceback logger.error(traceback.format_exc()) - patron = 'File "' + os.path.join(config.get_runtime_path(), "channels", "").replace("\\", - "\\\\") + '([^.]+)\.py"' + patron = 'File "' + os.path.join(config.get_runtime_path(), "channels", "").replace("\\", "\\\\") + '([^.]+)\.py"' canal = scrapertools.find_single_match(traceback.format_exc(), patron) try: @@ -433,7 +433,7 @@ def play_from_library(item): else: # Ventana emergente - from channels import videolibrary + from specials import videolibrary p_dialog = platformtools.dialog_progress_bg(config.get_localized_string(20000), config.get_localized_string(70004)) p_dialog.update(0, '') @@ -491,6 +491,6 @@ def play_from_library(item): item = videolibrary.play(itemlist[seleccion])[0] platformtools.play_video(item) - from channels import autoplay + from specials import autoplay if (platformtools.is_playing() and item.action) or item.server == 'torrent' or autoplay.is_active(item.contentChannel): break diff --git a/platformcode/platformtools.py b/platformcode/platformtools.py index 3ed3ac7f..3304149d 100644 --- a/platformcode/platformtools.py +++ b/platformcode/platformtools.py @@ -180,7 +180,7 @@ def render_items(itemlist, parent_item): item.thumbnail = get_thumb("videolibrary_tvshow.png") - if unify_enabled and parent_item.channel != 'alfavorites': + if unify_enabled and parent_item.channel != 'kodfavorites': # Formatear titulo con unify item = unify.title_format(item) else: @@ -268,11 +268,11 @@ def render_items(itemlist, parent_item): # ...forzamos segun el viewcontent xbmcplugin.setContent(int(sys.argv[1]), parent_item.viewcontent) - elif parent_item.channel not in ["channelselector", "", "alfavorites"]: + elif parent_item.channel not in ["channelselector", "", "kodfavorites"]: # ... o segun el canal xbmcplugin.setContent(int(sys.argv[1]), "movies") - elif parent_item.channel == "alfavorites" and parent_item.action == 'mostrar_perfil': + elif parent_item.channel == "kodfavorites" and parent_item.action == 'mostrar_perfil': xbmcplugin.setContent(int(sys.argv[1]), "movies") # Fijamos el "breadcrumb" @@ -470,7 +470,7 @@ def set_context_commands(item, parent_item): # Si no se está dentro de Alfavoritos y hay los contextos de alfavoritos, descartarlos. # (pasa al ir a un enlace de alfavoritos, si este se clona en el canal) - if parent_item.channel != 'alfavorites' and 'i_perfil' in command and 'i_enlace' in command: + if parent_item.channel != 'kodfavorites' and 'i_perfil' in command and 'i_enlace' in command: continue if "goto" in command: @@ -481,7 +481,7 @@ def set_context_commands(item, parent_item): (command["title"], "XBMC.RunPlugin(%s?%s)" % (sys.argv[0], item.clone(**command).tourl()))) # No añadir más opciones predefinidas si se está dentro de Alfavoritos - if parent_item.channel == 'alfavorites': + if parent_item.channel == 'kodfavorites': return context_commands # Opciones segun criterios, solo si el item no es un tag (etiqueta), ni es "Añadir a la videoteca", etc... @@ -548,7 +548,7 @@ def set_context_commands(item, parent_item): # Añadir a Alfavoritos (Mis enlaces) if item.channel not in ["favorites", "videolibrary", "help", ""] and parent_item.channel != "favorites": context_commands.append(('[COLOR blue]%s[/COLOR]' % config.get_localized_string(70557), "XBMC.RunPlugin(%s?%s)" % - (sys.argv[0], item.clone(channel="alfavorites", action="addFavourite", + (sys.argv[0], item.clone(channel="kodfavorites", action="addFavourite", from_channel=item.channel, from_action=item.action).tourl()))) @@ -596,7 +596,7 @@ def set_context_commands(item, parent_item): if item.channel != "downloads" and downloadenabled != "false": # Descargar pelicula - if item.contentType == "movie" and item.contentTitle: + if item.contentType == "movie": context_commands.append((config.get_localized_string(60354), "XBMC.RunPlugin(%s?%s)" % (sys.argv[0], item.clone(channel="downloads", action="save_download", from_channel=item.channel, from_action=item.action) @@ -966,7 +966,7 @@ def set_opcion(item, seleccion, opciones, video_urls): # "Descargar" elif opciones[seleccion] == config.get_localized_string(30153): - from channels import downloads + from specials import downloads import xbmcaddon import xbmcgui __addon__ = xbmcaddon.Addon() @@ -984,13 +984,13 @@ def set_opcion(item, seleccion, opciones, video_urls): # "Quitar de favoritos" elif opciones[seleccion] == config.get_localized_string(30154): - from channels import favorites + from specials import favorites favorites.delFavourite(item) salir = True # "Añadir a favoritos": elif opciones[seleccion] == config.get_localized_string(30155): - from channels import favorites + from specials import favorites item.from_channel = "favorites" favorites.addFavourite(item) salir = True diff --git a/platformcode/xbmc_config_menu.py b/platformcode/xbmc_config_menu.py index be084b35..da728191 100644 --- a/platformcode/xbmc_config_menu.py +++ b/platformcode/xbmc_config_menu.py @@ -174,12 +174,12 @@ class SettingsWindow(xbmcgui.WindowXMLDialog): channelpath = inspect.currentframe().f_back.f_back.f_code.co_filename self.channel = os.path.basename(channelpath).replace(".py", "") self.ch_type = os.path.basename(os.path.dirname(channelpath)) - + logger.info('PATH= ' + channelpath) # Si no tenemos list_controls, hay que sacarlos del json del canal if not self.list_controls: # Si la ruta del canal esta en la carpeta "channels", obtenemos los controles y valores mediante chaneltools - if os.path.join(config.get_runtime_path(), "channels") in channelpath: + if os.path.join(config.get_runtime_path(), "channels") or os.path.join(config.get_runtime_path(), "specials") in channelpath: # La llamada se hace desde un canal self.list_controls, default_values = channeltools.get_channel_controls_settings(self.channel) @@ -544,7 +544,7 @@ class SettingsWindow(xbmcgui.WindowXMLDialog): default = "" c["default"] = c.get("default", default) - c["color"] = c.get("color", "0xFF0066CC") + c["color"] = c.get("color", "0xFFFFFFFF") c["visible"] = c.get("visible", True) c["enabled"] = c.get("enabled", True) diff --git a/platformcode/xbmc_videolibrary.py b/platformcode/xbmc_videolibrary.py index 55ca30b8..adc5c1a3 100644 --- a/platformcode/xbmc_videolibrary.py +++ b/platformcode/xbmc_videolibrary.py @@ -51,7 +51,7 @@ def mark_auto_as_watched(item): logger.debug("marcado") item.playcount = 1 sync_with_trakt = True - from channels import videolibrary + from specials import videolibrary videolibrary.mark_content_as_watched2(item) break @@ -326,7 +326,7 @@ def mark_season_as_watched_on_kodi(item, value=1): def mark_content_as_watched_on_alfa(path): - from channels import videolibrary + from specials import videolibrary from core import videolibrarytools from core import scrapertools from core import filetools diff --git a/resources/settings.xml b/resources/settings.xml index 82537f5d..45a937c9 100644 --- a/resources/settings.xml +++ b/resources/settings.xml @@ -137,7 +137,7 @@ - + @@ -275,7 +275,7 @@ - + diff --git a/resources/skins/Default/720p/ChannelSettings.xml b/resources/skins/Default/720p/ChannelSettings.xml index 33fdc6e1..4f3c8e4e 100644 --- a/resources/skins/Default/720p/ChannelSettings.xml +++ b/resources/skins/Default/720p/ChannelSettings.xml @@ -23,7 +23,7 @@ 34 725 font12_title - 0xFFFFA500 + 0xFFFFFFFF center center diff --git a/specials/__init__.py b/specials/__init__.py new file mode 100644 index 00000000..eed08f62 --- /dev/null +++ b/specials/__init__.py @@ -0,0 +1,12 @@ +# -*- coding: utf-8 -*- + +import os +import sys + +# Appends the main plugin dir to the PYTHONPATH if an internal package cannot be imported. +# Examples: In Plex Media Server all modules are under "Code.*" package, and in Enigma2 under "Plugins.Extensions.*" +try: + # from core import logger + import core +except: + sys.path.append(os.path.abspath(os.path.join(os.path.dirname(__file__), ".."))) diff --git a/channels/autoplay.py b/specials/autoplay.py similarity index 100% rename from channels/autoplay.py rename to specials/autoplay.py diff --git a/channels/autorenumber.py b/specials/autorenumber.py similarity index 95% rename from channels/autorenumber.py rename to specials/autorenumber.py index e0146a71..22616195 100644 --- a/channels/autorenumber.py +++ b/specials/autorenumber.py @@ -14,7 +14,7 @@ from platformcode import config from core import jsontools, tvdb from core.item import Item from platformcode import platformtools -from channels.support import typo, log +from core.support import typo, log TAG_TVSHOW_RENUMERATE = "TVSHOW_AUTORENUMBER" TAG_SEASON_EPISODE = "season_episode" @@ -86,7 +86,7 @@ def write_data(channel, show, data): log() dict_series = jsontools.get_node_from_file(channel, TAG_TVSHOW_RENUMERATE) tvshow = show.strip() - list_season_episode = dict_series.get(tvshow, {}).get(TAG_SEASON_EPISODE, []) + # list_season_episode = dict_series.get(tvshow, {}).get(TAG_SEASON_EPISODE, []) if data: dict_renumerate = {TAG_SEASON_EPISODE: data} @@ -94,7 +94,7 @@ def write_data(channel, show, data): else: dict_series.pop(tvshow, None) - result, json_data = jsontools.update_node(dict_series, channel, TAG_TVSHOW_RENUMERATE) + result = jsontools.update_node(dict_series, channel, TAG_TVSHOW_RENUMERATE)[0] if result: if data: @@ -103,7 +103,7 @@ def write_data(channel, show, data): message = config.get_localized_string(60444) else: message = config.get_localized_string(70593) - + heading = show.strip() platformtools.dialog_notification(heading, message) diff --git a/channels/downloads.json b/specials/downloads.json similarity index 92% rename from channels/downloads.json rename to specials/downloads.json index 8476a4c7..f2fed43e 100644 --- a/channels/downloads.json +++ b/specials/downloads.json @@ -128,9 +128,9 @@ "label": "@70238", "lvalues": [ "@70244", - "Reordenar" + "@70245" ], - "default": 1, + "default": 0, "enabled": true, "visible": true }, @@ -139,13 +139,13 @@ "type": "list", "label": "@70246", "lvalues": [ - "Esp, Lat, Sub, Eng, Vose", - "Esp, Sub, Lat, Eng, Vose", - "Eng, Sub, Vose, Esp, Lat", - "Vose, Eng, Sub, Esp, Lat" + "Ita, Sub, Eng, Vos, Vosi", + "Eng, Ita, Sub, Vos, Vosi", + "Sub, Ita, Eng, Vos, Vosi", + "Eng, Sub, Ita, Vos, Vosi" ], "default": 0, - "enabled": "eq(-1,'Reordenar')", + "enabled": "eq(-1,'@70245')", "visible": true }, { diff --git a/channels/downloads.py b/specials/downloads.py similarity index 98% rename from channels/downloads.py rename to specials/downloads.py index 06bc50e7..46d8a264 100644 --- a/channels/downloads.py +++ b/specials/downloads.py @@ -9,12 +9,7 @@ import time import unicodedata -from core import filetools -from core import jsontools -from core import scraper -from core import scrapertools -from core import servertools -from core import videolibrarytools +from core import filetools, jsontools, scraper, scrapertools, servertools, videolibrarytools, support from core.downloader import Downloader from core.item import Item from platformcode import config, logger @@ -90,7 +85,7 @@ def mainlist(item): estados = [i.downloadStatus for i in itemlist] - # Si hay alguno completado + # Si hay alguno completado if 2 in estados: itemlist.insert(0, Item(channel=item.channel, action="clean_ready", title=config.get_localized_string(70218), contentType=item.contentType, contentChannel=item.contentChannel, @@ -104,22 +99,20 @@ def mainlist(item): # Si hay alguno pendiente if 1 in estados or 0 in estados: - itemlist.insert(0, Item(channel=item.channel, action="download_all", title=config.get_localized_string(70220), + itemlist.insert(0, Item(channel=item.channel, action="download_all", title=support.typo(config.get_localized_string(70220),'bold'), contentType=item.contentType, contentChannel=item.contentChannel, - contentSerieName=item.contentSerieName, text_color="green")) + contentSerieName=item.contentSerieName)) if len(itemlist): - itemlist.insert(0, Item(channel=item.channel, action="clean_all", title=config.get_localized_string(70221), + itemlist.insert(0, Item(channel=item.channel, action="clean_all", title=support.typo(config.get_localized_string(70221),'bold'), contentType=item.contentType, contentChannel=item.contentChannel, - contentSerieName=item.contentSerieName, text_color="red")) + contentSerieName=item.contentSerieName)) if not item.contentType == "tvshow" and config.get_setting("browser", "downloads") == True: - itemlist.insert(0, Item(channel=item.channel, action="browser", title=config.get_localized_string(70222), - url=DOWNLOAD_PATH, text_color="yellow")) + itemlist.insert(0, Item(channel=item.channel, action="browser", title=support.typo(config.get_localized_string(70222),'bold'),url=DOWNLOAD_PATH)) if not item.contentType == "tvshow": - itemlist.insert(0, Item(channel=item.channel, action="settings", title=config.get_localized_string(70223), - text_color="blue")) + itemlist.insert(0, Item(channel=item.channel, action="settings", title= support.typo(config.get_localized_string(70223),'bold color kod'))) return itemlist @@ -274,8 +267,7 @@ def move_to_libray(item): library_path = filetools.join(config.get_videolibrary_path(), *filetools.split(item.downloadFilename)) final_path = download_path - if config.get_setting("library_add", "downloads") == True and config.get_setting("library_move", - "downloads") == True: + if config.get_setting("library_add", "downloads") == True and config.get_setting("library_move", "downloads") == True: if not filetools.isdir(filetools.dirname(library_path)): filetools.mkdir(filetools.dirname(library_path)) diff --git a/channels/favorites.py b/specials/favorites.py similarity index 100% rename from channels/favorites.py rename to specials/favorites.py diff --git a/channels/filmontv.json b/specials/filmontv.json similarity index 100% rename from channels/filmontv.json rename to specials/filmontv.json diff --git a/channels/filmontv.py b/specials/filmontv.py similarity index 96% rename from channels/filmontv.py rename to specials/filmontv.py index d4ae1456..2674d946 100644 --- a/channels/filmontv.py +++ b/specials/filmontv.py @@ -7,8 +7,7 @@ import re import urllib -from channels import support -from core import httptools, scrapertools, tmdb +from core import httptools, scrapertools, tmdb, support from core.item import Item from platformcode import logger @@ -85,5 +84,5 @@ def tvoggi(item): def do_search(item): - from channels import search + from specials import search return search.do_search(item) \ No newline at end of file diff --git a/channels/filtertools.py b/specials/filtertools.py similarity index 100% rename from channels/filtertools.py rename to specials/filtertools.py diff --git a/channels/alfavorites.py b/specials/kodfavorites.py similarity index 99% rename from channels/alfavorites.py rename to specials/kodfavorites.py index 94bac5e5..709a17b7 100644 --- a/channels/alfavorites.py +++ b/specials/kodfavorites.py @@ -30,7 +30,7 @@ def fechahora_actual(): # Helpers para listas # ------------------- -PREFIJO_LISTA = 'alfavorites-' +PREFIJO_LISTA = 'kodfavorites-' # Devuelve el nombre de la lista activa (Ej: alfavorites-default.json) def get_lista_activa(): diff --git a/channels/news.json b/specials/news.json similarity index 100% rename from channels/news.json rename to specials/news.json diff --git a/channels/news.py b/specials/news.py similarity index 99% rename from channels/news.py rename to specials/news.py index 0bc9b148..453b69c6 100644 --- a/channels/news.py +++ b/specials/news.py @@ -257,7 +257,7 @@ def novedades(item): list_canales, any_active = get_channels_list() if config.is_xbmc(): - from channels import side_menu + from specials import side_menu if mode=='silent' and any_active and len(list_canales[item.extra]) > 0: side_menu.set_menu_settings(item) aux_list=[] diff --git a/channels/search.json b/specials/search.json similarity index 100% rename from channels/search.json rename to specials/search.json diff --git a/channels/search.py b/specials/search.py similarity index 99% rename from channels/search.py rename to specials/search.py index 25a9a88a..199ed090 100644 --- a/channels/search.py +++ b/specials/search.py @@ -13,7 +13,6 @@ from core.item import Item from platformcode import config, logger from platformcode import platformtools from core import tmdb - import xbmc, xbmcaddon addon = xbmcaddon.Addon('metadata.themoviedb.org') def_lang = addon.getSetting('language') @@ -437,7 +436,7 @@ def show_result(item): def channel_search(search_results, channel_parameters, tecleado): try: - exec "from channels import " + channel_parameters["channel"] + " as module" + exec("from specials import " + channel_parameters["channel"] + " as module") mainlist = module.mainlist(Item(channel=channel_parameters["channel"])) search_items = [item for item in mainlist if item.action == "search"] if not search_items: diff --git a/channels/searchall.py b/specials/searchall.py similarity index 99% rename from channels/searchall.py rename to specials/searchall.py index e5339d83..9192ab61 100644 --- a/channels/searchall.py +++ b/specials/searchall.py @@ -624,7 +624,7 @@ def channel_search(queue, channel_parameters, category, title_year, tecleado): title_search = urllib.unquote_plus(tecleado) - exec "from channels import " + channel_parameters["channel"] + " as module" + exec "from specials import " + channel_parameters["channel"] + " as module" mainlist = module.mainlist(Item(channel=channel_parameters["channel"])) for item in mainlist: diff --git a/channels/setting.py b/specials/setting.py similarity index 100% rename from channels/setting.py rename to specials/setting.py diff --git a/channels/side_menu.py b/specials/side_menu.py similarity index 99% rename from channels/side_menu.py rename to specials/side_menu.py index d63d59a4..cac9860a 100644 --- a/channels/side_menu.py +++ b/specials/side_menu.py @@ -89,7 +89,7 @@ def get_start_page(): if custom_start == False: item = Item(channel="news", action="novedades", extra=category, mode='silent') else: - from channels import side_menu + from specials import side_menu item = Item() item = side_menu.check_user_home(item) return item diff --git a/channels/tvmoviedb.json b/specials/tvmoviedb.json similarity index 100% rename from channels/tvmoviedb.json rename to specials/tvmoviedb.json diff --git a/channels/tvmoviedb.py b/specials/tvmoviedb.py similarity index 99% rename from channels/tvmoviedb.py rename to specials/tvmoviedb.py index 30486b7f..fdd9c084 100644 --- a/channels/tvmoviedb.py +++ b/specials/tvmoviedb.py @@ -15,7 +15,7 @@ from platformcode import config, logger from platformcode import platformtools import xbmc, xbmcaddon from channelselector import get_thumb -from channels.support import typo, thumb +from core.support import typo, thumb addon = xbmcaddon.Addon('metadata.themoviedb.org') def_lang = addon.getSetting('language') @@ -139,7 +139,7 @@ def busqueda(item): new_item.extra = item.contentTitle.replace("+", " ") new_item.category = item.extra - from channels import search + from specials import search return search.do_search(new_item, cat) @@ -1975,7 +1975,7 @@ def imagenes(item): return itemlist if item.images: - from channels import infoplus + from specials import infoplus for key, value in item.images.iteritems(): if key == "tmdb" and "Tmdb" in item.title: if item.folder: diff --git a/channels/url.json b/specials/url.json similarity index 100% rename from channels/url.json rename to specials/url.json diff --git a/channels/url.py b/specials/url.py similarity index 100% rename from channels/url.py rename to specials/url.py diff --git a/channels/videolibrary.json b/specials/videolibrary.json similarity index 100% rename from channels/videolibrary.json rename to specials/videolibrary.json diff --git a/channels/videolibrary.py b/specials/videolibrary.py similarity index 99% rename from channels/videolibrary.py rename to specials/videolibrary.py index 73d54fd5..aef75da2 100644 --- a/channels/videolibrary.py +++ b/specials/videolibrary.py @@ -422,7 +422,7 @@ def get_episodes(item): def findvideos(item): - from channels import autoplay + from specials import autoplay logger.info() # logger.debug("item:\n" + item.tostring('\n')) diff --git a/videolibrary_service.py b/videolibrary_service.py index cb88fe7b..06f9e1fe 100644 --- a/videolibrary_service.py +++ b/videolibrary_service.py @@ -23,7 +23,7 @@ except: from core import channeltools, filetools, videolibrarytools from platformcode import logger from platformcode import platformtools -from channels import videolibrary +from specials import videolibrary from lib import generictools