From 01ec31624f62e4d04338f9281cbfb03b55a14c08 Mon Sep 17 00:00:00 2001 From: marco Date: Sat, 4 Apr 2020 20:09:11 +0200 Subject: [PATCH] fix vari --- core/item.py | 5 ++-- core/support.py | 7 ++--- platformcode/launcher.py | 1 + platformcode/platformtools.py | 2 +- specials/videolibrary.py | 55 ++++++++++++++++++----------------- 5 files changed, 35 insertions(+), 35 deletions(-) diff --git a/core/item.py b/core/item.py index 1476af22..5ab216ea 100644 --- a/core/item.py +++ b/core/item.py @@ -13,10 +13,9 @@ if PY3: #from future import standard_library #standard_library.install_aliases() import urllib.parse as urllib # Es muy lento en PY2. En PY3 es nativo - from html.parser import HTMLParser else: import urllib # Usamos el nativo de PY2 que es más rápido - from HTMLParser import HTMLParser +from core.scrapertools import unescape import base64 import copy @@ -454,7 +453,7 @@ class Item(object): """ try: unicode_title = unicode(value, "utf8", "ignore") - return HTMLParser().unescape(unicode_title).encode("utf8") + return unescape(unicode_title).encode("utf8") except: if PY3 and isinstance(value, bytes): value = value.decode("utf8") diff --git a/core/support.py b/core/support.py index c303551c..b92267dd 100755 --- a/core/support.py +++ b/core/support.py @@ -171,11 +171,10 @@ def cleantitle(title): def scrapeBlock(item, args, block, patron, headers, action, pagination, debug, typeContentDict, typeActionDict, blacklist, search, pag, function, lang): itemlist = [] log("scrapeBlock qui") - matches = scrapertools.find_multiple_matches_groups(block, patron) - log('MATCHES =', matches) - if debug: regexDbg(item, patron, headers, block) + matches = scrapertools.find_multiple_matches_groups(block, patron) + log('MATCHES =', matches) known_keys = ['url', 'title', 'title2', 'season', 'episode', 'thumb', 'quality', 'year', 'plot', 'duration', 'genere', 'rating', 'type', 'lang', 'other'] # Legenda known_keys per i groups nei patron @@ -259,7 +258,7 @@ def scrapeBlock(item, args, block, patron, headers, action, pagination, debug, t infolabels['plot'] = plot if scraped['duration']: matches = scrapertools.find_multiple_matches(scraped['duration'], - r'([0-9])\s*?(?:[hH]|:|\.|,|\\|\/|\||\s)\s*?([0-9]+)') + r'([0-9])\s*?(?:[hH]|:|\.|,|\\|\/|\||\s)\s*?([0-9]+)') for h, m in matches: scraped['duration'] = int(h) * 60 + int(m) if not matches: diff --git a/platformcode/launcher.py b/platformcode/launcher.py index e5cda794..a377e863 100644 --- a/platformcode/launcher.py +++ b/platformcode/launcher.py @@ -481,6 +481,7 @@ def play_from_library(item): @type item: item @param item: elemento con información """ + item.fromLibrary = True logger.info() # logger.debug("item: \n" + item.tostring('\n')) diff --git a/platformcode/platformtools.py b/platformcode/platformtools.py index 27b9d210..866f055e 100644 --- a/platformcode/platformtools.py +++ b/platformcode/platformtools.py @@ -813,7 +813,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 diff --git a/specials/videolibrary.py b/specials/videolibrary.py index 476ea7fc..40173610 100644 --- a/specials/videolibrary.py +++ b/specials/videolibrary.py @@ -1086,31 +1086,32 @@ def check_tvshow_playcount(item, season): def add_download_items(item, itemlist): - downloadItem = Item(channel='downloads', - from_channel=item.channel, - title=typo(config.get_localized_string(60355), "color kod bold"), - fulltitle=item.fulltitle, - show=item.fulltitle, - contentType=item.contentType, - contentSerieName=item.contentSerieName, - url=item.url, - action='save_download', - from_action="findvideos", - contentTitle=item.contentTitle, - path=item.path, - thumbnail=thumb(thumb='downloads.png'), - parent=item.tourl()) - if item.action == 'findvideos': - if item.contentType == 'episode': - downloadItem.title = typo(config.get_localized_string(60356), "color kod bold") - else: # film - downloadItem.title = typo(config.get_localized_string(60354), "color kod bold") - downloadItem.downloadItemlist = [i.tourl() for i in itemlist] - itemlist.append(downloadItem) - else: - if item.contentSeason: # season - downloadItem.title = typo(config.get_localized_string(60357), "color kod bold") + if not item.fromLibrary: + downloadItem = Item(channel='downloads', + from_channel=item.channel, + title=typo(config.get_localized_string(60355), "color kod bold"), + fulltitle=item.fulltitle, + show=item.fulltitle, + contentType=item.contentType, + contentSerieName=item.contentSerieName, + url=item.url, + action='save_download', + from_action="findvideos", + contentTitle=item.contentTitle, + path=item.path, + thumbnail=thumb(thumb='downloads.png'), + parent=item.tourl()) + if item.action == 'findvideos': + if item.contentType == 'episode': + downloadItem.title = typo(config.get_localized_string(60356), "color kod bold") + else: # film + downloadItem.title = typo(config.get_localized_string(60354), "color kod bold") + downloadItem.downloadItemlist = [i.tourl() for i in itemlist] itemlist.append(downloadItem) - else: # tvshow + not seen - itemlist.append(downloadItem) - itemlist.append(downloadItem.clone(title=typo(config.get_localized_string(60003), "color kod bold"), unseen=True)) \ No newline at end of file + else: + if item.contentSeason: # season + downloadItem.title = typo(config.get_localized_string(60357), "color kod bold") + itemlist.append(downloadItem) + else: # tvshow + not seen + itemlist.append(downloadItem) + itemlist.append(downloadItem.clone(title=typo(config.get_localized_string(60003), "color kod bold"), unseen=True)) \ No newline at end of file