KoD 1.7.1
This commit is contained in:
+21
-171
@@ -39,32 +39,7 @@ def start(itemlist, item):
|
||||
if not config.is_xbmc():
|
||||
return itemlist
|
||||
|
||||
if config.get_setting('autoplay'):
|
||||
url_list_valid = []
|
||||
autoplay_list = []
|
||||
autoplay_b = []
|
||||
favorite_quality = []
|
||||
favorite_servers = []
|
||||
blacklisted_servers = config.get_setting("black_list", server='servers', default = [])
|
||||
favorite_servers = config.get_setting('favorites_servers_list', server='servers', default = [])
|
||||
|
||||
from core import servertools
|
||||
|
||||
servers_list = list(servertools.get_servers_list().items())
|
||||
for server, server_parameters in servers_list:
|
||||
if config.get_setting('favorites_servers_list', server=server) and server.lower() not in favorite_servers:
|
||||
favorite_servers.append(server.lower())
|
||||
|
||||
if not favorite_servers:
|
||||
config.set_setting('favorites_servers_list', [], server='servers')
|
||||
favorite_servers = []
|
||||
else:
|
||||
s_list = []
|
||||
for s in favorite_servers:
|
||||
if s not in blacklisted_servers:
|
||||
s_list.append(s)
|
||||
favorite_servers = s_list
|
||||
|
||||
if config.get_setting('autoplay') or (item.channel == 'community' and item.autoplay):
|
||||
# Save the current value of "Action and Player Mode" in preferences
|
||||
user_config_setting_action = config.get_setting("default_action")
|
||||
# user_config_setting_player = config.get_setting("player_mode")
|
||||
@@ -72,133 +47,12 @@ def start(itemlist, item):
|
||||
# Enable the "View in high quality" action (if the server returns more than one quality, eg gdrive)
|
||||
if not user_config_setting_action: config.set_setting("default_action", 2)
|
||||
|
||||
# if user_config_setting_player != 0: config.set_setting("player_mode", 0)
|
||||
from core.servertools import sort_servers
|
||||
autoplay_list = sort_servers(itemlist)
|
||||
|
||||
# Priorities when ordering itemlist:
|
||||
# 0: Servers and qualities
|
||||
# 1: Qualities and servers
|
||||
# 2: Servers only
|
||||
# 3: Only qualities
|
||||
# 4: Do not order
|
||||
|
||||
if config.get_setting('favorites_servers') and favorite_servers and config.get_setting('default_action'):
|
||||
priority = 0 # 0: Servers and qualities or 1: Qualities and servers
|
||||
elif config.get_setting('favorites_servers') and favorite_servers:
|
||||
priority = 2 # Servers only
|
||||
elif config.get_setting('default_action'):
|
||||
priority = 3 # Only qualities
|
||||
else:
|
||||
priority = 4 # Do not order
|
||||
|
||||
if config.get_setting('default_action') == 1:
|
||||
quality_list.reverse()
|
||||
favorite_quality = quality_list
|
||||
for item in itemlist:
|
||||
autoplay_elem = dict()
|
||||
b_dict = dict()
|
||||
|
||||
# We check that it is a video item
|
||||
if 'server' not in item:
|
||||
continue
|
||||
|
||||
if item.server.lower() in blacklisted_servers:
|
||||
continue
|
||||
|
||||
# If it does not have a defined quality, it assigns a 'default' quality.
|
||||
if item.quality.lower() not in quality_list:
|
||||
item.quality = 'default'
|
||||
# The list for custom settings is created
|
||||
|
||||
if priority < 2: # 0: Servers and qualities or 1: Qualities and servers
|
||||
|
||||
# if the server and the quality are not in the favorites lists or the url is repeated, we discard the item
|
||||
if item.server.lower() not in favorite_servers or item.quality.lower() not in favorite_quality or item.url in url_list_valid:
|
||||
item.type_b = True
|
||||
item.window = base_item.window
|
||||
b_dict['videoitem']= item
|
||||
autoplay_b.append(b_dict)
|
||||
continue
|
||||
autoplay_elem["indice_server"] = favorite_servers.index(item.server.lower())
|
||||
autoplay_elem["indice_quality"] = favorite_quality.index(item.quality.lower())
|
||||
|
||||
elif priority == 2: # Servers only
|
||||
|
||||
# if the server is not in the favorites list or the url is repeated, we discard the item
|
||||
if item.server.lower() not in favorite_servers or item.url in url_list_valid:
|
||||
item.type_b = True
|
||||
item.window = base_item.window
|
||||
b_dict['videoitem'] = item
|
||||
autoplay_b.append(b_dict)
|
||||
continue
|
||||
autoplay_elem["indice_server"] = favorite_servers.index(item.server.lower())
|
||||
|
||||
elif priority == 3: # Only qualities
|
||||
|
||||
# if the quality is not in the favorites list or the url is repeated, we discard the item
|
||||
if item.quality.lower() not in favorite_quality or item.url in url_list_valid:
|
||||
item.type_b = True
|
||||
item.window = base_item.window
|
||||
b_dict['videoitem'] = item
|
||||
autoplay_b.append(b_dict)
|
||||
continue
|
||||
autoplay_elem["indice_quality"] = favorite_quality.index(item.quality.lower())
|
||||
|
||||
else: # Do not order
|
||||
|
||||
# if the url is repeated, we discard the item
|
||||
item.window = base_item.window
|
||||
if item.url in url_list_valid:
|
||||
continue
|
||||
|
||||
# If the item reaches here we add it to the list of valid urls and to autoplay_list
|
||||
url_list_valid.append(item.url)
|
||||
item.plan_b=True
|
||||
item.window = base_item.window
|
||||
autoplay_elem['videoitem'] = item
|
||||
autoplay_list.append(autoplay_elem)
|
||||
|
||||
# We order according to priority
|
||||
if priority == 0: autoplay_list.sort(key=lambda orden: ((orden['indice_server'], orden['indice_quality']))) # Servers and qualities
|
||||
elif priority == 1: autoplay_list.sort(key=lambda orden: (orden['indice_quality'], orden['indice_server'])) # Qualities and servers
|
||||
elif priority == 2: autoplay_list.sort(key=lambda orden: (orden['indice_server'])) # Servers only
|
||||
elif priority == 3: autoplay_list.sort(key=lambda orden: (orden['indice_quality'])) # Only qualities
|
||||
|
||||
logger.debug('PRIORITY',priority, autoplay_list)
|
||||
|
||||
# if quality priority is active
|
||||
if priority == 0 and config.get_setting('quality_priority'):
|
||||
max_quality = autoplay_list[0]["indice_quality"] if autoplay_list and "indice_quality" in autoplay_list[0] else 0
|
||||
for n, item in enumerate(itemlist):
|
||||
if 'server' not in item:
|
||||
continue
|
||||
|
||||
if item.server.lower() in blacklisted_servers:
|
||||
continue
|
||||
|
||||
# If it does not have a defined quality, it assigns a 'default' quality.
|
||||
if item.quality == '':
|
||||
item.quality = 'default'
|
||||
|
||||
if favorite_quality.index(item.quality.lower()) < max_quality:
|
||||
item.type_b = False
|
||||
autoplay_elem["indice_server"] = n
|
||||
autoplay_elem["indice_quality"] = favorite_quality.index(item.quality.lower())
|
||||
autoplay_elem['videoitem'] = item
|
||||
autoplay_list.append(autoplay_elem)
|
||||
autoplay_list.sort(key=lambda orden: (orden['indice_quality'], orden['indice_server']))
|
||||
|
||||
# Plan b is prepared, in case it is active the non-favorite elements are added at the end
|
||||
# try: plan_b = settings_node['plan_b']
|
||||
# except:
|
||||
plan_b = True
|
||||
text_b = ''
|
||||
if plan_b: autoplay_list.extend(autoplay_b)
|
||||
# If there are elements in the autoplay list, an attempt is made to reproduce each element, until one is found or all fail.
|
||||
|
||||
if autoplay_list or (plan_b and autoplay_b):
|
||||
|
||||
max_intentos = 5
|
||||
max_intentos_servers = {}
|
||||
if autoplay_list:
|
||||
max_intents = 5
|
||||
max_intents_servers = {}
|
||||
|
||||
# If something is playing it stops playing
|
||||
if platformtools.is_playing():
|
||||
@@ -206,27 +60,23 @@ def start(itemlist, item):
|
||||
|
||||
for autoplay_elem in autoplay_list:
|
||||
play_item = Item
|
||||
channel_id = autoplay_elem['videoitem'].channel
|
||||
if autoplay_elem['videoitem'].channel == 'videolibrary':
|
||||
channel_id = autoplay_elem['videoitem'].contentChannel
|
||||
channel_id = autoplay_elem.channel
|
||||
if autoplay_elem.channel == 'videolibrary':
|
||||
channel_id = autoplay_elem.contentChannel
|
||||
|
||||
# If it is not a favorite element if you add the text plan b
|
||||
if autoplay_elem['videoitem'].type_b:
|
||||
text_b = '(Plan B)'
|
||||
if not platformtools.is_playing() and not PLAYED:
|
||||
videoitem = autoplay_elem['videoitem']
|
||||
if videoitem.server.lower() not in max_intentos_servers:
|
||||
max_intentos_servers[videoitem.server.lower()] = max_intentos
|
||||
videoitem = autoplay_elem
|
||||
if videoitem.server.lower() not in max_intents_servers:
|
||||
max_intents_servers[videoitem.server.lower()] = max_intents
|
||||
|
||||
# If the maximum number of attempts of this server have been reached, we jump to the next
|
||||
if max_intentos_servers[videoitem.server.lower()] == 0:
|
||||
if max_intents_servers[videoitem.server.lower()] == 0:
|
||||
continue
|
||||
|
||||
lang = " "
|
||||
if hasattr(videoitem, 'language') and videoitem.language != "":
|
||||
lang = " '%s' " % videoitem.language
|
||||
lang = " [{}]".format(videoitem.language) if videoitem.language else ''
|
||||
quality = ' [{}]'.format(videoitem.quality) if videoitem.quality and videoitem.quality != 'default' else ''
|
||||
name = servername(videoitem.server)
|
||||
platformtools.dialog_notification("AutoPlay %s" %text_b, "%s%s%s" % (name, lang, videoitem.quality.upper()), sound=False)
|
||||
platformtools.dialog_notification('AutoPlay', '{}{}{}'.format(name, lang, quality), sound=False)
|
||||
|
||||
# Try to play the links If the channel has its own play method, use it
|
||||
try: channel = __import__('channels.%s' % channel_id, None, None, ["channels.%s" % channel_id])
|
||||
@@ -251,7 +101,7 @@ def start(itemlist, item):
|
||||
platformtools.play_video(videoitem, autoplay=True)
|
||||
except:
|
||||
pass
|
||||
sleep(3)
|
||||
# sleep(3)
|
||||
try:
|
||||
if platformtools.is_playing():
|
||||
PLAYED = True
|
||||
@@ -260,13 +110,13 @@ def start(itemlist, item):
|
||||
logger.debug(str(len(autoplay_list)))
|
||||
|
||||
# If we have come this far, it is because it could not be reproduced
|
||||
max_intentos_servers[videoitem.server.lower()] -= 1
|
||||
max_intents_servers[videoitem.server.lower()] -= 1
|
||||
|
||||
# If the maximum number of attempts of this server has been reached, ask if we want to continue testing or ignore it.
|
||||
if max_intentos_servers[videoitem.server.lower()] == 0:
|
||||
if max_intents_servers[videoitem.server.lower()] == 0:
|
||||
text = config.get_localized_string(60072) % name
|
||||
if not platformtools.dialog_yesno("AutoPlay", text, config.get_localized_string(60073)):
|
||||
max_intentos_servers[videoitem.server.lower()] = max_intentos
|
||||
max_intents_servers[videoitem.server.lower()] = max_intents
|
||||
|
||||
# If there are no items in the list, it is reported
|
||||
if autoplay_elem == autoplay_list[-1]:
|
||||
@@ -292,4 +142,4 @@ def servername(server):
|
||||
path = filetools.join(config.get_runtime_path(), 'servers', server.lower() + '.json')
|
||||
name = jsontools.load(open(path, "rb").read())['name']
|
||||
if name.startswith('@'): name = config.get_localized_string(int(name.replace('@','')))
|
||||
return translate_server_name(name)
|
||||
return translate_server_name(name)
|
||||
|
||||
+90
-45
@@ -9,24 +9,17 @@ import sys
|
||||
PY3 = False
|
||||
if sys.version_info[0] >= 3: PY3 = True; unicode = str; unichr = chr; long = int
|
||||
|
||||
if PY3:
|
||||
#from future import standard_library
|
||||
#standard_library.install_aliases()
|
||||
import urllib.parse as urlparse #It is very slow in PY2. In PY3 it is native
|
||||
else:
|
||||
import urlparse # We use the native of PY2 which is faster
|
||||
if PY3: import urllib.parse as urlparse
|
||||
else: import urlparse
|
||||
|
||||
from future.builtins import range
|
||||
from past.utils import old_div
|
||||
|
||||
import re
|
||||
|
||||
from core import filetools
|
||||
from core import httptools
|
||||
from core import jsontools
|
||||
from core import filetools, httptools, jsontools
|
||||
from core.item import Item
|
||||
from platformcode import config, logger
|
||||
from platformcode import platformtools
|
||||
from platformcode import config, logger, platformtools
|
||||
from lib import unshortenit
|
||||
|
||||
dict_servers_parameters = {}
|
||||
@@ -522,26 +515,6 @@ def get_server_parameters(server):
|
||||
return dict_servers_parameters[server]
|
||||
|
||||
|
||||
# def get_server_json(server_name):
|
||||
# # logger.info("server_name=" + server_name)
|
||||
# try:
|
||||
# server_path = filetools.join(config.get_runtime_path(), "servers", server_name + ".json")
|
||||
# if not filetools.exists(server_path):
|
||||
# server_path = filetools.join(config.get_runtime_path(), "servers", "debriders", server_name + ".json")
|
||||
#
|
||||
# # logger.info("server_path=" + server_path)
|
||||
# server_json = jsontools.load(filetools.read(server_path))
|
||||
# # logger.info("server_json= %s" % server_json)
|
||||
#
|
||||
# except Exception as ex:
|
||||
# template = "An exception of type %s occured. Arguments:\n%r"
|
||||
# message = template % (type(ex).__name__, ex.args)
|
||||
# logger.error(" %s" % message)
|
||||
# server_json = None
|
||||
#
|
||||
# return server_json
|
||||
|
||||
|
||||
def get_server_host(server_name):
|
||||
from core import scrapertools
|
||||
return [scrapertools.get_domain_from_url(pattern['url']) for pattern in get_server_parameters(server_name)['find_videos']['patterns']]
|
||||
@@ -669,9 +642,10 @@ def get_servers_list():
|
||||
for server in filetools.listdir(filetools.join(config.get_runtime_path(), "servers")):
|
||||
if server.endswith(".json") and not server == "version.json":
|
||||
server_parameters = get_server_parameters(server)
|
||||
server_list[server.split(".")[0]] = server_parameters
|
||||
if server_parameters['active']:
|
||||
server_list[server.split(".")[0]] = server_parameters
|
||||
|
||||
# if type(server_list) != dict: server_list = sort_servers(server_list)
|
||||
if type(server_list) != dict: server_list = sort_servers(server_list)
|
||||
return server_list
|
||||
|
||||
|
||||
@@ -696,16 +670,67 @@ def sort_servers(servers_list):
|
||||
"""
|
||||
If the option "Order servers" is activated in the server configuration and there is a list of servers
|
||||
favorites in settings use it to sort the servers_list list
|
||||
:param servers_list: List of servers to order. The items in the servers_list can be strings or Item objects. In which case it is necessary that they have an item.server attribute of type str.
|
||||
:param servers_list: List of servers to order. The items in the servers_list can be strings or Item objects. In both cases it is necessary to have an item.server attribute of type str.
|
||||
:return: List of the same type of objects as servers_list ordered according to the favorite servers.
|
||||
"""
|
||||
if servers_list:
|
||||
if isinstance(servers_list[0], Item):
|
||||
servers_list = sorted(servers_list, key=lambda x: config.get_setting("favorites_servers_list", server=x.server))
|
||||
def index(lst, value):
|
||||
if value in lst:
|
||||
return lst.index(value)
|
||||
else:
|
||||
servers_list = sorted(servers_list, key=lambda x: config.get_setting("favorites_servers_list", server=x))
|
||||
logger.debug('Index not found: ' + value)
|
||||
return 999
|
||||
if not servers_list:
|
||||
return []
|
||||
|
||||
return servers_list
|
||||
blacklisted_servers = config.get_setting("black_list", server='servers', default=[])
|
||||
favorite_servers = config.get_setting('favorites_servers_list', server='servers', default=[])
|
||||
favorite_servers = [s for s in favorite_servers if s not in blacklisted_servers]
|
||||
if isinstance(servers_list[0], str):
|
||||
servers_list = sorted(servers_list, key=lambda x: favorite_servers.index(x) if x in favorite_servers else 999)
|
||||
return servers_list
|
||||
|
||||
favorite_quality = ['4k', '2160p', '2160', '4k2160p', '4k2160', '4k 2160p', '4k 2160', '2k',
|
||||
'fullhd', 'fullhd 1080', 'fullhd 1080p', 'full hd', 'full hd 1080', 'full hd 1080p', 'hd1080', 'hd1080p', 'hd 1080', 'hd 1080p', '1080', '1080p',
|
||||
'hd', 'hd720', 'hd720p', 'hd 720', 'hd 720p', '720', '720p', 'hdtv',
|
||||
'sd', '480p', '480', '360p', '360', '240p', '240']
|
||||
|
||||
sorted_list = []
|
||||
inverted = False
|
||||
|
||||
if config.get_setting('default_action') == 2:
|
||||
inverted = True
|
||||
|
||||
# Priorities when ordering itemlist:
|
||||
# 0: Only Qualities
|
||||
# 1: Servers and Qualities
|
||||
# 2: Qualities and Servers
|
||||
|
||||
priority = 0
|
||||
if config.get_setting('favorites_servers') and favorite_servers: priority = 1
|
||||
if config.get_setting('quality_priority'): priority = 2
|
||||
|
||||
for item in servers_list:
|
||||
element = dict()
|
||||
|
||||
# We check that it is a video item
|
||||
if 'server' not in item:
|
||||
continue
|
||||
|
||||
if item.server.lower() in blacklisted_servers:
|
||||
continue
|
||||
|
||||
element["index_server"] = index(favorite_servers, item.server.lower())
|
||||
element["index_quality"] = platformtools.calcResolution(item.quality)
|
||||
element['index_language'] = 0 if item.contentLanguage == 'ITA' else 1
|
||||
element['videoitem'] = item
|
||||
sorted_list.append(element)
|
||||
|
||||
# We order according to priority
|
||||
if priority == 0: sorted_list.sort(key=lambda element: (element['index_language'], -element['index_quality'] if inverted else element['index_quality'] , element['videoitem'].server))
|
||||
elif priority == 1: sorted_list.sort(key=lambda element: (element['index_language'], element['index_server'], -element['index_quality'] if inverted else element['index_quality'])) # Servers and Qualities
|
||||
elif priority == 2: sorted_list.sort(key=lambda element: (element['index_language'], -element['index_quality'] if inverted else element['index_quality'], element['index_server'])) # Qualities and Servers
|
||||
|
||||
return [v['videoitem'] for v in sorted_list if v]
|
||||
|
||||
|
||||
# Checking links
|
||||
@@ -733,10 +758,11 @@ def check_list_links(itemlist, numero='', timeout=3):
|
||||
it = res[0]
|
||||
verificacion = res[1]
|
||||
it.title = verificacion + ' ' + it.title.strip()
|
||||
logger.info('VERIFICATION= ' + verificacion)
|
||||
logger.debug('VERIFICATION= ' + verificacion)
|
||||
it.alive = verificacion
|
||||
return itemlist
|
||||
|
||||
|
||||
def check_video_link(item, timeout=3):
|
||||
"""
|
||||
Check if the link to a video is valid and return a 2-position string with verification.
|
||||
@@ -777,11 +803,30 @@ def check_video_link(item, timeout=3):
|
||||
httptools.HTTPTOOLS_DEFAULT_DOWNLOAD_TIMEOUT = ant_timeout # Restore download time
|
||||
return item, resultado
|
||||
|
||||
logger.debug("[check_video_link] There is no test_video_exists for server: %s" % server)
|
||||
logger.debug("[check_video_link] There is no test_video_exists for server:", server)
|
||||
return item, NK
|
||||
|
||||
|
||||
def translate_server_name(name):
|
||||
if '@' in name:
|
||||
return config.get_localized_string(int(name.replace('@','')))
|
||||
else:
|
||||
return name
|
||||
if '@' in name: return config.get_localized_string(int(name.replace('@','')))
|
||||
else: return name
|
||||
|
||||
|
||||
# def get_server_json(server_name):
|
||||
# # logger.info("server_name=" + server_name)
|
||||
# try:
|
||||
# server_path = filetools.join(config.get_runtime_path(), "servers", server_name + ".json")
|
||||
# if not filetools.exists(server_path):
|
||||
# server_path = filetools.join(config.get_runtime_path(), "servers", "debriders", server_name + ".json")
|
||||
#
|
||||
# # logger.info("server_path=" + server_path)
|
||||
# server_json = jsontools.load(filetools.read(server_path))
|
||||
# # logger.info("server_json= %s" % server_json)
|
||||
#
|
||||
# except Exception as ex:
|
||||
# template = "An exception of type %s occured. Arguments:\n%r"
|
||||
# message = template % (type(ex).__name__, ex.args)
|
||||
# logger.error(" %s" % message)
|
||||
# server_json = None
|
||||
#
|
||||
# return server_json
|
||||
|
||||
+60
-5
@@ -24,6 +24,56 @@ from platformcode import config
|
||||
from platformcode.logger import info
|
||||
from platformcode import logger
|
||||
|
||||
channels_order = {'Rai 1': 1,
|
||||
'Rai 2': 2,
|
||||
'Rai 3': 3,
|
||||
'Rete 4': 4,
|
||||
'Canale 5': 5,
|
||||
'Italia 1': 6,
|
||||
'La7': 7,
|
||||
'NOVE': 9,
|
||||
'20': 20,
|
||||
'Rai 4': 21,
|
||||
'Iris': 22,
|
||||
'Rai 5': 23,
|
||||
'Rai Movie': 24,
|
||||
'Rai Premium': 25,
|
||||
'Paramount': 27,
|
||||
'La7d': 29,
|
||||
'La 5': 30,
|
||||
'Real Time': 31,
|
||||
'Food Network': 33,
|
||||
'Cine34': 34,
|
||||
'Focus': 35,
|
||||
'Giallo': 38,
|
||||
'Top Crime': 39,
|
||||
'Boing': 40,
|
||||
'K2': 41,
|
||||
'Rai Gulp': 42,
|
||||
'Rai Yoyo': 43,
|
||||
'Frisbee': 44,
|
||||
'Cartoonito': 46,
|
||||
'Super': 46,
|
||||
'Rai News 24': 48,
|
||||
'Spike': 49,
|
||||
'TGCom': 51,
|
||||
'DMAX': 52,
|
||||
'Rai Storia': 54,
|
||||
'Mediaset Extra': 55,
|
||||
'Home and Garden TV': 56,
|
||||
'Rai Sport piu HD': 57,
|
||||
'Rai Sport': 58,
|
||||
'Motor Trend': 59,
|
||||
'Italia 2': 66,
|
||||
'VH1': 67,
|
||||
'Rai Scuola': 146,
|
||||
'Radio 105': 157,
|
||||
'R101tv': 167,
|
||||
'RMC': 256,
|
||||
'Virgin Radio': 257,
|
||||
'Rai Radio 2': 999,
|
||||
}
|
||||
|
||||
|
||||
def hdpass_get_servers(item):
|
||||
def get_hosts(url, quality):
|
||||
@@ -53,7 +103,7 @@ def hdpass_get_servers(item):
|
||||
|
||||
data = httptools.downloadpage(url, CF=False).data
|
||||
patron_res = '<div class="buttons-bar resolutions-bar">(.*?)<div class="buttons-bar'
|
||||
patron_mir = '<div class="buttons-bar hosts-bar">(.*?)<div id="main-player'
|
||||
patron_mir = '<div class="buttons-bar hosts-bar">(.*?)(?:<div id="main-player|<script)'
|
||||
patron_option = r'<a href="([^"]+?)"[^>]+>([^<]+?)</a'
|
||||
|
||||
res = scrapertools.find_single_match(data, patron_res)
|
||||
@@ -237,6 +287,7 @@ def scrapeBlock(item, args, block, patron, headers, action, pagination, debug, t
|
||||
contents.append(title)
|
||||
title2 = cleantitle(scraped.get('title2', '')) if not group or item.grouped else ''
|
||||
quality = scraped.get('quality', '')
|
||||
if not quality: quality = item.quality
|
||||
# Type = scraped['type'] if scraped['type'] else ''
|
||||
plot = cleantitle(scraped.get("plot", ''))
|
||||
|
||||
@@ -399,7 +450,8 @@ def scrapeBlock(item, args, block, patron, headers, action, pagination, debug, t
|
||||
contentEpisodeNumber=infolabels.get('episode', ''),
|
||||
news= item.news if item.news else '',
|
||||
other = scraped['other'] if scraped['other'] else '',
|
||||
grouped=group
|
||||
q=group,
|
||||
disable_videolibrary = not args.get('addVideolibrary', True)
|
||||
)
|
||||
if scraped['episode'] and group and not item.grouped: # some adjustment for grouping feature
|
||||
it.action = function
|
||||
@@ -1214,7 +1266,9 @@ def server(item, data='', itemlist=[], headers='', AutoPlay=True, CheckLinks=Tru
|
||||
videoitem.title = findS[0]
|
||||
videoitem.url = findS[1]
|
||||
srv_param = servertools.get_server_parameters(videoitem.server.lower())
|
||||
logger.debug(videoitem)
|
||||
else:
|
||||
videoitem.server = videoitem.server.lower()
|
||||
|
||||
if videoitem.video_urls or srv_param.get('active', False):
|
||||
item.title = typo(item.contentTitle.strip(), 'bold') if item.contentType == 'movie' or (config.get_localized_string(30161) in item.title) else item.title
|
||||
|
||||
@@ -1270,7 +1324,7 @@ def server(item, data='', itemlist=[], headers='', AutoPlay=True, CheckLinks=Tru
|
||||
logger.error(traceback.format_exc())
|
||||
pass
|
||||
|
||||
# verifiedItemlist = servertools.sort_servers(verifiedItemlist)
|
||||
verifiedItemlist = servertools.sort_servers(verifiedItemlist)
|
||||
|
||||
if Videolibrary and item.contentChannel != 'videolibrary':
|
||||
videolibrary(verifiedItemlist, item)
|
||||
@@ -1412,6 +1466,7 @@ def get_jwplayer_mediaurl(data, srvName, onlyHttp=False, dataIsBlock=False):
|
||||
|
||||
def thumb(item_itemlist_string=None, genre=False, live=False):
|
||||
from channelselector import get_thumb
|
||||
|
||||
if live:
|
||||
if type(item_itemlist_string) == list:
|
||||
for item in item_itemlist_string:
|
||||
@@ -1524,4 +1579,4 @@ def thumb(item_itemlist_string=None, genre=False, live=False):
|
||||
return autoselect_thumb(item_itemlist_string, genre)
|
||||
|
||||
else:
|
||||
return get_thumb('next.png')
|
||||
return get_thumb('next.png')
|
||||
|
||||
@@ -424,6 +424,8 @@ def set_infoLabels_item(item, seekTmdb=True, search_language=def_lang, lock=None
|
||||
if otmdb.get_id() and config.get_setting("tmdb_plus_info", default=False):
|
||||
# If the search has been successful and you are not looking for a list of items,
|
||||
# carry out another search to expand the information
|
||||
if search_type == 'multi':
|
||||
search_type = 'movie' if otmdb.result.get('media_type') else 'tv'
|
||||
otmdb = Tmdb(id_Tmdb=otmdb.result.get("id"), search_type=search_type,
|
||||
search_language=search_language)
|
||||
|
||||
@@ -619,6 +621,8 @@ def discovery(item, dict_=False, cast=False):
|
||||
from core.item import Item
|
||||
|
||||
if dict_:
|
||||
if item.page:
|
||||
item.discovery['page'] = item.page
|
||||
listado = Tmdb(discover = dict_, cast=cast)
|
||||
|
||||
elif item.search_type == 'discover':
|
||||
@@ -1562,10 +1566,12 @@ class Tmdb(object):
|
||||
:rtype: list of Dict
|
||||
"""
|
||||
ret = []
|
||||
|
||||
if self.result['id']:
|
||||
if self.result['videos']:
|
||||
self.result["videos"] = self.result["videos"]['results']
|
||||
else:
|
||||
self.result["videos"] = []
|
||||
# First video search in the search language
|
||||
url = "{}/{}/{}/videos?api_key={}&language={}".format(host, self.search_type, self.result['id'], api, self.search_language)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user