+dynamic channel url

implementing dynamic channel url, if url doesnt exists in macrojson get it from user preferences.
(dont know why EOF keeps changing and git committing +1000 files.)
This commit is contained in:
cttynul
2019-06-03 04:01:41 +02:00
parent 271ae4fd2b
commit d9e32745c9
7 changed files with 39 additions and 14 deletions

View File

@@ -9,7 +9,10 @@ from platformcode import logger, config
from specials import autoplay
#URL che reindirizza sempre al dominio corrente
host = "https://altadefinizione01.to"
#host = "https://altadefinizione01.to"
__channel__ = "altadefinizione01"
host = config.get_addon_version(__channel__)
IDIOMAS = {'Italiano': 'IT'}
list_language = IDIOMAS.values()

View File

@@ -12,10 +12,7 @@ from platformcode import config, logger
from specials import autoplay, filtertools
__channel__ = "altadefinizione01_club"
#host = "https://www.altadefinizione01.club/" # host da cambiare
#host = "https://www.altadefinizione01.team/" #aggiornato al 22 marzo 2019
host = "https://www.altadefinizione01.vision/" #aggiornato al 30-04-209
host = config.get_channel_url(__channel__)
# ======== Funzionalità =============================

View File

@@ -13,19 +13,13 @@ from platformcode import config, logger
__channel__ = "altadefinizione01_link"
#host = "https://altadefinizione01.link/" #riaggiornato al 29 aprile 2019
#host = "http://altadefinizione01.art/" # aggiornato al 22 marzo 2019
#host = "https://altadefinizione01.network/" #aggiornato al 22 marzo 2019
#host = "http://altadefinizione01.date/" #aggiornato al 3 maggio 2019
#host = "https://altadefinizione01.voto/" #aggiornato al 3 maggio 2019
#host = "https://altadefinizione01.estate/" # aggiornato al 23 maggio 2019
# ======== def per utility INIZIO ============================
list_servers = ['supervideo', 'streamcherry','rapidvideo', 'streamango', 'openload']
list_quality = ['default']
host = config.get_setting("channel_host", __channel__)
#host = config.get_setting("channel_host", __channel__)
host = config.get_channel_url(__channel__)
checklinks = config.get_setting('checklinks', __channel__)
checklinks_number = config.get_setting('checklinks_number', __channel__)

View File

@@ -10,7 +10,9 @@ from core.item import Item
from platformcode import logger, config
from specials import autoplay
host = config.get_setting("channel_host", 'altadefinizioneclick')
#host = config.get_setting("channel_host", 'altadefinizioneclick')
__channel__ = 'altadefinizioneclick'
host = config.get_channel_url(__channel__)
IDIOMAS = {'Italiano': 'IT'}
list_language = IDIOMAS.values()

3
custom_code.json Normal file
View File

@@ -0,0 +1,3 @@
{
"addon_version": "0.3"
}

View File

@@ -82,6 +82,22 @@ def is_xbmc():
def get_videolibrary_support():
return True
def get_channel_url(name):
try:
try:
import json
except:
import simplejson as json
ROOT_DIR = xbmc.translatePath(__settings__.getAddonInfo('Path'))
LOCAL_FILE = os.path.join(ROOT_DIR, "channels.json")
with open(LOCAL_FILE) as f:
data = json.load(f)
if data[name] is not None:
return data[name]
else:
return get_setting("channel_host", name)
except:
return get_setting("channel_host", name)
def get_system_platform():
""" fonction: pour recuperer la platform que xbmc tourne """

View File

@@ -309,12 +309,22 @@ def monitor_update():
logger.info("Inicio actualizacion programada para las %s h.: %s" % (update_start, datetime.datetime.now()))
check_for_update(overwrite=False)
def get_channel_json():
import urllib, os, xbmc, xbmcaddon
addon = xbmcaddon.Addon('plugin.video.kod')
ROOT_DIR = xbmc.translatePath(addon.getAddonInfo('Path'))
LOCAL_FILE = os.path.join(ROOT_DIR, "channels.json")
if os.path.exists(LOCAL_FILE):
os.remove(LOCAL_FILE)
urllib.urlretrieve("https://raw.githubusercontent.com/kodiondemand/addon/master/channels.json", LOCAL_FILE)
if __name__ == "__main__":
# Se ejecuta en cada inicio
import xbmc
import time
get_channel_json()
# modo adulto:
# sistema actual 0: Nunca, 1:Siempre, 2:Solo hasta que se reinicie Kodi