Altadefinizione Click e aggiungi alla videoteca per contentTpe non definiti

This commit is contained in:
Alhaziel01
2021-07-06 10:04:54 +02:00
parent 3103864308
commit 4db8d3a388
6 changed files with 41 additions and 44 deletions

View File

@@ -5,6 +5,7 @@
"language": ["ita","sub-ita"],
"thumbnail": "altadefinizioneclick.png",
"bannermenu": "altadefinizioneciclk.png",
"categories": ["movie","vos"],
"categories": ["tvshow","movie","vos"],
"not_active":["include_in_newest_series"],
"settings": []
}

View File

@@ -2,22 +2,7 @@
# ------------------------------------------------------------
# Canale per altadefinizioneclick
# ----------------------------------------------------------
"""
Eccezioni che non superano il test del canale:
- indicare le eccezioni
Novità. Indicare in quale/i sezione/i è presente il canale:
- film
Avvisi:
- Eventuali avvisi per i tester
Ulteriori info:
"""
from platformcode.logger import debug
from platformcode import logger
from core import support
from core.item import Item
from platformcode import config
@@ -67,13 +52,13 @@ def peliculas(item):
if not item.args:
patronBlock = r'(?:ULTIMI INSERITI|Serie TV)(?P<block>.*?)</section'
# nella pagina "CERCA", la voce "SUCCESSIVO" apre la maschera di inserimento dati
patronNext = r'<a class="next page-numbers" href="([^"]+)">'
return locals()
@support.scrape
def genres(item):
item.contentType = 'undefined'
action = 'peliculas'
patronMenu = r'<li><a href="(?P<url>[^"]+)">(?P<title>[^<]+)<'
@@ -141,8 +126,6 @@ def check(item):
data = ''
episodes = support.match(pageData if pageData else seas_url, patronBlock=patron_episode, patron=patron_option).matches
for episode_url, episode in episodes:
# episode_url = support.urlparse.urljoin(item.url, episode_url)
# if '-' in episode: episode = episode.split('-')[0].zfill(2) + 'x' + episode.split('-')[1].zfill(2)
title = season + "x" + episode.zfill(2) + ' - ' + item.fulltitle
data += title + '|' + episode_url + '\n'
return data
@@ -151,10 +134,11 @@ def check(item):
patron_episode = '<div class="[^"]+" id="episodesModal"[^>]+>(.*?)</ul>'
patron_option = r'<a href="([^"]+?)".*?>(?:Stagione |Episodio )([^<]+?)</a>'
url = support.match(item, patron=r'<iframe id="iframeVid" width="[^"]+" height="[^"]+" src="([^"]+)" allowfullscreen').match
seasons = support.match(url, patronBlock=patron_season, patron=patron_option)
url = support.match(item, patron=r'<iframe id="iframeVid" width="[^"]+" height="[^"]+" src="([^"]+)" allowfullscreen')
seasons = support.match(url.match, patronBlock=patron_season, patron=patron_option)
if not seasons.match:
item.contentType = 'tvshow'
item.data = url.data
return findvideos(item)
data = ''
@@ -186,10 +170,7 @@ def episodios(item):
return locals()
def findvideos(item):
support.info('findvideos', item)
return support.hdpass_get_servers(item)
logger.debug()
return support.hdpass_get_servers(item, item.data)
def play(item):
if 'hdpass' in item.url:
return support.hdpass_get_url(item)
return [item]

View File

@@ -25,7 +25,7 @@ from platformcode.logger import info
from platformcode import logger
def hdpass_get_servers(item):
def hdpass_get_servers(item, data=''):
def get_hosts(url, quality):
ret = []
page = httptools.downloadpage(url, CF=False).data
@@ -43,7 +43,8 @@ def hdpass_get_servers(item):
itemlist = []
if 'hdpass' in item.url or 'hdplayer' in item.url: url = item.url
else:
data = httptools.downloadpage(item.url, CF=False).data.replace('\n', '')
if not data:
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", "")

View File

