domini CF basati sui canali

This commit is contained in:
marco
2020-02-28 18:46:15 +01:00
parent 74ad4469eb
commit 2625cd446b
2 changed files with 20 additions and 10 deletions

View File

@@ -19,6 +19,8 @@ PLUGIN_NAME = "kod"
__settings__ = xbmcaddon.Addon(id="plugin.video." + PLUGIN_NAME)
__language__ = __settings__.getLocalizedString
channels_data = list()
def get_addon_core():
return __settings__
@@ -97,12 +99,13 @@ def is_xbmc():
def get_videolibrary_support():
return True
def get_channel_url(findhostMethod=None):
def get_channel_url(findhostMethod=None, name=None):
from core import jsontools
import inspect
frame = inspect.stack()[1]
name = os.path.basename(frame[0].f_code.co_filename).replace('.py', '')
if not name:
name = os.path.basename(frame[0].f_code.co_filename).replace('.py', '')
if findhostMethod:
url = jsontools.get_node_from_file(name, 'url')
if not url:
@@ -112,9 +115,11 @@ def get_channel_url(findhostMethod=None):
else:
ROOT_DIR = xbmc.translatePath(__settings__.getAddonInfo('Path'))
LOCAL_FILE = os.path.join(ROOT_DIR, "channels.json")
with open(LOCAL_FILE) as f:
data = jsontools.load(f.read())
return data[name]
global channels_data
if not channels_data:
with open(LOCAL_FILE) as f:
channels_data = jsontools.load(f.read())
return channels_data[name]
def get_system_platform():
""" fonction: pour recuperer la platform que xbmc tourne """