diff --git a/channels/cineblog01.py b/channels/cineblog01.py index 98cb0c8d..fdce9082 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 b92267dd..23ad1130 100755 --- a/core/support.py +++ b/core/support.py @@ -297,7 +297,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 '', @@ -970,6 +970,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' diff --git a/platformcode/platformtools.py b/platformcode/platformtools.py index 866f055e..9eae8de5 100644 --- a/platformcode/platformtools.py +++ b/platformcode/platformtools.py @@ -627,43 +627,6 @@ def set_context_commands(item, item_url, parent_item, **kwargs): else: context = [] - # if config.get_setting("faster_item_serialization"): - # # logger.info("Reducing serialization!") - # itemBK = item - # item = Item() - # item.action = itemBK.action - # item.channel = itemBK.channel - # infoLabels = {} - # if itemBK.infoLabels["year"]: infoLabels["year"] = itemBK.infoLabels["year"] - # if itemBK.infoLabels["imdb_id"]: infoLabels["imdb_id"] = itemBK.infoLabels["imdb_id"] - # if itemBK.infoLabels["tmdb_id"]: infoLabels["tmdb_id"] = itemBK.infoLabels["tmdb_id"] - # if itemBK.infoLabels["tvdb_id"]: infoLabels["tvdb_id"] = itemBK.infoLabels["tvdb_id"] - # if itemBK.infoLabels["noscrap_id"]: infoLabels["noscrap_id"] = itemBK.infoLabels["noscrap_id"] - # if len(infoLabels) > 0: item.infoLabels = infoLabels - # - # if itemBK.thumbnail: item.thumbnail = itemBK.thumbnail - # if itemBK.extra: item.extra = itemBK.extra - # if itemBK.contentEpisodeNumber: item.contentEpisodeNumber = itemBK.contentEpisodeNumber - # if itemBK.contentEpisodeTitle: item.contentEpisodeTitle = itemBK.contentEpisodeTitle - # if itemBK.contentPlot: item.contentPlot = itemBK.contentPlot - # if itemBK.contentQuality: item.contentQuality = itemBK.contentQuality - # if itemBK.contentSeason: item.contentSeason = itemBK.contentSeason - # if itemBK.contentSerieName: item.contentSerieName = itemBK.contentSerieName - # if itemBK.contentThumbnail: item.contentThumbnail = itemBK.contentThumbnail - # if itemBK.contentTitle: item.contentTitle = itemBK.contentTitle - # if itemBK.contentType: item.contentType = itemBK.contentType - # if itemBK.duration: item.duration = itemBK.duration - # if itemBK.plot: item.plot = itemBK.plot - # if itemBK.quality: item.quality = itemBK.quality - # if itemBK.show: item.show = itemBK.show - # if itemBK.title: item.title = itemBK.title - # if itemBK.viewcontent: item.viewcontent = itemBK.viewcontent - - # itemJson = item.tojson() - # logger.info("Elemento: {0} bytes".format(len(itemJson))) - # logger.info(itemJson) - # logger.info("--------------------------------------------------------------") - # Opciones segun item.context for command in context: # Predefinidos @@ -813,7 +776,7 @@ def set_context_commands(item, item_url, parent_item, **kwargs): # Descargar pelicula if item.contentType == "movie": context_commands.append((config.get_localized_string(60354), "XBMC.RunPlugin(%s?%s&%s)" % - (sys.argv[0], item_url, 'channel=downloads&action=save_download&from_channel=' + item.channel + 'from_action=' + item.action))) + (sys.argv[0], item_url, 'channel=downloads&action=save_download&from_channel=' + item.channel + '&from_action=' + item.action))) elif item.contentSerieName: # Descargar serie