@@ -682,9 +682,12 @@ def save_episodes(item, episodelist, extra_info, host, local_files, silent=False
def add_to_videolibrary(item, channel):
itemlist = getattr(channel, item.from_action)(item)
if itemlist and itemlist[0].contentType == 'episode':
return add_tvshow(item, channel)
else:
return add_tvshow(item, itemlist)
elif itemlist and itemlist[0].server:
return add_movie(item)
else:
videolibrarydb.close()
platformtools.dialog_ok(config.get_localized_string(30131), config.get_localized_string(70838) % item.contentTitle)
def add_movie(item):
@@ -703,7 +706,8 @@ def add_movie(item):
@param item: item to be saved.
"""
logger.debug()
from platformcode.launcher import set_search_temp; set_search_temp(item)
item.contentType = 'movie'
# from platformcode.launcher import set_search_temp; set_search_temp(item)
# To disambiguate titles, TMDB is caused to ask for the really desired title
# The user can select the title among those offered on the first screen
@@ -731,7 +735,7 @@ def add_movie(item):
videolibrarydb.close()
def add_tvshow(item, channel=None):
def add_tvshow(item, channel=None, itemlist=[]):
"""
Save content in the series library. This content can be one of these two:
- The series with all the chapters included in the episodelist.
@@ -753,7 +757,8 @@ def add_tvshow(item, channel=None):
"""
logger.debug("show=#" + item.show + "#")
from platformcode.launcher import set_search_temp; set_search_temp(item)
item.contentType = 'tvshow'
# from platformcode.launcher import set_search_temp; set_search_temp(item)
if item.channel == "downloads":
itemlist = [item.clone()]
@@ -792,7 +797,8 @@ def add_tvshow(item, channel=None):
# Get the episode list
it = item.clone()
itemlist = getattr(channel, it.action)(it)
if not itemlist:
itemlist = getattr(channel, it.action)(it)
item.host = channel.host
if itemlist:
from platformcode.autorenumber import start, check
@@ -818,24 +824,24 @@ def add_tvshow(item, channel=None):
elif not inserted and not overwritten and not failed:
filetools.rmdirtree(path)
platformtools.dialog_ok(config.get_localized_string(30131), config.get_localized_string(60067) % item.show)
logger.error("The string %s could not be added to the video library. Could not get any episode" % item.show)
platformtools.dialog_ok(config.get_localized_string(30131), config.get_localized_string(60067) % item.contentTitle)
logger.error("The string %s could not be added to the video library. Could not get any episode" % item.contentTitle)
elif failed == -1:
filetools.rmdirtree(path)
platformtools.dialog_ok(config.get_localized_string(30131), config.get_localized_string(60068) % item.show)
logger.error("The string %s could not be added to the video library" % item.show)
platformtools.dialog_ok(config.get_localized_string(30131), config.get_localized_string(60068) % item.contentTitle)
logger.error("The string %s could not be added to the video library" % item.contentTitle)
elif failed == -2:
filetools.rmdirtree(path)
elif failed > 0:
platformtools.dialog_ok(config.get_localized_string(30131), config.get_localized_string(60069) % item.show)
logger.error("Could not add %s episodes of series %s to the video library" % (failed, item.show))
platformtools.dialog_ok(config.get_localized_string(30131), config.get_localized_string(60069) % item.contentTitle)
logger.error("Could not add %s episodes of series %s to the video library" % (failed, item.contentTitle))
else:
platformtools.dialog_notification(config.get_localized_string(30131), config.get_localized_string(60070) % item.show)
logger.debug("%s episodes of series %s have been added to the video library" % (inserted, item.show))
platformtools.dialog_notification(config.get_localized_string(30131), config.get_localized_string(60070) % item.contentTitle)
logger.debug("%s episodes of series %s have been added to the video library" % (inserted, item.contentTitle))
if config.is_xbmc():
if config.get_setting("sync_trakt_new_tvshow", "videolibrary"):
import xbmc

View File

@@ -6163,6 +6163,10 @@ msgctxt "#70837"
msgid "Enable/Disable Channels"
msgstr ""
msgctxt "#70838"
msgid "There are no valid content for: %s"
msgstr ""
# DNS start [ settings and declaration ]
msgctxt "#707401"
msgid "Enable DNS check alert"

View File

@@ -6164,6 +6164,10 @@ msgctxt "#70837"
msgid "Enable/Disable Channels"
msgstr "Abilita/Disabilita Canali"
msgctxt "#70838"
msgid "There are no valid content for: %s"
msgstr "Non ci sono contenti validi per: %s"
# DNS start [ settings and declaration ]
msgctxt "#707401"
msgid "Enable DNS check alert"