- Migliorata "thumb" e spostata in support
- "log" spostata in logger
This commit is contained in:
@@ -46,7 +46,7 @@ def menu(item):
|
||||
if item.contentType == 'tvshow':
|
||||
itemlist += [item.clone(title=support.typo('In Corso','bold'), args=InCorso),
|
||||
item.clone(title=support.typo('Terminato','bold'), args=Terminato)]
|
||||
itemlist +=[item.clone(title=support.typo('Cerca...','bold'), action='search', thumbnail=support.thumb(thumb='search.png'))]
|
||||
itemlist +=[item.clone(title=support.typo('Cerca...','bold'), action='search', thumbnail=support.thumb('search'))]
|
||||
return itemlist
|
||||
|
||||
|
||||
|
||||
@@ -90,7 +90,7 @@ def menu(item):
|
||||
patronMenu=r'<button[^>]+>\s*(?P<title>[A-Za-z0-9]+)\s*<span.[^>]+>(?P<other>.*?)</ul>'
|
||||
def ItemItemlistHook(item, itemlist):
|
||||
itemlist.insert(0, item.clone(title=support.typo('Tutti','bold'), action='peliculas'))
|
||||
itemlist.append(item.clone(title=support.typo('Cerca...','bold'), action='search', search=True, thumbnail=support.thumb(thumb='search.png')))
|
||||
itemlist.append(item.clone(title=support.typo('Cerca...','bold'), action='search', search=True, thumbnail=support.thumb('search.png')))
|
||||
return itemlist
|
||||
return locals()
|
||||
|
||||
|
||||
@@ -24,7 +24,7 @@ def mainlist(item):
|
||||
patronBlock = r'<ul class="dropdown-menu(?P<block>.*?)</ul> </div'
|
||||
patron = r'<a href="(?P<url>[^"]+)"(?: class="")?>(?P<title>[^<]+)<'
|
||||
def itemHook(item):
|
||||
item.thumbnail = support.thumb(thumb='music.png')
|
||||
item.thumbnail = support.thumb('music')
|
||||
item.contentType = 'music'
|
||||
return item
|
||||
def itemlistHook(itemlist):
|
||||
@@ -36,7 +36,7 @@ def mainlist(item):
|
||||
contentType='music',
|
||||
url=item.url,
|
||||
action='search',
|
||||
thumbnail=support.thumb(thumb='search.png')))
|
||||
thumbnail=support.thumb('search')))
|
||||
|
||||
support.channel_config(item, itemlist)
|
||||
return itemlist
|
||||
|
||||
@@ -126,6 +126,6 @@ def findvideos(item):
|
||||
contentType='tvshow',
|
||||
url=url_serie,
|
||||
action='episodios',
|
||||
thumbnail = support.thumb(thumb='tvshow.png')))
|
||||
thumbnail = support.thumb('tvshow')))
|
||||
|
||||
return itemlist
|
||||
|
||||
@@ -22,12 +22,12 @@ def mainlist(item):
|
||||
action = 'radio'
|
||||
patron = r'text="(?P<title>[^"]+)" URL="(?P<url>[^"]+)"'
|
||||
def itemHook(item):
|
||||
item.thumbnail = support.thumb(thumb='music.png')
|
||||
item.thumbnail = support.thumb('music')
|
||||
item.contentType = 'music'
|
||||
return item
|
||||
def itemlistHook(itemlist):
|
||||
itemlist.append(
|
||||
item.clone(title=support.typo('Cerca...', 'bold color kod'), action='search', thumbnail=support.thumb(thumb='search.png')))
|
||||
item.clone(title=support.typo('Cerca...', 'bold color kod'), action='search', thumbnail=support.thumb('search')))
|
||||
support.channel_config(item, itemlist)
|
||||
return itemlist
|
||||
return locals()
|
||||
|
||||
@@ -4,8 +4,7 @@ import glob, os
|
||||
|
||||
from core import channeltools
|
||||
from core.item import Item
|
||||
from platformcode.unify import thumb_dict
|
||||
from platformcode import config, logger, unify
|
||||
from platformcode import config, logger
|
||||
addon = config.__settings__
|
||||
downloadenabled = addon.getSetting('downloadenabled')
|
||||
|
||||
@@ -102,6 +101,7 @@ def getchanneltypes(view="thumb_"):
|
||||
|
||||
|
||||
def filterchannels(category, view="thumb_"):
|
||||
from core import channeltools
|
||||
logger.info('Filter Channels ' + category)
|
||||
|
||||
channelslist = []
|
||||
@@ -275,110 +275,3 @@ def auto_filter(auto_lang=False):
|
||||
lang = 'all'
|
||||
|
||||
return lang
|
||||
|
||||
|
||||
def thumb(item_or_itemlist=None, genre=False, live=False, thumb=''):
|
||||
if live:
|
||||
if type(item_or_itemlist) == list:
|
||||
for item in item_or_itemlist:
|
||||
item.thumbnail = "https://raw.githubusercontent.com/kodiondemand/media/master/live/" + item.fulltitle.lower().replace(' ','_') + '.png'
|
||||
else:
|
||||
item_or_itemlist.thumbnail = "https://raw.githubusercontent.com/kodiondemand/media/master/live/" + item.fulltitle.lower().replace(' ','_') + '.png'
|
||||
return item_or_itemlist
|
||||
|
||||
import re
|
||||
icon_dict = {'movie':['film', 'movie'],
|
||||
'tvshow':['serie','tv','episodi','episodio','fiction', 'show'],
|
||||
'documentary':['documentari','documentario', 'documentary', 'documentaristico'],
|
||||
'teenager':['ragazzi','teenager', 'teen'],
|
||||
'learning':['learning'],
|
||||
'all':['tutti', 'all'],
|
||||
'news':['novità', "novita'", 'aggiornamenti', 'nuovi', 'nuove', 'new', 'newest', 'news', 'ultimi'],
|
||||
'now_playing':['cinema', 'in sala'],
|
||||
'anime':['anime'],
|
||||
'genres':['genere', 'generi', 'categorie', 'categoria', 'category'],
|
||||
'animation': ['animazione', 'cartoni', 'cartoon', 'animation'],
|
||||
'action':['azione', 'arti marziali', 'action'],
|
||||
'adventure': ['avventura', 'adventure'],
|
||||
'biographical':['biografico', 'biographical'],
|
||||
'comedy':['comico', 'commedia', 'demenziale', 'comedy', 'brillante'],
|
||||
'adult':['erotico', 'hentai', 'harem', 'ecchi', 'adult'],
|
||||
'drama':['drammatico', 'drama', 'dramma'],
|
||||
'syfy':['fantascienza', 'science fiction', 'syfy', 'sci'],
|
||||
'fantasy':['fantasy', 'magia', 'magic', 'fantastico'],
|
||||
'crime':['gangster','poliziesco', 'crime', 'crimine'],
|
||||
'grotesque':['grottesco', 'grotesque'],
|
||||
'war':['guerra', 'war'],
|
||||
'children':['bambini', 'kids'],
|
||||
'horror':['horror'],
|
||||
'music':['musical', 'musica', 'music', 'musicale'],
|
||||
'mistery':['mistero', 'giallo', 'mystery'],
|
||||
'noir':['noir'],
|
||||
'popular' : ['popolari','popolare', 'più visti'],
|
||||
'thriller':['thriller'],
|
||||
'top_rated' : ['fortunato', 'votati', 'lucky', 'top'],
|
||||
'on_the_air' : ['corso', 'onda', 'diretta', 'dirette'],
|
||||
'western':['western'],
|
||||
'vos':['sub','sub-ita'],
|
||||
'romance':['romantico','sentimentale', 'romance', 'soap'],
|
||||
'family':['famiglia','famiglie', 'family', 'historical'],
|
||||
'historical':['storico', 'history', 'storia'],
|
||||
'az':['lettera','lista','alfabetico','a-z', 'alphabetical'],
|
||||
'year':['anno', 'anni', 'year'],
|
||||
'update':['replay', 'update'],
|
||||
'videolibrary':['teche'],
|
||||
'autoplay':[config.get_localized_string(60071)]
|
||||
}
|
||||
|
||||
suffix_dict = {'_hd':['hd','altadefinizione','alta definizione'],
|
||||
'_4k':['4K'],
|
||||
'_az':['lettera','lista','alfabetico','a-z', 'alphabetical'],
|
||||
'_year':['anno', 'anni', 'year'],
|
||||
'_genre':['genere', 'generi', 'categorie', 'categoria']}
|
||||
|
||||
search = ['cerca', 'search']
|
||||
|
||||
search_suffix ={'_movie':['film', 'movie'],
|
||||
'_tvshow':['serie','tv', 'fiction']}
|
||||
|
||||
def autoselect_thumb(item, genre):
|
||||
if genre == False:
|
||||
for thumb, titles in icon_dict.items():
|
||||
if any( word in re.split(r'\.|\{|\}|\[|\]|\(|\)| ',item.title.lower()) for word in search):
|
||||
thumb = 'search'
|
||||
for suffix, titles in search_suffix.items():
|
||||
if any( word in re.split(r'\.|\{|\}|\[|\]|\(|\)| ',item.title.lower()) for word in titles ):
|
||||
thumb = thumb + suffix
|
||||
item.thumbnail = get_thumb(thumb + '.png')
|
||||
elif any( word in re.split(r'\.|\{|\}|\[|\]|\(|\)| ',item.title.lower()) for word in titles ):
|
||||
if thumb == 'movie' or thumb == 'tvshow':
|
||||
for suffix, titles in suffix_dict.items():
|
||||
if any( word in re.split(r'\.|\{|\}|\[|\]|\(|\)| ',item.title.lower()) for word in titles ):
|
||||
thumb = thumb + suffix
|
||||
item.thumbnail = get_thumb(thumb + '.png')
|
||||
else: item.thumbnail = get_thumb(thumb + '.png')
|
||||
else:
|
||||
thumb = item.thumbnail
|
||||
|
||||
else:
|
||||
for thumb, titles in icon_dict.items():
|
||||
if any(word in re.split(r'\.|\{|\}|\[|\]|\(|\)| ',item.title.lower()) for word in titles ):
|
||||
item.thumbnail = get_thumb(thumb + '.png')
|
||||
else:
|
||||
thumb = item.thumbnail
|
||||
|
||||
item.title = re.sub(r'\s*\{[^\}]+\}','',item.title)
|
||||
return item
|
||||
if item_or_itemlist:
|
||||
if type(item_or_itemlist) == list:
|
||||
for item in item_or_itemlist:
|
||||
autoselect_thumb(item, genre)
|
||||
return item_or_itemlist
|
||||
|
||||
else:
|
||||
return autoselect_thumb(item_or_itemlist, genre)
|
||||
|
||||
elif thumb:
|
||||
return get_thumb(thumb)
|
||||
else:
|
||||
return get_thumb('next.png')
|
||||
|
||||
200
core/support.py
200
core/support.py
@@ -1,33 +1,26 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
# -----------------------------------------------------------
|
||||
# support functions that are needed by many channels, to no repeat the same code
|
||||
import base64
|
||||
import inspect
|
||||
import os
|
||||
import re
|
||||
import sys
|
||||
from time import time
|
||||
import base64, inspect, os, re, sys
|
||||
|
||||
PY3 = False
|
||||
if sys.version_info[0] >= 3: PY3 = True; unicode = str; unichr = chr; long = int
|
||||
if PY3:
|
||||
from concurrent import futures
|
||||
else:
|
||||
from concurrent_py2 import futures
|
||||
|
||||
try:
|
||||
import urllib.request as urllib
|
||||
import urllib.parse as urlparse
|
||||
from urllib.parse import urlencode
|
||||
except ImportError:
|
||||
else:
|
||||
from concurrent_py2 import futures
|
||||
import urllib, urlparse
|
||||
from urllib import urlencode
|
||||
|
||||
from channelselector import thumb
|
||||
from time import time
|
||||
from core import httptools, scrapertools, servertools, tmdb, channeltools
|
||||
from core.item import Item
|
||||
from lib import unshortenit
|
||||
from platformcode import logger, config
|
||||
from platformcode import config
|
||||
from platformcode.logger import log
|
||||
from specials import autoplay
|
||||
|
||||
def hdpass_get_servers(item):
|
||||
@@ -39,28 +32,20 @@ def hdpass_get_servers(item):
|
||||
for mir_url, srv in scrapertools.find_multiple_matches(mir, patron_option):
|
||||
mir_url = scrapertools.decodeHtmlentities(mir_url)
|
||||
log(mir_url)
|
||||
it = item.clone(action="play",
|
||||
quality=quality,
|
||||
title=srv,
|
||||
server=srv,
|
||||
url= mir_url)
|
||||
if not servertools.get_server_parameters(srv.lower()): # do not exists or it's empty
|
||||
it = hdpass_get_url(it)[0]
|
||||
it = item.clone(action="play", quality=quality, title=srv, server=srv, url= mir_url)
|
||||
if not servertools.get_server_parameters(srv.lower()): it = hdpass_get_url(it)[0] # do not exists or it's empty
|
||||
ret.append(it)
|
||||
return ret
|
||||
# Carica la pagina
|
||||
itemlist = []
|
||||
if 'hdpass' in item.url or 'hdplayer' in item.url:
|
||||
url = item.url
|
||||
if 'hdpass' in item.url or 'hdplayer' in item.url: url = item.url
|
||||
else:
|
||||
data = httptools.downloadpage(item.url, CF=False).data.replace('\n', '')
|
||||
patron = r'<iframe(?: id="[^"]+")? width="[^"]+" height="[^"]+" src="([^"]+)"[^>]+><\/iframe>'
|
||||
url = scrapertools.find_single_match(data, patron)
|
||||
url = url.replace("&download=1", "")
|
||||
if 'hdpass' not in url and 'hdplayer' not in url:
|
||||
return itemlist
|
||||
if not url.startswith('http'):
|
||||
url = 'https:' + url
|
||||
if 'hdpass' not in url and 'hdplayer' not in url: return itemlist
|
||||
if not url.startswith('http'): url = 'https:' + url
|
||||
|
||||
data = httptools.downloadpage(url, CF=False).data
|
||||
patron_res = '<div class="buttons-bar resolutions-bar">(.*?)<div class="buttons-bar'
|
||||
@@ -68,7 +53,6 @@ def hdpass_get_servers(item):
|
||||
patron_option = r'<a href="([^"]+?)"[^>]+>([^<]+?)</a'
|
||||
|
||||
res = scrapertools.find_single_match(data, patron_res)
|
||||
# dbg()
|
||||
|
||||
with futures.ThreadPoolExecutor() as executor:
|
||||
thL = []
|
||||
@@ -78,15 +62,14 @@ def hdpass_get_servers(item):
|
||||
for res in futures.as_completed(thL):
|
||||
if res.result():
|
||||
itemlist.extend(res.result())
|
||||
return server(item, itemlist=itemlist)
|
||||
|
||||
return server(item, itemlist=itemlist)
|
||||
|
||||
def hdpass_get_url(item):
|
||||
data = httptools.downloadpage(item.url, CF=False).data
|
||||
src = scrapertools.find_single_match(data, r'<iframe allowfullscreen custom-src="([^"]+)')
|
||||
if src:
|
||||
item.url = base64.b64decode(src)
|
||||
else:
|
||||
item.url = scrapertools.find_single_match(data, r'<iframe allowfullscreen src="([^"]+)')
|
||||
if src: item.url = base64.b64decode(src)
|
||||
else: item.url = scrapertools.find_single_match(data, r'<iframe allowfullscreen src="([^"]+)')
|
||||
item.url, c = unshortenit.unshorten_only(item.url)
|
||||
|
||||
return [item]
|
||||
@@ -97,8 +80,7 @@ def color(text, color):
|
||||
|
||||
def search(channel, item, texto):
|
||||
log(item.url + " search " + texto)
|
||||
if 'findhost' in dir(channel):
|
||||
channel.findhost()
|
||||
if 'findhost' in dir(channel): channel.findhost()
|
||||
item.url = channel.host + "/?s=" + texto
|
||||
try:
|
||||
return channel.peliculas(item)
|
||||
@@ -152,10 +134,8 @@ def scrapeLang(scraped, lang, longtitle):
|
||||
language = ''
|
||||
|
||||
if scraped['lang']:
|
||||
if 'ita' in scraped['lang'].lower():
|
||||
language = 'ITA'
|
||||
if 'sub' in scraped['lang'].lower():
|
||||
language = 'Sub-' + language
|
||||
if 'ita' in scraped['lang'].lower(): language = 'ITA'
|
||||
if 'sub' in scraped['lang'].lower(): language = 'Sub-' + language
|
||||
|
||||
if not language: language = lang
|
||||
if language: longtitle += typo(language, '_ [] color kod')
|
||||
@@ -812,7 +792,6 @@ def menu(func):
|
||||
channel_config(item, itemlist)
|
||||
|
||||
# Apply auto Thumbnails at the menus
|
||||
from channelselector import thumb
|
||||
thumb(itemlist)
|
||||
log(item.channel + ' end')
|
||||
return itemlist
|
||||
@@ -1047,7 +1026,7 @@ def download(itemlist, item, typography='', function_level=1, function=''):
|
||||
from_action=from_action,
|
||||
contentTitle=contentTitle,
|
||||
path=item.path,
|
||||
thumbnail=thumb(thumb='downloads.png'),
|
||||
thumbnail=thumb('downloads'),
|
||||
downloadItemlist=downloadItemlist
|
||||
))
|
||||
if from_action == 'episodios':
|
||||
@@ -1064,7 +1043,7 @@ def download(itemlist, item, typography='', function_level=1, function=''):
|
||||
from_action=from_action,
|
||||
contentTitle=contentTitle,
|
||||
download='season',
|
||||
thumbnail=thumb(thumb='downloads.png'),
|
||||
thumbnail=thumb('downloads'),
|
||||
downloadItemlist=downloadItemlist
|
||||
))
|
||||
|
||||
@@ -1104,7 +1083,6 @@ def videolibrary(itemlist, item, typography='', function_level=1, function=''):
|
||||
if (function == 'findvideos' and contentType == 'movie') \
|
||||
or (function == 'episodios' and contentType != 'movie'):
|
||||
if config.get_videolibrary_support() and len(itemlist) > 0:
|
||||
from channelselector import get_thumb
|
||||
itemlist.append(
|
||||
Item(channel=item.channel,
|
||||
title=title,
|
||||
@@ -1118,7 +1096,7 @@ def videolibrary(itemlist, item, typography='', function_level=1, function=''):
|
||||
from_action=item.action,
|
||||
extra=extra,
|
||||
path=item.path,
|
||||
thumbnail=get_thumb('add_to_videolibrary.png')
|
||||
thumbnail=thumb('add_to_videolibrary')
|
||||
))
|
||||
|
||||
return itemlist
|
||||
@@ -1249,35 +1227,15 @@ def filterLang(item, itemlist):
|
||||
itemlist = filtertools.get_links(itemlist, item, list_language)
|
||||
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(*args):
|
||||
# Function to simplify the log
|
||||
# Automatically returns File Name and Function Name
|
||||
string = ''
|
||||
for arg in args:
|
||||
string += ' '+str(arg)
|
||||
frame = inspect.stack()[1]
|
||||
filename = frame[0].f_code.co_filename
|
||||
filename = os.path.basename(filename)
|
||||
logger.info("[" + filename + "] - [" + inspect.stack()[1][3] + "] " + string)
|
||||
|
||||
|
||||
def channel_config(item, itemlist):
|
||||
from channelselector import get_thumb
|
||||
itemlist.append(
|
||||
Item(channel='setting',
|
||||
action="channel_config",
|
||||
title=typo(config.get_localized_string(60587), 'color kod bold'),
|
||||
config=item.channel,
|
||||
folder=False,
|
||||
thumbnail=get_thumb('setting_0.png'))
|
||||
thumbnail=thumb('setting_0'))
|
||||
)
|
||||
|
||||
|
||||
@@ -1286,6 +1244,7 @@ def extract_wrapped(decorated):
|
||||
closure = (c.cell_contents for c in decorated.__closure__)
|
||||
return next((c for c in closure if isinstance(c, FunctionType)), None)
|
||||
|
||||
|
||||
def addQualityTag(item, itemlist, data, patron):
|
||||
if itemlist:
|
||||
defQualVideo = {
|
||||
@@ -1376,4 +1335,115 @@ def get_jwplayer_mediaurl(data, srvName, onlyHttp=False):
|
||||
video_urls.append(['.' + url.split('.')[-1] + ' [' + quality + '] [' + srvName + ']', url if not onlyHttp else url.replace('https://', 'http://')])
|
||||
|
||||
video_urls.sort(key=lambda x: x[0].split()[1])
|
||||
return video_urls
|
||||
return video_urls
|
||||
|
||||
|
||||
def thumb(item_itemlist_string=None, genre=False, live=False):
|
||||
from channelselector import get_thumb
|
||||
if live:
|
||||
if type(item_itemlist_string) == list:
|
||||
for item in item_itemlist_string:
|
||||
item.thumbnail = "https://raw.githubusercontent.com/kodiondemand/media/master/live/" + item.fulltitle.lower().replace(' ','_') + '.png'
|
||||
else:
|
||||
item_itemlist_string.thumbnail = "https://raw.githubusercontent.com/kodiondemand/media/master/live/" + item.fulltitle.lower().replace(' ','_') + '.png'
|
||||
return item_itemlist_string
|
||||
|
||||
import re
|
||||
icon_dict = {'movie':['film', 'movie'],
|
||||
'tvshow':['serie','tv','episodi','episodio','fiction', 'show'],
|
||||
'documentary':['documentari','documentario', 'documentary', 'documentaristico'],
|
||||
'teenager':['ragazzi','teenager', 'teen'],
|
||||
'learning':['learning'],
|
||||
'all':['tutti', 'all'],
|
||||
'news':['novità', "novita'", 'aggiornamenti', 'nuovi', 'nuove', 'new', 'newest', 'news', 'ultimi'],
|
||||
'now_playing':['cinema', 'in sala'],
|
||||
'anime':['anime'],
|
||||
'genres':['genere', 'generi', 'categorie', 'categoria', 'category'],
|
||||
'animation': ['animazione', 'cartoni', 'cartoon', 'animation'],
|
||||
'action':['azione', 'arti marziali', 'action'],
|
||||
'adventure': ['avventura', 'adventure'],
|
||||
'biographical':['biografico', 'biographical'],
|
||||
'comedy':['comico', 'commedia', 'demenziale', 'comedy', 'brillante'],
|
||||
'adult':['erotico', 'hentai', 'harem', 'ecchi', 'adult'],
|
||||
'drama':['drammatico', 'drama', 'dramma'],
|
||||
'syfy':['fantascienza', 'science fiction', 'syfy', 'sci'],
|
||||
'fantasy':['fantasy', 'magia', 'magic', 'fantastico'],
|
||||
'crime':['gangster','poliziesco', 'crime', 'crimine'],
|
||||
'grotesque':['grottesco', 'grotesque'],
|
||||
'war':['guerra', 'war'],
|
||||
'children':['bambini', 'kids'],
|
||||
'horror':['horror'],
|
||||
'music':['musical', 'musica', 'music', 'musicale'],
|
||||
'mistery':['mistero', 'giallo', 'mystery'],
|
||||
'noir':['noir'],
|
||||
'popular' : ['popolari','popolare', 'più visti'],
|
||||
'thriller':['thriller'],
|
||||
'top_rated' : ['fortunato', 'votati', 'lucky', 'top'],
|
||||
'on_the_air' : ['corso', 'onda', 'diretta', 'dirette'],
|
||||
'western':['western'],
|
||||
'vos':['sub','sub-ita'],
|
||||
'romance':['romantico','sentimentale', 'romance', 'soap'],
|
||||
'family':['famiglia','famiglie', 'family', 'historical'],
|
||||
'historical':['storico', 'history', 'storia'],
|
||||
'az':['lettera','lista','alfabetico','a-z', 'alphabetical'],
|
||||
'year':['anno', 'anni', 'year'],
|
||||
'update':['replay', 'update'],
|
||||
'videolibrary':['teche'],
|
||||
'autoplay':[config.get_localized_string(60071)]
|
||||
}
|
||||
|
||||
suffix_dict = {'_hd':['hd','altadefinizione','alta definizione'],
|
||||
'_4k':['4K'],
|
||||
'_az':['lettera','lista','alfabetico','a-z', 'alphabetical'],
|
||||
'_year':['anno', 'anni', 'year'],
|
||||
'_genre':['genere', 'generi', 'categorie', 'categoria']}
|
||||
|
||||
search = ['cerca', 'search']
|
||||
|
||||
search_suffix ={'_movie':['film', 'movie'],
|
||||
'_tvshow':['serie','tv', 'fiction']}
|
||||
|
||||
def autoselect_thumb(item, genre):
|
||||
if genre == False:
|
||||
for thumb, titles in icon_dict.items():
|
||||
if any(word in re.split(r'\.|\{|\}|\[|\]|\(|\)| ',item.title.lower()) for word in search):
|
||||
thumb = 'search'
|
||||
for suffix, titles in search_suffix.items():
|
||||
if any(word in re.split(r'\.|\{|\}|\[|\]|\(|\)| ',item.title.lower()) for word in titles ):
|
||||
thumb = thumb + suffix
|
||||
item.thumbnail = get_thumb(thumb + '.png')
|
||||
elif any(word in re.split(r'\.|\{|\}|\[|\]|\(|\)| ',item.title.lower()) for word in titles ):
|
||||
if thumb == 'movie' or thumb == 'tvshow':
|
||||
for suffix, titles in suffix_dict.items():
|
||||
if any(word in re.split(r'\.|\{|\}|\[|\]|\(|\)| ',item.title.lower()) for word in titles ):
|
||||
thumb = thumb + suffix
|
||||
item.thumbnail = get_thumb(thumb + '.png')
|
||||
else: item.thumbnail = get_thumb(thumb + '.png')
|
||||
else:
|
||||
thumb = item.thumbnail
|
||||
|
||||
else:
|
||||
for thumb, titles in icon_dict.items():
|
||||
if any(word in re.split(r'\.|\{|\}|\[|\]|\(|\)| ',item.title.lower()) for word in titles ):
|
||||
item.thumbnail = get_thumb(thumb + '.png')
|
||||
else:
|
||||
thumb = item.thumbnail
|
||||
|
||||
item.title = re.sub(r'\s*\{[^\}]+\}','',item.title)
|
||||
return item
|
||||
|
||||
if item_itemlist_string:
|
||||
if type(item_itemlist_string) == list:
|
||||
for item in item_itemlist_string:
|
||||
autoselect_thumb(item, genre)
|
||||
return item_itemlist_string
|
||||
|
||||
elif type(item_itemlist_string) == str:
|
||||
filename, file_extension = os.path.splitext(item_itemlist_string)
|
||||
if not file_extension: item_itemlist_string += '.png'
|
||||
return get_thumb(item_itemlist_string)
|
||||
else:
|
||||
return autoselect_thumb(item_itemlist_string, genre)
|
||||
|
||||
else:
|
||||
return get_thumb('next.png')
|
||||
@@ -110,6 +110,18 @@ def error(texto=""):
|
||||
xbmc.log(texto, xbmc.LOGERROR)
|
||||
|
||||
|
||||
def log(*args):
|
||||
# Function to simplify the log
|
||||
# Automatically returns File Name and Function Name
|
||||
import os
|
||||
string = ''
|
||||
for arg in args: string += ' '+str(arg)
|
||||
frame = inspect.stack()[1]
|
||||
filename = frame[0].f_code.co_filename
|
||||
filename = os.path.basename(filename)
|
||||
info("[" + filename + "] - [" + inspect.stack()[1][3] + "] " + string)
|
||||
|
||||
|
||||
class WebErrorException(Exception):
|
||||
def __init__(self, *args, **kwargs):
|
||||
Exception.__init__(self, *args, **kwargs)
|
||||
|
||||
@@ -17,10 +17,10 @@ blacklisted_genres = ['attualita', 'scienza', 'religione', 'cucina', 'notiziario
|
||||
def mainlist(item):
|
||||
support.log()
|
||||
|
||||
itemlist = [Item(title=support.typo('Film in onda oggi', 'bold'), channel=item.channel, action='category', contentType='movie', thumbnail=support.thumb(thumb='movie.png')),
|
||||
Item(title=support.typo('Serie Tv in onda oggi', 'bold'), channel=item.channel, action='peliculas', contentType='tvshow', thumbnail=support.thumb(thumb='tvshow.png')),
|
||||
Item(title=support.typo('Guida tv per canale', 'bold'), channel=item.channel, action='listaCanali', thumbnail=support.thumb(thumb='on_the_air.png')),
|
||||
Item(title=support.typo('Canali live', 'bold'), channel=item.channel, action='live', thumbnail=support.thumb(thumb='tvshow_on_the_air.png'))]
|
||||
itemlist = [Item(title=support.typo('Film in onda oggi', 'bold'), channel=item.channel, action='category', contentType='movie', thumbnail=support.thumb('movie')),
|
||||
Item(title=support.typo('Serie Tv in onda oggi', 'bold'), channel=item.channel, action='peliculas', contentType='tvshow', thumbnail=support.thumb('tvshow')),
|
||||
Item(title=support.typo('Guida tv per canale', 'bold'), channel=item.channel, action='listaCanali', thumbnail=support.thumb('on_the_air')),
|
||||
Item(title=support.typo('Canali live', 'bold'), channel=item.channel, action='live', thumbnail=support.thumb('tvshow_on_the_air'))]
|
||||
|
||||
return itemlist
|
||||
|
||||
|
||||
@@ -1132,7 +1132,7 @@ def add_download_items(item, itemlist):
|
||||
from_action="findvideos",
|
||||
contentTitle=item.contentTitle,
|
||||
path=item.path,
|
||||
thumbnail=thumb(thumb='downloads.png'),
|
||||
thumbnail=thumb('downloads'),
|
||||
parent=item.tourl())
|
||||
if item.action == 'findvideos':
|
||||
if item.contentType == 'episode':
|
||||
|
||||
Reference in New Issue
Block a user