toonitalia: fix channel
This commit is contained in:
+15
-18
@@ -3,8 +3,7 @@
|
|||||||
# Canale per ToonItalia
|
# Canale per ToonItalia
|
||||||
# ------------------------------------------------------------
|
# ------------------------------------------------------------
|
||||||
|
|
||||||
from core import httptools, scrapertools, support
|
from core import scrapertools, support
|
||||||
import inspect
|
|
||||||
|
|
||||||
host = support.config.get_channel_url()
|
host = support.config.get_channel_url()
|
||||||
headers = [['Referer', host]]
|
headers = [['Referer', host]]
|
||||||
@@ -12,20 +11,19 @@ headers = [['Referer', host]]
|
|||||||
|
|
||||||
@support.menu
|
@support.menu
|
||||||
def mainlist(item):
|
def mainlist(item):
|
||||||
|
menu = [('Anime',['/category/anime', 'peliculas', '', 'undefined']),
|
||||||
anime =['/category/anime',
|
('Anime ITA {submenu}',['/anime-ita', 'peliculas', 'list', 'undefined']),
|
||||||
('ITA',['/lista-anime-ita','peliculas',]),
|
('Anime Sub-ITA {submenu}',['/contatti', 'peliculas', 'list', 'undefined']),
|
||||||
('Sub-ITA',['/lista-anime-sub-ita', 'peliculas'])]
|
('Film Animazione',['/film-animazione', 'peliculas', 'list', 'undefined']),
|
||||||
# ('Film Animati',['/lista-anime-ita','peliculas', '', 'movie'])]
|
('Serie TV',['/serie-tv/', 'peliculas', 'list', 'tvshow'])]
|
||||||
search = ''
|
search = ''
|
||||||
return locals()
|
return locals()
|
||||||
|
|
||||||
|
|
||||||
def search(item, text):
|
def search(item, text):
|
||||||
support.info(text)
|
item.contentType = 'undefined'
|
||||||
# item.args='search'
|
item.url = "{}/?{}".format(host, support.urlencode({"s": text}))
|
||||||
item.text = text
|
support.info(item.url)
|
||||||
item.url = item.url + '/?a=b&s=' + text.replace(' ', '+')
|
|
||||||
|
|
||||||
try:
|
try:
|
||||||
return peliculas(item)
|
return peliculas(item)
|
||||||
@@ -44,16 +42,14 @@ def peliculas(item):
|
|||||||
action = 'check'
|
action = 'check'
|
||||||
|
|
||||||
deflang = 'ITA' if 'sub' not in item.url else 'Sub-ITA'
|
deflang = 'ITA' if 'sub' not in item.url else 'Sub-ITA'
|
||||||
if 'lista' in item.url:
|
if item.args == 'list':
|
||||||
pagination = 20
|
pagination = 20
|
||||||
patron = r'<li><a href="(?P<url>[^"]+)">(?P<title>[^<]+)'
|
patron = r'<li><a href="(?P<url>[^"]+)">(?P<title>[^<]+)'
|
||||||
|
|
||||||
else:
|
else:
|
||||||
patronBlock = '<main[^>]+>(?P<block>.*)</main>'
|
patronBlock = r'<main[^>]+>(?P<block>.*)</main>'
|
||||||
patron = r'(?i)<a href="(?P<url>[^"]+)" rel="bookmark">(?P<title>[^<]+)</a>(:?[^>]+>){3}(?:<img.*?src="(?P<thumb>[^"]+)")?.*?<p>(?P<plot>[^<]+)</p>.*?tag">.*?(?P<type>(?:film|serie|anime))(?P<cat>.*?)</span>'
|
patron = r'class="entry-title[^>]+><a href="(?P<url>[^"]+)">(?P<title>[^<]+)</a>.*?<p>(?P<plot>[^<]+)'
|
||||||
typeContentDict={'movie':['film']}
|
patronNext = r'<a class="next page-numbers" href="([^"]+)">'
|
||||||
typeActionDict={'findvideos':['film']}
|
|
||||||
patronNext = '<a class="next page-numbers" href="([^"]+)">'
|
|
||||||
|
|
||||||
def itemHook(item):
|
def itemHook(item):
|
||||||
support.info(item.title)
|
support.info(item.title)
|
||||||
@@ -74,7 +70,8 @@ def check(item):
|
|||||||
@support.scrape
|
@support.scrape
|
||||||
def episodios(item):
|
def episodios(item):
|
||||||
anime = True
|
anime = True
|
||||||
patron = r'>\s*(?:(?P<season>\d+)(?:×|x|×))?(?P<episode>\d+)(?:\s+–\s+)?[ –]+(?P<title2>[^<]+)[ –]+<a (?P<data>.*?)(?:<br|</p)'
|
item.contentType = 'tvshow'
|
||||||
|
patron = r'>\s*(?:(?P<season>\d+)(?:×|x|×))?(?P<episode>\d+)(?:\s+–\s+)?[ –]+(?P<title>[^<]+)[ –]+<a (?P<data>.*?)(?:<br|</p)'
|
||||||
return locals()
|
return locals()
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
+1
-1
@@ -709,7 +709,7 @@ class UnshortenIt(object):
|
|||||||
return httptools.downloadpage(uri, only_headers=True, follow_redirects=False).headers.get('location', uri), 200
|
return httptools.downloadpage(uri, only_headers=True, follow_redirects=False).headers.get('location', uri), 200
|
||||||
|
|
||||||
def _unshorten_uprot(self, uri):
|
def _unshorten_uprot(self, uri):
|
||||||
html = httptools.downloadpage(uri, cloudscraper=True).data
|
html = httptools.downloadpage(uri, cloudscraper=False).data
|
||||||
link = scrapertools.find_single_match(html, r'--></button></[a|div]?>.+?<a[^>]+href="([^"]+)">')
|
link = scrapertools.find_single_match(html, r'--></button></[a|div]?>.+?<a[^>]+href="([^"]+)">')
|
||||||
if link != uri:
|
if link != uri:
|
||||||
return link, 200
|
return link, 200
|
||||||
|
|||||||
@@ -340,7 +340,11 @@ def render_items(itemlist, parent_item):
|
|||||||
def setItem(n, item, parent_item):
|
def setItem(n, item, parent_item):
|
||||||
item.itemlistPosition = n
|
item.itemlistPosition = n
|
||||||
item_url = item.tourl()
|
item_url = item.tourl()
|
||||||
|
if item.thumbnail == parent_item.thumbnail and parent_item.action in ['peliculas', 'search']:
|
||||||
|
if item.contentType in ['movie', 'undefined']:
|
||||||
|
item.thumbnail = 'https://raw.githubusercontent.com/kodiondemand/media/master/null/movie.png'
|
||||||
|
else:
|
||||||
|
item.thumbnail = 'https://raw.githubusercontent.com/kodiondemand/media/master/null/tv.png'
|
||||||
if item.category == "":
|
if item.category == "":
|
||||||
item.category = parent_item.category
|
item.category = parent_item.category
|
||||||
# If there is no action or it is findvideos / play, folder = False because no listing will be returned
|
# If there is no action or it is findvideos / play, folder = False because no listing will be returned
|
||||||
@@ -484,7 +488,7 @@ def getCurrentView(item=None, parent_item=None):
|
|||||||
elif item.contentType == 'music':
|
elif item.contentType == 'music':
|
||||||
return 'musicvideo', 'musicvideos'
|
return 'musicvideo', 'musicvideos'
|
||||||
|
|
||||||
elif (item.contentType in ['movie'] and parent_item.action in parent_actions) \
|
elif (item.contentType in ['movie', 'undefined'] and parent_item.action in parent_actions) \
|
||||||
or (item.channel in ['videolibrary'] and parent_item.action in ['list_movies']) \
|
or (item.channel in ['videolibrary'] and parent_item.action in ['list_movies']) \
|
||||||
or (parent_item.channel in ['favorites'] and parent_item.action in ['mainlist']) \
|
or (parent_item.channel in ['favorites'] and parent_item.action in ['mainlist']) \
|
||||||
or parent_item.action in ['now_on_tv', 'now_on_misc', 'now_on_misc_film', 'mostrar_perfil', 'live', 'replay', 'news']:
|
or parent_item.action in ['now_on_tv', 'now_on_misc', 'now_on_misc_film', 'mostrar_perfil', 'live', 'replay', 'news']:
|
||||||
@@ -1658,7 +1662,7 @@ def resume_playback(played_time):
|
|||||||
|
|
||||||
|
|
||||||
if played_time and played_time > 30:
|
if played_time and played_time > 30:
|
||||||
if config.get_setting('resume_menu') == 0:
|
if config.get_setting('resume_menu') == 0: # Resume Menu matches Custom Theme
|
||||||
Dialog = ResumePlayback('ResumePlayback.xml', config.get_runtime_path(), played_time=played_time)
|
Dialog = ResumePlayback('ResumePlayback.xml', config.get_runtime_path(), played_time=played_time)
|
||||||
Dialog.show()
|
Dialog.show()
|
||||||
t = 0
|
t = 0
|
||||||
@@ -1666,7 +1670,7 @@ def resume_playback(played_time):
|
|||||||
t += 1
|
t += 1
|
||||||
xbmc.sleep(100)
|
xbmc.sleep(100)
|
||||||
if not Dialog.Resume: played_time = 0
|
if not Dialog.Resume: played_time = 0
|
||||||
else:
|
else: # Resume Menu matches Skin Theme
|
||||||
m, s = divmod(played_time, 60)
|
m, s = divmod(played_time, 60)
|
||||||
h, m = divmod(m, 60)
|
h, m = divmod(m, 60)
|
||||||
idx = xbmcgui.Dialog().contextmenu(
|
idx = xbmcgui.Dialog().contextmenu(
|
||||||
@@ -1674,7 +1678,10 @@ def resume_playback(played_time):
|
|||||||
xbmc.getLocalizedString(12022).format('%02d:%02d:%02d' % (h, m, s)),
|
xbmc.getLocalizedString(12022).format('%02d:%02d:%02d' % (h, m, s)),
|
||||||
xbmc.getLocalizedString(12021)
|
xbmc.getLocalizedString(12021)
|
||||||
])
|
])
|
||||||
if idx in [-1, 0]: played_time = 0
|
# if the dialog is skipped (idx == -1)
|
||||||
|
# or the second item is selected (idx == 1)
|
||||||
|
# resume from the beginning
|
||||||
|
if idx in [-1, 1]: played_time = 0
|
||||||
|
|
||||||
else: played_time = 0
|
else: played_time = 0
|
||||||
xbmc.sleep(300)
|
xbmc.sleep(300)
|
||||||
|
|||||||
Reference in New Issue
Block a user