fix autoplay: disabilitato status e rispettato hideserver in videoteca
This commit is contained in:
@@ -621,7 +621,7 @@ def downloadfileGzipped(url, pathfichero):
|
||||
else:
|
||||
tiempofalta = 0
|
||||
logger.info(sec_to_hms(tiempofalta))
|
||||
progreso.update(percent, "%.2fMB/%.2fMB (%d%%) %.2f Kb/s %s falta " %
|
||||
progreso.update(percent, "%.2fMB/%.2fMB (%d%%) %.2f Kb/s %s mancanti " %
|
||||
(descargadosmb, totalmb, percent, old_div(velocidad, 1024), sec_to_hms(tiempofalta)))
|
||||
break
|
||||
except:
|
||||
|
||||
@@ -1144,21 +1144,7 @@ def controls(itemlist, item, AutoPlay=True, CheckLinks=True, down_load=True, vid
|
||||
from platformcode.config import get_setting
|
||||
|
||||
CL = get_setting('checklinks') or get_setting('checklinks', item.channel)
|
||||
autoplay_node = jsontools.get_node_from_file('autoplay', 'AUTOPLAY')
|
||||
channel_node = autoplay_node.get(item.channel, {})
|
||||
if not channel_node: # non ha mai aperto il menu del canale quindi in autoplay_data.json non c'e la key
|
||||
try:
|
||||
channelFile = __import__('channels.' + item.channel, fromlist=["channels.%s" % item.channel])
|
||||
except:
|
||||
channelFile = __import__('specials.' + item.channel, fromlist=["specials.%s" % item.channel])
|
||||
if hasattr(channelFile, 'list_servers') and hasattr(channelFile, 'list_quality'):
|
||||
autoplay.init(item.channel, channelFile.list_servers, channelFile.list_quality)
|
||||
|
||||
autoplay_node = jsontools.get_node_from_file('autoplay', 'AUTOPLAY')
|
||||
channel_node = autoplay_node.get(item.channel, {})
|
||||
settings_node = channel_node.get('settings', {})
|
||||
AP = get_setting('autoplay') or (settings_node['active'] if 'active' in settings_node else False)
|
||||
HS = config.get_setting('hide_servers') or (settings_node['hide_servers'] if 'hide_server' in settings_node else False)
|
||||
AP, HS = autoplay.get_channel_AP_HS(item)
|
||||
|
||||
if CL and not AP:
|
||||
if get_setting('checklinks', item.channel):
|
||||
|
||||
@@ -113,12 +113,12 @@ def start(itemlist, item):
|
||||
if item.channel == 'videolibrary':
|
||||
autoplay_node = jsontools.get_node_from_file('autoplay', 'AUTOPLAY')
|
||||
channel_id = item.contentChannel
|
||||
try:
|
||||
active = autoplay_node['status']
|
||||
except:
|
||||
active = is_active(item.channel)
|
||||
# try:
|
||||
# active = autoplay_node['status']
|
||||
# except:
|
||||
# active = is_active(item.channel)
|
||||
|
||||
if not channel_id in autoplay_node or not active:
|
||||
if not channel_id in autoplay_node: # or not active:
|
||||
return itemlist
|
||||
|
||||
# Agrega servidores y calidades que no estaban listados a autoplay_node
|
||||
@@ -724,19 +724,40 @@ def reset(item, dict):
|
||||
|
||||
return
|
||||
|
||||
def set_status(status):
|
||||
logger.info()
|
||||
# Obtiene el nodo AUTOPLAY desde el json
|
||||
autoplay_node = jsontools.get_node_from_file('autoplay', 'AUTOPLAY')
|
||||
autoplay_node['status'] = status
|
||||
# def set_status(status):
|
||||
# logger.info()
|
||||
# # Obtiene el nodo AUTOPLAY desde el json
|
||||
# autoplay_node = jsontools.get_node_from_file('autoplay', 'AUTOPLAY')
|
||||
# autoplay_node['status'] = status
|
||||
#
|
||||
# result, json_data = jsontools.update_node(autoplay_node, 'autoplay', 'AUTOPLAY')
|
||||
|
||||
result, json_data = jsontools.update_node(autoplay_node, 'autoplay', 'AUTOPLAY')
|
||||
# return if item channel has autoplay and hideserver enabled
|
||||
def get_channel_AP_HS(item):
|
||||
autoplay_node = jsontools.get_node_from_file('autoplay', 'AUTOPLAY')
|
||||
channel_node = autoplay_node.get(item.channel, {})
|
||||
if not channel_node: # non ha mai aperto il menu del canale quindi in autoplay_data.json non c'e la key
|
||||
try:
|
||||
channelFile = __import__('channels.' + item.channel, fromlist=["channels.%s" % item.channel])
|
||||
except:
|
||||
channelFile = __import__('specials.' + item.channel, fromlist=["specials.%s" % item.channel])
|
||||
if hasattr(channelFile, 'list_servers') and hasattr(channelFile, 'list_quality'):
|
||||
init(item.channel, channelFile.list_servers, channelFile.list_quality)
|
||||
|
||||
autoplay_node = jsontools.get_node_from_file('autoplay', 'AUTOPLAY')
|
||||
channel_node = autoplay_node.get(item.channel, {})
|
||||
settings_node = channel_node.get('settings', {})
|
||||
AP = get_setting('autoplay') or (settings_node['active'] if 'active' in settings_node else False)
|
||||
HS = config.get_setting('hide_servers') or (
|
||||
settings_node['hide_servers'] if 'hide_server' in settings_node else False)
|
||||
|
||||
return AP, HS
|
||||
|
||||
def play_multi_channel(item, itemlist):
|
||||
logger.info()
|
||||
global PLAYED
|
||||
video_dict = dict()
|
||||
set_status(True)
|
||||
# set_status(True)
|
||||
|
||||
for video_item in itemlist:
|
||||
if is_active(video_item.contentChannel):
|
||||
@@ -751,3 +772,6 @@ def play_multi_channel(item, itemlist):
|
||||
start(videos, item)
|
||||
else:
|
||||
break
|
||||
|
||||
AP, HS = get_channel_AP_HS(item)
|
||||
return HS
|
||||
@@ -468,7 +468,7 @@ def findvideos(item):
|
||||
item_local = None
|
||||
|
||||
# Desactiva autoplay
|
||||
autoplay.set_status(False)
|
||||
# autoplay.set_status(False)
|
||||
|
||||
if not item.contentTitle or not item.strm_path:
|
||||
logger.debug("Unable to search for videos due to lack of parameters")
|
||||
@@ -587,7 +587,7 @@ def findvideos(item):
|
||||
list_servers = servertools.filter_servers(list_servers)
|
||||
elif item_json.action == 'play':
|
||||
from platformcode import platformtools
|
||||
autoplay.set_status(True)
|
||||
# autoplay.set_status(True)
|
||||
item_json.contentChannel = item_json.channel
|
||||
item_json.channel = "videolibrary"
|
||||
platformtools.play_video(item_json)
|
||||
@@ -629,7 +629,8 @@ def findvideos(item):
|
||||
itemlist.append(server)
|
||||
|
||||
# return sorted(itemlist, key=lambda it: it.title.lower())
|
||||
autoplay.play_multi_channel(item, itemlist)
|
||||
if autoplay.play_multi_channel(item, itemlist): # hideserver
|
||||
return []
|
||||
from inspect import stack
|
||||
from specials import nextep
|
||||
if nextep.check(item) and stack()[1][3] == 'run':
|
||||
|
||||
Reference in New Issue
Block a user