This commit is contained in:
marco
2020-04-04 20:09:11 +02:00
parent 01f1beaecf
commit 01ec31624f
5 changed files with 35 additions and 35 deletions
+2 -3
View File
@@ -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")
+3 -4
View File
@@ -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:
+1
View File
@@ -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'))
+1 -1
View File
@@ -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
+28 -27
View File
@@ -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))
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))