diff --git a/channels/cineblog01.py b/channels/cineblog01.py index 861fa864..472c1404 100644 --- a/channels/cineblog01.py +++ b/channels/cineblog01.py @@ -152,7 +152,7 @@ def peliculas(item): action = 'findvideos' else: # debug = True - patron = r'div class="card-image">.*?(?P.*?)(?:&#.*?)?(?P<lang>(?:[Ss][Uu][Bb]-)?[Ii][Tt][Aa])?<\/a>.*?(?:<strong><span style="[^"]+">(?P<genre>[^<>0-9(]+)\((?P<year>[0-9]{4}).*?</(?:p|div)>(?P<plot>.*?))?</div' + patron = r'div class="card-image">.*?<img src="(?P<thumb>[^ ]+)" alt.*?<a href="(?P<url>[^ >]+)">(?P<title>.*?)(?P<lang>(?:[Ss][Uu][Bb]-)?[Ii][Tt][Aa])?<\/a>.*?(?:<strong><span style="[^"]+">(?P<genre>[^<>0-9(]+)\((?P<year>[0-9]{4}).*?</(?:p|div)>(?P<plot>.*?))?</div' action = 'episodios' item.contentType = 'tvshow' @@ -169,30 +169,26 @@ def episodios(item): patronBlock = r'(?P<block><div class="sp-head[a-z ]*?" title="Espandi">\s*(?:STAGION[EI]\s*(?:DA\s*[0-9]+\s*A)?\s*[0-9]+|MINISERIE) - (?P<lang>[^-<]+)(?:- (?P<quality>[^-<]+))?.*?[^<>]*?<\/div>.*?)<div class="spdiv">\[riduci\]<\/div>' # patron = '(?:<p>|<strong>)(?P<episode>[0-9]+(?:×|×)[0-9]+)\s*(?P<title2>[^&<]*)?(?:–|-)?\s*(?P<url>.*?)(?:<\/p>|<br)' patron = r'(?:/>|<p>|<strong>)(?P<url>.*?(?P<episode>[0-9]+(?:×|×)[0-9]+)\s*(?P<title2>.*?)?(?:\s*–|\s*-|\s*<).*?)(?:<\/p>|<br)' - def fullItemlistHook(itemlist): + def itemlistHook(itemlist): title_dict = {} itlist = [] - special_list = [] for item in itemlist: item.title = re.sub(r'\.(\D)',' \\1', item.title) - if re.sub(r'(\[[^\]]+\])','',item.title) in [config.get_localized_string(30161),config.get_localized_string(60355),config.get_localized_string(60357)]: - special_list.append(item) + match = support.match(item.title, patron=r'(\d+.\d+)').match.replace('x','') + item.order = match + if match not in title_dict: + title_dict[match] = item + elif match in title_dict and item.contentLanguage == title_dict[match].contentLanguage \ + or item.contentLanguage == 'ITA' and not title_dict[match].contentLanguage \ + or title_dict[match].contentLanguage == 'ITA' and not item.contentLanguage: + title_dict[match].url = item.url else: - match = support.match(item.title, patron=r'(\d+.\d+)').match.replace('x','') - item.order = match - if match not in title_dict: - title_dict[match] = item - elif match in title_dict and item.contentLanguage == title_dict[match].contentLanguage \ - or item.contentLanguage == 'ITA' and not title_dict[match].contentLanguage \ - or title_dict[match].contentLanguage == 'ITA' and not item.contentLanguage: - title_dict[match].url = item.url - else: - title_dict[match + '1'] = item + title_dict[match + '1'] = item for key, value in title_dict.items(): itlist.append(value) - return sorted(itlist, key=lambda it: (it.contentLanguage, int(it.order))) + special_list + return sorted(itlist, key=lambda it: (it.contentLanguage, int(it.order))) return locals() diff --git a/core/support.py b/core/support.py index 817b9f74..4973bb60 100755 --- a/core/support.py +++ b/core/support.py @@ -301,7 +301,7 @@ def scrapeBlock(item, args, block, patron, headers, action, pagination, debug, t infoLabels=infolabels, thumbnail=item.thumbnail if function == 'episodios' and not scraped["thumb"] else scraped["thumb"] if scraped["thumb"] else '', args=item.args, - contentSerieName= scraped['title'] if item.contentType or CT != 'movie' and function != 'episodios' else item.fulltitle if function == 'episodios' else '', + contentSerieName= scraped['title'] if scraped['title'] else item.fulltitle if item.contentType or CT != 'movie' and function != 'episodios' else item.fulltitle if function == 'episodios' else '', contentTitle= scraped['title'] if item.contentType or CT == 'movie' else '', contentLanguage = lang1, contentEpisodeNumber=episode if episode else '', @@ -963,6 +963,13 @@ def videolibrary(itemlist, item, typography='', function_level=1, function=''): contentType = 'tvshow' function = function if function else inspect.stack()[function_level][3] + # go up until find findvideos/episodios + while function not in ['findvideos', 'episodios']: + function_level += 1 + try: + function = inspect.stack()[function_level][3] + except: + break if not typography: typography = 'color kod bold'