- Fix Videoteca

- Aggiunti server VOE e HighLoad
 - dbg spostato in logger
 - altre migliorie
This commit is contained in:
Alhaziel01
2021-09-29 10:35:21 +02:00
parent 4046014220
commit fee7a27758
52 changed files with 492 additions and 392 deletions
+1 -2
View File
@@ -31,7 +31,7 @@
"mediasetplay": "https://www.mediasetplay.mediaset.it",
"mondoserietv": "https://mondoserietv.club",
"paramount": "https://www.paramountnetwork.it",
"piratestreaming": "https://www.piratestreaming.design",
"piratestreaming": "https://www.piratestreaming.video",
"polpotv": "https://roma.polpo.tv",
"raiplay": "https://www.raiplay.it",
"seriehd": "https://altadefinizionecommunity.casa",
@@ -48,7 +48,6 @@
"findhost": {
"altadefinizioneclick": "https://altadefinizione-nuovo.click",
"altadefinizionecommunity": "https://altaregistrazione.com",
"animealtadefinizione": "https://www.animealtadefinizione.it",
"filmpertutti": "https://filmpertuttiii.nuovo.live"
}
}
+4 -4
View File
@@ -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.!!!!
@support.scrape
def peliculas(item):
#support.dbg() # decommentare per attivare web_pdb
#logger.dbg() # decommentare per attivare web_pdb
action = ''
blacklist = ['']
@@ -159,7 +159,7 @@ def peliculas(item):
@support.scrape
def episodios(item):
#support.dbg()
#logger.dbg()
action = ''
blacklist = ['']
@@ -175,7 +175,7 @@ def episodios(item):
# per genere, per anno, per lettera, per qualità ecc ecc
@support.scrape
def genres(item):
#support.dbg()
#logger.dbg()
action = ''
blacklist = ['']
@@ -195,7 +195,7 @@ def genres(item):
# andranno modificate anche le def peliculas e episodios ove occorre
def select(item):
logger.debug()
#support.dbg()
#logger.dbg()
data = httptools.downloadpage(item.url, headers=headers).data
# pulizia di data, in caso commentare le prossime 2 righe
data = re.sub('\n|\t', ' ', data)
+2
View File
@@ -3,6 +3,7 @@
import os
import sys
# 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.*"
try:
@@ -10,3 +11,4 @@ try:
import core
except:
sys.path.append(os.path.abspath(os.path.join(os.path.dirname(__file__), "..", "..")))
-1
View File
@@ -116,7 +116,6 @@ def findvideos(item):
if item.contentType == 'movie':
matches = support.match(item, patron=epPatron).matches
for title, url in matches:
# support.dbg()
get_video_list(item, url, title, itemlist)
else:
get_video_list(item, item.url, support.config.get_localized_string(30137), itemlist)
-37
View File
@@ -20,8 +20,6 @@ def get_cookie(data):
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
if 'ASCookie' in data:
get_cookie(data)
@@ -177,46 +175,11 @@ def findvideos(item):
logger.debug()
itemlist = []
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
# 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
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'))
# 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:
link = support.match(url, patron=r'<a href="([^"]+)"[^>]+><button', headers=headers).match
if link:
-40
View File
@@ -52,7 +52,6 @@ def menu(item):
def genres(item):
logger.debug()
# support.dbg()
itemlist = []
genres = json.loads(support.match(response.text, patron='genres="([^"]+)').match.replace('&quot;','"'))
@@ -219,45 +218,6 @@ def episodios(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
if item.video_url == None:
if item.extra == "tvshow":
-1
View File
@@ -81,7 +81,6 @@ def peliculas(item):
return locals()
def check(item):
# support.dbg()
item.url = support.match(item, patron=r'(?:<p>|/>)(.*?)(?:<br|</td>|</p>)', patronBlock=r'Streaming:(.*?)</tr>').matches
if 'Episodio' in str(item.url):
item.contentType = 'tvshow'
-1
View File
@@ -117,7 +117,6 @@ def episodios(item):
def findvideos(item):
itemlist = []
logger.debug()
# support.dbg()
matches = support.match(item, patron=r'href="([^"]+)"', patronBlock=r'<div style="white-space: (.*?)<div id="main-content"')
-3
View File
@@ -39,7 +39,6 @@ def mainlist(item):
@support.scrape
def peliculas(item):
# support.dbg()
deflang = 'Sub-ITA'
# è una singola pagina con tutti gli episodi
@@ -81,7 +80,6 @@ def peliculas(item):
def episodios_args(item):
actLike = 'episodios'
# support.dbg()
deflang = 'Sub-ITA'
action = 'findvideos'
@@ -101,7 +99,6 @@ def episodios(item):
@support.scrape
def genres(item):
logger.debug()
#support.dbg()
action = 'peliculas'
patronBlock = r'<div id="mcTagMapNav">(?P<block>.+?)</div>'
+1 -1
View File
@@ -191,7 +191,7 @@ def findvideos(item):
for i, url in enumerate(list_url):
itemlist.append(support.Item(
channel=item.channel,
title=list_servers[i],
# title=list_servers[i],
url=url,
action='play',
quality=list_quality[i],
+2 -2
View File
@@ -30,7 +30,7 @@ current_session.headers.update({'Content-Type': 'application/json', 'User-Agent'
# login anonimo
res = current_session.post(loginUrl, json=loginData, verify=False)
support.dbg()
logger.dbg()
Token = res.json['response']['beToken']
sid = res.json['response']['sid']
current_session.headers.update({'authorization': 'Bearer' + Token})
@@ -318,7 +318,7 @@ def get_from_id(item):
def get_programs(item, ret=[], args={}):
hasMore = False
url = ''
# support.dbg()
# logger.dbg()
if 'search' in item.args:
args['uxReference'] = item.args[2]
+1 -1
View File
@@ -105,7 +105,7 @@ def episodios(item):
data = ''
# debugging
# support.dbg()
# logger.dbg()
# for i, season in enumerate(seasons.matches):
# data += get_season(seasons.data if i == 0 else '', season[0], season[1])
import sys
+1 -1
View File
@@ -134,7 +134,7 @@ def episodios(item):
def findvideos(item):
# support.dbg()
# logger.dbg()
domain = scrapertools.find_single_match(item.url, 'https?://[a-z0-9.-]+')
if item.contentType == 'movie':
id = item.url.split('/')[-1]
+2 -2
View File
@@ -191,13 +191,13 @@ def findvideos(item):
# data += '\n'.join(listurl)
logger.debug(data)
itemlist = []
# support.dbg()
# logger.dbg()
if '/serietv/series/names' in item.url:
itemlist.extend(support.server(item, itemlist=hdpass(Item(url=item.url))))
else:
urls = support.match(data, patron=player_iframe).matches
# support.dbg()
# logger.dbg()
if item.otherLinks:
urls += support.match(item.otherLinks, patron=r'href="([^"]+)').matches
+1 -1
View File
@@ -102,7 +102,7 @@ def newest(categoria):
def peliculas(item):
itemlist = []
# support.dbg()
# logger.dbg()
if not item.args:
json_file =loadjs(item.url + 'channel/10005/last/')
logger.debug(json_file)
+4 -3
View File
@@ -32,7 +32,7 @@ def start(itemlist, item):
if not config.is_xbmc():
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
user_config_setting_action = config.get_setting("default_action")
# 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)
# 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])
except: channel = __import__('specials.%s' % channel_id, None, None, ["specials.%s" % channel_id])
channel = platformtools.channel_import(channel_id)
if not channel:
return
if hasattr(channel, 'play'):
resolved_item = getattr(channel, 'play')(videoitem)
if len(resolved_item) > 0:
-1
View File
@@ -171,7 +171,6 @@ def get_default_settings(channel_name):
channel_path = filetools.join(config.get_runtime_path(), 'channels', channel_name + '.json')
# from core.support import dbg; dbg()
if filetools.exists(channel_path):
default_controls = default_file['settings']
default_controls_renumber = default_file['renumber']
-1
View File
@@ -21,7 +21,6 @@ def find_and_set_infoLabels(item):
:param item:
:return: Boolean indicating if the 'code' could be found
"""
# from core.support import dbg;dbg()
global scraper
scraper = None
# logger.debug("item:\n" + item.tostring('\n'))
+3 -3
View File
@@ -63,7 +63,7 @@ def find_video_items(item=None, data=None):
for label, url, server, thumbnail in findvideos(data):
title = label
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
@@ -118,7 +118,7 @@ def get_servers_itemlist(itemlist, fnc=None, sort=False):
item.server = "directo"
if fnc:
item.title = fnc(item)
item.serverName = fnc(item)
# Sort according to favoriteslist if necessary
@@ -751,7 +751,7 @@ def check_list_links(itemlist, numero='', timeout=3):
if res:
it = res[0]
verificacion = res[1]
it.title = verificacion + ' ' + it.title.strip()
it.serverName = verificacion + ' ' + it.title.strip()
logger.debug('VERIFICATION= ' + verificacion)
it.alive = verificacion
return itemlist
+42 -43
View File
@@ -20,7 +20,7 @@ from time import time
from core import httptools, scrapertools, servertools, tmdb, channeltools, autoplay
from core.item import Item
from lib import unshortenit
from platformcode import config, logger
from platformcode import config, logger, platformtools
channels_order = {'Rai 1': 1,
'Rai 2': 2,
@@ -486,7 +486,8 @@ class scrape:
it.action=self.action
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
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('&nbsp;', ' '))
# 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
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):
if stackCheck('channel_search'):
if stackCheck(['channel_search', 'update_videolibrary']):
return itemlist
if not item.page:
@@ -959,7 +946,7 @@ def pagination(itemlist, item, function_level=1):
def season_pagination(itemlist, item, seasons=[], function_level=1):
if stackCheck('channel_search'):
if stackCheck(['channel_search', 'update_videolibrary']):
return itemlist
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):
logger.debug()
if item.autoplay != '': AutoPlay = item.autoplay
if not data and not itemlist:
data = httptools.downloadpage(item.url, headers=headers, ignore_response_code=True).data
if data:
@@ -1050,26 +1039,36 @@ def server(item, data='', itemlist=[], headers='', AutoPlay=True, CheckLinks=Tru
videoitem.server = videoitem.server.lower()
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 ''
# videoitem = item.clone(url=videoitem.url, serverName=videoitem.serverName, server=videoitem.server, action='play')
videoitem.contentLanguage = videoitem.contentLanguage if videoitem.contentLanguage else item.contentLanguage if item.contentLanguage else 'ITA'
videoitem.serverName = videoitem.title if videoitem.server == 'directo' else servertools.get_server_parameters(videoitem.server).get('name', videoitem.server.capitalize())
# videoitem.title = item.contentTitle.strip() if item.contentType == 'movie' and item.contentTitle or (config.get_localized_string(30161) in item.fulltitle) else item.fulltitle
videoitem.plot = typo(videoitem.title, 'bold') + (typo(quality, '_ [] bold') if quality else '')
videoitem.channel = item.channel
videoitem.fulltitle = item.fulltitle
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
vi = item.clone(server=videoitem.server,
serverName=videoitem.serverName,
url=videoitem.url,
video_urls= videoitem.video_urlsn,
ch_name=channeltools.get_channel_parameters(item.channel)['title'],
action = "play")
if videoitem.title: vi.serverName = videoitem.serverName
if videoitem.quality: vi.quality = videoitem.quality
if not vi.referer: vi.referer = item.url
if videoitem.contentType == 'episode': vi.fanart=videoitem.thumbnail
videoitem = vi
# videoitem = item.clone(serverName = videoitem.title if videoitem.title else videoitem.ser)
# quality = videoitem.quality if videoitem.quality else item.quality if item.quality else ''
# videoitem.contentLanguage = videoitem.contentLanguage if videoitem.contentLanguage else item.contentLanguage if item.contentLanguage else 'ITA'
# videoitem.serverName = videoitem.serverName if videoitem.server == 'directo' else servertools.get_server_parameters(videoitem.server).get('name', videoitem.server.capitalize())
# videoitem.plot = typo(videoitem.serverName, 'bold') + (typo(quality, '_ [] bold') if quality else '')
# videoitem.channel = item.channel
# videoitem.fulltitle = item.fulltitle
# 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
# 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):
if 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:
addQualityTag(item, verifiedItemlist, data, patronTag)
@@ -1840,12 +1836,15 @@ def dooplay_menu(item, type):
def get_jwplayer_mediaurl(data, srvName, onlyHttp=False, dataIsBlock=False):
from core import jsontools
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:
json = jsontools.load(block)
if json:
sources = []
for s in json:
if isinstance(s, str):
sources.append((s, ''))
else:
if 'file' in s.keys():
src = s['file']
else:
+1 -1
View File
@@ -214,7 +214,7 @@ def set_infoLabels_itemlist(itemlist, seekTmdb=False, search_language=def_lang,
return (_i, _item, ret)
# from core.support import dbg; dbg()
# logger.dbg()
# for i, item in enumerate(itemlist):
# r_list.append(sub_thread(item, i, seekTmdb))
with futures.ThreadPoolExecutor() as executor:
-2
View File
@@ -275,7 +275,6 @@ def wait_for_update_trakt():
def update_all():
# from core.support import dbg;dbg()
from time import sleep
logger.debug()
sleep(20)
@@ -306,7 +305,6 @@ def context(item):
pass
try:
from core.support import dbg;dbg()
result = execute(item.clone(url="/sync/watchlist/" + Type))
post = {Type: [{"ids": {"tmdb": item.infoLabels["tmdb_id"]}}]}
if condition in str(result):
-3
View File
@@ -78,7 +78,6 @@ otvdb_global = None
def find_and_set_infoLabels(item):
logger.debug()
# from core.support import dbg;dbg()
# logger.debug("item es %s" % item)
p_dialog = None
@@ -666,8 +665,6 @@ class Tvdb(object):
url = HOST + "/episodes/%s" % _id
# from core.support import dbg;dbg()
try:
DEFAULT_HEADERS["Accept-Language"] = lang
logger.debug("url: %s, \nheaders: %s" % (url, DEFAULT_HEADERS))
+47 -40
View File
@@ -120,7 +120,7 @@ def save_movie(item, silent=False):
# get extra info from fanart tv
# support.dbg()
# logger.dbg()
extra_info = get_fanart_tv(item)
if not item.infoLabels.get('posters', []): item.infoLabels['posters'] = []
item.infoLabels['posters'] += extra_info['poster']
@@ -443,10 +443,13 @@ def save_episodes(item, episodelist, extra_info, host, local_files, silent=False
episode = None
season_episode = None
if e.contentSeason and e.contentEpisodeNumber:
season_episode = '{}x{:02d}'.format(e.contentSeason, e.contentEpisodeNumber)
strm_path = filetools.join(item.base_name, "{}.strm".format(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']
@@ -454,7 +457,7 @@ def save_episodes(item, episodelist, extra_info, host, local_files, silent=False
tmdb.set_infoLabels_item(e)
if not e.infoLabels.get('playcount'): e.infoLabels['playcount'] = 0
head_nfo = scraper.get_nfo(e)
# head_nfo = scraper.get_nfo(e)
episode_item = Item(action='findvideos',
channel='videolibrary',
@@ -463,14 +466,12 @@ def save_episodes(item, episodelist, extra_info, host, local_files, silent=False
contentEpisodeNumber = e.contentEpisodeNumber,
contentType = e.contentType,
infoLabels = e.infoLabels,
head_nfo = head_nfo,
# 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, {})
try:
if not episode:
inserted += 1
@@ -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
# if not filetools.exists(filetools.join(TVSHOWS_PATH, strm_path)):
if season_episode not in local_files.get('db',{}).keys():
logger.debug("Creating .strm: " + 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,)
filetools.write(filetools.join(TVSHOWS_PATH, strm_path), '{}?{}'.format(addon_name, item_strm.tourl()))
logger.debug("Creating .strm: " + episode_item.strm_path)
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, episode_item.strm_path), '{}?{}'.format(addon_name, item_strm.tourl()))
# update db if episode added
# 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:
episodes[season_episode] = episode
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 in item.lang_list: item.lang_list.append(lang)
if not silent:
i += 1
p_dialog.update(int(math.ceil(i * t)), message=e.title)
# support.dbg()
# logger.dbg()
# for e in episodelist:
# item, episode, season_episode, lang, I, O, F = save_episode(item, episodes, e)
# inserted += I
@@ -781,11 +782,7 @@ def add_tvshow(item, channel=None, itemlist=[]):
item.__dict__["channel"] = item.__dict__.pop("from_channel")
if not channel:
try:
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")
channel = platformtools.channel_import(item.channel)
# 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
@@ -806,7 +803,7 @@ def add_tvshow(item, channel=None, itemlist=[]):
itemlist = getattr(channel, it.action)(it)
item.host = channel.host
if itemlist:
# support.dbg()
# logger.dbg()
from platformcode.autorenumber import start, check
if not check(item, itemlist):
action = item.action
@@ -881,7 +878,7 @@ def get_fanart_tv(item, set='', ret={}):
return d
_id = item.infoLabels.get('tmdb_id')
# support.dbg()
# logger.dbg()
if _id:
_type = item.contentType.replace('show','').replace('movie','movies')
@@ -1085,48 +1082,59 @@ def restore_videolibrary():
try: os.mkdir(TVSHOWS_PATH)
except: pass
movie_files = []
for root, dir, files in filetools.walk(MOVIES_PATH):
movie_files.extend(files)
for item in movies:
dialog.update(int(progress / total * 100), item.title)
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
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
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)
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)
filetools.write(filetools.join(MOVIES_PATH, item.strm_path), '{}?{}'.format(addon_name, item_strm.tourl()))
progress += 1
dialog.update(int(progress / total * 100))
dialog.update(int(progress / total * 100), item.title)
for item in tvshows:
dialog.update(int(progress / total * 100), item.title)
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
nfo_path = filetools.join(base_name, "tvshow.nfo")
nfo_exists = filetools.exists(filetools.join(TVSHOWS_PATH, nfo_path))
if not nfo_exists:
if not filetools.exists(filetools.join(TVSHOWS_PATH, base_name, 'tvshow.nfo')):
if not item.head_nfo: item.head_nfo = scraper.get_nfo(item)
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()]
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)
strm_path = filetools.join(item.base_name, "{}.strm".format(season_episode))
strm_exists = filetools.exists(filetools.join(MOVIES_PATH, strm_path))
strm_path = filetools.join(item.base_name, '{}.strm'.format(season_episode))
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)
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()))
progress += 1
dialog.update(int(progress / total * 100))
dialog.update(int(progress / total * 100), item.title)
videolibrarydb.close()
dbconverter.save_all()
@@ -1178,8 +1186,7 @@ def convert_videolibrary():
it.url = channels_dict[ch]
remove_host(it)
tmdb.find_and_set_infoLabels(it)
try: channel = __import__('channels.%s' % ch, fromlist=['channels.%s' % ch])
except: channel = __import__('specials.%s' % ch, fromlist=['specials.%s' % ch])
channel = platformtools.channel_import(ch)
it.host = channel.host
it.url = channel.host + it.url
episodes = getattr(channel, 'episodios')(it)
+1 -1
View File
@@ -197,7 +197,7 @@ def update_title(item):
# new_item.infoLabels['year'] = '-'
# if new_item.contentSeason:
# del new_item.infoLabels['season'] # It works wrong with num. seasonal
# support.dbg()
# logger.dbg()
# scraper_return = scraper.find_and_set_infoLabels(new_item)
#logger.debug(item)
+7 -1
View File
@@ -42,6 +42,7 @@ class UnshortenIt(object):
_swzz_regex = r'swzz\.xyz'
_stayonline_regex = r'stayonline\.pro'
_snip_regex = r'[0-9a-z]+snip\.|uprotector\.xyz'
_linksafe_regex = r'linksafe\.cc'
# for services that only include real link inside iframe
_simple_iframe_regex = r'cryptmango|xshield\.net|vcrypt\.club'
# 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,
_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
@@ -98,6 +99,8 @@ class UnshortenIt(object):
uri, code = self._unshorten_stayonline(uri)
if re.search(self._snip_regex, uri, re.IGNORECASE):
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):
p = httptools.downloadpage(uri)
uri = p.url
@@ -666,6 +669,9 @@ class UnshortenIt(object):
# uri = new_uri
return uri, 200
def _unshorten_linksafe(self, uri):
return b64decode(uri.split('?url=')[-1]).decode(), 200
def decrypt_aes(text, key):
try:
+3 -3
View File
@@ -7,7 +7,7 @@
import xbmc, xbmcgui, re, base64, sys
from core import jsontools, tmdb, filetools
from core.item import Item
from core.support import typo, dbg, Item
from core.support import typo, Item
from platformcode import config, platformtools, logger
PY3 = True if sys.version_info[0] >= 3 else False
if PY3:
@@ -70,7 +70,7 @@ def b64(json, mode = 'encode'):
def find_episodes(item):
logger.debug()
ch = __import__('channels.' + item.channel, fromlist=["channels.{}".format(item.channel)])
ch = platformtools.channel_import(item.channel)
itemlist = getattr(ch, item.action)(item)
return itemlist
@@ -187,7 +187,7 @@ class autorenumber():
item.contentSeason = int(self.episodes[number].split('x')[0])
item.contentEpisodeNumber = int(self.episodes[number].split('x')[1])
# dbg()
# logger.dbg()
# for i in self.itemlist:
# sub_thread(i)
+1 -1
View File
@@ -121,7 +121,7 @@ def get_id():
return dbid
def check_condition():
# support.dbg()
# logger.dbg()
global path
path = search_paths(get_id())
return path
+16 -4
View File
@@ -10,9 +10,9 @@ import sqlite3
# conn = sqlite3.connect(get_file_db())
date = strftime('%Y-%m-%d %H:%M:%S', localtime(float(time())))
def save_all():
movies = dict(videolibrarydb['movie'])
tvshows = dict(videolibrarydb['tvshow'])
def save_all(_type=''):
movies = dict(videolibrarydb['movie']) if _type == 'movie' or not _type else {}
tvshows = dict(videolibrarydb['tvshow']) if _type == 'tvshow' or not _type else {}
videolibrarydb.close()
for movie in movies.values():
@@ -93,6 +93,12 @@ def get_id(column, table):
else: _id = 1
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):
@@ -292,6 +298,12 @@ class addMovie(object):
def set_files(self):
self.idFile = get_id('idFile', 'files')
if exist(self.idPath, 'idpath', 'files'):
if self.info.get('playcount', None):
sql = 'UPDATE path SET playCount=? WHERE idPath=?'
params = (self.info.get('playcount', None), self.idPath)
self.sql_actions.append([sql, params])
else:
if self.info.get('playcount', None):
sql = 'INSERT OR IGNORE INTO files (idFile, idPath, strFilename, playCount, lastPlayed, dateAdded) VALUES ( ?, ?, ?, ?, ?, ?)'
params = (self.idFile, self.idPath, self.strFilename, self.info.get('playcount', None), self.item.lastplayed, date)
@@ -595,7 +607,7 @@ class addTvShow(object):
files = {r[1].replace('.strm',''):r[0] for r in records}
self.idFiles = {}
idFile = get_id('idFile', 'files')
# support.dbg()
# logger.dbg()
for episode in self.idEpisodes.keys():
if episode in files.keys():
self.idFiles[episode] = files[episode]
+1 -1
View File
@@ -60,7 +60,7 @@ def extract():
def setting():
# support.dbg()
# logger.dbg()
xbmc.executebuiltin('UpdateLocalAddons')
xbmc.sleep(1000)
if filetools.isfile(elementum_setting_file):
+1 -1
View File
@@ -8,7 +8,7 @@ from core import httptools, tmdb
from core.item import Item
from platformcode import config, platformtools, logger
from core.support import match, typo, dbg
from core.support import match, typo
info_list = []
+1 -1
View File
@@ -186,7 +186,7 @@ class Main(xbmcgui.WindowXMLDialog):
import channelselector
itemlist = self.menulist(channelselector.getchanneltypes())
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'))))
self.SUBMENU.reset()
self.SUBMENU.addItems(itemlist)
+22 -45
View File
@@ -46,6 +46,8 @@ def run(item=None):
if len(sp) > 1:
for e in sp[1:]:
key, val = e.split('=')
if val.lower() == 'false': val = False
elif val.lower() == 'true': val = True
item.__setattr__(key, val)
# If no item, this is mainlist
else:
@@ -66,7 +68,6 @@ def run(item=None):
config.set_setting('show_once', True)
logger.info(item.tostring())
# from core.support import dbg;dbg()
try:
if not config.get_setting('tmdb_active'):
@@ -113,8 +114,7 @@ def run(item=None):
elif item.channel == "infoplus":
from platformcode import infoplus
action = getattr(infoplus, item.action)
return action(item)
return getattr(infoplus, item.action)(item)
elif item.channel == 'trakt_tools':
from core import trakt_tools
@@ -156,7 +156,6 @@ def run(item=None):
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)]))
elif item.action == "gotopage":
# from core.support import dbg;dbg()
from core import scrapertools
head = config.get_localized_string(70511)
scraped_page = scrapertools.find_single_match(item.url,'[=/]([0-9]+)')
@@ -184,23 +183,9 @@ def run(item=None):
item.nextSeason = season
xbmc.executebuiltin("Container.Update(%s?%s)" % (sys.argv[0], item.tourl()))
else:
# Checks if channel exists
if os.path.isfile(os.path.join(config.get_runtime_path(), 'channels', item.channel + ".py")):
CHANNELS = 'channels'
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")
channel = platformtools.channel_import(item.channel)
if not channel:
return
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
elif item.action == "findvideos":
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.update(0)
@@ -260,7 +246,7 @@ def run(item=None):
if config.get_setting("max_links", "videolibrary") != 0:
itemlist = limit_itemlist(itemlist)
if item.window and item.channel not in ['videolibrary', 'local']:
if p_dialog:
p_dialog.update(100)
p_dialog.close()
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
elif item.action == "search":
# from core.support import dbg;dbg()
if filetools.isfile(temp_search_file) and config.get_setting('videolibrary_kodi'):
itemlist = []
f = filetools.read(temp_search_file)
@@ -474,27 +459,19 @@ def play_from_library(item):
@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
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")))
xbmc.Player().stop()
if xbmc.getCondVisibility('Window.IsMedia') and not item.window_type == 0:
platformtools.window_type(item)
platformtools.prevent_busy(item)
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':
it = videolibrarydb[item.contentType][item.videolibrary_id]['{}x{:02d}'.format(item.infoLabels['season'], item.infoLabels['episode'])]['item']
else:
@@ -504,4 +481,4 @@ def play_from_library(item):
videolibrarydb.close()
else:
item.window = True
return videolibrary.findvideos(item)
return run(item)
+11
View File
@@ -51,6 +51,17 @@ def log(*args, **kwargs):
function=frame.f_code.co_name,
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):
def __init__(self, url, channel, *args, **kwargs):
+26 -14
View File
@@ -18,7 +18,7 @@ else:
import os, xbmc, xbmcgui, xbmcplugin
from past.utils import old_div
from core import scrapertools
from core import filetools, scrapertools
from core.item import Item
from platformcode import logger, config
@@ -425,7 +425,7 @@ def render_items(itemlist, parent_item):
return item, item_url, listitem
# 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 = []
@@ -674,7 +674,6 @@ def set_context_commands(item, item_url, parent_item, **kwargs):
# context_commands.append((config.get_localized_string(60348), "Action(Info)"))
# InfoPlus
# from core.support import dbg;dbg()
# if config.get_setting("infoplus"):
#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:
@@ -1054,7 +1053,7 @@ def play_video(item, strm=False, force_direct=False, autoplay=False):
if not mediaurl: return
# 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})
set_infolabels(xlistitem, item, True)
@@ -1771,7 +1770,6 @@ def get_platform():
def get_played_time(item):
logger.debug()
from core import db
# from core.support import dbg;dbg()
played_time = 0
if not item.infoLabels:
@@ -1801,7 +1799,6 @@ def get_played_time(item):
def set_played_time(item):
logger.debug()
from core import db
# from core.support import dbg;dbg()
played_time = item.played_time
if not item.infoLabels:
@@ -1815,6 +1812,7 @@ def set_played_time(item):
e = item.infoLabels.get('episode')
try:
# logger.dbg()
if e:
newDict = db['viewed'].get(ID, {})
newDict['{}x{}'.format(s, e)] = played_time
@@ -1828,16 +1826,9 @@ def set_played_time(item):
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):
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"))
else: xbmcplugin.setResolvedUrl(int(sys.argv[1]), True, xbmcgui.ListItem(path=os.path.join(config.get_runtime_path(), "resources", "kod.mp4")))
xbmc.sleep(200)
@@ -1910,3 +1901,24 @@ def serverwindow(item, itemlist):
from platformcode.launcher import run
run(selection)
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
-2
View File
@@ -102,7 +102,6 @@ def channels_menu(item):
def check_channels(item):
from specials import setting
from platformcode import config, platformtools
# from core.support import dbg; dbg()
item.channel = 'setting'
item.extra = 'lib_check_datajson'
itemlist = setting.conf_tools(item)
@@ -131,7 +130,6 @@ def SettingOnPosition(item):
def select(item):
# from core.support import dbg;dbg()
from platformcode import config, platformtools
# item.id = setting ID
# item.type = labels or values
+4 -3
View File
@@ -261,6 +261,7 @@ def mark_content_as_watched_on_kodi(item, value=1):
@param value: > 0 for seen, 0 for not seen
"""
logger.debug()
logger.dbg()
if item.contentType == 'movie':
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:
payload = {"jsonrpc": "2.0", "method": "VideoLibrary.SetMovieDetails", "params": {"movieid": r[0][0], "playcount": value}, "id": 1}
data = get_data(payload)
logger.debug(data)
elif item.contentType == 'episode':
path = '%{}'.format(item.strm_path.replace('\\','%').replace('/', '%'))
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):
from specials import videolibrary
from core import videolibrarydb
# from core.support import dbg;dbg()
data = jsontools.load(data)
Type = data.get('item', {}).get('type','')
@@ -329,7 +330,7 @@ def set_watched_on_kod(data):
# item.all_ep
else:
# support.dbg()
# logger.dbg()
sql = 'select strPath from {}_view where (id{} like "{}")'.format(Type, Type.replace('tv','').capitalize(), ID)
n, records = execute_sql_kodi(sql)
if records:
@@ -811,7 +812,7 @@ def clean_by_id(item):
tmdb_id = item.infoLabels.get('tmdb_id', '')
season_id = item.infoLabels.get('temporada_id', '')
episode_id = item.infoLabels.get('episodio_id', '')
# support.dbg()
# logger.dbg()
# search movie ID
if item.contentType == 'movie':
+2 -2
View File
@@ -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*['"]([^"']+)""")
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')
video_urls = [{'type':'m3u8', 'url':'special://temp/hdmario.m3u8'}]
video_urls = [{'type':'hls', 'url':baseUrl + '/pl/' + page_url.split('/')[-1].replace('?', '')}]
return video_urls
+42
View File
@@ -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"
}
+84
View File
@@ -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)
+2 -2
View File
@@ -19,7 +19,7 @@ def get_video_url(page_url, premium=False, user="", password="", video_password=
global data
logger.debug("URL", page_url)
video_urls = []
# support.dbg()
# logger.dbg()
headers = {'User-Agent': httptools.get_user_agent(),
'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
if data.get('result',{}).get('playlist'):
# support.dbg()
# logger.dbg()
url = data.get('result',{}).get('playlist')
video_urls.append({'type':url.split('.')[-1], 'url':url + '|Referer:' + page_url})
-1
View File
@@ -18,7 +18,6 @@ def test_video_exists(page_url):
def get_video_url(page_url, premium=False, user="", password="", video_password=""):
logger.debug("url=" + page_url)
# from core.support import dbg;dbg()
qualities = []
video_urls = []
mgid = support.match(data, patron=r'uri":"([^"]+)"').match
+42
View File
@@ -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"
}
+36
View File
@@ -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
+1 -1
View File
@@ -141,7 +141,7 @@ def channel_search(item):
module_dict = {}
for ch in channel_list:
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))
module_dict[ch] = module
+1 -1
View File
@@ -444,7 +444,7 @@ def findvideos(item):
item.url = {}
json.append({"url": url})
# support.dbg()
# logger.dbg()
for option in json:
extra = set_extra_values(item, option, item.path)
itemlist.append(
+6 -18
View File
@@ -4,6 +4,7 @@
# ------------------------------------------------------------
from __future__ import division
import channels
#from builtins import str
import sys, os
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)
try:
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])
channel = platformtools.channel_import(item.contentChannel)
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)
@@ -725,10 +723,7 @@ def download_from_best_server(item):
logger.debug('using cached servers')
play_items = [Item().fromurl(i) for i in item.downloadItemlist]
else:
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])
channel = platformtools.channel_import(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')
play_items = [Item().fromurl(i) for i in item.downloadItemlist]
else:
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])
channel = platformtools.channel_import(item.contentChannel)
progreso.update(50, config.get_localized_string(70184) + '\n' + config.get_localized_string(70180) % item.contentChannel)
if hasattr(channel, item.contentAction):
@@ -853,18 +845,14 @@ def get_episodes(item):
if item.downloadItemlist:
episodes = [Item().fromurl(i) for i in item.downloadItemlist]
else:
# The item is a series or season...
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])
channel = platformtools.channel_import(item.contentChannel)
# We get the list of episodes
episodes = getattr(channel, item.contentAction)(item)
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':
# from platformcode.autorenumber import select_type, renumber, check
# # support.dbg()
# # logger.dbg()
# if not check(item):
# select_type(item)
# return get_episodes(item)
+1 -1
View File
@@ -264,7 +264,7 @@ def live(item):
def load_live(channel_name):
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])
except:
itemlist = []
+3 -3
View File
@@ -4,7 +4,7 @@
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 import channeltools, scrapertools, support
from platformcode import platformtools, config, logger
@@ -127,7 +127,7 @@ class SearchWindow(xbmcgui.WindowXML):
for channel in self.channelsList:
logger.debug(channel)
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))
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
@@ -658,7 +658,7 @@ class SearchWindow(xbmcgui.WindowXML):
def loadEpisodes(self ,item):
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)
except:
import traceback
+2 -11
View File
@@ -348,17 +348,8 @@ def get_newest(channel_id, categoria):
# 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
try:
puede = True
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:
modulo = platformtools.channel_import(channel_id)
if not modulo:
return
logger.debug("running channel " + modulo.__name__ + " " + modulo.__file__)
+1 -1
View File
@@ -355,7 +355,7 @@ def filter(item):
elif control in [101]: # Genre
genresIds = []
genresNames = []
# support.dbg()
# logger.dbg()
if self.item.db_type == 'tmdb':
url = ('{}/genre/{}/list?api_key={}&language={}'.format(tmdb.host, item.args, tmdb.api, langs.tmdb))
genres = httptools.downloadpage(url).json['genres']
+33 -50
View File
@@ -1,6 +1,7 @@
# -*- coding: utf-8 -*-
#from builtins import str
import channels
import sys, os, traceback, xbmc, xbmcgui
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.item import Item
from platformcode import config, logger, platformtools
from platformcode import config, dbconverter, logger, platformtools
if PY3:
from concurrent import futures
@@ -18,7 +19,6 @@ else:
import urlparse
def mainlist(item):
logger.debug()
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):
videos = dict(videolibrarydb['collection']).values()
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)
add_context(itemlist)
return itemlist
@@ -184,14 +185,14 @@ def list_movies(item, silent=False):
logger.debug()
videos = dict(videolibrarydb['movie']).values()
if item.list_year: itemlist = [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_genre: itemlist = [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_director: itemlist = [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 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()]
else: itemlist = [v['item'] for v in videos if item.text.lower() in v['item'].title.lower()]
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 = [platformtools.window_type(v['item']) for v in videos if item.list_rating == int(float(v['item'].infoLabels['rating']))]
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 = [platformtools.window_type(v['item']) for v in videos if item.list_actor in str(v['item'].infoLabels['castandrole'])]
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 = [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.clone(contentType='list') for v in dict(videolibrarydb['collection']).values()]
else: itemlist = [platformtools.window_type(v['item']) for v in videos if item.text.lower() in v['item'].title.lower()]
videolibrarydb.close()
add_context(itemlist)
if silent == False:
@@ -209,12 +210,12 @@ def list_tvshows(item):
videos = dict(videolibrarydb['tvshow']).values()
if item.list_year: series = [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_genre: series = [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_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']]
else: series = [v['item'] for v in videos if item.text.lower() in v['item'].title.lower()]
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 = [platformtools.window_type(v['item']) for v in videos if item.list_rating == int(float(v['item'].infoLabels['rating']))]
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 = [platformtools.window_type(v['item']) for v in videos if item.list_actor in str(v['item'].infoLabels['castandrole'])]
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 = [platformtools.window_type(v['item']) for v in videos if item.text.lower() in v['item'].title.lower()]
def sub_thread(it):
it.contentType = 'tvshow'
@@ -330,17 +331,9 @@ def get_episodes(item):
def findvideos(item):
from core import autoplay, servertools
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)
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:
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
videolibrarydb.close()
if item.window:
p_dialog.update(50)
if videolibrary_items.get('local'):
try:
local = videolibrary_items['local']
@@ -400,8 +392,6 @@ def findvideos(item):
pl = [s for s in itemlist if s.contentLanguage in [prefered_lang, '']]
if pl: itemlist = pl
if item.window:
p_dialog.update(100)
if len(itlist) > 1:
for it in itemlist:
@@ -415,12 +405,9 @@ def findvideos(item):
if config.get_setting('checklinks') and not config.get_setting('autoplay'):
itemlist = servertools.check_list_links(itemlist, config.get_setting('checklinks_number'))
if item.window:
p_dialog.close()
platformtools.serverwindow(item, itemlist)
else:
if not item.window:
add_download_items(item, itemlist)
return itemlist
@@ -446,10 +433,7 @@ def servers(item, ch, items):
return serverlist
if ch_params.get('active', False):
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)])
channel = platformtools.channel_import(ch)
with futures.ThreadPoolExecutor() as executor:
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):
logger.log()
# support.dbg()
# logger.dbg()
# logger.debug("item:\n" + item.tostring('\n'))
# platformtools.play_video(item)
if not item.channel == "local":
if os.path.isfile(os.path.join(config.get_runtime_path(), 'channels', item.channel + '.py')): _channel = 'channels'
else: _channel = 'specials'
channel = __import__('{}.{}'.format(_channel, item.channel), fromlist=['{}.{}'.format(_channel, item.channel)])
channel = platformtools.channel_import(item.channel)
if hasattr(channel, "play"):
itemlist = getattr(channel, "play")(item)
@@ -538,14 +519,16 @@ def update_videolibrary(item=None):
for it in show_list:
i += 1
it.not_add = True
chname = channeltools.get_channel_parameters(it.channel)['title']
p_dialog.update(int(i * t), message=message % (it.fulltitle, chname))
it = get_host(it)
try: channel = __import__('channels.{}'.format(it.channel), fromlist=['channels.{}'.format(it.channel)])
except: channel = __import__('specials.{}'.format(it.channel), fromlist=['specials.{}'.format(it.channel)])
channel = platformtools.channel_import(it.channel)
itemlist = getattr(channel, it.action)(it)
videolibrarytools.save_tvshow(it, itemlist, True)
p_dialog.close()
if config.get_setting("videolibrary_kodi"):
dbconverter.save_all('tvshow')
except:
p_dialog.close()
@@ -838,9 +821,7 @@ def get_host(item , channel=None):
item.url = urlparse.urlparse(item.url).path
if item.url.startswith('/'):
if not channel:
try : channel = __import__('channels.' + item.channel, None, None, ['channels.' + item.channel])
except: channel = __import__('specials.' + item.channel, None, None, ['specials.' + item.channel])
channel = platformtools.channel_import(item.channel)
host = channel.host
if host.endswith('/'): host = host[:-1]
item.url = host + item.url
@@ -882,7 +863,7 @@ class subcontext(object):
return config.get_localized_string(self.titledict[self.item.contentType][_type])
def makecontext(self):
# support.dbg()
# logger.dbg()
# set watched
# if not self.item.set:
watched = self.item.infoLabels.get('playcount', 0)
@@ -1023,6 +1004,7 @@ def add_download_items(item, itemlist):
path=item.path,
thumbnail=support.thumb('download'),
parent=item.tourl())
if item.action == 'findvideos':
if item.contentType != 'movie':
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 --------------
def delete(item):
# support.dbg()
# logger.dbg()
from platformcode import xbmc_videolibrary
select = None
delete = None
@@ -1363,3 +1345,4 @@ def convert_videolibrary(item):
def restore_videolibrary(item):
videolibrarytools.restore_videolibrary()