diff --git a/channels/altadefinizionecommunity.py b/channels/altadefinizionecommunity.py index c9169444..3a75d587 100644 --- a/channels/altadefinizionecommunity.py +++ b/channels/altadefinizionecommunity.py @@ -130,7 +130,15 @@ def registerOrLogin(): @support.scrape def peliculas(item): json = {} - action = 'check' + + if item.contentType == 'undefined': + disabletmdb = True + action = 'check' + elif item.contentType == 'movie': + action = 'findvideos' + else: + action = 'episodios' + if '/load-more-film' not in item.url and '/search' not in item.url: # generi o altri menu, converto import ast ajax = support.match(item.url, patron='ajax_data\s*=\s*"?\s*([^;]+)', cloudscraper=True).match @@ -139,8 +147,8 @@ def peliculas(item): json = support.httptools.downloadpage(item.url, headers=headers, cloudscraper=True).json data = "\n".join(json['data']) else: - disabletmdb = True - data = support.httptools.downloadpage(item.url, headers=headers, cloudscraper=True).data + json = support.httptools.downloadpage(item.url, headers=headers, cloudscraper=True).json + data = "\n".join(json['data']) patron = r'wrapFilm">\s*\s*(?P[0-9]{4})\s*]+>[^<]+\s*(?P[^<]+).*?]+>\s*

(?P[^<[]+)(?:\[(?P<lang>[sSuUbBiItTaA-]+))?' # paginazione @@ -177,8 +185,10 @@ def genres(item): patronMenu = r'<a href="(?P<url>[^"]+)">(?P<title>[^<]+)' if item.args == 'quality': + item.contentType = 'undefined' patronBlock = r'Risoluzione(?P<block>.*?)</ul>' elif item.args == 'years': + item.contentType = 'undefined' patronBlock = r'ANNO(?P<block>.*?</section>)' else: patronBlock = ('Film' if item.contentType == 'movie' else 'Serie TV') + r'<span></span></a>\s+<ul class="dropdown-menu(?P<block>.*?)active-parent-menu' @@ -197,7 +207,7 @@ def episodios(item): it.infoLabels['season'] = int(spl[0])+1 it.infoLabels['episode'] = int(spl[1])+1 it.url = it.url.replace('/watch-unsubscribed', '/watch-external') - it.title = '{}x{:02d} - {}'.format(it.contentSeason, it.contentEpisodeNumber, it.contentTitle) + it.title = '{}x{:02d} - {}'.format(it.contentSeason, it.contentEpisodeNumber, it.fulltitle) return it return locals() diff --git a/core/support.py b/core/support.py index cca9010a..1f0ebb76 100755 --- a/core/support.py +++ b/core/support.py @@ -227,6 +227,7 @@ def scrapeBlock(item, args, block, patron, headers, action, pagination, debug, t scraped[kk] = val.strip() if type(val) == str else val # episode = re.sub(r'\s-\s|-|x|–|×', 'x', scraped['episode']) if scraped['episode'] else '' + title = cleantitle(scraped.get('title', '')) if group and scraped.get('title', '') in contents and not item.grouped: # same title and grouping enabled continue @@ -391,8 +392,8 @@ def scrapeBlock(item, args, block, patron, headers, action, pagination, debug, t infoLabels=infolabels, thumbnail=item.prevthumb if item.prevthumb else item.thumbnail if not scraped["thumb"] else scraped["thumb"], args=item.args, - contentSerieName= title if 'movie' not in [contentType] and function != 'episodios' else item.contentSerieName, - contentTitle= title if 'movie' in [contentType] and function == 'peliculas' else item.contentTitle, + contentSerieName= title if contentType not in ['movie'] and function != 'episodios' or contentType in ['undefined'] else item.contentSerieName, + contentTitle= title if contentType in ['movie', 'undefined'] and function == 'peliculas' else item.contentTitle, contentLanguage = lang1, contentSeason= infolabels.get('season', ''), contentEpisodeNumber=infolabels.get('episode', ''), diff --git a/core/videolibrarytools.py b/core/videolibrarytools.py index 2daf2093..c2446c29 100644 --- a/core/videolibrarytools.py +++ b/core/videolibrarytools.py @@ -952,7 +952,7 @@ def get_local_content(path): 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) + return add_tvshow(item, channel, itemlist) else: return add_movie(item) @@ -998,7 +998,7 @@ def add_movie(item): config.get_localized_string(60066) % new_item.contentTitle) # "ERROR, the movie has NOT been added to the video library") -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. @@ -1060,7 +1060,7 @@ def add_tvshow(item, channel=None): # Get the episode list # from core.support import dbg;dbg() - itemlist = getattr(channel, item.action)(item) + if not itemlist: itemlist = getattr(channel, item.action)(item) if itemlist and not scrapertools.find_single_match(itemlist[0].title, r'[Ss]?(\d+)(?:x|_|\s+)[Ee]?[Pp]?(\d+)'): from platformcode.autorenumber import start, check if not check(item):