Some Fix
This commit is contained in:
@@ -43,13 +43,13 @@ def mainlist(item):
|
|||||||
support.menu(itemlist, 'HD submenu', 'menu', host, args="Film HD Streaming")
|
support.menu(itemlist, 'HD submenu', 'menu', host, args="Film HD Streaming")
|
||||||
support.menu(itemlist, 'Per genere submenu', 'menu', host, args="Film per Genere")
|
support.menu(itemlist, 'Per genere submenu', 'menu', host, args="Film per Genere")
|
||||||
support.menu(itemlist, 'Per anno submenu', 'menu', host, args="Film per Anno")
|
support.menu(itemlist, 'Per anno submenu', 'menu', host, args="Film per Anno")
|
||||||
support.menu(itemlist, 'Cerca Film... submenu color blue', 'search', host)
|
support.menu(itemlist, 'Cerca... submenu color blue', 'search', host, args='film')
|
||||||
|
|
||||||
support.menu(itemlist, 'Serie TV bold', 'peliculas', host + '/serietv/', contentType='episode')
|
support.menu(itemlist, 'Serie TV bold', 'peliculas', host + '/serietv/', contentType='episode')
|
||||||
support.menu(itemlist, 'Per lettera submenu', 'menu', host + '/serietv/', contentType='episode', args="Serie-Tv per Lettera")
|
support.menu(itemlist, 'Per Lettera submenu', 'menu', host + '/serietv/', contentType='episode', args="Serie-Tv per Lettera")
|
||||||
support.menu(itemlist, 'Per genere submenu', 'menu', host + '/serietv/', contentType='episode', args="Serie-Tv per Genere")
|
support.menu(itemlist, 'Per Genere submenu', 'menu', host + '/serietv/', contentType='episode', args="Serie-Tv per Genere")
|
||||||
support.menu(itemlist, 'Per Anno submenu', 'menu', host + '/serietv/', contentType='episode', args="Serie-Tv per Anno")
|
support.menu(itemlist, 'Per anno submenu', 'menu', host + '/serietv/', contentType='episode', args="Serie-Tv per Anno")
|
||||||
support.menu(itemlist, 'Cerca Serie TV... submenu color blue', 'search', host + '/serietv/', contentType='episode')
|
support.menu(itemlist, 'Cerca... submenu color blue', 'search', host + '/serietv/', contentType='episode', args='serie')
|
||||||
|
|
||||||
autoplay.show_option(item.channel, itemlist)
|
autoplay.show_option(item.channel, itemlist)
|
||||||
|
|
||||||
@@ -74,7 +74,8 @@ def menu(item):
|
|||||||
url=host + scrapedurl
|
url=host + scrapedurl
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
return itemlist
|
|
||||||
|
return support.thumb(itemlist)
|
||||||
|
|
||||||
|
|
||||||
def search(item, text):
|
def search(item, text):
|
||||||
|
|||||||
@@ -53,7 +53,7 @@ def hdpass_get_servers(item):
|
|||||||
contentType=item.contentType,
|
contentType=item.contentType,
|
||||||
server=server,
|
server=server,
|
||||||
url=url_decode(media_url)))
|
url=url_decode(media_url)))
|
||||||
logger.info("video ->" + res_video)
|
log("video -> ", res_video)
|
||||||
|
|
||||||
return itemlist
|
return itemlist
|
||||||
|
|
||||||
@@ -115,7 +115,7 @@ def scrape(item, patron = '', listGroups = [], headers="", blacklist="", data=""
|
|||||||
data = httptools.downloadpage(item.url, headers=headers).data.replace("'", '"')
|
data = httptools.downloadpage(item.url, headers=headers).data.replace("'", '"')
|
||||||
data = re.sub('\n|\t', ' ', data)
|
data = re.sub('\n|\t', ' ', data)
|
||||||
# replace all ' with " and eliminate newline, so we don't need to worry about
|
# replace all ' with " and eliminate newline, so we don't need to worry about
|
||||||
logger.info('DATA ='+data)
|
log('DATA =', data)
|
||||||
|
|
||||||
block = data
|
block = data
|
||||||
|
|
||||||
@@ -128,12 +128,12 @@ def scrape(item, patron = '', listGroups = [], headers="", blacklist="", data=""
|
|||||||
block = ""
|
block = ""
|
||||||
for b in blocks:
|
for b in blocks:
|
||||||
block += "\n" + b
|
block += "\n" + b
|
||||||
logger.info('BLOCK '+str(n)+'=' + block)
|
log('BLOCK ', n, '=', block)
|
||||||
else:
|
else:
|
||||||
block = data
|
block = data
|
||||||
if patron and listGroups:
|
if patron and listGroups:
|
||||||
matches = scrapertoolsV2.find_multiple_matches(block, patron)
|
matches = scrapertoolsV2.find_multiple_matches(block, patron)
|
||||||
logger.info('MATCHES ='+str(matches))
|
log('MATCHES =', matches)
|
||||||
|
|
||||||
for match in matches:
|
for match in matches:
|
||||||
if len(listGroups) > len(match): # to fix a bug
|
if len(listGroups) > len(match): # to fix a bug
|
||||||
@@ -275,16 +275,17 @@ def swzz_get_url(item):
|
|||||||
|
|
||||||
|
|
||||||
def menu(itemlist, title='', action='', url='', contentType='movie', args=[]):
|
def menu(itemlist, title='', action='', url='', contentType='movie', args=[]):
|
||||||
|
# Function to simplify menu creation
|
||||||
|
|
||||||
frame = inspect.stack()[1]
|
frame = inspect.stack()[1]
|
||||||
filename = frame[0].f_code.co_filename
|
filename = frame[0].f_code.co_filename
|
||||||
filename = os.path.basename(filename).replace('.py','')
|
filename = os.path.basename(filename).replace('.py','')
|
||||||
logger.info('FILENAME= ' + filename)
|
|
||||||
|
|
||||||
|
# Call typo function
|
||||||
title = typo(title)
|
title = typo(title)
|
||||||
|
|
||||||
if contentType == 'movie': extra = 'movie'
|
if contentType == 'movie': extra = 'movie'
|
||||||
else: extra = 'tvshow'
|
else: extra = 'tvshow'
|
||||||
logger.info('EXTRA= ' + title + ' '+extra)
|
|
||||||
|
|
||||||
itemlist.append(Item(
|
itemlist.append(Item(
|
||||||
channel = filename,
|
channel = filename,
|
||||||
@@ -295,29 +296,57 @@ def menu(itemlist, title='', action='', url='', contentType='movie', args=[]):
|
|||||||
args = args,
|
args = args,
|
||||||
contentType = contentType
|
contentType = contentType
|
||||||
))
|
))
|
||||||
|
|
||||||
|
# Apply auto Thumbnails at the menus
|
||||||
from channelselector import thumb
|
from channelselector import thumb
|
||||||
thumb(itemlist)
|
thumb(itemlist)
|
||||||
|
|
||||||
return itemlist
|
return itemlist
|
||||||
|
|
||||||
|
|
||||||
def typo(string):
|
def typo(string, typography=''):
|
||||||
if '[]' in string:
|
|
||||||
string = '[' + re.sub(r'\s\[\]','',string) + ']'
|
|
||||||
if '()' in string:
|
# Check if the typographic attributes are in the string or outside
|
||||||
string = '(' + re.sub(r'\s\(\)','',string) + ')'
|
if typography:
|
||||||
if '{}' in string:
|
string = string + ' ' + typography
|
||||||
string = '{' + re.sub(r'\s\{\}','',string) + '}'
|
if config.get_localized_string(30992) in string:
|
||||||
if 'submenu' in string:
|
string = string + ' >'
|
||||||
string = ' > ' + re.sub('\ssubmenu','',string)
|
|
||||||
if 'color' in string:
|
# If there are no attributes, it applies the default ones
|
||||||
color = scrapertoolsV2.find_single_match(string,'color ([a-z]+)')
|
attribute = ['[]','()','{}','submenu','color','bold','italic','_','[B]','[I]','[COLOR]']
|
||||||
string = '[COLOR '+ color +']' + re.sub('\scolor\s([a-z]+)','',string) + '[/COLOR]'
|
|
||||||
if 'bold' in string:
|
movie_word_list = ['film', 'serie', 'tv', 'anime', 'cinema', 'sala']
|
||||||
string = '[B]' + re.sub('\sbold','',string) + '[/B]'
|
search_word_list = ['cerca']
|
||||||
if 'italic' in string:
|
categories_word_list = ['genere', 'categoria', 'categorie', 'ordine', 'lettera', 'anno', 'alfabetico', 'a-z', 'menu']
|
||||||
string = '[I]' + re.sub('\sitalic','',string) + '[/I]'
|
|
||||||
if '_' in string:
|
if not any(word in string for word in attribute):
|
||||||
string = ' ' + re.sub('\s_','',string)
|
if any(word in string.lower() for word in search_word_list):
|
||||||
|
string = '[COLOR blue]' + 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]+)')
|
||||||
|
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)
|
||||||
|
|
||||||
return string
|
return string
|
||||||
|
|
||||||
@@ -326,13 +355,16 @@ def match(item, patron='', patron_block='', headers=''):
|
|||||||
data = httptools.downloadpage(item.url, headers=headers).data.replace("'", '"')
|
data = httptools.downloadpage(item.url, headers=headers).data.replace("'", '"')
|
||||||
data = re.sub('\n|\t', '', data)
|
data = re.sub('\n|\t', '', data)
|
||||||
log('DATA= ',data)
|
log('DATA= ',data)
|
||||||
|
|
||||||
if patron_block:
|
if patron_block:
|
||||||
block = scrapertoolsV2.find_single_match(data, patron_block)
|
block = scrapertoolsV2.find_single_match(data, patron_block)
|
||||||
log('BLOCK= ',block)
|
log('BLOCK= ',block)
|
||||||
else:
|
else:
|
||||||
data = block
|
data = block
|
||||||
|
|
||||||
matches = scrapertoolsV2.find_multiple_matches(block, patron)
|
matches = scrapertoolsV2.find_multiple_matches(block, patron)
|
||||||
log('MATCHES=',matches)
|
log('MATCHES= ',matches)
|
||||||
|
|
||||||
return matches
|
return matches
|
||||||
|
|
||||||
|
|
||||||
@@ -351,21 +383,23 @@ def videolibrary(itemlist, item, typography=''):
|
|||||||
title=title,
|
title=title,
|
||||||
url=item.url,
|
url=item.url,
|
||||||
action=action,
|
action=action,
|
||||||
|
extra=extra,
|
||||||
contentTitle=item.fulltitle))
|
contentTitle=item.fulltitle))
|
||||||
|
|
||||||
|
|
||||||
def nextPage(itemlist, item, data, patron):
|
def nextPage(itemlist, item, data, patron):
|
||||||
next_page = scrapertoolsV2.find_single_match(data, patron)
|
next_page = scrapertoolsV2.find_single_match(data, patron)
|
||||||
logger.info('NEXT ' + next_page)
|
log('NEXT= ',next_page)
|
||||||
|
|
||||||
if next_page != "":
|
if next_page != "":
|
||||||
|
thumbnails = thumb()
|
||||||
itemlist.append(
|
itemlist.append(
|
||||||
Item(channel=item.channel,
|
Item(channel=item.channel,
|
||||||
action="peliculas",
|
action="peliculas",
|
||||||
contentType=item.contentType,
|
contentType=item.contentType,
|
||||||
title=typo(config.get_localized_string(30992) + ' > color blue'),
|
title=typo(config.get_localized_string(30992), 'color blue'),
|
||||||
url=next_page,
|
url=next_page,
|
||||||
thumbnails=thumb()))
|
thumbnail=thumb()))
|
||||||
|
|
||||||
return itemlist
|
return itemlist
|
||||||
|
|
||||||
@@ -378,7 +412,7 @@ def server(item, data='', headers=''):
|
|||||||
itemlist = servertools.find_video_items(data=data)
|
itemlist = servertools.find_video_items(data=data)
|
||||||
|
|
||||||
for videoitem in itemlist:
|
for videoitem in itemlist:
|
||||||
videoitem.title = "".join([item.title, ' ', typo(videoitem.title + ' color blue []')])
|
videoitem.title = "".join([item.title, ' ', typo(videoitem.title, 'color blue []')])
|
||||||
videoitem.fulltitle = item.fulltitle
|
videoitem.fulltitle = item.fulltitle
|
||||||
videoitem.show = item.show
|
videoitem.show = item.show
|
||||||
videoitem.thumbnail = item.thumbnail
|
videoitem.thumbnail = item.thumbnail
|
||||||
@@ -389,6 +423,9 @@ def server(item, data='', headers=''):
|
|||||||
|
|
||||||
|
|
||||||
def log(stringa1="", stringa2="", stringa3="", stringa4="", stringa5=""):
|
def log(stringa1="", stringa2="", stringa3="", stringa4="", stringa5=""):
|
||||||
|
# Function to simplify the log
|
||||||
|
# Automatically returns File Name and Function Name
|
||||||
|
|
||||||
frame = inspect.stack()[1]
|
frame = inspect.stack()[1]
|
||||||
filename = frame[0].f_code.co_filename
|
filename = frame[0].f_code.co_filename
|
||||||
filename = os.path.basename(filename)
|
filename = os.path.basename(filename)
|
||||||
|
|||||||
@@ -352,7 +352,29 @@ def thumb(itemlist=[]):
|
|||||||
'news':['novità', "novita'"],
|
'news':['novità', "novita'"],
|
||||||
'now_playing':['cinema', 'in sala'],
|
'now_playing':['cinema', 'in sala'],
|
||||||
'channels_anime':['anime'],
|
'channels_anime':['anime'],
|
||||||
'genres':['genere', 'generi', 'categorie', 'categoria']}
|
'genres':['genere', 'generi', 'categorie', 'categoria'],
|
||||||
|
'channels_animation': ['animazione'],
|
||||||
|
'channels_adventure': ['avventura'],
|
||||||
|
'channels_action':['azione'],
|
||||||
|
'channels_biographical':['biografico'],
|
||||||
|
'channels_comedy':['comico','commedia'],
|
||||||
|
'channels_adult':['erotico'],
|
||||||
|
'channels_drama':['drammatico'],
|
||||||
|
'channels_syfy':['fantascienza'],
|
||||||
|
'channels_fantasy':['fantasy'],
|
||||||
|
'channels_crime':['gangster','poliziesco'],
|
||||||
|
'channels_grotesque':['grottesco'],
|
||||||
|
'channels_war':['guerra'],
|
||||||
|
'channels_horror':['horror'],
|
||||||
|
'channels_music':['musical'],
|
||||||
|
'channels_noir':['noir', 'Mistero'],
|
||||||
|
'channels_thriller':['thriller'],
|
||||||
|
'channels_western':['western'],
|
||||||
|
'channels_vos':['sub','sub-ita'],
|
||||||
|
'channels_romance':['romantico','sentimentale'],
|
||||||
|
'channels_family':['famiglia','famiglie'],
|
||||||
|
'channels_historical':['storico']
|
||||||
|
}
|
||||||
|
|
||||||
suffix_dict = {'_hd':['hd','altadefinizione','alta definizione'],
|
suffix_dict = {'_hd':['hd','altadefinizione','alta definizione'],
|
||||||
'_4k':['4K'],
|
'_4k':['4K'],
|
||||||
@@ -363,9 +385,12 @@ def thumb(itemlist=[]):
|
|||||||
search = ['cerca']
|
search = ['cerca']
|
||||||
|
|
||||||
search_suffix ={'_movie':['film'],
|
search_suffix ={'_movie':['film'],
|
||||||
'_tvshow':['sarie','tv']}
|
'_tvshow':['serie','tv']}
|
||||||
|
|
||||||
for item in itemlist:
|
for item in itemlist:
|
||||||
|
|
||||||
|
# Check if item has args propriety
|
||||||
|
if item.args: item.title = item.title + ' || ' + str(item.args)
|
||||||
|
|
||||||
for thumb, titles in icon_dict.items():
|
for thumb, titles in icon_dict.items():
|
||||||
if any( word in item.title.lower() for word in search):
|
if any( word in item.title.lower() for word in search):
|
||||||
thumb = 'search'
|
thumb = 'search'
|
||||||
@@ -374,15 +399,15 @@ def thumb(itemlist=[]):
|
|||||||
thumb = thumb + suffix
|
thumb = thumb + suffix
|
||||||
item.thumbnail = get_thumb(thumb + '.png')
|
item.thumbnail = get_thumb(thumb + '.png')
|
||||||
elif any( word in item.title.lower() for word in titles ):
|
elif any( word in item.title.lower() for word in titles ):
|
||||||
thumb = thumb
|
if thumb == 'channels_movie' or thumb == 'channels_tvshow':
|
||||||
if thumb == 'channels_movie' or 'channels_tvshow':
|
|
||||||
for suffix, titles in suffix_dict.items():
|
for suffix, titles in suffix_dict.items():
|
||||||
if any( word in item.title.lower() for word in titles ):
|
if any( word in item.title.lower() for word in titles ):
|
||||||
thumb = thumb + suffix
|
thumb = thumb + suffix
|
||||||
item.thumbnail = get_thumb(thumb + '.png')
|
item.thumbnail = get_thumb(thumb + '.png')
|
||||||
else:
|
else:
|
||||||
thumb = item.thumbnails
|
thumb = item.thumbnails
|
||||||
|
# REmove args from title
|
||||||
|
if item.args: item.title = item.title.replace(' || ' + str(item.args), '')
|
||||||
return itemlist
|
return itemlist
|
||||||
else:
|
else:
|
||||||
return get_thumb('next.png')
|
return get_thumb('next.png')
|
||||||
Binary file not shown.
|
Before Width: | Height: | Size: 2.3 KiB After Width: | Height: | Size: 3.2 KiB |
Reference in New Issue
Block a user