- Fix Videoteca
- Aggiunti server VOE e HighLoad - dbg spostato in logger - altre migliorie
This commit is contained in:
+1
-2
@@ -31,7 +31,7 @@
|
|||||||
"mediasetplay": "https://www.mediasetplay.mediaset.it",
|
"mediasetplay": "https://www.mediasetplay.mediaset.it",
|
||||||
"mondoserietv": "https://mondoserietv.club",
|
"mondoserietv": "https://mondoserietv.club",
|
||||||
"paramount": "https://www.paramountnetwork.it",
|
"paramount": "https://www.paramountnetwork.it",
|
||||||
"piratestreaming": "https://www.piratestreaming.design",
|
"piratestreaming": "https://www.piratestreaming.video",
|
||||||
"polpotv": "https://roma.polpo.tv",
|
"polpotv": "https://roma.polpo.tv",
|
||||||
"raiplay": "https://www.raiplay.it",
|
"raiplay": "https://www.raiplay.it",
|
||||||
"seriehd": "https://altadefinizionecommunity.casa",
|
"seriehd": "https://altadefinizionecommunity.casa",
|
||||||
@@ -48,7 +48,6 @@
|
|||||||
"findhost": {
|
"findhost": {
|
||||||
"altadefinizioneclick": "https://altadefinizione-nuovo.click",
|
"altadefinizioneclick": "https://altadefinizione-nuovo.click",
|
||||||
"altadefinizionecommunity": "https://altaregistrazione.com",
|
"altadefinizionecommunity": "https://altaregistrazione.com",
|
||||||
"animealtadefinizione": "https://www.animealtadefinizione.it",
|
|
||||||
"filmpertutti": "https://filmpertuttiii.nuovo.live"
|
"filmpertutti": "https://filmpertuttiii.nuovo.live"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -145,7 +145,7 @@ def mainlist(item):
|
|||||||
# AVVERTENZE: Se il titolo è trovato nella ricerca TMDB/TVDB/Altro allora le locandine e altre info non saranno quelle recuperate nel sito.!!!!
|
# AVVERTENZE: Se il titolo è trovato nella ricerca TMDB/TVDB/Altro allora le locandine e altre info non saranno quelle recuperate nel sito.!!!!
|
||||||
@support.scrape
|
@support.scrape
|
||||||
def peliculas(item):
|
def peliculas(item):
|
||||||
#support.dbg() # decommentare per attivare web_pdb
|
#logger.dbg() # decommentare per attivare web_pdb
|
||||||
|
|
||||||
action = ''
|
action = ''
|
||||||
blacklist = ['']
|
blacklist = ['']
|
||||||
@@ -159,7 +159,7 @@ def peliculas(item):
|
|||||||
|
|
||||||
@support.scrape
|
@support.scrape
|
||||||
def episodios(item):
|
def episodios(item):
|
||||||
#support.dbg()
|
#logger.dbg()
|
||||||
|
|
||||||
action = ''
|
action = ''
|
||||||
blacklist = ['']
|
blacklist = ['']
|
||||||
@@ -175,7 +175,7 @@ def episodios(item):
|
|||||||
# per genere, per anno, per lettera, per qualità ecc ecc
|
# per genere, per anno, per lettera, per qualità ecc ecc
|
||||||
@support.scrape
|
@support.scrape
|
||||||
def genres(item):
|
def genres(item):
|
||||||
#support.dbg()
|
#logger.dbg()
|
||||||
|
|
||||||
action = ''
|
action = ''
|
||||||
blacklist = ['']
|
blacklist = ['']
|
||||||
@@ -195,7 +195,7 @@ def genres(item):
|
|||||||
# andranno modificate anche le def peliculas e episodios ove occorre
|
# andranno modificate anche le def peliculas e episodios ove occorre
|
||||||
def select(item):
|
def select(item):
|
||||||
logger.debug()
|
logger.debug()
|
||||||
#support.dbg()
|
#logger.dbg()
|
||||||
data = httptools.downloadpage(item.url, headers=headers).data
|
data = httptools.downloadpage(item.url, headers=headers).data
|
||||||
# pulizia di data, in caso commentare le prossime 2 righe
|
# pulizia di data, in caso commentare le prossime 2 righe
|
||||||
data = re.sub('\n|\t', ' ', data)
|
data = re.sub('\n|\t', ' ', data)
|
||||||
|
|||||||
@@ -3,6 +3,7 @@
|
|||||||
import os
|
import os
|
||||||
import sys
|
import sys
|
||||||
|
|
||||||
|
|
||||||
# Appends the main plugin dir to the PYTHONPATH if an internal package cannot be imported.
|
# Appends the main plugin dir to the PYTHONPATH if an internal package cannot be imported.
|
||||||
# Examples: In Plex Media Server all modules are under "Code.*" package, and in Enigma2 under "Plugins.Extensions.*"
|
# Examples: In Plex Media Server all modules are under "Code.*" package, and in Enigma2 under "Plugins.Extensions.*"
|
||||||
try:
|
try:
|
||||||
@@ -10,3 +11,4 @@ try:
|
|||||||
import core
|
import core
|
||||||
except:
|
except:
|
||||||
sys.path.append(os.path.abspath(os.path.join(os.path.dirname(__file__), "..", "..")))
|
sys.path.append(os.path.abspath(os.path.join(os.path.dirname(__file__), "..", "..")))
|
||||||
|
|
||||||
|
|||||||
@@ -116,7 +116,6 @@ def findvideos(item):
|
|||||||
if item.contentType == 'movie':
|
if item.contentType == 'movie':
|
||||||
matches = support.match(item, patron=epPatron).matches
|
matches = support.match(item, patron=epPatron).matches
|
||||||
for title, url in matches:
|
for title, url in matches:
|
||||||
# support.dbg()
|
|
||||||
get_video_list(item, url, title, itemlist)
|
get_video_list(item, url, title, itemlist)
|
||||||
else:
|
else:
|
||||||
get_video_list(item, item.url, support.config.get_localized_string(30137), itemlist)
|
get_video_list(item, item.url, support.config.get_localized_string(30137), itemlist)
|
||||||
|
|||||||
@@ -20,8 +20,6 @@ def get_cookie(data):
|
|||||||
|
|
||||||
|
|
||||||
def get_data(item):
|
def get_data(item):
|
||||||
# support.dbg()
|
|
||||||
# url = support.match(item.url, headers=headers, follow_redirects=True, only_headers=True).url
|
|
||||||
data = support.match(item.url, headers=headers, follow_redirects=True).data
|
data = support.match(item.url, headers=headers, follow_redirects=True).data
|
||||||
if 'ASCookie' in data:
|
if 'ASCookie' in data:
|
||||||
get_cookie(data)
|
get_cookie(data)
|
||||||
@@ -177,46 +175,11 @@ def findvideos(item):
|
|||||||
logger.debug()
|
logger.debug()
|
||||||
itemlist = []
|
itemlist = []
|
||||||
links = []
|
links = []
|
||||||
# page_data = ''
|
|
||||||
# titles =['Primario', 'Secondario', 'Alternativo Primario', 'Alternativo Secondario']
|
|
||||||
# pre_data = support.match(item, headers=headers).data
|
|
||||||
# url = support.match(pre_data , patron=r'<a href="([^"]+)">[^>]+>[^>]+>G').match
|
|
||||||
# urls = [url, url+'&extra=1', url+'&s=alt', url+'&s=alt&extra=1']
|
|
||||||
# links = []
|
|
||||||
# support.dbg()
|
|
||||||
# for i, url in enumerate(urls):
|
|
||||||
# data = support.match(url, headers=headers).data
|
|
||||||
# if not '&s' in url:
|
|
||||||
# link = support.match(data, patron=r'(?:<source type="[^"]+"\s*src=|file:\s*)"([^"]+)"', headers=headers).match
|
|
||||||
# else:
|
|
||||||
# link = support.match(data, headers=headers, patron=r'file:\s*"([^"]+)"').match
|
|
||||||
# if not link:
|
|
||||||
# page_data += data
|
|
||||||
# if link and link not in links:
|
|
||||||
# links.append(link)
|
|
||||||
# # link += '|Referer=' + item.url
|
|
||||||
# itemlist.append(item.clone(action="play", title=titles[i], url=link, server='directo'))
|
|
||||||
|
|
||||||
# return support.server(item, data=data, itemlist=itemlist)
|
|
||||||
main_url = support.match(item, patron=r'<a href="([^"]+)">[^>]+>[^>]+>G').match
|
main_url = support.match(item, patron=r'<a href="([^"]+)">[^>]+>[^>]+>G').match
|
||||||
# internal = support.match(data, patron=r'<a href="([^"]+)">[^>]+>[^>]+>G').match
|
|
||||||
urls = support.match(support.match(main_url, headers=headers).data, patron=r'<a class="dropdown-item"\s*href="([^"]+)', headers=headers).matches
|
urls = support.match(support.match(main_url, headers=headers).data, patron=r'<a class="dropdown-item"\s*href="([^"]+)', headers=headers).matches
|
||||||
itemlist.append(item.clone(action="play", title='Primario', url=main_url, server='directo'))
|
itemlist.append(item.clone(action="play", title='Primario', url=main_url, server='directo'))
|
||||||
itemlist.append(item.clone(action="play", title='Secondario', url=main_url + '&s=alt', server='directo'))
|
itemlist.append(item.clone(action="play", title='Secondario', url=main_url + '&s=alt', server='directo'))
|
||||||
# support.dbg()
|
|
||||||
# for i, url in enumerate(internal_urls):
|
|
||||||
# internal_data = support.match(url, headers=headers).data
|
|
||||||
# if not '&s' in url:
|
|
||||||
# link = support.match(internal_data, patron=r'(?:<source type="[^"]+"\s*src=|file:\s*)"([^"]+)"', headers=headers).match
|
|
||||||
# else:
|
|
||||||
# link = support.match(internal_data, headers=headers, patron=r'file:\s*"([^"]+)"').match
|
|
||||||
# if not link:
|
|
||||||
# links.append(internal_data)
|
|
||||||
# if link and link not in links:
|
|
||||||
# links.append(link)
|
|
||||||
# itemlist.append(item.clone(action="play", title=internal_titles[i], url=link, server='directo'))
|
|
||||||
# link = support.match(external[0], patron=r'href="([^"]+)', headers=headers, debug=True).match
|
|
||||||
# support.dbg()
|
|
||||||
for url in urls:
|
for url in urls:
|
||||||
link = support.match(url, patron=r'<a href="([^"]+)"[^>]+><button', headers=headers).match
|
link = support.match(url, patron=r'<a href="([^"]+)"[^>]+><button', headers=headers).match
|
||||||
if link:
|
if link:
|
||||||
|
|||||||
@@ -52,7 +52,6 @@ def menu(item):
|
|||||||
|
|
||||||
def genres(item):
|
def genres(item):
|
||||||
logger.debug()
|
logger.debug()
|
||||||
# support.dbg()
|
|
||||||
itemlist = []
|
itemlist = []
|
||||||
|
|
||||||
genres = json.loads(support.match(response.text, patron='genres="([^"]+)').match.replace('"','"'))
|
genres = json.loads(support.match(response.text, patron='genres="([^"]+)').match.replace('"','"'))
|
||||||
@@ -219,45 +218,6 @@ def episodios(item):
|
|||||||
|
|
||||||
|
|
||||||
def findvideos(item):
|
def findvideos(item):
|
||||||
# def calculateToken():
|
|
||||||
# from time import time
|
|
||||||
# from base64 import b64encode as b64
|
|
||||||
# import hashlib
|
|
||||||
# o = 48
|
|
||||||
# n = support.match('https://au-1.scws-content.net/get-ip').data
|
|
||||||
# i = 'Yc8U6r8KjAKAepEA'
|
|
||||||
# t = int(time() + (3600 * o))
|
|
||||||
# l = '{}{} {}'.format(t, n, i)
|
|
||||||
# md5 = hashlib.md5(l.encode())
|
|
||||||
# s = '?token={}&expires={}'.format(b64(md5.digest()).decode().replace('=', '').replace('+', "-").replace('\\', "_"), t)
|
|
||||||
# return s
|
|
||||||
# token = calculateToken()
|
|
||||||
|
|
||||||
# url = 'https://streamingcommunityws.com/master/{}{}'.format(item.video_url, token)
|
|
||||||
|
|
||||||
# # support.dbg()
|
|
||||||
|
|
||||||
# m3u8_original = httptools.downloadpage(url, CF=False).data
|
|
||||||
|
|
||||||
# m_video = re.search(r'\.\/video\/(\d+p)\/playlist.m3u8', m3u8_original)
|
|
||||||
# video_res = m_video.group(1)
|
|
||||||
# m_audio = re.search(r'\.\/audio\/(\d+k)\/playlist.m3u8', m3u8_original)
|
|
||||||
# audio_res = m_audio.group(1)
|
|
||||||
|
|
||||||
# # https://streamingcommunityws.com/master/5957?type=video&rendition=480p&token=wQLowWskEnbLfOfXXWWPGA&expires=1623437317
|
|
||||||
# video_url = 'https://streamingcommunityws.com/master/{}{}&type=video&rendition={}'.format(item.video_url, token, video_res)
|
|
||||||
# audio_url = 'https://streamingcommunityws.com/master/{}{}&type=audio&rendition={}'.format(item.video_url, token, audio_res)
|
|
||||||
|
|
||||||
# m3u8_original = m3u8_original.replace( m_video.group(0), video_url )
|
|
||||||
# m3u8_original = m3u8_original.replace( m_audio.group(0), audio_url )
|
|
||||||
|
|
||||||
# file_path = 'special://temp/animeunity.m3u8'
|
|
||||||
|
|
||||||
# filetools.write(xbmc.translatePath(file_path), m3u8_original, 'w')
|
|
||||||
|
|
||||||
# return support.server(item, itemlist=[item.clone(title=support.config.get_localized_string(30137), url=file_path, manifest = 'hls', server='directo', action='play')])
|
|
||||||
# item.url=item.video_url
|
|
||||||
|
|
||||||
directLink = False
|
directLink = False
|
||||||
if item.video_url == None:
|
if item.video_url == None:
|
||||||
if item.extra == "tvshow":
|
if item.extra == "tvshow":
|
||||||
|
|||||||
@@ -81,7 +81,6 @@ def peliculas(item):
|
|||||||
return locals()
|
return locals()
|
||||||
|
|
||||||
def check(item):
|
def check(item):
|
||||||
# support.dbg()
|
|
||||||
item.url = support.match(item, patron=r'(?:<p>|/>)(.*?)(?:<br|</td>|</p>)', patronBlock=r'Streaming:(.*?)</tr>').matches
|
item.url = support.match(item, patron=r'(?:<p>|/>)(.*?)(?:<br|</td>|</p>)', patronBlock=r'Streaming:(.*?)</tr>').matches
|
||||||
if 'Episodio' in str(item.url):
|
if 'Episodio' in str(item.url):
|
||||||
item.contentType = 'tvshow'
|
item.contentType = 'tvshow'
|
||||||
|
|||||||
@@ -117,7 +117,6 @@ def episodios(item):
|
|||||||
def findvideos(item):
|
def findvideos(item):
|
||||||
itemlist = []
|
itemlist = []
|
||||||
logger.debug()
|
logger.debug()
|
||||||
# support.dbg()
|
|
||||||
|
|
||||||
matches = support.match(item, patron=r'href="([^"]+)"', patronBlock=r'<div style="white-space: (.*?)<div id="main-content"')
|
matches = support.match(item, patron=r'href="([^"]+)"', patronBlock=r'<div style="white-space: (.*?)<div id="main-content"')
|
||||||
|
|
||||||
|
|||||||
@@ -39,7 +39,6 @@ def mainlist(item):
|
|||||||
|
|
||||||
@support.scrape
|
@support.scrape
|
||||||
def peliculas(item):
|
def peliculas(item):
|
||||||
# support.dbg()
|
|
||||||
deflang = 'Sub-ITA'
|
deflang = 'Sub-ITA'
|
||||||
|
|
||||||
# è una singola pagina con tutti gli episodi
|
# è una singola pagina con tutti gli episodi
|
||||||
@@ -81,7 +80,6 @@ def peliculas(item):
|
|||||||
|
|
||||||
def episodios_args(item):
|
def episodios_args(item):
|
||||||
actLike = 'episodios'
|
actLike = 'episodios'
|
||||||
# support.dbg()
|
|
||||||
|
|
||||||
deflang = 'Sub-ITA'
|
deflang = 'Sub-ITA'
|
||||||
action = 'findvideos'
|
action = 'findvideos'
|
||||||
@@ -101,7 +99,6 @@ def episodios(item):
|
|||||||
@support.scrape
|
@support.scrape
|
||||||
def genres(item):
|
def genres(item):
|
||||||
logger.debug()
|
logger.debug()
|
||||||
#support.dbg()
|
|
||||||
|
|
||||||
action = 'peliculas'
|
action = 'peliculas'
|
||||||
patronBlock = r'<div id="mcTagMapNav">(?P<block>.+?)</div>'
|
patronBlock = r'<div id="mcTagMapNav">(?P<block>.+?)</div>'
|
||||||
|
|||||||
@@ -191,7 +191,7 @@ def findvideos(item):
|
|||||||
for i, url in enumerate(list_url):
|
for i, url in enumerate(list_url):
|
||||||
itemlist.append(support.Item(
|
itemlist.append(support.Item(
|
||||||
channel=item.channel,
|
channel=item.channel,
|
||||||
title=list_servers[i],
|
# title=list_servers[i],
|
||||||
url=url,
|
url=url,
|
||||||
action='play',
|
action='play',
|
||||||
quality=list_quality[i],
|
quality=list_quality[i],
|
||||||
|
|||||||
@@ -30,7 +30,7 @@ current_session.headers.update({'Content-Type': 'application/json', 'User-Agent'
|
|||||||
|
|
||||||
# login anonimo
|
# login anonimo
|
||||||
res = current_session.post(loginUrl, json=loginData, verify=False)
|
res = current_session.post(loginUrl, json=loginData, verify=False)
|
||||||
support.dbg()
|
logger.dbg()
|
||||||
Token = res.json['response']['beToken']
|
Token = res.json['response']['beToken']
|
||||||
sid = res.json['response']['sid']
|
sid = res.json['response']['sid']
|
||||||
current_session.headers.update({'authorization': 'Bearer' + Token})
|
current_session.headers.update({'authorization': 'Bearer' + Token})
|
||||||
@@ -318,7 +318,7 @@ def get_from_id(item):
|
|||||||
def get_programs(item, ret=[], args={}):
|
def get_programs(item, ret=[], args={}):
|
||||||
hasMore = False
|
hasMore = False
|
||||||
url = ''
|
url = ''
|
||||||
# support.dbg()
|
# logger.dbg()
|
||||||
|
|
||||||
if 'search' in item.args:
|
if 'search' in item.args:
|
||||||
args['uxReference'] = item.args[2]
|
args['uxReference'] = item.args[2]
|
||||||
|
|||||||
+1
-1
@@ -105,7 +105,7 @@ def episodios(item):
|
|||||||
data = ''
|
data = ''
|
||||||
|
|
||||||
# debugging
|
# debugging
|
||||||
# support.dbg()
|
# logger.dbg()
|
||||||
# for i, season in enumerate(seasons.matches):
|
# for i, season in enumerate(seasons.matches):
|
||||||
# data += get_season(seasons.data if i == 0 else '', season[0], season[1])
|
# data += get_season(seasons.data if i == 0 else '', season[0], season[1])
|
||||||
import sys
|
import sys
|
||||||
|
|||||||
@@ -134,7 +134,7 @@ def episodios(item):
|
|||||||
|
|
||||||
|
|
||||||
def findvideos(item):
|
def findvideos(item):
|
||||||
# support.dbg()
|
# logger.dbg()
|
||||||
domain = scrapertools.find_single_match(item.url, 'https?://[a-z0-9.-]+')
|
domain = scrapertools.find_single_match(item.url, 'https?://[a-z0-9.-]+')
|
||||||
if item.contentType == 'movie':
|
if item.contentType == 'movie':
|
||||||
id = item.url.split('/')[-1]
|
id = item.url.split('/')[-1]
|
||||||
|
|||||||
@@ -191,13 +191,13 @@ def findvideos(item):
|
|||||||
# data += '\n'.join(listurl)
|
# data += '\n'.join(listurl)
|
||||||
logger.debug(data)
|
logger.debug(data)
|
||||||
itemlist = []
|
itemlist = []
|
||||||
# support.dbg()
|
# logger.dbg()
|
||||||
|
|
||||||
if '/serietv/series/names' in item.url:
|
if '/serietv/series/names' in item.url:
|
||||||
itemlist.extend(support.server(item, itemlist=hdpass(Item(url=item.url))))
|
itemlist.extend(support.server(item, itemlist=hdpass(Item(url=item.url))))
|
||||||
else:
|
else:
|
||||||
urls = support.match(data, patron=player_iframe).matches
|
urls = support.match(data, patron=player_iframe).matches
|
||||||
# support.dbg()
|
# logger.dbg()
|
||||||
if item.otherLinks:
|
if item.otherLinks:
|
||||||
urls += support.match(item.otherLinks, patron=r'href="([^"]+)').matches
|
urls += support.match(item.otherLinks, patron=r'href="([^"]+)').matches
|
||||||
|
|
||||||
|
|||||||
+1
-1
@@ -102,7 +102,7 @@ def newest(categoria):
|
|||||||
def peliculas(item):
|
def peliculas(item):
|
||||||
|
|
||||||
itemlist = []
|
itemlist = []
|
||||||
# support.dbg()
|
# logger.dbg()
|
||||||
if not item.args:
|
if not item.args:
|
||||||
json_file =loadjs(item.url + 'channel/10005/last/')
|
json_file =loadjs(item.url + 'channel/10005/last/')
|
||||||
logger.debug(json_file)
|
logger.debug(json_file)
|
||||||
|
|||||||
+4
-3
@@ -32,7 +32,7 @@ def start(itemlist, item):
|
|||||||
if not config.is_xbmc():
|
if not config.is_xbmc():
|
||||||
return itemlist
|
return itemlist
|
||||||
|
|
||||||
if config.get_setting('autoplay') or (item.channel == 'community' and item.autoplay):
|
if config.get_setting('autoplay') or item.autoplay:
|
||||||
# Save the current value of "Action and Player Mode" in preferences
|
# Save the current value of "Action and Player Mode" in preferences
|
||||||
user_config_setting_action = config.get_setting("default_action")
|
user_config_setting_action = config.get_setting("default_action")
|
||||||
# user_config_setting_player = config.get_setting("player_mode")
|
# user_config_setting_player = config.get_setting("player_mode")
|
||||||
@@ -72,8 +72,9 @@ def start(itemlist, item):
|
|||||||
platformtools.dialog_notification('AutoPlay', '{}{}{}'.format(name, lang, quality), 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 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])
|
channel = platformtools.channel_import(channel_id)
|
||||||
except: channel = __import__('specials.%s' % channel_id, None, None, ["specials.%s" % channel_id])
|
if not channel:
|
||||||
|
return
|
||||||
if hasattr(channel, 'play'):
|
if hasattr(channel, 'play'):
|
||||||
resolved_item = getattr(channel, 'play')(videoitem)
|
resolved_item = getattr(channel, 'play')(videoitem)
|
||||||
if len(resolved_item) > 0:
|
if len(resolved_item) > 0:
|
||||||
|
|||||||
@@ -171,7 +171,6 @@ def get_default_settings(channel_name):
|
|||||||
|
|
||||||
channel_path = filetools.join(config.get_runtime_path(), 'channels', channel_name + '.json')
|
channel_path = filetools.join(config.get_runtime_path(), 'channels', channel_name + '.json')
|
||||||
|
|
||||||
# from core.support import dbg; dbg()
|
|
||||||
if filetools.exists(channel_path):
|
if filetools.exists(channel_path):
|
||||||
default_controls = default_file['settings']
|
default_controls = default_file['settings']
|
||||||
default_controls_renumber = default_file['renumber']
|
default_controls_renumber = default_file['renumber']
|
||||||
|
|||||||
@@ -21,7 +21,6 @@ def find_and_set_infoLabels(item):
|
|||||||
:param item:
|
:param item:
|
||||||
:return: Boolean indicating if the 'code' could be found
|
:return: Boolean indicating if the 'code' could be found
|
||||||
"""
|
"""
|
||||||
# from core.support import dbg;dbg()
|
|
||||||
global scraper
|
global scraper
|
||||||
scraper = None
|
scraper = None
|
||||||
# logger.debug("item:\n" + item.tostring('\n'))
|
# logger.debug("item:\n" + item.tostring('\n'))
|
||||||
|
|||||||
+3
-3
@@ -63,7 +63,7 @@ def find_video_items(item=None, data=None):
|
|||||||
for label, url, server, thumbnail in findvideos(data):
|
for label, url, server, thumbnail in findvideos(data):
|
||||||
title = label
|
title = label
|
||||||
itemlist.append(
|
itemlist.append(
|
||||||
item.clone(title=title, action="play", url=url, thumbnail=thumbnail, server=server, folder=False))
|
item.clone(serverName=title, action="play", url=url, thumbnail=thumbnail, server=server, folder=False))
|
||||||
|
|
||||||
return itemlist
|
return itemlist
|
||||||
|
|
||||||
@@ -118,7 +118,7 @@ def get_servers_itemlist(itemlist, fnc=None, sort=False):
|
|||||||
item.server = "directo"
|
item.server = "directo"
|
||||||
|
|
||||||
if fnc:
|
if fnc:
|
||||||
item.title = fnc(item)
|
item.serverName = fnc(item)
|
||||||
|
|
||||||
|
|
||||||
# Sort according to favoriteslist if necessary
|
# Sort according to favoriteslist if necessary
|
||||||
@@ -751,7 +751,7 @@ def check_list_links(itemlist, numero='', timeout=3):
|
|||||||
if res:
|
if res:
|
||||||
it = res[0]
|
it = res[0]
|
||||||
verificacion = res[1]
|
verificacion = res[1]
|
||||||
it.title = verificacion + ' ' + it.title.strip()
|
it.serverName = verificacion + ' ' + it.title.strip()
|
||||||
logger.debug('VERIFICATION= ' + verificacion)
|
logger.debug('VERIFICATION= ' + verificacion)
|
||||||
it.alive = verificacion
|
it.alive = verificacion
|
||||||
return itemlist
|
return itemlist
|
||||||
|
|||||||
+46
-47
@@ -20,7 +20,7 @@ from time import time
|
|||||||
from core import httptools, scrapertools, servertools, tmdb, channeltools, autoplay
|
from core import httptools, scrapertools, servertools, tmdb, channeltools, autoplay
|
||||||
from core.item import Item
|
from core.item import Item
|
||||||
from lib import unshortenit
|
from lib import unshortenit
|
||||||
from platformcode import config, logger
|
from platformcode import config, logger, platformtools
|
||||||
|
|
||||||
channels_order = {'Rai 1': 1,
|
channels_order = {'Rai 1': 1,
|
||||||
'Rai 2': 2,
|
'Rai 2': 2,
|
||||||
@@ -486,7 +486,8 @@ class scrape:
|
|||||||
it.action=self.action
|
it.action=self.action
|
||||||
|
|
||||||
if it.action == 'findvideos':
|
if it.action == 'findvideos':
|
||||||
it.window = True if item.window_type == 0 or (config.get_setting("window_type") == 0) else False
|
platformtools.window_type(it)
|
||||||
|
# it.window = True if item.window_type == 0 or (config.get_setting("window_type") == 0) else False
|
||||||
if it.window: it.folder = False
|
if it.window: it.folder = False
|
||||||
|
|
||||||
for lg in list(set(match.keys()).difference(self.known_keys)):
|
for lg in list(set(match.keys()).difference(self.known_keys)):
|
||||||
@@ -573,20 +574,6 @@ def html_uniform(data):
|
|||||||
return re.sub("='([^']+)'", '="\\1"', data.replace('\n', ' ').replace('\t', ' ').replace(' ', ' '))
|
return re.sub("='([^']+)'", '="\\1"', data.replace('\n', ' ').replace('\t', ' ').replace(' ', ' '))
|
||||||
|
|
||||||
|
|
||||||
# Debug
|
|
||||||
|
|
||||||
def dbg():
|
|
||||||
if config.dev_mode():
|
|
||||||
try:
|
|
||||||
import web_pdb
|
|
||||||
if not web_pdb.WebPdb.active_instance:
|
|
||||||
import webbrowser
|
|
||||||
webbrowser.open('http://127.0.0.1:5555')
|
|
||||||
web_pdb.set_trace()
|
|
||||||
except:
|
|
||||||
pass
|
|
||||||
|
|
||||||
|
|
||||||
# Menu
|
# Menu
|
||||||
|
|
||||||
def menuItem(itemlist, channel, title='', action='', url='', contentType='undefined', args=[], style=True):
|
def menuItem(itemlist, channel, title='', action='', url='', contentType='undefined', args=[], style=True):
|
||||||
@@ -914,7 +901,7 @@ def nextPage(itemlist, item, function_or_level=1, **kwargs):
|
|||||||
|
|
||||||
|
|
||||||
def pagination(itemlist, item, function_level=1):
|
def pagination(itemlist, item, function_level=1):
|
||||||
if stackCheck('channel_search'):
|
if stackCheck(['channel_search', 'update_videolibrary']):
|
||||||
return itemlist
|
return itemlist
|
||||||
|
|
||||||
if not item.page:
|
if not item.page:
|
||||||
@@ -959,7 +946,7 @@ def pagination(itemlist, item, function_level=1):
|
|||||||
|
|
||||||
|
|
||||||
def season_pagination(itemlist, item, seasons=[], function_level=1):
|
def season_pagination(itemlist, item, seasons=[], function_level=1):
|
||||||
if stackCheck('channel_search'):
|
if stackCheck(['channel_search', 'update_videolibrary']):
|
||||||
return itemlist
|
return itemlist
|
||||||
|
|
||||||
action = function_level if type(function_level) == str else inspect.stack()[function_level][3]
|
action = function_level if type(function_level) == str else inspect.stack()[function_level][3]
|
||||||
@@ -1020,6 +1007,8 @@ def season_pagination(itemlist, item, seasons=[], function_level=1):
|
|||||||
def server(item, data='', itemlist=[], headers='', AutoPlay=True, CheckLinks=True, Download=True, patronTag=None, Videolibrary=True):
|
def server(item, data='', itemlist=[], headers='', AutoPlay=True, CheckLinks=True, Download=True, patronTag=None, Videolibrary=True):
|
||||||
logger.debug()
|
logger.debug()
|
||||||
|
|
||||||
|
if item.autoplay != '': AutoPlay = item.autoplay
|
||||||
|
|
||||||
if not data and not itemlist:
|
if not data and not itemlist:
|
||||||
data = httptools.downloadpage(item.url, headers=headers, ignore_response_code=True).data
|
data = httptools.downloadpage(item.url, headers=headers, ignore_response_code=True).data
|
||||||
if data:
|
if data:
|
||||||
@@ -1050,26 +1039,36 @@ def server(item, data='', itemlist=[], headers='', AutoPlay=True, CheckLinks=Tru
|
|||||||
videoitem.server = videoitem.server.lower()
|
videoitem.server = videoitem.server.lower()
|
||||||
|
|
||||||
if videoitem.video_urls or srv_param.get('active', False):
|
if videoitem.video_urls or srv_param.get('active', False):
|
||||||
logger.debug(item)
|
|
||||||
quality = videoitem.quality if videoitem.quality else item.quality if item.quality else ''
|
vi = item.clone(server=videoitem.server,
|
||||||
# videoitem = item.clone(url=videoitem.url, serverName=videoitem.serverName, server=videoitem.server, action='play')
|
serverName=videoitem.serverName,
|
||||||
videoitem.contentLanguage = videoitem.contentLanguage if videoitem.contentLanguage else item.contentLanguage if item.contentLanguage else 'ITA'
|
url=videoitem.url,
|
||||||
videoitem.serverName = videoitem.title if videoitem.server == 'directo' else servertools.get_server_parameters(videoitem.server).get('name', videoitem.server.capitalize())
|
video_urls= videoitem.video_urlsn,
|
||||||
# videoitem.title = item.contentTitle.strip() if item.contentType == 'movie' and item.contentTitle or (config.get_localized_string(30161) in item.fulltitle) else item.fulltitle
|
ch_name=channeltools.get_channel_parameters(item.channel)['title'],
|
||||||
videoitem.plot = typo(videoitem.title, 'bold') + (typo(quality, '_ [] bold') if quality else '')
|
action = "play")
|
||||||
videoitem.channel = item.channel
|
if videoitem.title: vi.serverName = videoitem.serverName
|
||||||
videoitem.fulltitle = item.fulltitle
|
if videoitem.quality: vi.quality = videoitem.quality
|
||||||
videoitem.show = item.show
|
if not vi.referer: vi.referer = item.url
|
||||||
videoitem.ch_name = channeltools.get_channel_parameters(item.channel)['title']
|
if videoitem.contentType == 'episode': vi.fanart=videoitem.thumbnail
|
||||||
if not videoitem.video_urls: videoitem.thumbnail = item.thumbnail
|
videoitem = vi
|
||||||
videoitem.contentType = item.contentType
|
# videoitem = item.clone(serverName = videoitem.title if videoitem.title else videoitem.ser)
|
||||||
videoitem.infoLabels = item.infoLabels
|
# quality = videoitem.quality if videoitem.quality else item.quality if item.quality else ''
|
||||||
videoitem.quality = quality
|
# videoitem.contentLanguage = videoitem.contentLanguage if videoitem.contentLanguage else item.contentLanguage if item.contentLanguage else 'ITA'
|
||||||
videoitem.referer = item.referer if item.referer else item.url
|
# videoitem.serverName = videoitem.serverName if videoitem.server == 'directo' else servertools.get_server_parameters(videoitem.server).get('name', videoitem.server.capitalize())
|
||||||
videoitem.action = "play"
|
# videoitem.plot = typo(videoitem.serverName, 'bold') + (typo(quality, '_ [] bold') if quality else '')
|
||||||
videoitem.videolibrary_id = item.videolibrary_id
|
# videoitem.channel = item.channel
|
||||||
videoitem.from_library = item.from_library
|
# videoitem.fulltitle = item.fulltitle
|
||||||
videoitem.fanart = item.fanart if item.contentType == 'movie' else item.thumbnail
|
# videoitem.show = item.show
|
||||||
|
# videoitem.ch_name = channeltools.get_channel_parameters(item.channel)['title']
|
||||||
|
# if not videoitem.video_urls: videoitem.thumbnail = item.thumbnail
|
||||||
|
# videoitem.contentType = item.contentType
|
||||||
|
# videoitem.infoLabels = item.infoLabels
|
||||||
|
# videoitem.quality = quality
|
||||||
|
# videoitem.referer = item.referer if item.referer else item.url
|
||||||
|
# videoitem.action = "play"
|
||||||
|
# videoitem.videolibrary_id = item.videolibrary_id
|
||||||
|
# videoitem.from_library = item.from_library
|
||||||
|
# videoitem.fanart = item.fanart if item.contentType == 'movie' else item.thumbnail
|
||||||
return videoitem
|
return videoitem
|
||||||
|
|
||||||
# non threaded for webpdb
|
# non threaded for webpdb
|
||||||
@@ -1084,10 +1083,7 @@ def server(item, data='', itemlist=[], headers='', AutoPlay=True, CheckLinks=Tru
|
|||||||
for it in futures.as_completed(thL):
|
for it in futures.as_completed(thL):
|
||||||
if it.result():
|
if it.result():
|
||||||
verifiedItemlist.append(it.result())
|
verifiedItemlist.append(it.result())
|
||||||
try:
|
|
||||||
verifiedItemlist.sort(key=lambda it: int(re.sub(r'\D','',it.quality)))
|
|
||||||
except:
|
|
||||||
verifiedItemlist.sort(key=lambda it: it.quality, reverse=True)
|
|
||||||
if patronTag:
|
if patronTag:
|
||||||
addQualityTag(item, verifiedItemlist, data, patronTag)
|
addQualityTag(item, verifiedItemlist, data, patronTag)
|
||||||
|
|
||||||
@@ -1840,17 +1836,20 @@ def dooplay_menu(item, type):
|
|||||||
def get_jwplayer_mediaurl(data, srvName, onlyHttp=False, dataIsBlock=False):
|
def get_jwplayer_mediaurl(data, srvName, onlyHttp=False, dataIsBlock=False):
|
||||||
from core import jsontools
|
from core import jsontools
|
||||||
video_urls = []
|
video_urls = []
|
||||||
block = scrapertools.find_single_match(data, r'sources"?\s*:\s*(.*?}])') if not dataIsBlock else data
|
block = scrapertools.find_single_match(data, r'sources"?\s*:\s*(.*?}?])') if not dataIsBlock else data
|
||||||
if block:
|
if block:
|
||||||
json = jsontools.load(block)
|
json = jsontools.load(block)
|
||||||
if json:
|
if json:
|
||||||
sources = []
|
sources = []
|
||||||
for s in json:
|
for s in json:
|
||||||
if 'file' in s.keys():
|
if isinstance(s, str):
|
||||||
src = s['file']
|
sources.append((s, ''))
|
||||||
else:
|
else:
|
||||||
src = s['src']
|
if 'file' in s.keys():
|
||||||
sources.append((src, s.get('label')))
|
src = s['file']
|
||||||
|
else:
|
||||||
|
src = s['src']
|
||||||
|
sources.append((src, s.get('label')))
|
||||||
else:
|
else:
|
||||||
if 'file:' in block:
|
if 'file:' in block:
|
||||||
sources = scrapertools.find_multiple_matches(block, r'file:\s*"([^"]+)"(?:,label:\s*"([^"]+)")?')
|
sources = scrapertools.find_multiple_matches(block, r'file:\s*"([^"]+)"(?:,label:\s*"([^"]+)")?')
|
||||||
|
|||||||
+1
-1
@@ -214,7 +214,7 @@ def set_infoLabels_itemlist(itemlist, seekTmdb=False, search_language=def_lang,
|
|||||||
|
|
||||||
return (_i, _item, ret)
|
return (_i, _item, ret)
|
||||||
|
|
||||||
# from core.support import dbg; dbg()
|
# logger.dbg()
|
||||||
# for i, item in enumerate(itemlist):
|
# for i, item in enumerate(itemlist):
|
||||||
# r_list.append(sub_thread(item, i, seekTmdb))
|
# r_list.append(sub_thread(item, i, seekTmdb))
|
||||||
with futures.ThreadPoolExecutor() as executor:
|
with futures.ThreadPoolExecutor() as executor:
|
||||||
|
|||||||
@@ -275,7 +275,6 @@ def wait_for_update_trakt():
|
|||||||
|
|
||||||
|
|
||||||
def update_all():
|
def update_all():
|
||||||
# from core.support import dbg;dbg()
|
|
||||||
from time import sleep
|
from time import sleep
|
||||||
logger.debug()
|
logger.debug()
|
||||||
sleep(20)
|
sleep(20)
|
||||||
@@ -306,7 +305,6 @@ def context(item):
|
|||||||
pass
|
pass
|
||||||
|
|
||||||
try:
|
try:
|
||||||
from core.support import dbg;dbg()
|
|
||||||
result = execute(item.clone(url="/sync/watchlist/" + Type))
|
result = execute(item.clone(url="/sync/watchlist/" + Type))
|
||||||
post = {Type: [{"ids": {"tmdb": item.infoLabels["tmdb_id"]}}]}
|
post = {Type: [{"ids": {"tmdb": item.infoLabels["tmdb_id"]}}]}
|
||||||
if condition in str(result):
|
if condition in str(result):
|
||||||
|
|||||||
@@ -78,7 +78,6 @@ otvdb_global = None
|
|||||||
|
|
||||||
def find_and_set_infoLabels(item):
|
def find_and_set_infoLabels(item):
|
||||||
logger.debug()
|
logger.debug()
|
||||||
# from core.support import dbg;dbg()
|
|
||||||
# logger.debug("item es %s" % item)
|
# logger.debug("item es %s" % item)
|
||||||
|
|
||||||
p_dialog = None
|
p_dialog = None
|
||||||
@@ -666,8 +665,6 @@ class Tvdb(object):
|
|||||||
|
|
||||||
url = HOST + "/episodes/%s" % _id
|
url = HOST + "/episodes/%s" % _id
|
||||||
|
|
||||||
# from core.support import dbg;dbg()
|
|
||||||
|
|
||||||
try:
|
try:
|
||||||
DEFAULT_HEADERS["Accept-Language"] = lang
|
DEFAULT_HEADERS["Accept-Language"] = lang
|
||||||
logger.debug("url: %s, \nheaders: %s" % (url, DEFAULT_HEADERS))
|
logger.debug("url: %s, \nheaders: %s" % (url, DEFAULT_HEADERS))
|
||||||
|
|||||||
+65
-58
@@ -120,7 +120,7 @@ def save_movie(item, silent=False):
|
|||||||
|
|
||||||
|
|
||||||
# get extra info from fanart tv
|
# get extra info from fanart tv
|
||||||
# support.dbg()
|
# logger.dbg()
|
||||||
extra_info = get_fanart_tv(item)
|
extra_info = get_fanart_tv(item)
|
||||||
if not item.infoLabels.get('posters', []): item.infoLabels['posters'] = []
|
if not item.infoLabels.get('posters', []): item.infoLabels['posters'] = []
|
||||||
item.infoLabels['posters'] += extra_info['poster']
|
item.infoLabels['posters'] += extra_info['poster']
|
||||||
@@ -443,33 +443,34 @@ def save_episodes(item, episodelist, extra_info, host, local_files, silent=False
|
|||||||
episode = None
|
episode = None
|
||||||
season_episode = None
|
season_episode = None
|
||||||
|
|
||||||
|
|
||||||
if e.contentSeason and e.contentEpisodeNumber:
|
if e.contentSeason and e.contentEpisodeNumber:
|
||||||
season_episode = '{}x{:02d}'.format(e.contentSeason, e.contentEpisodeNumber)
|
season_episode = '{}x{:02d}'.format(e.contentSeason, e.contentEpisodeNumber)
|
||||||
strm_path = filetools.join(item.base_name, "{}.strm".format(season_episode))
|
|
||||||
|
|
||||||
if item.infoLabels.get('imdb_id'): e.infoLabels['imdb_id'] = item.infoLabels['imdb_id']
|
|
||||||
if item.infoLabels.get('tmdb_id'): e.infoLabels['tmdb_id'] = item.infoLabels['tmdb_id']
|
|
||||||
if item.infoLabels.get('tvdb_id'): e.infoLabels['tvdb_id'] = item.infoLabels['tvdb_id']
|
|
||||||
|
|
||||||
tmdb.set_infoLabels_item(e)
|
|
||||||
if not e.infoLabels.get('playcount'): e.infoLabels['playcount'] = 0
|
|
||||||
head_nfo = scraper.get_nfo(e)
|
|
||||||
|
|
||||||
episode_item = Item(action='findvideos',
|
|
||||||
channel='videolibrary',
|
|
||||||
strm_path=strm_path,
|
|
||||||
contentSeason = e.contentSeason,
|
|
||||||
contentEpisodeNumber = e.contentEpisodeNumber,
|
|
||||||
contentType = e.contentType,
|
|
||||||
infoLabels = e.infoLabels,
|
|
||||||
head_nfo = head_nfo,
|
|
||||||
videolibrary_id = item.videolibrary_id,
|
|
||||||
thumbnail = e.infoLabels.get('poster_path') if e.infoLabels.get('poster_path') else item.thumbnail,
|
|
||||||
fanart = e.infoLabels.get('poster_path') if e.infoLabels.get('poster_path') else item.fanart,
|
|
||||||
title = e.infoLabels['title'])
|
|
||||||
|
|
||||||
episode = episodes.get(season_episode, {})
|
episode = episodes.get(season_episode, {})
|
||||||
|
if episode:
|
||||||
|
episode_item = episode['item']
|
||||||
|
else:
|
||||||
|
strm_path = filetools.join(item.base_name, '{}.strm'.format(season_episode))
|
||||||
|
|
||||||
|
if item.infoLabels.get('imdb_id'): e.infoLabels['imdb_id'] = item.infoLabels['imdb_id']
|
||||||
|
if item.infoLabels.get('tmdb_id'): e.infoLabels['tmdb_id'] = item.infoLabels['tmdb_id']
|
||||||
|
if item.infoLabels.get('tvdb_id'): e.infoLabels['tvdb_id'] = item.infoLabels['tvdb_id']
|
||||||
|
|
||||||
|
tmdb.set_infoLabels_item(e)
|
||||||
|
if not e.infoLabels.get('playcount'): e.infoLabels['playcount'] = 0
|
||||||
|
# head_nfo = scraper.get_nfo(e)
|
||||||
|
|
||||||
|
episode_item = Item(action='findvideos',
|
||||||
|
channel='videolibrary',
|
||||||
|
strm_path=strm_path,
|
||||||
|
contentSeason = e.contentSeason,
|
||||||
|
contentEpisodeNumber = e.contentEpisodeNumber,
|
||||||
|
contentType = e.contentType,
|
||||||
|
infoLabels = e.infoLabels,
|
||||||
|
# head_nfo = head_nfo,
|
||||||
|
videolibrary_id = item.videolibrary_id,
|
||||||
|
thumbnail = e.infoLabels.get('poster_path') if e.infoLabels.get('poster_path') else item.thumbnail,
|
||||||
|
fanart = e.infoLabels.get('poster_path') if e.infoLabels.get('poster_path') else item.fanart,
|
||||||
|
title = e.infoLabels['title'])
|
||||||
|
|
||||||
try:
|
try:
|
||||||
if not episode:
|
if not episode:
|
||||||
@@ -526,9 +527,9 @@ def save_episodes(item, episodelist, extra_info, host, local_files, silent=False
|
|||||||
# add strm_file if episode is not present in db or inside videolibrary path
|
# add strm_file if episode is not present in db or inside videolibrary path
|
||||||
# if not filetools.exists(filetools.join(TVSHOWS_PATH, strm_path)):
|
# if not filetools.exists(filetools.join(TVSHOWS_PATH, strm_path)):
|
||||||
if season_episode not in local_files.get('db',{}).keys():
|
if season_episode not in local_files.get('db',{}).keys():
|
||||||
logger.debug("Creating .strm: " + strm_path)
|
logger.debug("Creating .strm: " + episode_item.strm_path)
|
||||||
item_strm = Item(channel='videolibrary', action='play_from_library', strm_path=strm_path, contentType='episode', videolibrary_id=episode_item.videolibrary_id, contentSeason = episode_item.contentSeason, contentEpisodeNumber = episode_item.contentEpisodeNumber,)
|
item_strm = Item(channel='videolibrary', action='play_from_library', strm_path=episode_item.strm_path, contentType='episode', videolibrary_id=episode_item.videolibrary_id, contentSeason = episode_item.contentSeason, contentEpisodeNumber = episode_item.contentEpisodeNumber,)
|
||||||
filetools.write(filetools.join(TVSHOWS_PATH, strm_path), '{}?{}'.format(addon_name, item_strm.tourl()))
|
filetools.write(filetools.join(TVSHOWS_PATH, episode_item.strm_path), '{}?{}'.format(addon_name, item_strm.tourl()))
|
||||||
|
|
||||||
# update db if episode added
|
# update db if episode added
|
||||||
# if failed == 0 and config.get_setting('kod_scraper'):
|
# if failed == 0 and config.get_setting('kod_scraper'):
|
||||||
@@ -610,14 +611,14 @@ def save_episodes(item, episodelist, extra_info, host, local_files, silent=False
|
|||||||
if episode:
|
if episode:
|
||||||
episodes[season_episode] = episode
|
episodes[season_episode] = episode
|
||||||
e = episode['item']
|
e = episode['item']
|
||||||
if not e.contentSeason in current_seasons: current_seasons.append(e.contentSeason)
|
if not e.contentSeason in current_seasons or e.contentSeason not in seasons: current_seasons.append(e.contentSeason)
|
||||||
if not lang: lang = item.contentLanguage if item.contentLanguage else 'ITA'
|
if not lang: lang = item.contentLanguage if item.contentLanguage else 'ITA'
|
||||||
if not lang in item.lang_list: item.lang_list.append(lang)
|
if not lang in item.lang_list: item.lang_list.append(lang)
|
||||||
if not silent:
|
if not silent:
|
||||||
i += 1
|
i += 1
|
||||||
p_dialog.update(int(math.ceil(i * t)), message=e.title)
|
p_dialog.update(int(math.ceil(i * t)), message=e.title)
|
||||||
|
|
||||||
# support.dbg()
|
# logger.dbg()
|
||||||
# for e in episodelist:
|
# for e in episodelist:
|
||||||
# item, episode, season_episode, lang, I, O, F = save_episode(item, episodes, e)
|
# item, episode, season_episode, lang, I, O, F = save_episode(item, episodes, e)
|
||||||
# inserted += I
|
# inserted += I
|
||||||
@@ -781,11 +782,7 @@ def add_tvshow(item, channel=None, itemlist=[]):
|
|||||||
item.__dict__["channel"] = item.__dict__.pop("from_channel")
|
item.__dict__["channel"] = item.__dict__.pop("from_channel")
|
||||||
|
|
||||||
if not channel:
|
if not channel:
|
||||||
try:
|
channel = platformtools.channel_import(item.channel)
|
||||||
channel = __import__('channels.%s' % item.channel, fromlist=["channels.%s" % item.channel])
|
|
||||||
# channel = __import__('specials.%s' % item.channel, fromlist=["specials.%s" % item.channel])
|
|
||||||
except ImportError:
|
|
||||||
exec("import channels." + item.channel + " as channel")
|
|
||||||
|
|
||||||
# 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
|
||||||
# The user can select the title among those offered on the first screen
|
# The user can select the title among those offered on the first screen
|
||||||
@@ -806,7 +803,7 @@ def add_tvshow(item, channel=None, itemlist=[]):
|
|||||||
itemlist = getattr(channel, it.action)(it)
|
itemlist = getattr(channel, it.action)(it)
|
||||||
item.host = channel.host
|
item.host = channel.host
|
||||||
if itemlist:
|
if itemlist:
|
||||||
# support.dbg()
|
# logger.dbg()
|
||||||
from platformcode.autorenumber import start, check
|
from platformcode.autorenumber import start, check
|
||||||
if not check(item, itemlist):
|
if not check(item, itemlist):
|
||||||
action = item.action
|
action = item.action
|
||||||
@@ -881,7 +878,7 @@ def get_fanart_tv(item, set='', ret={}):
|
|||||||
return d
|
return d
|
||||||
|
|
||||||
_id = item.infoLabels.get('tmdb_id')
|
_id = item.infoLabels.get('tmdb_id')
|
||||||
# support.dbg()
|
# logger.dbg()
|
||||||
|
|
||||||
if _id:
|
if _id:
|
||||||
_type = item.contentType.replace('show','').replace('movie','movies')
|
_type = item.contentType.replace('show','').replace('movie','movies')
|
||||||
@@ -1085,48 +1082,59 @@ def restore_videolibrary():
|
|||||||
try: os.mkdir(TVSHOWS_PATH)
|
try: os.mkdir(TVSHOWS_PATH)
|
||||||
except: pass
|
except: pass
|
||||||
|
|
||||||
|
movie_files = []
|
||||||
|
for root, dir, files in filetools.walk(MOVIES_PATH):
|
||||||
|
movie_files.extend(files)
|
||||||
|
|
||||||
for item in movies:
|
for item in movies:
|
||||||
|
dialog.update(int(progress / total * 100), item.title)
|
||||||
base_name = set_base_name(item, item.videolibrary_id)
|
base_name = set_base_name(item, item.videolibrary_id)
|
||||||
path = filetools.join(MOVIES_PATH, base_name)
|
|
||||||
try: os.mkdir(path)
|
try: os.mkdir(filetools.join(MOVIES_PATH, base_name))
|
||||||
except: pass
|
except: pass
|
||||||
nfo_path = filetools.join(base_name, "{}.nfo".format(base_name))
|
|
||||||
strm_path = filetools.join(base_name, "{}.strm".format(base_name))
|
|
||||||
nfo_exists = filetools.exists(filetools.join(MOVIES_PATH, nfo_path))
|
|
||||||
strm_exists = filetools.exists(filetools.join(MOVIES_PATH, strm_path))
|
|
||||||
local = True if 'local' in videolibrarydb['movie'][item.videolibrary_id]['channels'] else False
|
local = True if 'local' in videolibrarydb['movie'][item.videolibrary_id]['channels'] else False
|
||||||
if not nfo_exists:
|
|
||||||
|
if not "{}.nfo".format(base_name) in movie_files:
|
||||||
if not item.head_nfo: item.head_nfo = scraper.get_nfo(item)
|
if not item.head_nfo: item.head_nfo = scraper.get_nfo(item)
|
||||||
filetools.write(filetools.join(MOVIES_PATH, item.nfo_path), item.head_nfo)
|
filetools.write(filetools.join(MOVIES_PATH, item.nfo_path), item.head_nfo)
|
||||||
if not strm_exists and not local:
|
|
||||||
|
if not "{}.strm".format(base_name) in movie_files and not local:
|
||||||
item_strm = Item(channel='videolibrary', action='play_from_library', strm_path=item.strm_path, contentType='movie', contentTitle=item.contentTitle, videolibrary_id=item.videolibrary_id)
|
item_strm = Item(channel='videolibrary', action='play_from_library', strm_path=item.strm_path, contentType='movie', contentTitle=item.contentTitle, videolibrary_id=item.videolibrary_id)
|
||||||
filetools.write(filetools.join(MOVIES_PATH, item.strm_path), '{}?{}'.format(addon_name, item_strm.tourl()))
|
filetools.write(filetools.join(MOVIES_PATH, item.strm_path), '{}?{}'.format(addon_name, item_strm.tourl()))
|
||||||
|
|
||||||
progress += 1
|
progress += 1
|
||||||
dialog.update(int(progress / total * 100))
|
dialog.update(int(progress / total * 100), item.title)
|
||||||
|
|
||||||
for item in tvshows:
|
for item in tvshows:
|
||||||
|
dialog.update(int(progress / total * 100), item.title)
|
||||||
base_name = set_base_name(item, item.videolibrary_id)
|
base_name = set_base_name(item, item.videolibrary_id)
|
||||||
path = filetools.join(TVSHOWS_PATH, base_name)
|
|
||||||
try: os.mkdir(path)
|
try: os.mkdir(filetools.join(TVSHOWS_PATH, base_name))
|
||||||
except: pass
|
except: pass
|
||||||
nfo_path = filetools.join(base_name, "tvshow.nfo")
|
|
||||||
nfo_exists = filetools.exists(filetools.join(TVSHOWS_PATH, nfo_path))
|
if not filetools.exists(filetools.join(TVSHOWS_PATH, base_name, 'tvshow.nfo')):
|
||||||
if not nfo_exists:
|
|
||||||
if not item.head_nfo: item.head_nfo = scraper.get_nfo(item)
|
if not item.head_nfo: item.head_nfo = scraper.get_nfo(item)
|
||||||
filetools.write(filetools.join(TVSHOWS_PATH, item.nfo_path), item.head_nfo)
|
filetools.write(filetools.join(TVSHOWS_PATH, item.nfo_path), item.head_nfo)
|
||||||
|
|
||||||
episodes = [x['item'] for x in dict(videolibrarydb['episode'][item.videolibrary_id]).values()]
|
episodes = [x['item'] for x in dict(videolibrarydb['episode'][item.videolibrary_id]).values()]
|
||||||
for e in episodes:
|
|
||||||
|
episode_files = []
|
||||||
|
|
||||||
|
for root, dir, files in filetools.walk(filetools.join(TVSHOWS_PATH, base_name)):
|
||||||
|
episode_files.extend(files)
|
||||||
|
|
||||||
|
for e in sorted(episodes, key=lambda e: (e.contentSeason, e.contentEpisodeNumber)):
|
||||||
|
dialog.update(int(progress / total * 100), item.title + '\n{}x{:02d}'.format(e.contentSeason, e.contentEpisodeNumber))
|
||||||
season_episode = '{}x{:02d}'.format(e.contentSeason, e.contentEpisodeNumber)
|
season_episode = '{}x{:02d}'.format(e.contentSeason, e.contentEpisodeNumber)
|
||||||
strm_path = filetools.join(item.base_name, "{}.strm".format(season_episode))
|
strm_path = filetools.join(item.base_name, '{}.strm'.format(season_episode))
|
||||||
strm_exists = filetools.exists(filetools.join(MOVIES_PATH, strm_path))
|
|
||||||
local = True if 'local' in videolibrarydb['episode'][item.videolibrary_id][season_episode]['channels'] else False
|
local = True if 'local' in videolibrarydb['episode'][item.videolibrary_id][season_episode]['channels'] else False
|
||||||
if not strm_exists and not local:
|
if not '{}.strm'.format(season_episode) in episode_files and not local:
|
||||||
logger.debug("Creating .strm: " + strm_path)
|
logger.debug("Creating .strm: " + strm_path)
|
||||||
item_strm = Item(channel='videolibrary', action='play_from_library', strm_path=strm_path, contentType='episode', videolibrary_id=e.videolibrary_id, contentSeason = e.contentSeason, contentEpisodeNumber = e.contentEpisodeNumber,)
|
item_strm = Item(channel='videolibrary', action='play_from_library', strm_path=strm_path, contentType='episode', videolibrary_id=e.videolibrary_id, contentSeason = e.contentSeason, contentEpisodeNumber = e.contentEpisodeNumber,)
|
||||||
filetools.write(filetools.join(TVSHOWS_PATH, strm_path), '{}?{}'.format(addon_name, item_strm.tourl()))
|
filetools.write(filetools.join(TVSHOWS_PATH, strm_path), '{}?{}'.format(addon_name, item_strm.tourl()))
|
||||||
progress += 1
|
progress += 1
|
||||||
dialog.update(int(progress / total * 100))
|
dialog.update(int(progress / total * 100), item.title)
|
||||||
videolibrarydb.close()
|
videolibrarydb.close()
|
||||||
|
|
||||||
dbconverter.save_all()
|
dbconverter.save_all()
|
||||||
@@ -1178,8 +1186,7 @@ def convert_videolibrary():
|
|||||||
it.url = channels_dict[ch]
|
it.url = channels_dict[ch]
|
||||||
remove_host(it)
|
remove_host(it)
|
||||||
tmdb.find_and_set_infoLabels(it)
|
tmdb.find_and_set_infoLabels(it)
|
||||||
try: channel = __import__('channels.%s' % ch, fromlist=['channels.%s' % ch])
|
channel = platformtools.channel_import(ch)
|
||||||
except: channel = __import__('specials.%s' % ch, fromlist=['specials.%s' % ch])
|
|
||||||
it.host = channel.host
|
it.host = channel.host
|
||||||
it.url = channel.host + it.url
|
it.url = channel.host + it.url
|
||||||
episodes = getattr(channel, 'episodios')(it)
|
episodes = getattr(channel, 'episodios')(it)
|
||||||
|
|||||||
+1
-1
@@ -197,7 +197,7 @@ def update_title(item):
|
|||||||
# new_item.infoLabels['year'] = '-'
|
# new_item.infoLabels['year'] = '-'
|
||||||
# if new_item.contentSeason:
|
# if new_item.contentSeason:
|
||||||
# del new_item.infoLabels['season'] # It works wrong with num. seasonal
|
# del new_item.infoLabels['season'] # It works wrong with num. seasonal
|
||||||
# support.dbg()
|
# logger.dbg()
|
||||||
# scraper_return = scraper.find_and_set_infoLabels(new_item)
|
# scraper_return = scraper.find_and_set_infoLabels(new_item)
|
||||||
|
|
||||||
#logger.debug(item)
|
#logger.debug(item)
|
||||||
|
|||||||
+7
-1
@@ -42,6 +42,7 @@ class UnshortenIt(object):
|
|||||||
_swzz_regex = r'swzz\.xyz'
|
_swzz_regex = r'swzz\.xyz'
|
||||||
_stayonline_regex = r'stayonline\.pro'
|
_stayonline_regex = r'stayonline\.pro'
|
||||||
_snip_regex = r'[0-9a-z]+snip\.|uprotector\.xyz'
|
_snip_regex = r'[0-9a-z]+snip\.|uprotector\.xyz'
|
||||||
|
_linksafe_regex = r'linksafe\.cc'
|
||||||
# for services that only include real link inside iframe
|
# for services that only include real link inside iframe
|
||||||
_simple_iframe_regex = r'cryptmango|xshield\.net|vcrypt\.club'
|
_simple_iframe_regex = r'cryptmango|xshield\.net|vcrypt\.club'
|
||||||
# for services that only do redirects
|
# for services that only do redirects
|
||||||
@@ -49,7 +50,7 @@ class UnshortenIt(object):
|
|||||||
|
|
||||||
listRegex = [_adfly_regex, _linkbucks_regex, _adfocus_regex, _lnxlu_regex, _shst_regex, _hrefli_regex, _anonymz_regex,
|
listRegex = [_adfly_regex, _linkbucks_regex, _adfocus_regex, _lnxlu_regex, _shst_regex, _hrefli_regex, _anonymz_regex,
|
||||||
_shrink_service_regex, _rapidcrypt_regex, _simple_iframe_regex, _linkup_regex, _linkhub_regex,
|
_shrink_service_regex, _rapidcrypt_regex, _simple_iframe_regex, _linkup_regex, _linkhub_regex,
|
||||||
_swzz_regex, _stayonline_regex, _snip_regex, _simple_redirect]
|
_swzz_regex, _stayonline_regex, _snip_regex, _linksafe_regex, _simple_redirect]
|
||||||
|
|
||||||
_maxretries = 5
|
_maxretries = 5
|
||||||
|
|
||||||
@@ -98,6 +99,8 @@ class UnshortenIt(object):
|
|||||||
uri, code = self._unshorten_stayonline(uri)
|
uri, code = self._unshorten_stayonline(uri)
|
||||||
if re.search(self._snip_regex, uri, re.IGNORECASE):
|
if re.search(self._snip_regex, uri, re.IGNORECASE):
|
||||||
uri, code = self._unshorten_snip(uri)
|
uri, code = self._unshorten_snip(uri)
|
||||||
|
if re.search(self._linksafe_regex, uri, re.IGNORECASE):
|
||||||
|
uri, code = self._unshorten_linksafe(uri)
|
||||||
if re.search(self._simple_redirect, uri, re.IGNORECASE):
|
if re.search(self._simple_redirect, uri, re.IGNORECASE):
|
||||||
p = httptools.downloadpage(uri)
|
p = httptools.downloadpage(uri)
|
||||||
uri = p.url
|
uri = p.url
|
||||||
@@ -666,6 +669,9 @@ class UnshortenIt(object):
|
|||||||
# uri = new_uri
|
# uri = new_uri
|
||||||
return uri, 200
|
return uri, 200
|
||||||
|
|
||||||
|
def _unshorten_linksafe(self, uri):
|
||||||
|
return b64decode(uri.split('?url=')[-1]).decode(), 200
|
||||||
|
|
||||||
|
|
||||||
def decrypt_aes(text, key):
|
def decrypt_aes(text, key):
|
||||||
try:
|
try:
|
||||||
|
|||||||
@@ -7,7 +7,7 @@
|
|||||||
import xbmc, xbmcgui, re, base64, sys
|
import xbmc, xbmcgui, re, base64, sys
|
||||||
from core import jsontools, tmdb, filetools
|
from core import jsontools, tmdb, filetools
|
||||||
from core.item import Item
|
from core.item import Item
|
||||||
from core.support import typo, dbg, Item
|
from core.support import typo, Item
|
||||||
from platformcode import config, platformtools, logger
|
from platformcode import config, platformtools, logger
|
||||||
PY3 = True if sys.version_info[0] >= 3 else False
|
PY3 = True if sys.version_info[0] >= 3 else False
|
||||||
if PY3:
|
if PY3:
|
||||||
@@ -70,7 +70,7 @@ def b64(json, mode = 'encode'):
|
|||||||
|
|
||||||
def find_episodes(item):
|
def find_episodes(item):
|
||||||
logger.debug()
|
logger.debug()
|
||||||
ch = __import__('channels.' + item.channel, fromlist=["channels.{}".format(item.channel)])
|
ch = platformtools.channel_import(item.channel)
|
||||||
itemlist = getattr(ch, item.action)(item)
|
itemlist = getattr(ch, item.action)(item)
|
||||||
return itemlist
|
return itemlist
|
||||||
|
|
||||||
@@ -187,7 +187,7 @@ class autorenumber():
|
|||||||
item.contentSeason = int(self.episodes[number].split('x')[0])
|
item.contentSeason = int(self.episodes[number].split('x')[0])
|
||||||
item.contentEpisodeNumber = int(self.episodes[number].split('x')[1])
|
item.contentEpisodeNumber = int(self.episodes[number].split('x')[1])
|
||||||
|
|
||||||
# dbg()
|
# logger.dbg()
|
||||||
# for i in self.itemlist:
|
# for i in self.itemlist:
|
||||||
# sub_thread(i)
|
# sub_thread(i)
|
||||||
|
|
||||||
|
|||||||
@@ -121,7 +121,7 @@ def get_id():
|
|||||||
return dbid
|
return dbid
|
||||||
|
|
||||||
def check_condition():
|
def check_condition():
|
||||||
# support.dbg()
|
# logger.dbg()
|
||||||
global path
|
global path
|
||||||
path = search_paths(get_id())
|
path = search_paths(get_id())
|
||||||
return path
|
return path
|
||||||
|
|||||||
+22
-10
@@ -10,9 +10,9 @@ import sqlite3
|
|||||||
# conn = sqlite3.connect(get_file_db())
|
# conn = sqlite3.connect(get_file_db())
|
||||||
date = strftime('%Y-%m-%d %H:%M:%S', localtime(float(time())))
|
date = strftime('%Y-%m-%d %H:%M:%S', localtime(float(time())))
|
||||||
|
|
||||||
def save_all():
|
def save_all(_type=''):
|
||||||
movies = dict(videolibrarydb['movie'])
|
movies = dict(videolibrarydb['movie']) if _type == 'movie' or not _type else {}
|
||||||
tvshows = dict(videolibrarydb['tvshow'])
|
tvshows = dict(videolibrarydb['tvshow']) if _type == 'tvshow' or not _type else {}
|
||||||
videolibrarydb.close()
|
videolibrarydb.close()
|
||||||
|
|
||||||
for movie in movies.values():
|
for movie in movies.values():
|
||||||
@@ -93,6 +93,12 @@ def get_id(column, table):
|
|||||||
else: _id = 1
|
else: _id = 1
|
||||||
return _id
|
return _id
|
||||||
|
|
||||||
|
def exist(value, column, table):
|
||||||
|
statement = False
|
||||||
|
sql = 'SELECT * FROM {} WHERE {} = {}'.format(table, column, value)
|
||||||
|
nun_records, records = execute_sql_kodi(sql, conn=conn)
|
||||||
|
if nun_records: statement = True
|
||||||
|
return statement
|
||||||
|
|
||||||
def get_images(item):
|
def get_images(item):
|
||||||
|
|
||||||
@@ -292,13 +298,19 @@ class addMovie(object):
|
|||||||
|
|
||||||
def set_files(self):
|
def set_files(self):
|
||||||
self.idFile = get_id('idFile', 'files')
|
self.idFile = get_id('idFile', 'files')
|
||||||
if self.info.get('playcount', None):
|
if exist(self.idPath, 'idpath', 'files'):
|
||||||
sql = 'INSERT OR IGNORE INTO files (idFile, idPath, strFilename, playCount, lastPlayed, dateAdded) VALUES ( ?, ?, ?, ?, ?, ?)'
|
if self.info.get('playcount', None):
|
||||||
params = (self.idFile, self.idPath, self.strFilename, self.info.get('playcount', None), self.item.lastplayed, date)
|
sql = 'UPDATE path SET playCount=? WHERE idPath=?'
|
||||||
|
params = (self.info.get('playcount', None), self.idPath)
|
||||||
|
self.sql_actions.append([sql, params])
|
||||||
else:
|
else:
|
||||||
sql = 'INSERT OR IGNORE INTO files (idFile, idPath, strFilename, dateAdded) VALUES ( ?, ?, ?, ?)'
|
if self.info.get('playcount', None):
|
||||||
params = (self.idFile, self.idPath, self.strFilename, date)
|
sql = 'INSERT OR IGNORE INTO files (idFile, idPath, strFilename, playCount, lastPlayed, dateAdded) VALUES ( ?, ?, ?, ?, ?, ?)'
|
||||||
self.sql_actions.append([sql, params])
|
params = (self.idFile, self.idPath, self.strFilename, self.info.get('playcount', None), self.item.lastplayed, date)
|
||||||
|
else:
|
||||||
|
sql = 'INSERT OR IGNORE INTO files (idFile, idPath, strFilename, dateAdded) VALUES ( ?, ?, ?, ?)'
|
||||||
|
params = (self.idFile, self.idPath, self.strFilename, date)
|
||||||
|
self.sql_actions.append([sql, params])
|
||||||
|
|
||||||
def set_rating(self):
|
def set_rating(self):
|
||||||
self.rating_id = get_id('rating_id', 'rating')
|
self.rating_id = get_id('rating_id', 'rating')
|
||||||
@@ -595,7 +607,7 @@ class addTvShow(object):
|
|||||||
files = {r[1].replace('.strm',''):r[0] for r in records}
|
files = {r[1].replace('.strm',''):r[0] for r in records}
|
||||||
self.idFiles = {}
|
self.idFiles = {}
|
||||||
idFile = get_id('idFile', 'files')
|
idFile = get_id('idFile', 'files')
|
||||||
# support.dbg()
|
# logger.dbg()
|
||||||
for episode in self.idEpisodes.keys():
|
for episode in self.idEpisodes.keys():
|
||||||
if episode in files.keys():
|
if episode in files.keys():
|
||||||
self.idFiles[episode] = files[episode]
|
self.idFiles[episode] = files[episode]
|
||||||
|
|||||||
@@ -60,7 +60,7 @@ def extract():
|
|||||||
|
|
||||||
|
|
||||||
def setting():
|
def setting():
|
||||||
# support.dbg()
|
# logger.dbg()
|
||||||
xbmc.executebuiltin('UpdateLocalAddons')
|
xbmc.executebuiltin('UpdateLocalAddons')
|
||||||
xbmc.sleep(1000)
|
xbmc.sleep(1000)
|
||||||
if filetools.isfile(elementum_setting_file):
|
if filetools.isfile(elementum_setting_file):
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ from core import httptools, tmdb
|
|||||||
from core.item import Item
|
from core.item import Item
|
||||||
from platformcode import config, platformtools, logger
|
from platformcode import config, platformtools, logger
|
||||||
|
|
||||||
from core.support import match, typo, dbg
|
from core.support import match, typo
|
||||||
|
|
||||||
|
|
||||||
info_list = []
|
info_list = []
|
||||||
|
|||||||
@@ -186,7 +186,7 @@ class Main(xbmcgui.WindowXMLDialog):
|
|||||||
import channelselector
|
import channelselector
|
||||||
itemlist = self.menulist(channelselector.getchanneltypes())
|
itemlist = self.menulist(channelselector.getchanneltypes())
|
||||||
elif channel_name not in ['downloads', 'setting', 'help']:
|
elif channel_name not in ['downloads', 'setting', 'help']:
|
||||||
channel = __import__('specials.%s' % channel_name, fromlist=["specials.%s" % channel_name])
|
channel = platformtools.channel_import(channel_name)
|
||||||
itemlist = self.menulist(channel.mainlist(Item().fromurl(self.MENU.getSelectedItem().getProperty('run'))))
|
itemlist = self.menulist(channel.mainlist(Item().fromurl(self.MENU.getSelectedItem().getProperty('run'))))
|
||||||
self.SUBMENU.reset()
|
self.SUBMENU.reset()
|
||||||
self.SUBMENU.addItems(itemlist)
|
self.SUBMENU.addItems(itemlist)
|
||||||
|
|||||||
+22
-45
@@ -46,6 +46,8 @@ def run(item=None):
|
|||||||
if len(sp) > 1:
|
if len(sp) > 1:
|
||||||
for e in sp[1:]:
|
for e in sp[1:]:
|
||||||
key, val = e.split('=')
|
key, val = e.split('=')
|
||||||
|
if val.lower() == 'false': val = False
|
||||||
|
elif val.lower() == 'true': val = True
|
||||||
item.__setattr__(key, val)
|
item.__setattr__(key, val)
|
||||||
# If no item, this is mainlist
|
# If no item, this is mainlist
|
||||||
else:
|
else:
|
||||||
@@ -66,7 +68,6 @@ def run(item=None):
|
|||||||
config.set_setting('show_once', True)
|
config.set_setting('show_once', True)
|
||||||
|
|
||||||
logger.info(item.tostring())
|
logger.info(item.tostring())
|
||||||
# from core.support import dbg;dbg()
|
|
||||||
|
|
||||||
try:
|
try:
|
||||||
if not config.get_setting('tmdb_active'):
|
if not config.get_setting('tmdb_active'):
|
||||||
@@ -113,8 +114,7 @@ def run(item=None):
|
|||||||
|
|
||||||
elif item.channel == "infoplus":
|
elif item.channel == "infoplus":
|
||||||
from platformcode import infoplus
|
from platformcode import infoplus
|
||||||
action = getattr(infoplus, item.action)
|
return getattr(infoplus, item.action)(item)
|
||||||
return action(item)
|
|
||||||
|
|
||||||
elif item.channel == 'trakt_tools':
|
elif item.channel == 'trakt_tools':
|
||||||
from core import trakt_tools
|
from core import trakt_tools
|
||||||
@@ -156,7 +156,6 @@ def run(item=None):
|
|||||||
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)]))
|
||||||
elif item.action == "gotopage":
|
elif item.action == "gotopage":
|
||||||
# from core.support import dbg;dbg()
|
|
||||||
from core import scrapertools
|
from core import scrapertools
|
||||||
head = config.get_localized_string(70511)
|
head = config.get_localized_string(70511)
|
||||||
scraped_page = scrapertools.find_single_match(item.url,'[=/]([0-9]+)')
|
scraped_page = scrapertools.find_single_match(item.url,'[=/]([0-9]+)')
|
||||||
@@ -184,23 +183,9 @@ def run(item=None):
|
|||||||
item.nextSeason = season
|
item.nextSeason = season
|
||||||
xbmc.executebuiltin("Container.Update(%s?%s)" % (sys.argv[0], item.tourl()))
|
xbmc.executebuiltin("Container.Update(%s?%s)" % (sys.argv[0], item.tourl()))
|
||||||
else:
|
else:
|
||||||
# Checks if channel exists
|
channel = platformtools.channel_import(item.channel)
|
||||||
if os.path.isfile(os.path.join(config.get_runtime_path(), 'channels', item.channel + ".py")):
|
if not channel:
|
||||||
CHANNELS = 'channels'
|
return
|
||||||
else:
|
|
||||||
CHANNELS = 'specials'
|
|
||||||
|
|
||||||
channel_file = os.path.join(config.get_runtime_path(), CHANNELS, item.channel + ".py")
|
|
||||||
|
|
||||||
logger.debug("channel_file= " + channel_file + ' - ' + CHANNELS + ' - ' + item.channel)
|
|
||||||
|
|
||||||
channel = None
|
|
||||||
|
|
||||||
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__))
|
logger.info("Running channel %s | %s" % (channel.__name__, channel.__file__))
|
||||||
|
|
||||||
@@ -244,7 +229,8 @@ def run(item=None):
|
|||||||
# Special action for findvideos, where the plugin looks for known urls
|
# Special action for findvideos, where the plugin looks for known urls
|
||||||
elif item.action == "findvideos":
|
elif item.action == "findvideos":
|
||||||
from core import servertools
|
from core import servertools
|
||||||
if item.window and item.channel != 'videolibrary':
|
p_dialog = None
|
||||||
|
if item.window:
|
||||||
p_dialog = platformtools.dialog_progress_bg(config.get_localized_string(20000), config.get_localized_string(60683))
|
p_dialog = platformtools.dialog_progress_bg(config.get_localized_string(20000), config.get_localized_string(60683))
|
||||||
p_dialog.update(0)
|
p_dialog.update(0)
|
||||||
|
|
||||||
@@ -260,7 +246,7 @@ def run(item=None):
|
|||||||
if config.get_setting("max_links", "videolibrary") != 0:
|
if config.get_setting("max_links", "videolibrary") != 0:
|
||||||
itemlist = limit_itemlist(itemlist)
|
itemlist = limit_itemlist(itemlist)
|
||||||
|
|
||||||
if item.window and item.channel not in ['videolibrary', 'local']:
|
if p_dialog:
|
||||||
p_dialog.update(100)
|
p_dialog.update(100)
|
||||||
p_dialog.close()
|
p_dialog.close()
|
||||||
platformtools.serverwindow(item, itemlist)
|
platformtools.serverwindow(item, itemlist)
|
||||||
@@ -291,7 +277,6 @@ def run(item=None):
|
|||||||
|
|
||||||
# Special action for searching, first asks for the words then call the "search" function
|
# Special action for searching, first asks for the words then call the "search" function
|
||||||
elif item.action == "search":
|
elif item.action == "search":
|
||||||
# from core.support import dbg;dbg()
|
|
||||||
if filetools.isfile(temp_search_file) and config.get_setting('videolibrary_kodi'):
|
if filetools.isfile(temp_search_file) and config.get_setting('videolibrary_kodi'):
|
||||||
itemlist = []
|
itemlist = []
|
||||||
f = filetools.read(temp_search_file)
|
f = filetools.read(temp_search_file)
|
||||||
@@ -474,27 +459,19 @@ def play_from_library(item):
|
|||||||
@param item: item with information
|
@param item: item with information
|
||||||
"""
|
"""
|
||||||
|
|
||||||
# def get_played_time(item):
|
|
||||||
# if item.contentType == 'movie': nfo_path = item.nfo
|
|
||||||
# else: nfo_path = item.strm_path.replace('strm','nfo')
|
|
||||||
# if nfo_path and filetools.isfile(nfo_path):
|
|
||||||
# from core import videolibrarytools
|
|
||||||
# head_nfo, item_nfo = videolibrarytools.read_nfo(nfo_path)
|
|
||||||
# sleep(1)
|
|
||||||
# played_time = platformtools.get_played_time(item_nfo)
|
|
||||||
# else: played_time = 0
|
|
||||||
# return played_time
|
|
||||||
|
|
||||||
|
|
||||||
# from time import sleep
|
|
||||||
|
|
||||||
# logger.debug("item: \n" + item.tostring('\n'))
|
|
||||||
# from core.support import dbg; dbg()
|
|
||||||
import xbmc, xbmcgui, xbmcplugin
|
import xbmc, xbmcgui, xbmcplugin
|
||||||
item.window_type = config.get_setting("window_type") if config.get_setting('next_ep') < 3 and item.contentType != 'movie' else 0
|
|
||||||
xbmcplugin.setResolvedUrl(int(sys.argv[1]), True, xbmcgui.ListItem(path=os.path.join(config.get_runtime_path(), "resources", "kod.mp4")))
|
platformtools.window_type(item)
|
||||||
xbmc.Player().stop()
|
platformtools.prevent_busy(item)
|
||||||
if xbmc.getCondVisibility('Window.IsMedia') and not item.window_type == 0:
|
item.action = item.next_action if item.next_action else 'findvideos'
|
||||||
|
|
||||||
|
if not item.videolibrary_id:
|
||||||
|
if item.window and item.action == 'findvideos':
|
||||||
|
return run(item)
|
||||||
|
else:
|
||||||
|
xbmc.executebuiltin("Container.Update(" + sys.argv[0] + "?" + item.tourl() + ")")
|
||||||
|
|
||||||
|
elif xbmc.getCondVisibility('Window.IsMedia') and not item.window:
|
||||||
if item.contentType == 'episode':
|
if item.contentType == 'episode':
|
||||||
it = videolibrarydb[item.contentType][item.videolibrary_id]['{}x{:02d}'.format(item.infoLabels['season'], item.infoLabels['episode'])]['item']
|
it = videolibrarydb[item.contentType][item.videolibrary_id]['{}x{:02d}'.format(item.infoLabels['season'], item.infoLabels['episode'])]['item']
|
||||||
else:
|
else:
|
||||||
@@ -504,4 +481,4 @@ def play_from_library(item):
|
|||||||
videolibrarydb.close()
|
videolibrarydb.close()
|
||||||
else:
|
else:
|
||||||
item.window = True
|
item.window = True
|
||||||
return videolibrary.findvideos(item)
|
return run(item)
|
||||||
|
|||||||
@@ -51,6 +51,17 @@ def log(*args, **kwargs):
|
|||||||
function=frame.f_code.co_name,
|
function=frame.f_code.co_name,
|
||||||
message=msg), kwargs.get('level', DEF_LEVEL))
|
message=msg), kwargs.get('level', DEF_LEVEL))
|
||||||
|
|
||||||
|
def dbg(open=True):
|
||||||
|
if config.dev_mode():
|
||||||
|
try:
|
||||||
|
import web_pdb
|
||||||
|
if not web_pdb.WebPdb.active_instance and open:
|
||||||
|
import webbrowser
|
||||||
|
webbrowser.open('http://127.0.0.1:5555')
|
||||||
|
web_pdb.set_trace()
|
||||||
|
except:
|
||||||
|
pass
|
||||||
|
|
||||||
|
|
||||||
class WebErrorException(Exception):
|
class WebErrorException(Exception):
|
||||||
def __init__(self, url, channel, *args, **kwargs):
|
def __init__(self, url, channel, *args, **kwargs):
|
||||||
|
|||||||
@@ -18,7 +18,7 @@ else:
|
|||||||
|
|
||||||
import os, xbmc, xbmcgui, xbmcplugin
|
import os, xbmc, xbmcgui, xbmcplugin
|
||||||
from past.utils import old_div
|
from past.utils import old_div
|
||||||
from core import scrapertools
|
from core import filetools, scrapertools
|
||||||
from core.item import Item
|
from core.item import Item
|
||||||
from platformcode import logger, config
|
from platformcode import logger, config
|
||||||
|
|
||||||
@@ -425,7 +425,7 @@ def render_items(itemlist, parent_item):
|
|||||||
return item, item_url, listitem
|
return item, item_url, listitem
|
||||||
|
|
||||||
# For Debug
|
# For Debug
|
||||||
# from core.support import dbg;dbg()
|
# logger.dbg()
|
||||||
# r_list = [set_item(i, item, parent_item) for i, item in enumerate(itemlist)]
|
# r_list = [set_item(i, item, parent_item) for i, item in enumerate(itemlist)]
|
||||||
|
|
||||||
r_list = []
|
r_list = []
|
||||||
@@ -674,7 +674,6 @@ def set_context_commands(item, item_url, parent_item, **kwargs):
|
|||||||
# context_commands.append((config.get_localized_string(60348), "Action(Info)"))
|
# context_commands.append((config.get_localized_string(60348), "Action(Info)"))
|
||||||
|
|
||||||
# InfoPlus
|
# InfoPlus
|
||||||
# from core.support import dbg;dbg()
|
|
||||||
# if config.get_setting("infoplus"):
|
# if config.get_setting("infoplus"):
|
||||||
#if item.infoLabels['tmdb_id'] or item.infoLabels['imdb_id'] or item.infoLabels['tvdb_id'] or \
|
#if item.infoLabels['tmdb_id'] or item.infoLabels['imdb_id'] or item.infoLabels['tvdb_id'] or \
|
||||||
# (item.contentTitle and item.infoLabels["year"]) or item.contentSerieName:
|
# (item.contentTitle and item.infoLabels["year"]) or item.contentSerieName:
|
||||||
@@ -1054,7 +1053,7 @@ def play_video(item, strm=False, force_direct=False, autoplay=False):
|
|||||||
if not mediaurl: return
|
if not mediaurl: return
|
||||||
|
|
||||||
# video information is obtained.
|
# video information is obtained.
|
||||||
xlistitem = xbmcgui.ListItem(item.title, path=item.url)
|
xlistitem = xbmcgui.ListItem(item.contentTitle, path=item.url)
|
||||||
xlistitem.setArt({"thumb": item.contentThumbnail if item.contentThumbnail else item.thumbnail})
|
xlistitem.setArt({"thumb": item.contentThumbnail if item.contentThumbnail else item.thumbnail})
|
||||||
set_infolabels(xlistitem, item, True)
|
set_infolabels(xlistitem, item, True)
|
||||||
|
|
||||||
@@ -1771,7 +1770,6 @@ def get_platform():
|
|||||||
def get_played_time(item):
|
def get_played_time(item):
|
||||||
logger.debug()
|
logger.debug()
|
||||||
from core import db
|
from core import db
|
||||||
# from core.support import dbg;dbg()
|
|
||||||
|
|
||||||
played_time = 0
|
played_time = 0
|
||||||
if not item.infoLabels:
|
if not item.infoLabels:
|
||||||
@@ -1801,7 +1799,6 @@ def get_played_time(item):
|
|||||||
def set_played_time(item):
|
def set_played_time(item):
|
||||||
logger.debug()
|
logger.debug()
|
||||||
from core import db
|
from core import db
|
||||||
# from core.support import dbg;dbg()
|
|
||||||
|
|
||||||
played_time = item.played_time
|
played_time = item.played_time
|
||||||
if not item.infoLabels:
|
if not item.infoLabels:
|
||||||
@@ -1815,6 +1812,7 @@ def set_played_time(item):
|
|||||||
e = item.infoLabels.get('episode')
|
e = item.infoLabels.get('episode')
|
||||||
|
|
||||||
try:
|
try:
|
||||||
|
# logger.dbg()
|
||||||
if e:
|
if e:
|
||||||
newDict = db['viewed'].get(ID, {})
|
newDict = db['viewed'].get(ID, {})
|
||||||
newDict['{}x{}'.format(s, e)] = played_time
|
newDict['{}x{}'.format(s, e)] = played_time
|
||||||
@@ -1828,16 +1826,9 @@ def set_played_time(item):
|
|||||||
del db['viewed'][ID]
|
del db['viewed'][ID]
|
||||||
|
|
||||||
|
|
||||||
# def prevent_busy(item):
|
|
||||||
# logger.debug()
|
|
||||||
# if not item.autoplay and not item.window:
|
|
||||||
# xbmc.Player().play(os.path.join(config.get_runtime_path(), "resources", "kod.mp4"))
|
|
||||||
# xbmc.sleep(200)
|
|
||||||
# xbmc.Player().stop()
|
|
||||||
|
|
||||||
def prevent_busy(item):
|
def prevent_busy(item):
|
||||||
logger.debug()
|
logger.debug()
|
||||||
if not item.autoplay and not item.window:
|
if item.action == 'play_from_library' or (not item.autoplay and not item.window):
|
||||||
if item.globalsearch: xbmc.Player().play(os.path.join(config.get_runtime_path(), "resources", "kod.mp4"))
|
if item.globalsearch: xbmc.Player().play(os.path.join(config.get_runtime_path(), "resources", "kod.mp4"))
|
||||||
else: xbmcplugin.setResolvedUrl(int(sys.argv[1]), True, xbmcgui.ListItem(path=os.path.join(config.get_runtime_path(), "resources", "kod.mp4")))
|
else: xbmcplugin.setResolvedUrl(int(sys.argv[1]), True, xbmcgui.ListItem(path=os.path.join(config.get_runtime_path(), "resources", "kod.mp4")))
|
||||||
xbmc.sleep(200)
|
xbmc.sleep(200)
|
||||||
@@ -1909,4 +1900,25 @@ def serverwindow(item, itemlist):
|
|||||||
else:
|
else:
|
||||||
from platformcode.launcher import run
|
from platformcode.launcher import run
|
||||||
run(selection)
|
run(selection)
|
||||||
reopen = True
|
reopen = True
|
||||||
|
|
||||||
|
|
||||||
|
def window_type(item):
|
||||||
|
if type(item.window) == bool:
|
||||||
|
pass
|
||||||
|
elif config.get_setting('window_type') == 0 or (config.get_setting('next_ep') == 3 and item.contentType != 'movie'):
|
||||||
|
item.window = True
|
||||||
|
else:
|
||||||
|
item.window = False
|
||||||
|
return item
|
||||||
|
|
||||||
|
|
||||||
|
def channel_import(channel_id):
|
||||||
|
if filetools.exists(filetools.join(config.get_runtime_path(), 'channels', channel_id + ".py")):
|
||||||
|
channel = __import__('channels.'+ channel_id, None, None, ["channels." + channel_id])
|
||||||
|
elif filetools.exists(filetools.join(config.get_runtime_path(), 'specials', channel_id + ".py")):
|
||||||
|
channel = __import__('specials.' + channel_id, None, None, ["specials." + channel_id])
|
||||||
|
else:
|
||||||
|
logger.info('Channel {} not Exist')
|
||||||
|
channel = None
|
||||||
|
return channel
|
||||||
@@ -102,7 +102,6 @@ def channels_menu(item):
|
|||||||
def check_channels(item):
|
def check_channels(item):
|
||||||
from specials import setting
|
from specials import setting
|
||||||
from platformcode import config, platformtools
|
from platformcode import config, platformtools
|
||||||
# from core.support import dbg; dbg()
|
|
||||||
item.channel = 'setting'
|
item.channel = 'setting'
|
||||||
item.extra = 'lib_check_datajson'
|
item.extra = 'lib_check_datajson'
|
||||||
itemlist = setting.conf_tools(item)
|
itemlist = setting.conf_tools(item)
|
||||||
@@ -131,7 +130,6 @@ def SettingOnPosition(item):
|
|||||||
|
|
||||||
|
|
||||||
def select(item):
|
def select(item):
|
||||||
# from core.support import dbg;dbg()
|
|
||||||
from platformcode import config, platformtools
|
from platformcode import config, platformtools
|
||||||
# item.id = setting ID
|
# item.id = setting ID
|
||||||
# item.type = labels or values
|
# item.type = labels or values
|
||||||
|
|||||||
@@ -261,6 +261,7 @@ def mark_content_as_watched_on_kodi(item, value=1):
|
|||||||
@param value: > 0 for seen, 0 for not seen
|
@param value: > 0 for seen, 0 for not seen
|
||||||
"""
|
"""
|
||||||
logger.debug()
|
logger.debug()
|
||||||
|
logger.dbg()
|
||||||
|
|
||||||
if item.contentType == 'movie':
|
if item.contentType == 'movie':
|
||||||
path = '%{}%'.format(item.strm_path.split('\\')[0].split('/')[0] if item.strm_path else item.base_name)
|
path = '%{}%'.format(item.strm_path.split('\\')[0].split('/')[0] if item.strm_path else item.base_name)
|
||||||
@@ -270,6 +271,7 @@ def mark_content_as_watched_on_kodi(item, value=1):
|
|||||||
if r:
|
if r:
|
||||||
payload = {"jsonrpc": "2.0", "method": "VideoLibrary.SetMovieDetails", "params": {"movieid": r[0][0], "playcount": value}, "id": 1}
|
payload = {"jsonrpc": "2.0", "method": "VideoLibrary.SetMovieDetails", "params": {"movieid": r[0][0], "playcount": value}, "id": 1}
|
||||||
data = get_data(payload)
|
data = get_data(payload)
|
||||||
|
logger.debug(data)
|
||||||
elif item.contentType == 'episode':
|
elif item.contentType == 'episode':
|
||||||
path = '%{}'.format(item.strm_path.replace('\\','%').replace('/', '%'))
|
path = '%{}'.format(item.strm_path.replace('\\','%').replace('/', '%'))
|
||||||
sql = 'select idEpisode from episode_view where c18 like "{}"'.format(path)
|
sql = 'select idEpisode from episode_view where c18 like "{}"'.format(path)
|
||||||
@@ -299,7 +301,6 @@ def mark_content_as_watched_on_kodi(item, value=1):
|
|||||||
def set_watched_on_kod(data):
|
def set_watched_on_kod(data):
|
||||||
from specials import videolibrary
|
from specials import videolibrary
|
||||||
from core import videolibrarydb
|
from core import videolibrarydb
|
||||||
# from core.support import dbg;dbg()
|
|
||||||
|
|
||||||
data = jsontools.load(data)
|
data = jsontools.load(data)
|
||||||
Type = data.get('item', {}).get('type','')
|
Type = data.get('item', {}).get('type','')
|
||||||
@@ -329,7 +330,7 @@ def set_watched_on_kod(data):
|
|||||||
# item.all_ep
|
# item.all_ep
|
||||||
|
|
||||||
else:
|
else:
|
||||||
# support.dbg()
|
# logger.dbg()
|
||||||
sql = 'select strPath from {}_view where (id{} like "{}")'.format(Type, Type.replace('tv','').capitalize(), ID)
|
sql = 'select strPath from {}_view where (id{} like "{}")'.format(Type, Type.replace('tv','').capitalize(), ID)
|
||||||
n, records = execute_sql_kodi(sql)
|
n, records = execute_sql_kodi(sql)
|
||||||
if records:
|
if records:
|
||||||
@@ -811,7 +812,7 @@ def clean_by_id(item):
|
|||||||
tmdb_id = item.infoLabels.get('tmdb_id', '')
|
tmdb_id = item.infoLabels.get('tmdb_id', '')
|
||||||
season_id = item.infoLabels.get('temporada_id', '')
|
season_id = item.infoLabels.get('temporada_id', '')
|
||||||
episode_id = item.infoLabels.get('episodio_id', '')
|
episode_id = item.infoLabels.get('episodio_id', '')
|
||||||
# support.dbg()
|
# logger.dbg()
|
||||||
|
|
||||||
# search movie ID
|
# search movie ID
|
||||||
if item.contentType == 'movie':
|
if item.contentType == 'movie':
|
||||||
|
|||||||
+2
-2
@@ -137,9 +137,9 @@ def get_video_url(page_url, premium=False, user="", password="", video_password=
|
|||||||
secureProof = scrapertools.find_single_match(unpacked, """X-Secure-Proof['"]\s*,\s*['"]([^"']+)""")
|
secureProof = scrapertools.find_single_match(unpacked, """X-Secure-Proof['"]\s*,\s*['"]([^"']+)""")
|
||||||
logger.debug('X-Secure-Proof=' + secureProof)
|
logger.debug('X-Secure-Proof=' + secureProof)
|
||||||
|
|
||||||
data = httptools.downloadpage(baseUrl + '/pl/' + page_url.split('/')[-1].replace('?', '') + '.m3u8', headers=[['X-Secure-Proof', secureProof]]).data
|
data = httptools.downloadpage(baseUrl + '/pl/' + page_url.split('/')[-1].replace('?', ''), headers=[['X-Secure-Proof', secureProof]]).data
|
||||||
filetools.write(xbmc.translatePath('special://temp/hdmario.m3u8'), data, 'w')
|
filetools.write(xbmc.translatePath('special://temp/hdmario.m3u8'), data, 'w')
|
||||||
|
|
||||||
video_urls = [{'type':'m3u8', 'url':'special://temp/hdmario.m3u8'}]
|
video_urls = [{'type':'hls', 'url':baseUrl + '/pl/' + page_url.split('/')[-1].replace('?', '')}]
|
||||||
|
|
||||||
return video_urls
|
return video_urls
|
||||||
|
|||||||
@@ -0,0 +1,42 @@
|
|||||||
|
{
|
||||||
|
"active": true,
|
||||||
|
"find_videos": {
|
||||||
|
"ignore_urls": [],
|
||||||
|
"patterns": [
|
||||||
|
{
|
||||||
|
"pattern": "(https://highload.to/[ef]/[A-z0-9]+)",
|
||||||
|
"url": "\\1"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"free": true,
|
||||||
|
"id": "highload",
|
||||||
|
"name": "HighLoad",
|
||||||
|
"settings": [
|
||||||
|
{
|
||||||
|
"default": false,
|
||||||
|
"enabled": true,
|
||||||
|
"id": "black_list",
|
||||||
|
"label": "@60654",
|
||||||
|
"type": "bool",
|
||||||
|
"visible": true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"default": 0,
|
||||||
|
"enabled": true,
|
||||||
|
"id": "favorites_servers_list",
|
||||||
|
"label": "@60655",
|
||||||
|
"lvalues": [
|
||||||
|
"No",
|
||||||
|
"1",
|
||||||
|
"2",
|
||||||
|
"3",
|
||||||
|
"4",
|
||||||
|
"5"
|
||||||
|
],
|
||||||
|
"type": "list",
|
||||||
|
"visible": false
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"thumbnail": "https://i.postimg.cc/3JrRZv5w/highload.png"
|
||||||
|
}
|
||||||
@@ -0,0 +1,84 @@
|
|||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
try:
|
||||||
|
from urllib.parse import urlparse
|
||||||
|
except:
|
||||||
|
from urlparse import urlparse
|
||||||
|
|
||||||
|
from core import httptools, support
|
||||||
|
from platformcode import logger, config
|
||||||
|
from functools import reduce
|
||||||
|
import base64
|
||||||
|
|
||||||
|
|
||||||
|
def test_video_exists(page_url):
|
||||||
|
logger.info('page_url="{}"'.format(page_url))
|
||||||
|
global data
|
||||||
|
data = httptools.downloadpage(page_url)
|
||||||
|
if data.code == 404 or "We can't find the video" in data.data or 'sorry' in data.data:
|
||||||
|
return False, config.get_localized_string(70449) % "HighLoad"
|
||||||
|
data = data.data
|
||||||
|
return True, ""
|
||||||
|
|
||||||
|
|
||||||
|
def get_video_url(page_url, premium=False, user="", password="", video_password=""):
|
||||||
|
logger.info("url=" + page_url)
|
||||||
|
|
||||||
|
global data
|
||||||
|
media_url = ''
|
||||||
|
video_urls = []
|
||||||
|
|
||||||
|
host = 'https://' + urlparse(page_url).netloc
|
||||||
|
|
||||||
|
first = unhunt(support.match(data, patron =r'<head>(.+?)</head>').match)
|
||||||
|
|
||||||
|
second_url = host + support.match(data, patron=r'src="(/assets/js/(?:master|tabber).js)').match
|
||||||
|
second = unhunt(httptools.downloadpage(second_url).data)
|
||||||
|
|
||||||
|
v, r1, r2 = support.match(second, patron=r'var\s*res\s*=\s*([^.]+)\.replace\("([^"]+).+?replace\("([^"]+)').match
|
||||||
|
match = support.match(first, patron=r'var\s*{}\s*=\s*"([^"]+)'.format(v)).match
|
||||||
|
|
||||||
|
if match:
|
||||||
|
media_url = base64.b64decode(match.replace(r1, '').replace(r2, '')).decode('utf-8')
|
||||||
|
|
||||||
|
if media_url:
|
||||||
|
video_urls.append([media_url.split('.')[-1] +' [HighLoad]', media_url])
|
||||||
|
return video_urls
|
||||||
|
|
||||||
|
|
||||||
|
def unhunt(source):
|
||||||
|
def decode(params):
|
||||||
|
h = params[0]
|
||||||
|
n = params[1]
|
||||||
|
t = int(params[2])
|
||||||
|
e = int(params[3])
|
||||||
|
r = ""
|
||||||
|
i = 0
|
||||||
|
while i < len(h):
|
||||||
|
s = ""
|
||||||
|
while h[i] != n[e]:
|
||||||
|
s += h[i]
|
||||||
|
i += 1
|
||||||
|
|
||||||
|
for j in enumerate(n):
|
||||||
|
s = s.replace(j[1], str(j[0]))
|
||||||
|
|
||||||
|
r += chr(int(dehunt(s, e, 10)) - t)
|
||||||
|
i += 1
|
||||||
|
|
||||||
|
return r
|
||||||
|
|
||||||
|
def dehunt(d, e, f):
|
||||||
|
g = "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ+/"
|
||||||
|
h = g[0:e]
|
||||||
|
i = g[0:f]
|
||||||
|
d = d[::-1]
|
||||||
|
j = reduce(lambda a, b: a + int(h[int(b[1])]) * (e ** int(b[0])) if int(h[int(b[1])]) != -1 else None, enumerate(d), 0)
|
||||||
|
k = ""
|
||||||
|
while j > 0:
|
||||||
|
k = i[int(j % f)] + k
|
||||||
|
j = (j - (j % f)) / f
|
||||||
|
|
||||||
|
return k or "0"
|
||||||
|
|
||||||
|
return decode(support.match(source, patron=r'\(h,\s*u,\s*n,\s*t,\s*e,\s*r\).+}\("([^"]+)",[^,]+,\s*"([^"]+)",\s*(\d+),\s*(\d+)').match)
|
||||||
|
|
||||||
@@ -19,7 +19,7 @@ def get_video_url(page_url, premium=False, user="", password="", video_password=
|
|||||||
global data
|
global data
|
||||||
logger.debug("URL", page_url)
|
logger.debug("URL", page_url)
|
||||||
video_urls = []
|
video_urls = []
|
||||||
# support.dbg()
|
# logger.dbg()
|
||||||
|
|
||||||
headers = {'User-Agent': httptools.get_user_agent(),
|
headers = {'User-Agent': httptools.get_user_agent(),
|
||||||
'Referer': page_url,
|
'Referer': page_url,
|
||||||
@@ -31,7 +31,7 @@ def get_video_url(page_url, premium=False, user="", password="", video_password=
|
|||||||
data = httptools.downloadpage(apiUrl, headers=headers, post=post).json
|
data = httptools.downloadpage(apiUrl, headers=headers, post=post).json
|
||||||
|
|
||||||
if data.get('result',{}).get('playlist'):
|
if data.get('result',{}).get('playlist'):
|
||||||
# support.dbg()
|
# logger.dbg()
|
||||||
url = data.get('result',{}).get('playlist')
|
url = data.get('result',{}).get('playlist')
|
||||||
|
|
||||||
video_urls.append({'type':url.split('.')[-1], 'url':url + '|Referer:' + page_url})
|
video_urls.append({'type':url.split('.')[-1], 'url':url + '|Referer:' + page_url})
|
||||||
|
|||||||
@@ -18,7 +18,6 @@ def test_video_exists(page_url):
|
|||||||
|
|
||||||
def get_video_url(page_url, premium=False, user="", password="", video_password=""):
|
def get_video_url(page_url, premium=False, user="", password="", video_password=""):
|
||||||
logger.debug("url=" + page_url)
|
logger.debug("url=" + page_url)
|
||||||
# from core.support import dbg;dbg()
|
|
||||||
qualities = []
|
qualities = []
|
||||||
video_urls = []
|
video_urls = []
|
||||||
mgid = support.match(data, patron=r'uri":"([^"]+)"').match
|
mgid = support.match(data, patron=r'uri":"([^"]+)"').match
|
||||||
|
|||||||
@@ -0,0 +1,42 @@
|
|||||||
|
{
|
||||||
|
"active": true,
|
||||||
|
"find_videos": {
|
||||||
|
"ignore_urls": [],
|
||||||
|
"patterns": [
|
||||||
|
{
|
||||||
|
"pattern": "voe.sx/(?:e/|)([A-z0-9]+)",
|
||||||
|
"url": "https://voe.sx/e/\\1"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"free": true,
|
||||||
|
"id": "voe",
|
||||||
|
"name": "VOE",
|
||||||
|
"settings": [
|
||||||
|
{
|
||||||
|
"default": false,
|
||||||
|
"enabled": true,
|
||||||
|
"id": "black_list",
|
||||||
|
"label": "@60654",
|
||||||
|
"type": "bool",
|
||||||
|
"visible": true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"default": 0,
|
||||||
|
"enabled": true,
|
||||||
|
"id": "favorites_servers_list",
|
||||||
|
"label": "@60655",
|
||||||
|
"lvalues": [
|
||||||
|
"No",
|
||||||
|
"1",
|
||||||
|
"2",
|
||||||
|
"3",
|
||||||
|
"4",
|
||||||
|
"5"
|
||||||
|
],
|
||||||
|
"type": "list",
|
||||||
|
"visible": false
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"thumbnail": "https://i.postimg.cc/4xzBfwBd/voe.png"
|
||||||
|
}
|
||||||
@@ -0,0 +1,36 @@
|
|||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
# -*- Server Voe -*-
|
||||||
|
# -*- Created for Alfa-addon -*-
|
||||||
|
# -*- By the Alfa Develop Group -*-
|
||||||
|
|
||||||
|
from core import httptools
|
||||||
|
from core import scrapertools
|
||||||
|
from platformcode import logger
|
||||||
|
from platformcode import config
|
||||||
|
import sys
|
||||||
|
|
||||||
|
PY3 = False
|
||||||
|
if sys.version_info[0] >= 3: PY3 = True; unicode = str; unichr = chr; long = int
|
||||||
|
|
||||||
|
|
||||||
|
def test_video_exists(page_url):
|
||||||
|
global data
|
||||||
|
logger.info("(page_url='%s')" % page_url)
|
||||||
|
data = httptools.downloadpage(page_url).data
|
||||||
|
|
||||||
|
if "File not found" in data or "File is no longer available" in data:
|
||||||
|
return False, config.get_localized_string(70449) % "VOE"
|
||||||
|
return True, ""
|
||||||
|
|
||||||
|
|
||||||
|
def get_video_url(page_url, premium=False, user="", password="", video_password=""):
|
||||||
|
logger.info("(page_url='%s')" % page_url)
|
||||||
|
video_urls = []
|
||||||
|
video_srcs = scrapertools.find_multiple_matches(data, r"src: '([^']+)'")
|
||||||
|
if not video_srcs:
|
||||||
|
bloque = scrapertools.find_single_match(data, "sources.*?\}")
|
||||||
|
video_srcs = scrapertools.find_multiple_matches(bloque, ': "([^"]+)')
|
||||||
|
for url in video_srcs:
|
||||||
|
video_urls.append([" [Voe]", url])
|
||||||
|
|
||||||
|
return video_urls
|
||||||
@@ -141,7 +141,7 @@ def channel_search(item):
|
|||||||
module_dict = {}
|
module_dict = {}
|
||||||
for ch in channel_list:
|
for ch in channel_list:
|
||||||
try:
|
try:
|
||||||
module = __import__('channels.%s' % ch, fromlist=["channels.%s" % ch])
|
module = platformtools.channel_import(ch)
|
||||||
mainlist = getattr(module, 'mainlist')(Item(channel=ch, global_search=True))
|
mainlist = getattr(module, 'mainlist')(Item(channel=ch, global_search=True))
|
||||||
|
|
||||||
module_dict[ch] = module
|
module_dict[ch] = module
|
||||||
|
|||||||
@@ -444,7 +444,7 @@ def findvideos(item):
|
|||||||
item.url = {}
|
item.url = {}
|
||||||
json.append({"url": url})
|
json.append({"url": url})
|
||||||
|
|
||||||
# support.dbg()
|
# logger.dbg()
|
||||||
for option in json:
|
for option in json:
|
||||||
extra = set_extra_values(item, option, item.path)
|
extra = set_extra_values(item, option, item.path)
|
||||||
itemlist.append(
|
itemlist.append(
|
||||||
|
|||||||
+6
-18
@@ -4,6 +4,7 @@
|
|||||||
# ------------------------------------------------------------
|
# ------------------------------------------------------------
|
||||||
|
|
||||||
from __future__ import division
|
from __future__ import division
|
||||||
|
import channels
|
||||||
#from builtins import str
|
#from builtins import str
|
||||||
import sys, os
|
import sys, os
|
||||||
PY3 = False
|
PY3 = False
|
||||||
@@ -645,10 +646,7 @@ def download_from_server(item):
|
|||||||
progreso = platformtools.dialog_progress_bg(config.get_localized_string(30101), config.get_localized_string(70178) % item.server)
|
progreso = platformtools.dialog_progress_bg(config.get_localized_string(30101), config.get_localized_string(70178) % item.server)
|
||||||
|
|
||||||
try:
|
try:
|
||||||
if item.contentChannel in ['community', 'videolibrary']:
|
channel = platformtools.channel_import(item.contentChannel)
|
||||||
channel = __import__('specials.%s' % item.contentChannel, None, None, ['specials.%s' % item.contentChannel])
|
|
||||||
else:
|
|
||||||
channel = __import__('channels.%s' % item.contentChannel, None, None, ['channels.%s' % item.contentChannel])
|
|
||||||
if hasattr(channel, "play") and not item.play_menu:
|
if hasattr(channel, "play") and not item.play_menu:
|
||||||
|
|
||||||
progreso.update(50, config.get_localized_string(70178) % item.server + '\n' + config.get_localized_string(70180) % item.contentChannel)
|
progreso.update(50, config.get_localized_string(70178) % item.server + '\n' + config.get_localized_string(70180) % item.contentChannel)
|
||||||
@@ -725,10 +723,7 @@ def download_from_best_server(item):
|
|||||||
logger.debug('using cached servers')
|
logger.debug('using cached servers')
|
||||||
play_items = [Item().fromurl(i) for i in item.downloadItemlist]
|
play_items = [Item().fromurl(i) for i in item.downloadItemlist]
|
||||||
else:
|
else:
|
||||||
if item.contentChannel in ['community', 'videolibrary']:
|
channel = platformtools.channel_import(item.contentChannel)
|
||||||
channel = __import__('specials.%s' % item.contentChannel, None, None, ['specials.%s' % item.contentChannel])
|
|
||||||
else:
|
|
||||||
channel = __import__('channels.%s' % item.contentChannel, None, None, ['channels.%s' % item.contentChannel])
|
|
||||||
|
|
||||||
progreso.update(50, config.get_localized_string(70184) + '\n' + config.get_localized_string(70180) % item.contentChannel)
|
progreso.update(50, config.get_localized_string(70184) + '\n' + config.get_localized_string(70180) % item.contentChannel)
|
||||||
|
|
||||||
@@ -778,10 +773,7 @@ def select_server(item):
|
|||||||
logger.debug('using cached servers')
|
logger.debug('using cached servers')
|
||||||
play_items = [Item().fromurl(i) for i in item.downloadItemlist]
|
play_items = [Item().fromurl(i) for i in item.downloadItemlist]
|
||||||
else:
|
else:
|
||||||
if item.contentChannel in ['community', 'videolibrary']:
|
channel = platformtools.channel_import(item.contentChannel)
|
||||||
channel = __import__('specials.%s' % item.contentChannel, None, None, ['specials.%s' % item.contentChannel])
|
|
||||||
else:
|
|
||||||
channel = __import__('channels.%s' % item.contentChannel, None, None, ['channels.%s' % item.contentChannel])
|
|
||||||
progreso.update(50, config.get_localized_string(70184) + '\n' + config.get_localized_string(70180) % item.contentChannel)
|
progreso.update(50, config.get_localized_string(70184) + '\n' + config.get_localized_string(70180) % item.contentChannel)
|
||||||
|
|
||||||
if hasattr(channel, item.contentAction):
|
if hasattr(channel, item.contentAction):
|
||||||
@@ -853,18 +845,14 @@ def get_episodes(item):
|
|||||||
if item.downloadItemlist:
|
if item.downloadItemlist:
|
||||||
episodes = [Item().fromurl(i) for i in item.downloadItemlist]
|
episodes = [Item().fromurl(i) for i in item.downloadItemlist]
|
||||||
else:
|
else:
|
||||||
# The item is a series or season...
|
channel = platformtools.channel_import(item.contentChannel)
|
||||||
if item.contentChannel in ['community', 'videolibrary']:
|
|
||||||
channel = __import__('specials.%s' % item.contentChannel, None, None, ["specials.%s" % item.contentChannel])
|
|
||||||
else:
|
|
||||||
channel = __import__('channels.%s' % item.contentChannel, None, None, ["channels.%s" % item.contentChannel])
|
|
||||||
# We get the list of episodes
|
# We get the list of episodes
|
||||||
episodes = getattr(channel, item.contentAction)(item)
|
episodes = getattr(channel, item.contentAction)(item)
|
||||||
|
|
||||||
itemlist = []
|
itemlist = []
|
||||||
# if episodes and not scrapertools.find_single_match(episodes[0].title, r'(\d+.\d+)') and item.channel not in ['videolibrary'] and item.action != 'season':
|
# if episodes and not scrapertools.find_single_match(episodes[0].title, r'(\d+.\d+)') and item.channel not in ['videolibrary'] and item.action != 'season':
|
||||||
# from platformcode.autorenumber import select_type, renumber, check
|
# from platformcode.autorenumber import select_type, renumber, check
|
||||||
# # support.dbg()
|
# # logger.dbg()
|
||||||
# if not check(item):
|
# if not check(item):
|
||||||
# select_type(item)
|
# select_type(item)
|
||||||
# return get_episodes(item)
|
# return get_episodes(item)
|
||||||
|
|||||||
@@ -264,7 +264,7 @@ def live(item):
|
|||||||
|
|
||||||
def load_live(channel_name):
|
def load_live(channel_name):
|
||||||
try:
|
try:
|
||||||
channel = __import__('%s.%s' % ('channels', channel_name), None, None, ['%s.%s' % ('channels', channel_name)])
|
channel = platformtools.channel_import(item.contentChannel)
|
||||||
itemlist = channel.live(channel.mainlist(Item())[0])
|
itemlist = channel.live(channel.mainlist(Item())[0])
|
||||||
except:
|
except:
|
||||||
itemlist = []
|
itemlist = []
|
||||||
|
|||||||
@@ -4,7 +4,7 @@
|
|||||||
|
|
||||||
|
|
||||||
import xbmc, xbmcgui, sys, channelselector, time, threading
|
import xbmc, xbmcgui, sys, channelselector, time, threading
|
||||||
from core.support import dbg, tmdb
|
from core.support import tmdb
|
||||||
from core.item import Item
|
from core.item import Item
|
||||||
from core import channeltools, scrapertools, support
|
from core import channeltools, scrapertools, support
|
||||||
from platformcode import platformtools, config, logger
|
from platformcode import platformtools, config, logger
|
||||||
@@ -127,7 +127,7 @@ class SearchWindow(xbmcgui.WindowXML):
|
|||||||
for channel in self.channelsList:
|
for channel in self.channelsList:
|
||||||
logger.debug(channel)
|
logger.debug(channel)
|
||||||
try:
|
try:
|
||||||
module = __import__('channels.%s' % channel, fromlist=["channels.%s" % channel])
|
module = platformtools.channel_import(channel)
|
||||||
mainlist = getattr(module, 'mainlist')(Item(channel=channel, global_search=True))
|
mainlist = getattr(module, 'mainlist')(Item(channel=channel, global_search=True))
|
||||||
actions = [elem for elem in mainlist if elem.action == "search" and (self.mode in ['all', 'person'] or elem.contentType in [self.mode, 'undefined'])]
|
actions = [elem for elem in mainlist if elem.action == "search" and (self.mode in ['all', 'person'] or elem.contentType in [self.mode, 'undefined'])]
|
||||||
self.moduleDict[channel] = module
|
self.moduleDict[channel] = module
|
||||||
@@ -658,7 +658,7 @@ class SearchWindow(xbmcgui.WindowXML):
|
|||||||
|
|
||||||
def loadEpisodes(self ,item):
|
def loadEpisodes(self ,item):
|
||||||
try:
|
try:
|
||||||
self.channel = __import__('channels.%s' % item.channel, fromlist=["channels.%s" % item.channel])
|
self.channel = platformtools.channel_import(item.channel)
|
||||||
self.itemsResult = getattr(self.channel, item.action)(item)
|
self.itemsResult = getattr(self.channel, item.action)(item)
|
||||||
except:
|
except:
|
||||||
import traceback
|
import traceback
|
||||||
|
|||||||
+2
-11
@@ -348,17 +348,8 @@ def get_newest(channel_id, categoria):
|
|||||||
# We request the news of the category (item.extra) searched in the channel channel
|
# We request the news of the category (item.extra) searched in the channel channel
|
||||||
# If there are no news for that category in the channel, it returns an empty list
|
# If there are no news for that category in the channel, it returns an empty list
|
||||||
try:
|
try:
|
||||||
|
modulo = platformtools.channel_import(channel_id)
|
||||||
puede = True
|
if not modulo:
|
||||||
try:
|
|
||||||
modulo = __import__('channels.%s' % channel_id, fromlist=["channels.%s" % channel_id])
|
|
||||||
except:
|
|
||||||
try:
|
|
||||||
exec("import channels." + channel_id + " as modulo")
|
|
||||||
except:
|
|
||||||
puede = False
|
|
||||||
|
|
||||||
if not puede:
|
|
||||||
return
|
return
|
||||||
|
|
||||||
logger.debug("running channel " + modulo.__name__ + " " + modulo.__file__)
|
logger.debug("running channel " + modulo.__name__ + " " + modulo.__file__)
|
||||||
|
|||||||
@@ -355,7 +355,7 @@ def filter(item):
|
|||||||
elif control in [101]: # Genre
|
elif control in [101]: # Genre
|
||||||
genresIds = []
|
genresIds = []
|
||||||
genresNames = []
|
genresNames = []
|
||||||
# support.dbg()
|
# logger.dbg()
|
||||||
if self.item.db_type == 'tmdb':
|
if self.item.db_type == 'tmdb':
|
||||||
url = ('{}/genre/{}/list?api_key={}&language={}'.format(tmdb.host, item.args, tmdb.api, langs.tmdb))
|
url = ('{}/genre/{}/list?api_key={}&language={}'.format(tmdb.host, item.args, tmdb.api, langs.tmdb))
|
||||||
genres = httptools.downloadpage(url).json['genres']
|
genres = httptools.downloadpage(url).json['genres']
|
||||||
|
|||||||
+34
-51
@@ -1,6 +1,7 @@
|
|||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
#from builtins import str
|
#from builtins import str
|
||||||
|
import channels
|
||||||
import sys, os, traceback, xbmc, xbmcgui
|
import sys, os, traceback, xbmc, xbmcgui
|
||||||
|
|
||||||
PY3 = False
|
PY3 = False
|
||||||
@@ -8,7 +9,7 @@ if sys.version_info[0] >= 3: PY3 = True; unicode = str; unichr = chr; long = int
|
|||||||
|
|
||||||
from core import httptools, support, filetools, scrapertools, videolibrarytools, videolibrarydb
|
from core import httptools, support, filetools, scrapertools, videolibrarytools, videolibrarydb
|
||||||
from core.item import Item
|
from core.item import Item
|
||||||
from platformcode import config, logger, platformtools
|
from platformcode import config, dbconverter, logger, platformtools
|
||||||
|
|
||||||
if PY3:
|
if PY3:
|
||||||
from concurrent import futures
|
from concurrent import futures
|
||||||
@@ -18,7 +19,6 @@ else:
|
|||||||
import urlparse
|
import urlparse
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
def mainlist(item):
|
def mainlist(item):
|
||||||
logger.debug()
|
logger.debug()
|
||||||
itemlist = [item.clone(title=config.get_localized_string(60509), contentType='movie', action='list_movies', thumbnail=support.thumb('videolibrary_movie')),
|
itemlist = [item.clone(title=config.get_localized_string(60509), contentType='movie', action='list_movies', thumbnail=support.thumb('videolibrary_movie')),
|
||||||
@@ -91,7 +91,8 @@ def list_genres(item):
|
|||||||
def list_sets(item):
|
def list_sets(item):
|
||||||
videos = dict(videolibrarydb['collection']).values()
|
videos = dict(videolibrarydb['collection']).values()
|
||||||
videolibrarydb.close()
|
videolibrarydb.close()
|
||||||
itemlist = [v for v in videos]
|
itemlist = []
|
||||||
|
itemlist = [v.clone(contentType='list') for v in videos]
|
||||||
itemlist.sort(key=lambda it: it.title)
|
itemlist.sort(key=lambda it: it.title)
|
||||||
add_context(itemlist)
|
add_context(itemlist)
|
||||||
return itemlist
|
return itemlist
|
||||||
@@ -184,14 +185,14 @@ def list_movies(item, silent=False):
|
|||||||
logger.debug()
|
logger.debug()
|
||||||
|
|
||||||
videos = dict(videolibrarydb['movie']).values()
|
videos = dict(videolibrarydb['movie']).values()
|
||||||
if item.list_year: itemlist = [v['item'] for v in videos if item.list_year == v['item'].infoLabels['year']]
|
if item.list_year: itemlist = [platformtools.window_type(v['item']) for v in videos if item.list_year == v['item'].infoLabels['year']]
|
||||||
elif item.list_rating: itemlist = [v['item'] for v in videos if item.list_rating == int(float(v['item'].infoLabels['rating']))]
|
elif item.list_rating: itemlist = [platformtools.window_type(v['item']) for v in videos if item.list_rating == int(float(v['item'].infoLabels['rating']))]
|
||||||
elif item.list_genre: itemlist = [v['item'] for v in videos if item.list_genre in v['item'].infoLabels['genre']]
|
elif item.list_genre: itemlist = [platformtools.window_type(v['item']) for v in videos if item.list_genre in v['item'].infoLabels['genre']]
|
||||||
elif item.list_actor: itemlist = [v['item'] for v in videos if item.list_actor in str(v['item'].infoLabels['castandrole'])]
|
elif item.list_actor: itemlist = [platformtools.window_type(v['item']) for v in videos if item.list_actor in str(v['item'].infoLabels['castandrole'])]
|
||||||
elif item.list_director: itemlist = [v['item'] for v in videos if item.list_director in v['item'].infoLabels['director']]
|
elif item.list_director: itemlist = [platformtools.window_type(v['item']) for v in videos if item.list_director in v['item'].infoLabels['director']]
|
||||||
elif item.set: itemlist = [v['item'] for v in videos if item.set == v['item'].infoLabels.get('setid', '')]
|
elif item.set: itemlist = [platformtools.window_type(v['item']) for v in videos if item.set == v['item'].infoLabels.get('setid', '')]
|
||||||
elif config.get_setting('collection') and not item.text: itemlist = [v['item'] for v in videos if (item.text.lower() in v['item'].title.lower() and not 'setid' in v['item'].infoLabels)] + [v for v in dict(videolibrarydb['collection']).values()]
|
elif config.get_setting('collection') and not item.text: itemlist = [v['item'] for v in videos if (item.text.lower() in v['item'].title.lower() and not 'setid' in v['item'].infoLabels)] + [v.clone(contentType='list') for v in dict(videolibrarydb['collection']).values()]
|
||||||
else: itemlist = [v['item'] for v in videos if item.text.lower() in v['item'].title.lower()]
|
else: itemlist = [platformtools.window_type(v['item']) for v in videos if item.text.lower() in v['item'].title.lower()]
|
||||||
videolibrarydb.close()
|
videolibrarydb.close()
|
||||||
add_context(itemlist)
|
add_context(itemlist)
|
||||||
if silent == False:
|
if silent == False:
|
||||||
@@ -209,12 +210,12 @@ def list_tvshows(item):
|
|||||||
|
|
||||||
videos = dict(videolibrarydb['tvshow']).values()
|
videos = dict(videolibrarydb['tvshow']).values()
|
||||||
|
|
||||||
if item.list_year: series = [v['item'] for v in videos if item.list_year == v['item'].infoLabels['year']]
|
if item.list_year: series = [platformtools.window_type(v['item']) for v in videos if item.list_year == v['item'].infoLabels['year']]
|
||||||
elif item.list_rating: series = [v['item'] for v in videos if item.list_rating == int(float(v['item'].infoLabels['rating']))]
|
elif item.list_rating: series = [platformtools.window_type(v['item']) for v in videos if item.list_rating == int(float(v['item'].infoLabels['rating']))]
|
||||||
elif item.list_genre: series = [v['item'] for v in videos if item.list_genre in v['item'].infoLabels['genre']]
|
elif item.list_genre: series = [platformtools.window_type(v['item']) for v in videos if item.list_genre in v['item'].infoLabels['genre']]
|
||||||
elif item.list_actor: series = [v['item'] for v in videos if item.list_actor in str(v['item'].infoLabels['castandrole'])]
|
elif item.list_actor: series = [platformtools.window_type(v['item']) for v in videos if item.list_actor in str(v['item'].infoLabels['castandrole'])]
|
||||||
elif item.list_director: series = [v['item'] for v in videos if item.list_director in v['item'].infoLabels['director'] or item.list_director in v['item'].infoLabels['writer']]
|
elif item.list_director: series = [platformtools.window_type(v['item']) for v in videos if item.list_director in v['item'].infoLabels['director'] or item.list_director in v['item'].infoLabels['writer']]
|
||||||
else: series = [v['item'] for v in videos if item.text.lower() in v['item'].title.lower()]
|
else: series = [platformtools.window_type(v['item']) for v in videos if item.text.lower() in v['item'].title.lower()]
|
||||||
|
|
||||||
def sub_thread(it):
|
def sub_thread(it):
|
||||||
it.contentType = 'tvshow'
|
it.contentType = 'tvshow'
|
||||||
@@ -330,17 +331,9 @@ def get_episodes(item):
|
|||||||
def findvideos(item):
|
def findvideos(item):
|
||||||
from core import autoplay, servertools
|
from core import autoplay, servertools
|
||||||
from platformcode import platformtools
|
from platformcode import platformtools
|
||||||
logger.debug()
|
|
||||||
if config.get_setting('next_ep') == 3 and item.contentType != 'movie':
|
|
||||||
platformtools.prevent_busy(item)
|
|
||||||
item.window = True
|
|
||||||
|
|
||||||
videolibrarytools.check_renumber_options(item)
|
videolibrarytools.check_renumber_options(item)
|
||||||
itemlist = []
|
itemlist = []
|
||||||
if item.window:
|
|
||||||
p_dialog = platformtools.dialog_progress_bg(config.get_localized_string(20000), config.get_localized_string(60683))
|
|
||||||
p_dialog.update(0)
|
|
||||||
|
|
||||||
|
|
||||||
if not item.strm_path:
|
if not item.strm_path:
|
||||||
logger.debug('Unable to search for videos due to lack of parameters')
|
logger.debug('Unable to search for videos due to lack of parameters')
|
||||||
@@ -363,8 +356,7 @@ def findvideos(item):
|
|||||||
item.infoLabels = videolibrarydb['episode'][item.videolibrary_id][ep]['item'].infoLabels
|
item.infoLabels = videolibrarydb['episode'][item.videolibrary_id][ep]['item'].infoLabels
|
||||||
|
|
||||||
videolibrarydb.close()
|
videolibrarydb.close()
|
||||||
if item.window:
|
|
||||||
p_dialog.update(50)
|
|
||||||
if videolibrary_items.get('local'):
|
if videolibrary_items.get('local'):
|
||||||
try:
|
try:
|
||||||
local = videolibrary_items['local']
|
local = videolibrary_items['local']
|
||||||
@@ -400,8 +392,6 @@ def findvideos(item):
|
|||||||
|
|
||||||
pl = [s for s in itemlist if s.contentLanguage in [prefered_lang, '']]
|
pl = [s for s in itemlist if s.contentLanguage in [prefered_lang, '']]
|
||||||
if pl: itemlist = pl
|
if pl: itemlist = pl
|
||||||
if item.window:
|
|
||||||
p_dialog.update(100)
|
|
||||||
|
|
||||||
if len(itlist) > 1:
|
if len(itlist) > 1:
|
||||||
for it in itemlist:
|
for it in itemlist:
|
||||||
@@ -415,13 +405,10 @@ def findvideos(item):
|
|||||||
if config.get_setting('checklinks') and not config.get_setting('autoplay'):
|
if config.get_setting('checklinks') and not config.get_setting('autoplay'):
|
||||||
itemlist = servertools.check_list_links(itemlist, config.get_setting('checklinks_number'))
|
itemlist = servertools.check_list_links(itemlist, config.get_setting('checklinks_number'))
|
||||||
|
|
||||||
if item.window:
|
if not item.window:
|
||||||
p_dialog.close()
|
|
||||||
platformtools.serverwindow(item, itemlist)
|
|
||||||
|
|
||||||
else:
|
|
||||||
add_download_items(item, itemlist)
|
add_download_items(item, itemlist)
|
||||||
return itemlist
|
|
||||||
|
return itemlist
|
||||||
|
|
||||||
|
|
||||||
def servers(item, ch, items):
|
def servers(item, ch, items):
|
||||||
@@ -446,10 +433,7 @@ def servers(item, ch, items):
|
|||||||
return serverlist
|
return serverlist
|
||||||
|
|
||||||
if ch_params.get('active', False):
|
if ch_params.get('active', False):
|
||||||
|
channel = platformtools.channel_import(ch)
|
||||||
if os.path.isfile(os.path.join(config.get_runtime_path(), 'channels', ch + '.py')): _channel = 'channels'
|
|
||||||
else: _channel = 'specials'
|
|
||||||
channel = __import__('{}.{}'.format(_channel, ch), fromlist=['{}.{}'.format(_channel, ch)])
|
|
||||||
|
|
||||||
with futures.ThreadPoolExecutor() as executor:
|
with futures.ThreadPoolExecutor() as executor:
|
||||||
itlist = [executor.submit(channel_servers, item, it, channel, ch_name) for it in items]
|
itlist = [executor.submit(channel_servers, item, it, channel, ch_name) for it in items]
|
||||||
@@ -461,15 +445,12 @@ def servers(item, ch, items):
|
|||||||
|
|
||||||
def play(item):
|
def play(item):
|
||||||
logger.log()
|
logger.log()
|
||||||
# support.dbg()
|
# logger.dbg()
|
||||||
# logger.debug("item:\n" + item.tostring('\n'))
|
# logger.debug("item:\n" + item.tostring('\n'))
|
||||||
# platformtools.play_video(item)
|
# platformtools.play_video(item)
|
||||||
|
|
||||||
if not item.channel == "local":
|
if not item.channel == "local":
|
||||||
if os.path.isfile(os.path.join(config.get_runtime_path(), 'channels', item.channel + '.py')): _channel = 'channels'
|
channel = platformtools.channel_import(item.channel)
|
||||||
else: _channel = 'specials'
|
|
||||||
|
|
||||||
channel = __import__('{}.{}'.format(_channel, item.channel), fromlist=['{}.{}'.format(_channel, item.channel)])
|
|
||||||
|
|
||||||
if hasattr(channel, "play"):
|
if hasattr(channel, "play"):
|
||||||
itemlist = getattr(channel, "play")(item)
|
itemlist = getattr(channel, "play")(item)
|
||||||
@@ -538,14 +519,16 @@ def update_videolibrary(item=None):
|
|||||||
|
|
||||||
for it in show_list:
|
for it in show_list:
|
||||||
i += 1
|
i += 1
|
||||||
|
it.not_add = True
|
||||||
chname = channeltools.get_channel_parameters(it.channel)['title']
|
chname = channeltools.get_channel_parameters(it.channel)['title']
|
||||||
p_dialog.update(int(i * t), message=message % (it.fulltitle, chname))
|
p_dialog.update(int(i * t), message=message % (it.fulltitle, chname))
|
||||||
it = get_host(it)
|
it = get_host(it)
|
||||||
try: channel = __import__('channels.{}'.format(it.channel), fromlist=['channels.{}'.format(it.channel)])
|
channel = platformtools.channel_import(it.channel)
|
||||||
except: channel = __import__('specials.{}'.format(it.channel), fromlist=['specials.{}'.format(it.channel)])
|
|
||||||
itemlist = getattr(channel, it.action)(it)
|
itemlist = getattr(channel, it.action)(it)
|
||||||
videolibrarytools.save_tvshow(it, itemlist, True)
|
videolibrarytools.save_tvshow(it, itemlist, True)
|
||||||
p_dialog.close()
|
p_dialog.close()
|
||||||
|
if config.get_setting("videolibrary_kodi"):
|
||||||
|
dbconverter.save_all('tvshow')
|
||||||
|
|
||||||
except:
|
except:
|
||||||
p_dialog.close()
|
p_dialog.close()
|
||||||
@@ -838,9 +821,7 @@ def get_host(item , channel=None):
|
|||||||
item.url = urlparse.urlparse(item.url).path
|
item.url = urlparse.urlparse(item.url).path
|
||||||
if item.url.startswith('/'):
|
if item.url.startswith('/'):
|
||||||
if not channel:
|
if not channel:
|
||||||
try : channel = __import__('channels.' + item.channel, None, None, ['channels.' + item.channel])
|
channel = platformtools.channel_import(item.channel)
|
||||||
except: channel = __import__('specials.' + item.channel, None, None, ['specials.' + item.channel])
|
|
||||||
|
|
||||||
host = channel.host
|
host = channel.host
|
||||||
if host.endswith('/'): host = host[:-1]
|
if host.endswith('/'): host = host[:-1]
|
||||||
item.url = host + item.url
|
item.url = host + item.url
|
||||||
@@ -882,7 +863,7 @@ class subcontext(object):
|
|||||||
return config.get_localized_string(self.titledict[self.item.contentType][_type])
|
return config.get_localized_string(self.titledict[self.item.contentType][_type])
|
||||||
|
|
||||||
def makecontext(self):
|
def makecontext(self):
|
||||||
# support.dbg()
|
# logger.dbg()
|
||||||
# set watched
|
# set watched
|
||||||
# if not self.item.set:
|
# if not self.item.set:
|
||||||
watched = self.item.infoLabels.get('playcount', 0)
|
watched = self.item.infoLabels.get('playcount', 0)
|
||||||
@@ -1023,6 +1004,7 @@ def add_download_items(item, itemlist):
|
|||||||
path=item.path,
|
path=item.path,
|
||||||
thumbnail=support.thumb('download'),
|
thumbnail=support.thumb('download'),
|
||||||
parent=item.tourl())
|
parent=item.tourl())
|
||||||
|
|
||||||
if item.action == 'findvideos':
|
if item.action == 'findvideos':
|
||||||
if item.contentType != 'movie':
|
if item.contentType != 'movie':
|
||||||
downloadItem.title = '{} {}'.format(support.typo(config.get_localized_string(60356), 'color kod bold'), item.title)
|
downloadItem.title = '{} {}'.format(support.typo(config.get_localized_string(60356), 'color kod bold'), item.title)
|
||||||
@@ -1041,7 +1023,7 @@ def add_download_items(item, itemlist):
|
|||||||
#-------------- DELETE --------------
|
#-------------- DELETE --------------
|
||||||
|
|
||||||
def delete(item):
|
def delete(item):
|
||||||
# support.dbg()
|
# logger.dbg()
|
||||||
from platformcode import xbmc_videolibrary
|
from platformcode import xbmc_videolibrary
|
||||||
select = None
|
select = None
|
||||||
delete = None
|
delete = None
|
||||||
@@ -1363,3 +1345,4 @@ def convert_videolibrary(item):
|
|||||||
|
|
||||||
def restore_videolibrary(item):
|
def restore_videolibrary(item):
|
||||||
videolibrarytools.restore_videolibrary()
|
videolibrarytools.restore_videolibrary()
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user