Fix Support
This commit is contained in:
+16
-12
@@ -157,7 +157,8 @@ def scrapeLang(scraped, lang, longtitle):
|
|||||||
return language, longtitle
|
return language, longtitle
|
||||||
|
|
||||||
def cleantitle(title):
|
def cleantitle(title):
|
||||||
cleantitle = scrapertools.htmlclean(scrapertools.decodeHtmlentities(title).replace('"', "'").replace('×', 'x').replace('–', '-')).strip()
|
if type(title) != str: title.decode('UTF-8')
|
||||||
|
cleantitle = title.replace('"', "'").replace('×', 'x').replace('–', '-').strip()
|
||||||
return cleantitle
|
return cleantitle
|
||||||
|
|
||||||
def scrapeBlock(item, args, block, patron, headers, action, pagination, debug, typeContentDict, typeActionDict, blacklist, search, pag, function, lang):
|
def scrapeBlock(item, args, block, patron, headers, action, pagination, debug, typeContentDict, typeActionDict, blacklist, search, pag, function, lang):
|
||||||
@@ -192,16 +193,17 @@ def scrapeBlock(item, args, block, patron, headers, action, pagination, debug, t
|
|||||||
for i, match in enumerate(matches):
|
for i, match in enumerate(matches):
|
||||||
if pagination and (pag - 1) * pagination > i and not search: continue # pagination
|
if pagination and (pag - 1) * pagination > i and not search: continue # pagination
|
||||||
if pagination and i >= pag * pagination and not search: break # pagination
|
if pagination and i >= pag * pagination and not search: break # pagination
|
||||||
listGroups = match.keys()
|
# listGroups = match.keys()
|
||||||
match = match.values()
|
# match = match.values()
|
||||||
|
|
||||||
if len(listGroups) > len(match): # to fix a bug
|
# if len(listGroups) > len(match): # to fix a bug
|
||||||
match = list(match)
|
# match = list(match)
|
||||||
match.extend([''] * (len(listGroups) - len(match)))
|
# match.extend([''] * (len(listGroups) - len(match)))
|
||||||
|
|
||||||
scraped = {}
|
scraped = {}
|
||||||
for kk in known_keys:
|
for kk in known_keys:
|
||||||
val = match[listGroups.index(kk)] if kk in listGroups else ''
|
val = match[kk] if kk in match else ''
|
||||||
|
# val = match[listGroups.index(kk)] if kk in listGroups else ''
|
||||||
if val and (kk == "url" or kk == 'thumb') and 'http' not in val:
|
if val and (kk == "url" or kk == 'thumb') and 'http' not in val:
|
||||||
val = scrapertools.find_single_match(item.url, 'https?://[a-z0-9.-]+') + (val if val.startswith('/') else '/' + val)
|
val = scrapertools.find_single_match(item.url, 'https?://[a-z0-9.-]+') + (val if val.startswith('/') else '/' + val)
|
||||||
scraped[kk] = val
|
scraped[kk] = val
|
||||||
@@ -294,8 +296,10 @@ def scrapeBlock(item, args, block, patron, headers, action, pagination, debug, t
|
|||||||
other = scraped['other'] if scraped['other'] else ''
|
other = scraped['other'] if scraped['other'] else ''
|
||||||
)
|
)
|
||||||
|
|
||||||
for lg in list(set(listGroups).difference(known_keys)):
|
# for lg in list(set(listGroups).difference(known_keys)):
|
||||||
it.__setattr__(lg, match[listGroups.index(lg)])
|
# it.__setattr__(lg, match[listGroups.index(lg)])
|
||||||
|
for lg in list(set(match.keys()).difference(known_keys)):
|
||||||
|
it.__setattr__(lg, match[lg])
|
||||||
|
|
||||||
if 'itemHook' in args:
|
if 'itemHook' in args:
|
||||||
it = args['itemHook'](it)
|
it = args['itemHook'](it)
|
||||||
@@ -744,7 +748,7 @@ def typo(string, typography=''):
|
|||||||
if '{}' in string:
|
if '{}' in string:
|
||||||
string = '{' + re.sub(r'\s\{\}','',string) + '}'
|
string = '{' + re.sub(r'\s\{\}','',string) + '}'
|
||||||
if 'submenu' in string:
|
if 'submenu' in string:
|
||||||
string = u"\u2022\u2022 ".encode('utf-8') + re.sub(r'\ssubmenu','',string)
|
string = "•• " + re.sub(r'\ssubmenu','',string)
|
||||||
if 'color' in string:
|
if 'color' in string:
|
||||||
color = scrapertools.find_single_match(string, 'color ([a-z]+)')
|
color = scrapertools.find_single_match(string, 'color ([a-z]+)')
|
||||||
if color == 'kod' or '': color = kod_color
|
if color == 'kod' or '': color = kod_color
|
||||||
@@ -758,7 +762,7 @@ def typo(string, typography=''):
|
|||||||
if '--' in string:
|
if '--' in string:
|
||||||
string = ' - ' + re.sub(r'\s--','',string)
|
string = ' - ' + re.sub(r'\s--','',string)
|
||||||
if 'bullet' in string:
|
if 'bullet' in string:
|
||||||
string = '[B]' + u"\u2022".encode('utf-8') + '[/B] ' + re.sub(r'\sbullet','',string)
|
string = '[B]' + "•" + '[/B] ' + re.sub(r'\sbullet','',string)
|
||||||
|
|
||||||
return string
|
return string
|
||||||
|
|
||||||
@@ -1064,7 +1068,7 @@ def controls(itemlist, item, AutoPlay=True, CheckLinks=True, down_load=True):
|
|||||||
channel_node = autoplay_node.get(item.channel, {})
|
channel_node = autoplay_node.get(item.channel, {})
|
||||||
settings_node = channel_node.get('settings', {})
|
settings_node = channel_node.get('settings', {})
|
||||||
AP = get_setting('autoplay') or settings_node['active']
|
AP = get_setting('autoplay') or settings_node['active']
|
||||||
HS = config.get_setting('hide_servers') or (settings_node['hide_servers'] if settings_node.has_key('hide_server') else False)
|
HS = config.get_setting('hide_servers') or (settings_node['hide_servers'] if 'hide_server' in settings_node else False)
|
||||||
|
|
||||||
if CL and not AP:
|
if CL and not AP:
|
||||||
if get_setting('checklinks', item.channel):
|
if get_setting('checklinks', item.channel):
|
||||||
|
|||||||
Reference in New Issue
Block a user