Test Nuovo launcher
This commit is contained in:
+37
-34
@@ -74,20 +74,15 @@ def search(item, text):
|
|||||||
def peliculas(item):
|
def peliculas(item):
|
||||||
search = item.search
|
search = item.search
|
||||||
anime = True
|
anime = True
|
||||||
# debug = True
|
action = 'check'
|
||||||
if 'movie' in item.url:
|
|
||||||
action = 'findvideos'
|
|
||||||
else:
|
|
||||||
action = 'check'
|
|
||||||
|
|
||||||
# if not item.args:
|
|
||||||
# pagination = ''
|
|
||||||
# patron = r'<a\s*href="(?P<url>[^"]+)"\s*title="(?P<title>[^"]+)">'
|
|
||||||
# else:
|
|
||||||
patron = r'<a href="(?P<url>[^"]+)"[^>]+>\s*<img src="(?P<thumb>[^"]+)" alt="(?P<title>.*?)(?: Sub| sub| SUB|")'
|
patron = r'<a href="(?P<url>[^"]+)"[^>]+>\s*<img src="(?P<thumb>[^"]+)" alt="(?P<title>.*?)(?: Sub| sub| SUB|")'
|
||||||
|
|
||||||
|
if search:
|
||||||
|
patron = r'<a href="(?P<url>[^"]+)"\s*title="(?P<title>.*?)(?: Sub| sub| SUB|")'
|
||||||
|
|
||||||
if item.args == 'newest': item.action = 'findvideos'
|
if item.args == 'newest': item.action = 'findvideos'
|
||||||
|
|
||||||
patronNext = '<li class="page-item disabled">(?:[^>]+>){4}<a class="page-link" href="([^"]+)'
|
patronNext = '<li class="page-item disabled">(?:[^>]+>){4}<a class="page-link" href="([^"]+)'
|
||||||
|
|
||||||
def itemHook(item):
|
def itemHook(item):
|
||||||
@@ -100,7 +95,7 @@ def peliculas(item):
|
|||||||
|
|
||||||
|
|
||||||
def check(item):
|
def check(item):
|
||||||
m = support.match(item, headers=headers, patron=r'Tipologia[^>]+><a href="([^"]+)"')
|
m = support.match(item, headers=headers, patron=r'Tipologia[^>]+>\s*<a href="([^"]+)"')
|
||||||
item.data = m.data
|
item.data = m.data
|
||||||
if 'movie' in m.match:
|
if 'movie' in m.match:
|
||||||
item.contentType = 'movie'
|
item.contentType = 'movie'
|
||||||
@@ -112,6 +107,7 @@ def check(item):
|
|||||||
@support.scrape
|
@support.scrape
|
||||||
def episodios(item):
|
def episodios(item):
|
||||||
anime = True
|
anime = True
|
||||||
|
pagination = 50
|
||||||
data = item.data
|
data = item.data
|
||||||
|
|
||||||
if '<h6>Streaming</h6>' in data:
|
if '<h6>Streaming</h6>' in data:
|
||||||
@@ -130,30 +126,37 @@ def episodios(item):
|
|||||||
def findvideos(item):
|
def findvideos(item):
|
||||||
support.info(item)
|
support.info(item)
|
||||||
itemlist = []
|
itemlist = []
|
||||||
|
if item.data:
|
||||||
if 'adf.ly' in item.url:
|
url = support.match(item.data, patron=r'<a\s*href="([^"]+)"\s*title="[^"]+"\s*class="btn btn-dark mb-1">').match
|
||||||
from servers.decrypters import adfly
|
|
||||||
url = adfly.get_long_url(item.url)
|
|
||||||
|
|
||||||
elif 'bit.ly' in item.url:
|
|
||||||
url = support.httptools.downloadpage(item.url, only_headers=True, follow_redirects=False).headers.get("location")
|
|
||||||
|
|
||||||
else:
|
else:
|
||||||
url = host
|
url = item.url
|
||||||
for u in item.url.split('/'):
|
|
||||||
if u and 'animeforce' not in u and 'http' not in u:
|
|
||||||
url += '/' + u
|
|
||||||
|
|
||||||
if 'php?' in url:
|
# if 'adf.ly' in item.url:
|
||||||
url = support.httptools.downloadpage(url, only_headers=True, follow_redirects=False).headers.get("location")
|
# from servers.decrypters import adfly
|
||||||
url = support.match(url, patron=r'class="button"><a href=(?:")?([^" ]+)', headers=headers).match
|
# url = adfly.get_long_url(item.url)
|
||||||
else:
|
|
||||||
if item.data: url = item.data
|
# elif 'bit.ly' in item.url:
|
||||||
url = support.match(url, patron=r'data-href="([^"]+)" target').match
|
# url = support.httptools.downloadpage(item.url, only_headers=True, follow_redirects=False).headers.get("location")
|
||||||
if not url: url = support.match(url, patron=[r'<source src=(?:")?([^" ]+)',r'name="_wp_http_referer" value="([^"]+)"']).match
|
|
||||||
if url.startswith('//'): url = 'https:' + url
|
# else:
|
||||||
elif url.startswith('/'): url = 'https:/' + url
|
# url = host
|
||||||
if 'vvvvid' in url: itemlist.append(item.clone(action="play", title='VVVVID', url=url, server='vvvvid'))
|
# for u in item.url.split('/'):
|
||||||
else: itemlist.append(item.clone(action="play", title=support.config.get_localized_string(30137), url=url, server='directo'))
|
# if u and 'animeforce' not in u and 'http' not in u:
|
||||||
|
# url += '/' + u
|
||||||
|
|
||||||
|
|
||||||
|
# if 'php?' in url:
|
||||||
|
# url = support.httptools.downloadpage(url, only_headers=True, follow_redirects=False).headers.get("location")
|
||||||
|
# url = support.match(url, patron=r'class="button"><a href=(?:")?([^" ]+)', headers=headers).match
|
||||||
|
# else:
|
||||||
|
# if item.data: url = item.data
|
||||||
|
# if item.contentType == 'movie': url = support.match()
|
||||||
|
# url = support.match(url, patron=r'data-href="([^"]+)" target').match
|
||||||
|
# if not url: url = support.match(url, patron=[r'<source src=(?:")?([^" ]+)',r'name="_wp_http_referer" value="([^"]+)"']).match
|
||||||
|
# if url.startswith('//'): url = 'https:' + url
|
||||||
|
# elif url.startswith('/'): url = 'https:/' + url
|
||||||
|
url = support.match(url, patron=r'data-href="([^"]+)" target').match
|
||||||
|
if 'vvvvid' in url: itemlist.append(item.clone(action="play", title='VVVVID', url=url, server='vvvvid'))
|
||||||
|
else: itemlist.append(item.clone(action="play", title=support.config.get_localized_string(30137), url=url, server='directo'))
|
||||||
|
|
||||||
return support.server(item, itemlist=itemlist)
|
return support.server(item, itemlist=itemlist)
|
||||||
|
|||||||
+12
-12
@@ -54,7 +54,7 @@ def search(item, texto):
|
|||||||
|
|
||||||
item.url = host + "/?s=" + texto
|
item.url = host + "/?s=" + texto
|
||||||
try:
|
try:
|
||||||
item.contentType = 'undefined'
|
item.args = 'search'
|
||||||
return peliculas(item)
|
return peliculas(item)
|
||||||
|
|
||||||
# Continua la ricerca in caso di errore
|
# Continua la ricerca in caso di errore
|
||||||
@@ -78,11 +78,11 @@ def newest(categoria):
|
|||||||
|
|
||||||
@support.scrape
|
@support.scrape
|
||||||
def peliculas(item):
|
def peliculas(item):
|
||||||
if item.contentType == 'undefined':
|
action = 'check'
|
||||||
action = 'check'
|
item.contentType == 'undefined'
|
||||||
|
if item.args == 'search':
|
||||||
patron = r'<a href="(?P<url>[^"]+)" title="Permalink to\s*(?P<title>[^"]+) \((?P<year>[0-9]+)[^<]*\)[^"]*"[^>]+>\s*<img[^s]+src="(?P<thumb>[^"]+)".*?<div class="calitate">\s*<p>(?P<quality>[^<]+)<\/p>'
|
patron = r'<a href="(?P<url>[^"]+)" title="Permalink to\s*(?P<title>[^"]+) \((?P<year>[0-9]+)[^<]*\)[^"]*"[^>]+>\s*<img[^s]+src="(?P<thumb>[^"]+)".*?<div class="calitate">\s*<p>(?P<quality>[^<]+)<\/p>'
|
||||||
else:
|
else:
|
||||||
action = 'findvideos' if item.contentType == 'movie' else 'episodios'
|
|
||||||
patronNext = r'<a class="nextpostslink" rel="next" href="([^"]+)">'
|
patronNext = r'<a class="nextpostslink" rel="next" href="([^"]+)">'
|
||||||
patron = r'<div class="mediaWrap mediaWrapAlt">\s*<a href="(?P<url>[^"]+)"(?:[^>]+)?>?\s*(?:<img[^s]+src="(?P<thumb>[^"]+)"[^>]+>\s*)?<\/a>[^>]+>[^>]+>[^>]+>(?P<title>[^<]+?)(?P<lang>[sS][uU][bB]\-[iI][tT][aA]+)?(?:[ ]?\((?P<year>\d{4})-?(?:\d{4})?)\).[^<]+[^>]+><\/a>[^>]+>[^>]+>[^>]+>[^>]+>[^>]+>\s*(?P<quality>[a-zA-Z-0-9\.]+)?'
|
patron = r'<div class="mediaWrap mediaWrapAlt">\s*<a href="(?P<url>[^"]+)"(?:[^>]+)?>?\s*(?:<img[^s]+src="(?P<thumb>[^"]+)"[^>]+>\s*)?<\/a>[^>]+>[^>]+>[^>]+>(?P<title>[^<]+?)(?P<lang>[sS][uU][bB]\-[iI][tT][aA]+)?(?:[ ]?\((?P<year>\d{4})-?(?:\d{4})?)\).[^<]+[^>]+><\/a>[^>]+>[^>]+>[^>]+>[^>]+>[^>]+>\s*(?P<quality>[a-zA-Z-0-9\.]+)?'
|
||||||
patronBlock = r'<div id="main_col">(?P<block>.*?)<!\-\- main_col \-\->'
|
patronBlock = r'<div id="main_col">(?P<block>.*?)<!\-\- main_col \-\->'
|
||||||
@@ -139,14 +139,14 @@ def check(item):
|
|||||||
if 'sub' in check.lower():
|
if 'sub' in check.lower():
|
||||||
item.contentLanguage = 'Sub-ITA'
|
item.contentLanguage = 'Sub-ITA'
|
||||||
logger.debug("CHECK : ", check)
|
logger.debug("CHECK : ", check)
|
||||||
if 'anime' in check.lower():
|
# if 'anime' in check.lower():
|
||||||
item.contentType = 'tvshow'
|
# item.contentType = 'tvshow'
|
||||||
logger.debug('select = ### è una anime ###')
|
# logger.debug('select = ### è una anime ###')
|
||||||
try:
|
# try:
|
||||||
return episodios(item)
|
# return episodios(item)
|
||||||
except:
|
# except:
|
||||||
pass
|
# pass
|
||||||
elif 'serie' in check.lower():
|
if 'serie' in check.lower():
|
||||||
item.contentType = 'tvshow'
|
item.contentType = 'tvshow'
|
||||||
return episodios(item)
|
return episodios(item)
|
||||||
else:
|
else:
|
||||||
|
|||||||
@@ -974,7 +974,7 @@ def add_movie(item):
|
|||||||
@param item: item to be saved.
|
@param item: item to be saved.
|
||||||
"""
|
"""
|
||||||
logger.debug()
|
logger.debug()
|
||||||
from platformcode.launcher import set_search_temp; set_search_temp(item)
|
# from platformcode.launcher import set_search_temp; set_search_temp(item)
|
||||||
item.contentType = 'movie'
|
item.contentType = 'movie'
|
||||||
|
|
||||||
# To disambiguate titles, TMDB is caused to ask for the really desired title
|
# To disambiguate titles, TMDB is caused to ask for the really desired title
|
||||||
@@ -1023,7 +1023,7 @@ def add_tvshow(item, channel=None, itemlist=[]):
|
|||||||
|
|
||||||
logger.debug("show=#" + item.show + "#")
|
logger.debug("show=#" + item.show + "#")
|
||||||
item.contentType = 'tvshow'
|
item.contentType = 'tvshow'
|
||||||
from platformcode.launcher import set_search_temp; set_search_temp(item)
|
# from platformcode.launcher import set_search_temp; set_search_temp(item)
|
||||||
|
|
||||||
if item.channel == "downloads":
|
if item.channel == "downloads":
|
||||||
itemlist = [item.clone()]
|
itemlist = [item.clone()]
|
||||||
|
|||||||
+235
-336
@@ -2,27 +2,20 @@
|
|||||||
# ------------------------------------------------------------
|
# ------------------------------------------------------------
|
||||||
# XBMC Launcher (xbmc / kodi)
|
# XBMC Launcher (xbmc / kodi)
|
||||||
# ------------------------------------------------------------
|
# ------------------------------------------------------------
|
||||||
import datetime
|
|
||||||
import json
|
|
||||||
import sys, os
|
|
||||||
|
|
||||||
import requests
|
|
||||||
|
|
||||||
PY3 = False
|
|
||||||
if sys.version_info[0] >= 3:PY3 = True; unicode = str; unichr = chr; long = int
|
|
||||||
|
|
||||||
|
import sys
|
||||||
from core.item import Item
|
from core.item import Item
|
||||||
from core import filetools, jsontools
|
from core import filetools
|
||||||
from platformcode import config, logger, platformtools, xbmc_videolibrary
|
from platformcode import config, logger, platformtools
|
||||||
from platformcode.logger import WebErrorException
|
from platformcode.logger import WebErrorException
|
||||||
temp_search_file = config.get_temp_file('temp-search')
|
|
||||||
|
|
||||||
|
|
||||||
def start():
|
def start():
|
||||||
""" First function that is executed when entering the plugin.
|
'''
|
||||||
|
First function that is executed when entering the plugin.
|
||||||
Within this function all calls should go to
|
Within this function all calls should go to
|
||||||
functions that we want to execute as soon as we open the plugin.
|
functions that we want to execute as soon as we open the plugin.
|
||||||
"""
|
'''
|
||||||
logger.debug()
|
logger.debug()
|
||||||
|
|
||||||
if not config.dev_mode():
|
if not config.dev_mode():
|
||||||
@@ -31,7 +24,7 @@ def start():
|
|||||||
changelog = fileC.read()
|
changelog = fileC.read()
|
||||||
if changelog.strip():
|
if changelog.strip():
|
||||||
platformtools.dialog_ok('Kodi on Demand', 'Aggiornamenti applicati:\n' + changelog)
|
platformtools.dialog_ok('Kodi on Demand', 'Aggiornamenti applicati:\n' + changelog)
|
||||||
os.remove(config.changelogFile)
|
filetools.remove(config.changelogFile)
|
||||||
except:
|
except:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
@@ -39,116 +32,58 @@ def start():
|
|||||||
def run(item=None):
|
def run(item=None):
|
||||||
logger.debug()
|
logger.debug()
|
||||||
|
|
||||||
if not item:
|
# Extract item from sys.argv
|
||||||
# Extract item from sys.argv
|
if not item: item = makeItem()
|
||||||
if sys.argv[2]:
|
|
||||||
sp = sys.argv[2].split('&')
|
|
||||||
url = sp[0]
|
|
||||||
item = Item().fromurl(url)
|
|
||||||
if len(sp) > 1:
|
|
||||||
for e in sp[1:]:
|
|
||||||
key, val = e.split('=')
|
|
||||||
item.__setattr__(key, val)
|
|
||||||
# If no item, this is mainlist
|
|
||||||
else:
|
|
||||||
item = Item(channel="channelselector", action="getmainlist", viewmode="movie")
|
|
||||||
if not config.get_setting('show_once'):
|
|
||||||
if not config.get_all_settings_addon():
|
|
||||||
logger.error('corrupted settings.xml!!')
|
|
||||||
settings_xml = os.path.join(config.get_data_path(), "settings.xml")
|
|
||||||
settings_bak = os.path.join(config.get_data_path(), "settings.bak")
|
|
||||||
if filetools.exists(settings_bak):
|
|
||||||
filetools.copy(settings_bak, settings_xml, True)
|
|
||||||
logger.info('restored settings.xml from backup')
|
|
||||||
else:
|
|
||||||
filetools.write(settings_xml, '<settings version="2">\n</settings>') # resetted settings
|
|
||||||
else:
|
|
||||||
from platformcode import xbmc_videolibrary
|
|
||||||
xbmc_videolibrary.ask_set_content(silent=False)
|
|
||||||
config.set_setting('show_once', True)
|
|
||||||
|
|
||||||
logger.info(item.tostring())
|
# Load or Repare Settings
|
||||||
|
if not config.get_setting('show_once'): showOnce()
|
||||||
|
|
||||||
reload = False
|
# Acrions
|
||||||
from core import db
|
logger.debug(item.tostring())
|
||||||
if db['OnPlay'].get('addon', False):
|
|
||||||
reload = True
|
|
||||||
db['OnPlay']['addon'] = False
|
|
||||||
db.close()
|
|
||||||
|
|
||||||
try:
|
try:
|
||||||
|
# Active tmdb
|
||||||
if not config.get_setting('tmdb_active'):
|
if not config.get_setting('tmdb_active'):
|
||||||
config.set_setting('tmdb_active', True)
|
config.set_setting('tmdb_active', True)
|
||||||
|
|
||||||
# If item has no action, stops here
|
# If item has no action, stops here
|
||||||
if item.action == "":
|
if item.action == '':
|
||||||
logger.debug("Item without action")
|
logger.debug('Item without action')
|
||||||
return
|
return
|
||||||
|
|
||||||
# Action for main menu in channelselector
|
# Channel Selector
|
||||||
elif item.action == "getmainlist":
|
if item.channel == 'channelselector':
|
||||||
|
itemlist = []
|
||||||
import channelselector
|
import channelselector
|
||||||
|
if item.action == 'getmainlist': # Action for main menu in channelselector
|
||||||
itemlist = channelselector.getmainlist()
|
itemlist = channelselector.getmainlist()
|
||||||
|
elif item.action == 'getchanneltypes': # Action for channel types on channelselector: movies, series, etc.
|
||||||
|
itemlist = channelselector.getchanneltypes()
|
||||||
|
elif item.action == 'filterchannels': # Action for channel listing on channelselector
|
||||||
|
itemlist = channelselector.filterchannels(item.channel_type)
|
||||||
platformtools.render_items(itemlist, item)
|
platformtools.render_items(itemlist, item)
|
||||||
|
|
||||||
# Action for channel types on channelselector: movies, series, etc.
|
|
||||||
elif item.action == "getchanneltypes":
|
|
||||||
import channelselector
|
|
||||||
itemlist = channelselector.getchanneltypes()
|
|
||||||
|
|
||||||
platformtools.render_items(itemlist, item)
|
|
||||||
|
|
||||||
# Action for channel listing on channelselector
|
|
||||||
elif item.action == "filterchannels":
|
|
||||||
import channelselector
|
|
||||||
itemlist = channelselector.filterchannels(item.channel_type)
|
|
||||||
|
|
||||||
platformtools.render_items(itemlist, item)
|
|
||||||
|
|
||||||
# Special action for playing a video from the library
|
# Special action for playing a video from the library
|
||||||
elif item.action == "play_from_library":
|
elif item.action == 'play_from_library':
|
||||||
play_from_library(item)
|
return playFromLibrary(item)
|
||||||
return
|
|
||||||
|
|
||||||
elif item.action == "keymap":
|
# Special play action
|
||||||
from platformcode import keymaptools
|
elif item.action == 'play': play(item)
|
||||||
if item.open:
|
|
||||||
return keymaptools.open_shortcut_menu()
|
|
||||||
else:
|
|
||||||
return keymaptools.set_key()
|
|
||||||
|
|
||||||
elif item.channel == "infoplus":
|
# Special findvideos Action
|
||||||
from platformcode import infoplus
|
elif item.action == 'findvideos': findvideos(item)
|
||||||
return infoplus.Main(item)
|
|
||||||
|
|
||||||
elif item.channel == "backup":
|
# Special action for searching, first asks for the words then call the "search" function
|
||||||
from platformcode import backup
|
elif item.action == 'search': search(item)
|
||||||
return getattr(backup, item.action)(item)
|
|
||||||
|
|
||||||
elif item.channel == "elementum_download":
|
######## Following shares must be improved ########
|
||||||
from platformcode import elementum_download
|
|
||||||
return getattr(elementum_download, item.action)(item)
|
|
||||||
|
|
||||||
elif item.channel == "shortcuts":
|
# Special itemInfo Action
|
||||||
from platformcode import shortcuts
|
|
||||||
return getattr(shortcuts, item.action)(item)
|
|
||||||
|
|
||||||
elif item.channel == "autorenumber":
|
|
||||||
from platformcode import autorenumber
|
|
||||||
return getattr(autorenumber, item.action)(item)
|
|
||||||
|
|
||||||
elif item.action == "delete_key":
|
|
||||||
from platformcode import keymaptools
|
|
||||||
return keymaptools.delete_key()
|
|
||||||
|
|
||||||
elif item.action == "script":
|
|
||||||
from core import tmdb
|
|
||||||
tmdb.clean_cache()
|
|
||||||
platformtools.dialog_notification(config.get_localized_string(20000), config.get_localized_string(60011), time=2000, sound=False)
|
|
||||||
elif item.action == "itemInfo":
|
elif item.action == "itemInfo":
|
||||||
platformtools.dialog_textviewer('Item info', item.parent)
|
platformtools.dialog_textviewer('Item info', item.parent)
|
||||||
|
|
||||||
|
# Special action for open item.url in browser
|
||||||
elif item.action == "open_browser":
|
elif item.action == "open_browser":
|
||||||
import webbrowser
|
import webbrowser
|
||||||
if not webbrowser.open(item.url):
|
if not webbrowser.open(item.url):
|
||||||
@@ -157,6 +92,8 @@ def run(item=None):
|
|||||||
xbmc.executebuiltin('StartAndroidActivity("", "android.intent.action.VIEW", "", "%s")' % item.url)
|
xbmc.executebuiltin('StartAndroidActivity("", "android.intent.action.VIEW", "", "%s")' % item.url)
|
||||||
else:
|
else:
|
||||||
platformtools.dialog_ok(config.get_localized_string(20000), config.get_localized_string(70740) % "\n".join([item.url[j:j+57] for j in range(0, len(item.url), 57)]))
|
platformtools.dialog_ok(config.get_localized_string(20000), config.get_localized_string(70740) % "\n".join([item.url[j:j+57] for j in range(0, len(item.url), 57)]))
|
||||||
|
|
||||||
|
# Special gotopage Action
|
||||||
elif item.action == "gotopage":
|
elif item.action == "gotopage":
|
||||||
page = platformtools.dialog_numeric(0, config.get_localized_string(70513))
|
page = platformtools.dialog_numeric(0, config.get_localized_string(70513))
|
||||||
if page:
|
if page:
|
||||||
@@ -169,148 +106,52 @@ def run(item=None):
|
|||||||
item.url = re.sub('([=/])[0-9]+(/?)$', '\g<1>' + page + '\g<2>', item.url)
|
item.url = re.sub('([=/])[0-9]+(/?)$', '\g<1>' + page + '\g<2>', item.url)
|
||||||
xbmc.executebuiltin("Container.Update(%s?%s)" % (sys.argv[0], item.tourl()))
|
xbmc.executebuiltin("Container.Update(%s?%s)" % (sys.argv[0], item.tourl()))
|
||||||
|
|
||||||
elif reload and item.channel == 'filmontv' and item.action == 'new_search':
|
# Special action for adding a movie to the library
|
||||||
import xbmc
|
elif item.action == "add_pelicula_to_library":
|
||||||
platformtools.fakeVideo()
|
from core import videolibrarytools
|
||||||
return xbmc.executebuiltin("Container.Update(" + sys.argv[0] + "?" + item.tourl() + ")")
|
videolibrarytools.add_movie(item)
|
||||||
else:
|
|
||||||
# Checks if channel exists
|
# Special action for adding a serie to the library
|
||||||
if os.path.isfile(os.path.join(config.get_runtime_path(), 'channels', item.channel + ".py")):
|
elif item.action == "add_serie_to_library":
|
||||||
CHANNELS = 'channels'
|
channel = importChannel(item)
|
||||||
|
from core import videolibrarytools
|
||||||
|
videolibrarytools.add_tvshow(item, channel)
|
||||||
|
|
||||||
|
# Special action for adding a undefined to the library
|
||||||
|
elif item.action == "add_to_library":
|
||||||
|
channel = importChannel(item)
|
||||||
|
from core import videolibrarytools
|
||||||
|
videolibrarytools.add_to_videolibrary(item, channel)
|
||||||
|
|
||||||
|
# Special action for downloading all episodes from a serie
|
||||||
|
elif item.action == "download_all_episodes":
|
||||||
|
from specials import downloads
|
||||||
|
item.action = item.extra
|
||||||
|
del item.extra
|
||||||
|
downloads.save_download(item)
|
||||||
|
|
||||||
|
# keymaptools special actions
|
||||||
|
elif item.action == "keymap":
|
||||||
|
from platformcode import keymaptools
|
||||||
|
if item.open:
|
||||||
|
return keymaptools.open_shortcut_menu()
|
||||||
else:
|
else:
|
||||||
CHANNELS = 'specials'
|
return keymaptools.set_key()
|
||||||
|
elif item.action == "delete_key":
|
||||||
|
from platformcode import keymaptools
|
||||||
|
return keymaptools.delete_key()
|
||||||
|
|
||||||
channel_file = os.path.join(config.get_runtime_path(), CHANNELS, item.channel + ".py")
|
# delete tmdb cache
|
||||||
|
elif item.action == "script":
|
||||||
|
from core import tmdb
|
||||||
|
tmdb.clean_cache()
|
||||||
|
platformtools.dialog_notification(config.get_localized_string(20000), config.get_localized_string(60011), time=2000, sound=False)
|
||||||
|
|
||||||
logger.debug("channel_file= " + channel_file + ' - ' + CHANNELS + ' - ' + item.channel)
|
################################################
|
||||||
|
|
||||||
channel = None
|
# For all other actions
|
||||||
|
else: actions(item)
|
||||||
|
|
||||||
if os.path.exists(channel_file):
|
|
||||||
try:
|
|
||||||
channel = __import__('%s.%s' % (CHANNELS, item.channel), None, None, ['%s.%s' % (CHANNELS, item.channel)])
|
|
||||||
except ImportError:
|
|
||||||
exec("import " + CHANNELS + "." + item.channel + " as channel")
|
|
||||||
|
|
||||||
logger.info("Running channel %s | %s" % (channel.__name__, channel.__file__))
|
|
||||||
|
|
||||||
# Special play action
|
|
||||||
if item.action == "play":
|
|
||||||
# from core.support import dbg;dbg()
|
|
||||||
# define la info para trakt
|
|
||||||
try:
|
|
||||||
from core import trakt_tools
|
|
||||||
trakt_tools.set_trakt_info(item)
|
|
||||||
except:
|
|
||||||
pass
|
|
||||||
logger.debug("item.action=%s" % item.action.upper())
|
|
||||||
# logger.debug("item_toPlay: " + "\n" + item.tostring('\n'))
|
|
||||||
|
|
||||||
# First checks if channel has a "play" function
|
|
||||||
if hasattr(channel, 'play'):
|
|
||||||
logger.debug("Executing channel 'play' method")
|
|
||||||
itemlist = channel.play(item)
|
|
||||||
b_favourite = item.isFavourite
|
|
||||||
# Play should return a list of playable URLS
|
|
||||||
if len(itemlist) > 0 and isinstance(itemlist[0], Item):
|
|
||||||
item = itemlist[0]
|
|
||||||
if b_favourite:
|
|
||||||
item.isFavourite = True
|
|
||||||
platformtools.play_video(item)
|
|
||||||
|
|
||||||
# Permitir varias calidades desde play en el Channel
|
|
||||||
elif len(itemlist) > 0 and isinstance(itemlist[0], list):
|
|
||||||
item.video_urls = itemlist
|
|
||||||
platformtools.play_video(item)
|
|
||||||
|
|
||||||
# If not, shows user an error message
|
|
||||||
else:
|
|
||||||
platformtools.dialog_ok(config.get_localized_string(20000), config.get_localized_string(60339))
|
|
||||||
|
|
||||||
# If player don't have a "play" function, not uses the standard play from platformtools
|
|
||||||
else:
|
|
||||||
logger.debug("Executing core 'play' method")
|
|
||||||
platformtools.play_video(item)
|
|
||||||
|
|
||||||
# Special action for findvideos, where the plugin looks for known urls
|
|
||||||
elif item.action == "findvideos":
|
|
||||||
findvideos(item)
|
|
||||||
# platformtools.render_items(itemlist, item)
|
|
||||||
|
|
||||||
# Special action for adding a movie to the library
|
|
||||||
elif item.action == "add_pelicula_to_library":
|
|
||||||
from core import videolibrarytools
|
|
||||||
videolibrarytools.add_movie(item)
|
|
||||||
|
|
||||||
# Special action for adding a serie to the library
|
|
||||||
elif item.action == "add_serie_to_library":
|
|
||||||
from core import videolibrarytools
|
|
||||||
videolibrarytools.add_tvshow(item, channel)
|
|
||||||
|
|
||||||
# Special action for adding a undefined to the library
|
|
||||||
elif item.action == "add_to_library":
|
|
||||||
from core import videolibrarytools
|
|
||||||
videolibrarytools.add_to_videolibrary(item, channel)
|
|
||||||
|
|
||||||
# Special action for downloading all episodes from a serie
|
|
||||||
elif item.action == "download_all_episodes":
|
|
||||||
from specials import downloads
|
|
||||||
item.action = item.extra
|
|
||||||
del item.extra
|
|
||||||
downloads.save_download(item)
|
|
||||||
|
|
||||||
# Special action for searching, first asks for the words then call the "search" function
|
|
||||||
elif item.action == "search":
|
|
||||||
if filetools.isfile(temp_search_file) and config.get_setting('videolibrary_kodi'):
|
|
||||||
itemlist = []
|
|
||||||
f = filetools.read(temp_search_file)
|
|
||||||
strList = f.split(',')
|
|
||||||
if strList[0] == '[V]' and strList[1] == item.channel:
|
|
||||||
for it in strList:
|
|
||||||
if it and it not in ['[V]', item.channel]:
|
|
||||||
itemlist.append(Item().fromurl(it))
|
|
||||||
filetools.write(temp_search_file, f[4:])
|
|
||||||
return platformtools.render_items(itemlist, item)
|
|
||||||
else:
|
|
||||||
filetools.remove(temp_search_file)
|
|
||||||
|
|
||||||
logger.debug("item.action=%s" % item.action.upper())
|
|
||||||
from core import channeltools
|
|
||||||
|
|
||||||
if config.get_setting('last_search'):
|
|
||||||
last_search = channeltools.get_channel_setting('Last_searched', 'search', '')
|
|
||||||
else:
|
|
||||||
last_search = ''
|
|
||||||
|
|
||||||
search_text = platformtools.dialog_input(last_search)
|
|
||||||
|
|
||||||
if search_text is not None:
|
|
||||||
channeltools.set_channel_setting('Last_searched', search_text, 'search')
|
|
||||||
itemlist = new_search(item.clone(text=search_text), channel)
|
|
||||||
else:
|
|
||||||
return
|
|
||||||
|
|
||||||
platformtools.render_items(itemlist, item)
|
|
||||||
|
|
||||||
# For all other actions
|
|
||||||
else:
|
|
||||||
|
|
||||||
logger.debug("Executing channel '%s' method" % item.action)
|
|
||||||
itemlist = getattr(channel, item.action)(item)
|
|
||||||
if config.get_setting('trakt_sync'):
|
|
||||||
from core import trakt_tools
|
|
||||||
token_auth = config.get_setting("token_trakt", "trakt")
|
|
||||||
if not token_auth:
|
|
||||||
trakt_tools.auth_trakt()
|
|
||||||
else:
|
|
||||||
import xbmc
|
|
||||||
if not xbmc.getCondVisibility('System.HasAddon(script.trakt)') and config.get_setting('install_trakt'):
|
|
||||||
trakt_tools.ask_install_script()
|
|
||||||
itemlist = trakt_tools.trakt_check(itemlist)
|
|
||||||
else:
|
|
||||||
config.set_setting('install_trakt', True)
|
|
||||||
|
|
||||||
platformtools.render_items(itemlist, item)
|
|
||||||
|
|
||||||
|
|
||||||
except WebErrorException as e:
|
except WebErrorException as e:
|
||||||
@@ -322,24 +163,25 @@ def run(item=None):
|
|||||||
platformtools.dialog_ok(
|
platformtools.dialog_ok(
|
||||||
config.get_localized_string(59985) % e.channel,
|
config.get_localized_string(59985) % e.channel,
|
||||||
config.get_localized_string(60013) % e.url)
|
config.get_localized_string(60013) % e.url)
|
||||||
|
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
import traceback
|
import traceback
|
||||||
from core import scrapertools
|
from core import scrapertools
|
||||||
|
|
||||||
logger.error(traceback.format_exc())
|
logger.error(traceback.format_exc())
|
||||||
|
|
||||||
patron = 'File "' + os.path.join(config.get_runtime_path(), "channels", "").replace("\\", "\\\\") + r'([^.]+)\.py"'
|
patron = r'File "{}([^.]+)\.py"'.format(filetools.join(config.get_runtime_path(), 'channels', '').replace('\\', '\\\\'))
|
||||||
Channel = scrapertools.find_single_match(traceback.format_exc(), patron)
|
Channel = scrapertools.find_single_match(traceback.format_exc(), patron)
|
||||||
|
|
||||||
if Channel or e.__class__ == logger.ChannelScraperException:
|
if Channel or e.__class__ == logger.ChannelScraperException:
|
||||||
if item.url:
|
if item.url:
|
||||||
if platformtools.dialog_yesno(config.get_localized_string(60087) % Channel, config.get_localized_string(60014), nolabel='ok', yeslabel=config.get_localized_string(70739)):
|
if platformtools.dialog_yesno(config.get_localized_string(60087) % Channel, config.get_localized_string(60014), nolabel='ok', yeslabel=config.get_localized_string(70739)):
|
||||||
run(Item(action="open_browser", url=item.url))
|
run(Item(action='open_browser', url=item.url))
|
||||||
else:
|
else:
|
||||||
platformtools.dialog_ok(config.get_localized_string(60087) % Channel, config.get_localized_string(60014))
|
platformtools.dialog_ok(config.get_localized_string(60087) % Channel, config.get_localized_string(60014))
|
||||||
else:
|
else:
|
||||||
if platformtools.dialog_yesno(config.get_localized_string(60038), config.get_localized_string(60015)):
|
if platformtools.dialog_yesno(config.get_localized_string(60038), config.get_localized_string(60015)):
|
||||||
platformtools.itemlist_update(Item(channel="setting", action="report_menu"), True)
|
platformtools.itemlist_update(Item(channel='setting', action='report_menu'), True)
|
||||||
finally:
|
finally:
|
||||||
# db need to be closed when not used, it will cause freezes
|
# db need to be closed when not used, it will cause freezes
|
||||||
from core import db
|
from core import db
|
||||||
@@ -357,95 +199,102 @@ def new_search(item, channel=None):
|
|||||||
writelist = item.channel
|
writelist = item.channel
|
||||||
for it in itemlist:
|
for it in itemlist:
|
||||||
writelist += ',' + it.tourl()
|
writelist += ',' + it.tourl()
|
||||||
filetools.write(temp_search_file, writelist)
|
# filetools.write(temp_search_file, writelist)
|
||||||
return itemlist
|
return itemlist
|
||||||
|
|
||||||
def set_search_temp(item):
|
|
||||||
if filetools.isfile(temp_search_file) and config.get_setting('videolibrary_kodi'):
|
|
||||||
f = '[V],' + filetools.read(temp_search_file)
|
|
||||||
filetools.write(temp_search_file, f)
|
|
||||||
|
|
||||||
def reorder_itemlist(itemlist):
|
def limitItemlist(itemlist):
|
||||||
logger.debug()
|
logger.debug()
|
||||||
# logger.debug("Inlet itemlist size: %i" % len(itemlist))
|
|
||||||
|
|
||||||
new_list = []
|
|
||||||
mod_list = []
|
|
||||||
not_mod_list = []
|
|
||||||
|
|
||||||
modified = 0
|
|
||||||
not_modified = 0
|
|
||||||
|
|
||||||
to_change = [[config.get_localized_string(60335), '[V]'], [config.get_localized_string(60336), '[D]']]
|
|
||||||
|
|
||||||
for item in itemlist:
|
|
||||||
if not PY3:
|
|
||||||
old_title = unicode(item.title, "utf8").lower().encode("utf8")
|
|
||||||
else:
|
|
||||||
old_title = item.title.lower()
|
|
||||||
for before, after in to_change:
|
|
||||||
if before in item.title:
|
|
||||||
item.title = item.title.replace(before, after)
|
|
||||||
break
|
|
||||||
|
|
||||||
if not PY3:
|
|
||||||
new_title = unicode(item.title, "utf8").lower().encode("utf8")
|
|
||||||
else:
|
|
||||||
new_title = item.title.lower()
|
|
||||||
if old_title != new_title:
|
|
||||||
mod_list.append(item)
|
|
||||||
modified += 1
|
|
||||||
else:
|
|
||||||
not_mod_list.append(item)
|
|
||||||
not_modified += 1
|
|
||||||
|
|
||||||
# logger.debug("OLD: %s | NEW: %s" % (old_title, new_title))
|
|
||||||
|
|
||||||
new_list.extend(mod_list)
|
|
||||||
new_list.extend(not_mod_list)
|
|
||||||
|
|
||||||
logger.debug("Modified Titles:%i |Unmodified:%i" % (modified, not_modified))
|
|
||||||
|
|
||||||
if len(new_list) == 0:
|
|
||||||
new_list = itemlist
|
|
||||||
|
|
||||||
# logger.debug("Outlet itemlist size: %i" % len(new_list))
|
|
||||||
return new_list
|
|
||||||
|
|
||||||
|
|
||||||
def limit_itemlist(itemlist):
|
|
||||||
logger.debug()
|
|
||||||
# logger.debug("Inlet itemlist size: %i" % len(itemlist))
|
|
||||||
|
|
||||||
try:
|
try:
|
||||||
opt = config.get_setting("max_links", "videolibrary")
|
value = config.get_setting('max_links', 'videolibrary')
|
||||||
if opt == 0:
|
if value == 0:
|
||||||
new_list = itemlist
|
new_list = itemlist
|
||||||
else:
|
else:
|
||||||
i_max = 30 * opt
|
new_list = itemlist[:value]
|
||||||
new_list = itemlist[:i_max]
|
|
||||||
|
|
||||||
# logger.debug("Outlet itemlist size: %i" % len(new_list))
|
|
||||||
return new_list
|
return new_list
|
||||||
except:
|
except:
|
||||||
return itemlist
|
return itemlist
|
||||||
|
|
||||||
|
|
||||||
def findvideos(item):
|
def makeItem():
|
||||||
from core import db
|
logger.debug()
|
||||||
db['controls']['reopen'] = False
|
if sys.argv[2]:
|
||||||
db.close()
|
sp = sys.argv[2].split('&')
|
||||||
logger.debug('Executing channel', item.channel, 'method', item.action)
|
url = sp[0]
|
||||||
channel = platformtools.channelImport(item.channel)
|
item = Item().fromurl(url)
|
||||||
if not channel:
|
if len(sp) > 1:
|
||||||
logger.debug('Channel', item.channel, 'not exist!')
|
for e in sp[1:]:
|
||||||
return
|
key, val = e.split('=')
|
||||||
from core import servertools
|
if val.lower() == 'false': val = False
|
||||||
|
elif val.lower() == 'true': val = True
|
||||||
|
item.__setattr__(key, val)
|
||||||
|
# If no item, this is mainlist
|
||||||
|
else:
|
||||||
|
item = Item(channel='channelselector', action='getmainlist', viewmode='movie')
|
||||||
|
|
||||||
p_dialog = platformtools.dialog_progress_bg(config.get_localized_string(20000), config.get_localized_string(60683))
|
return item
|
||||||
p_dialog.update(0)
|
|
||||||
|
|
||||||
|
|
||||||
|
def showOnce():
|
||||||
|
if not config.get_all_settings_addon():
|
||||||
|
logger.error('corrupted settings.xml!!')
|
||||||
|
settings_xml = filetools.join(config.get_data_path(), 'settings.xml')
|
||||||
|
settings_bak = filetools.join(config.get_data_path(), 'settings.bak')
|
||||||
|
if filetools.exists(settings_bak):
|
||||||
|
filetools.copy(settings_bak, settings_xml, True)
|
||||||
|
logger.info('restored settings.xml from backup')
|
||||||
|
else:
|
||||||
|
filetools.write(settings_xml, '<settings version="2">\n</settings>') # resetted settings
|
||||||
|
else:
|
||||||
|
from platformcode import xbmc_videolibrary
|
||||||
|
xbmc_videolibrary.ask_set_content(silent=False)
|
||||||
|
config.set_setting('show_once', True)
|
||||||
|
|
||||||
|
|
||||||
|
def play(item):
|
||||||
|
channel = importChannel(item)
|
||||||
|
|
||||||
|
# define info for trakt
|
||||||
try:
|
try:
|
||||||
|
from core import trakt_tools
|
||||||
|
trakt_tools.set_trakt_info(item)
|
||||||
|
except:
|
||||||
|
pass
|
||||||
|
logger.debug('item.action=', item.action.upper())
|
||||||
|
|
||||||
|
# First checks if channel has a "play" function
|
||||||
|
if hasattr(channel, 'play'):
|
||||||
|
logger.debug('Executing channel "play" method')
|
||||||
|
itemlist = channel.play(item)
|
||||||
|
# Play should return a list of playable URLS
|
||||||
|
if len(itemlist) > 0 and isinstance(itemlist[0], Item):
|
||||||
|
item = itemlist[0]
|
||||||
|
platformtools.play_video(item)
|
||||||
|
|
||||||
|
# Allow several qualities from Play in El Channel
|
||||||
|
elif len(itemlist) > 0 and isinstance(itemlist[0], list):
|
||||||
|
item.video_urls = itemlist
|
||||||
|
platformtools.play_video(item)
|
||||||
|
|
||||||
|
# If not, shows user an error message
|
||||||
|
else:
|
||||||
|
platformtools.dialog_ok(config.get_localized_string(20000), config.get_localized_string(60339))
|
||||||
|
|
||||||
|
# If player don't have a "play" function, not uses the standard play from platformtools
|
||||||
|
else:
|
||||||
|
logger.debug('Executing core "play" method')
|
||||||
|
platformtools.play_video(item)
|
||||||
|
|
||||||
|
|
||||||
|
def findvideos(item, itemlist=[]):
|
||||||
|
if not itemlist:
|
||||||
|
logger.debug('Executing channel', item.channel, 'method', item.action)
|
||||||
|
channel = importChannel(item)
|
||||||
|
from core import servertools
|
||||||
|
|
||||||
|
p_dialog = platformtools.dialog_progress_bg(config.get_localized_string(20000), config.get_localized_string(60683))
|
||||||
|
p_dialog.update(0)
|
||||||
|
|
||||||
# First checks if channel has a "findvideos" function
|
# First checks if channel has a "findvideos" function
|
||||||
if hasattr(channel, 'findvideos'):
|
if hasattr(channel, 'findvideos'):
|
||||||
itemlist = getattr(channel, item.action)(item)
|
itemlist = getattr(channel, item.action)(item)
|
||||||
@@ -455,35 +304,85 @@ def findvideos(item):
|
|||||||
logger.debug('No channel "findvideos" method, executing core method')
|
logger.debug('No channel "findvideos" method, executing core method')
|
||||||
itemlist = servertools.find_video_items(item)
|
itemlist = servertools.find_video_items(item)
|
||||||
|
|
||||||
itemlist = limit_itemlist(itemlist)
|
itemlist = limitItemlist(itemlist)
|
||||||
except:
|
|
||||||
itemlist = []
|
|
||||||
|
|
||||||
p_dialog.update(100)
|
p_dialog.update(100)
|
||||||
p_dialog.close()
|
p_dialog.close()
|
||||||
|
|
||||||
serverlist = [s for s in itemlist if s.server]
|
serverlist = [s for s in itemlist if s.server]
|
||||||
|
if itemlist and not serverlist:
|
||||||
|
platformtools.render_items(itemlist, item)
|
||||||
if not serverlist:
|
if not serverlist:
|
||||||
platformtools.dialog_notification(config.get_localized_string(20000), config.get_localized_string(60347))
|
platformtools.dialog_notification(config.get_localized_string(20000), config.get_localized_string(60347))
|
||||||
elif len(serverlist) == 1:
|
elif len(serverlist) == 1:
|
||||||
run(serverlist[0].clone(no_return=True))
|
# If there is only one server play it immediately
|
||||||
|
play(itemlist[0].clone(no_return=True))
|
||||||
else:
|
else:
|
||||||
platformtools.serverWindow(item, itemlist)
|
platformtools.serverWindow(item, itemlist)
|
||||||
|
|
||||||
def play_from_library(item):
|
|
||||||
"""
|
def search(item):
|
||||||
The .strm files when played from kodi, this expects it to be a "playable" file so it cannot contain
|
channel = importChannel(item)
|
||||||
more items, at most a selection dialog can be placed.
|
from core import channeltools
|
||||||
We solve this by "cheating kodi" and making him believe that something has been reproduced, so later by
|
|
||||||
"Container.Update ()" we load the strm as if an item from inside the addon were treated, removing all
|
if config.get_setting('last_search'):
|
||||||
the limitations and allowing to reproduce through the general function without having to create new methods to
|
last_search = channeltools.get_channel_setting('Last_searched', 'search', '')
|
||||||
the video library.
|
else:
|
||||||
@type item: item
|
last_search = ''
|
||||||
@param item: item with information
|
|
||||||
"""
|
search_text = platformtools.dialog_input(last_search)
|
||||||
|
|
||||||
|
if search_text is not None:
|
||||||
|
channeltools.set_channel_setting('Last_searched', search_text, 'search')
|
||||||
|
itemlist = new_search(item.clone(text=search_text), channel)
|
||||||
|
else:
|
||||||
|
return
|
||||||
|
|
||||||
|
platformtools.render_items(itemlist, item)
|
||||||
|
|
||||||
|
|
||||||
|
def addToLibrary(item):
|
||||||
|
channel = importChannel(item)
|
||||||
|
from core import videolibrarytools
|
||||||
|
videolibrarytools.add_to_videolibrary(item, channel)
|
||||||
|
|
||||||
|
|
||||||
|
def importChannel(item):
|
||||||
|
channel = platformtools.channelImport(item.channel)
|
||||||
|
if not channel:
|
||||||
|
logger.debug('Channel', item.channel, 'not exist!')
|
||||||
|
return
|
||||||
|
|
||||||
|
logger.debug('Running channel', channel.__name__, '|', channel.__file__)
|
||||||
|
return channel
|
||||||
|
|
||||||
|
|
||||||
|
def actions(item):
|
||||||
|
logger.debug('Executing channel', item.channel, 'method', item.action)
|
||||||
|
channel = importChannel(item)
|
||||||
|
itemlist = getattr(channel, item.action)(item)
|
||||||
|
if type(itemlist) == list:
|
||||||
|
if config.get_setting('trakt_sync'):
|
||||||
|
from core import trakt_tools
|
||||||
|
token_auth = config.get_setting('token_trakt', 'trakt')
|
||||||
|
if not token_auth:
|
||||||
|
trakt_tools.auth_trakt()
|
||||||
|
else:
|
||||||
|
import xbmc
|
||||||
|
if not xbmc.getCondVisibility('System.HasAddon(script.trakt)') and config.get_setting('install_trakt'):
|
||||||
|
trakt_tools.ask_install_script()
|
||||||
|
itemlist = trakt_tools.trakt_check(itemlist)
|
||||||
|
else:
|
||||||
|
config.set_setting('install_trakt', True)
|
||||||
|
|
||||||
|
if len([s for s in itemlist if s.server]) > 0:
|
||||||
|
findvideos(item, itemlist)
|
||||||
|
else:
|
||||||
|
platformtools.render_items(itemlist, item)
|
||||||
|
|
||||||
|
|
||||||
|
def playFromLibrary(item):
|
||||||
if not item.next_ep: platformtools.fakeVideo()
|
if not item.next_ep: platformtools.fakeVideo()
|
||||||
item.action = item.next_action if item.next_action else 'findvideos'
|
item.action = item.next_action if item.next_action else 'findvideos'
|
||||||
|
logger.debug('Executing channel', item.channel, 'method', item.action)
|
||||||
return run(item)
|
return run(item)
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -1711,10 +1711,10 @@ def serverWindow(item, itemlist):
|
|||||||
ENTER = 7
|
ENTER = 7
|
||||||
EXIT = 10
|
EXIT = 10
|
||||||
BACKSPACE = 92
|
BACKSPACE = 92
|
||||||
prevent_busy()
|
|
||||||
|
|
||||||
class ServerWindow(xbmcgui.WindowXMLDialog):
|
class ServerWindow(xbmcgui.WindowXMLDialog):
|
||||||
def start(self, item, itemlist):
|
def start(self, item, itemlist):
|
||||||
|
prevent_busy()
|
||||||
self.itemlist = itemlist
|
self.itemlist = itemlist
|
||||||
self.item = item
|
self.item = item
|
||||||
self.servers = []
|
self.servers = []
|
||||||
@@ -1789,6 +1789,7 @@ def serverWindow(item, itemlist):
|
|||||||
|
|
||||||
class ServerSkinWindow(xbmcgui.WindowXMLDialog):
|
class ServerSkinWindow(xbmcgui.WindowXMLDialog):
|
||||||
def start(self, item, itemlist):
|
def start(self, item, itemlist):
|
||||||
|
prevent_busy()
|
||||||
self.item = item
|
self.item = item
|
||||||
self.itemlist = itemlist
|
self.itemlist = itemlist
|
||||||
self.selection = -1
|
self.selection = -1
|
||||||
@@ -1833,13 +1834,14 @@ def serverWindow(item, itemlist):
|
|||||||
color = typo(' •', 'bold color 0x{}'.format(color)) if color else ''
|
color = typo(' •', 'bold color 0x{}'.format(color)) if color else ''
|
||||||
title = '{}{}{}'.format(videoitem.serverName, quality, color)
|
title = '{}{}{}'.format(videoitem.serverName, quality, color)
|
||||||
else:
|
else:
|
||||||
logger.debug(videoitem)
|
|
||||||
title = videoitem.title
|
title = videoitem.title
|
||||||
it = xbmcgui.ListItem(title)
|
it = xbmcgui.ListItem(title)
|
||||||
if videoitem.ch_name:
|
if videoitem.ch_name:
|
||||||
it.setLabel2(videoitem.ch_name)
|
it.setLabel2(videoitem.ch_name)
|
||||||
else:
|
elif not videoitem.action:
|
||||||
it.setLabel2(videoitem.plot)
|
it.setLabel2(videoitem.plot)
|
||||||
|
else:
|
||||||
|
it.setLabel2(videoitem.fulltitle)
|
||||||
it.setArt({'thumb': videoitem.thumbnail})
|
it.setArt({'thumb': videoitem.thumbnail})
|
||||||
items.append(it)
|
items.append(it)
|
||||||
self.list.reset()
|
self.list.reset()
|
||||||
|
|||||||
+5
-2
@@ -219,8 +219,11 @@ def find_file(hash):
|
|||||||
def elementum_actions(parameter, TorrentHash):
|
def elementum_actions(parameter, TorrentHash):
|
||||||
elementum_setting, elementum_host, TorrentPath = setting()
|
elementum_setting, elementum_host, TorrentPath = setting()
|
||||||
if elementum_setting:
|
if elementum_setting:
|
||||||
if parameter == 'delete': monitor_update(TorrentPath, TorrentHash, remove=True)
|
try:
|
||||||
requests.get('%s/%s/%s' %(elementum_host, parameter, TorrentHash))
|
if parameter == 'delete': monitor_update(TorrentPath, TorrentHash, remove=True)
|
||||||
|
requests.get('%s/%s/%s' %(elementum_host, parameter, TorrentHash))
|
||||||
|
except:
|
||||||
|
pass
|
||||||
|
|
||||||
|
|
||||||
def process_filename(filename, Title, ext=True):
|
def process_filename(filename, Title, ext=True):
|
||||||
|
|||||||
Reference in New Issue
Block a user