Merge remote-tracking branch 'origin/master'
This commit is contained in:
@@ -7,9 +7,11 @@ from core import support
|
||||
|
||||
def findhost():
|
||||
data = support.httptools.downloadpage('https://lagazzettadelcorsaro.com/').data
|
||||
return support.scrapertools.find_single_match(data, '<li><a href="([^"]+)')
|
||||
url = support.scrapertools.find_single_match(data, '<li><a href="([^"]+)')
|
||||
return url[:-1] if url.endswith('/') else url
|
||||
|
||||
host = support.config.get_channel_url(findhost)
|
||||
support.log('HOST',host)
|
||||
# host = 'https://ilcorsaronero.xyz'
|
||||
headers = [['Referer', host]]
|
||||
|
||||
@@ -21,21 +23,21 @@ def mainlist(item):
|
||||
|
||||
menu = [
|
||||
('BDRiP {film}', ['/categoria.php?active=0&category=1&order=data&by=DESC&page=', 'peliculas', [0, 'movie', True]]),
|
||||
('Cerca BDRiP... submenu {film}', ['/categoria.php?active=0&category=1&order=data&by=DESC&argh.php?search=', 'search', ['search', 'movie', True]]),
|
||||
('Cerca BDRiP... submenu {film}', ['/torrent-ita/1/', 'search', ['search', 'movie', True]]),
|
||||
('DVD {film}', ['/categoria.php?active=0&category=20&order=data&by=DESC&page=', 'peliculas', [0, 'movie', True]]),
|
||||
('Cerca DVD... submenu {film}', ['/categoria.php?active=0&category=20&order=data&by=DESC&argh.php?search=', 'search', ['search', 'movie', True]]),
|
||||
('Cerca DVD... submenu {film}', ['/torrent-ita/20/', 'search', ['search', 'movie', True]]),
|
||||
('Screener {film}', ['/categoria.php?active=0&category=19&order=data&by=DESC&page=', 'peliculas', [0, 'movie', True]]),
|
||||
('Cerca Screener.. submenu {film}', ['/categoria.php?active=0&category=19&order=data&by=DESC&argh.php?search=', 'search', ['search', 'movie', True]]),
|
||||
('Cerca Screener.. submenu {film}', ['/torrent-ita/19/', 'search', ['search', 'movie', True]]),
|
||||
('Serie TV', ['/categoria.php?active=0&category=15&order=data&by=DES&page=', 'peliculas', [0 , 'tvshow', True]]),
|
||||
('Cerca Serie TV.. submenu', ['/categoria.php?active=0&category=15&order=data&by=DESC&argh.php?search=', 'search', ['search', 'tvshow',True]]),
|
||||
('Cerca Serie TV.. submenu', ['/torrent-ita/15/', 'search', ['search', 'tvshow',True]]),
|
||||
('Anime', ['/categoria.php?active=0&category=5&order=data&by=DESC&page=', 'peliculas', [0, 'anime', True]]),
|
||||
('Cerca Anime.. submenu', ['/categoria.php?active=0&category=5&order=data&by=DESC&argh.php?search=', 'search', ['search', 'anime', True]]),
|
||||
('Cerca Anime.. submenu', ['/torrent-ita/5/', 'search', ['search', 'anime', True]]),
|
||||
('Musica', ['/categoria.php?active=0&category=2&order=data&by=DESC&page=', 'peliculas', [0, 'music', False]]),
|
||||
('Cerca Musica.. submenu', ['/categoria.php?active=0&category=2&order=data&by=DESC&argh.php?search=', 'search', ['search', 'music', False]]),
|
||||
('Cerca Musica.. submenu', ['/torrent-ita/2/', 'search', ['search', 'music', False]]),
|
||||
('Audiolibri {musica}', ['/categoria.php?active=0&category=18&order=data&by=DESC&page=', 'peliculas', [0, 'music', False]]),
|
||||
('Cerca Audiolibri.. submenu', ['/categoria.php?active=0&category=18&order=data&by=DESC&argh.php?search=', 'search', ['search', 'music', False]]),
|
||||
('Cerca Audiolibri.. submenu', ['/torrent-ita/18/', 'search', ['search', 'music', False]]),
|
||||
('Altro {film}', ['/categoria.php?active=0&category=4&order=data&by=DESC&page=', 'peliculas', [0, 'movie', False]]),
|
||||
('Cerca altro.. submenu', ['/categoria.php?active=0&category=4&order=data&by=DESC&argh.php?search=', 'search', ['search', 'movie', False]]),
|
||||
('Cerca altro.. submenu', ['/torrent-ita/4/', 'search', ['search', 'movie', False]]),
|
||||
('Cerca Tutto... color kod bold', ['/argh.php?search=', 'search', ['search', 'all', False]])
|
||||
]
|
||||
|
||||
@@ -61,13 +63,15 @@ def peliculas(item):
|
||||
support.log('OK')
|
||||
item.url += str(item.args[0])
|
||||
def itemlistHook(itemlist):
|
||||
args = item.args
|
||||
args[0] += 1
|
||||
itemlist.append(
|
||||
support.Item(channel=item.channel,
|
||||
action = item.action,
|
||||
contentType=item.contentType,
|
||||
title=support.typo(support.config.get_localized_string(30992), 'color kod bold'),
|
||||
url=item.url,
|
||||
args=[item.args[0] + 1, item.args[1]],
|
||||
args=args,
|
||||
thumbnail=support.thumb()))
|
||||
return itemlist
|
||||
return locals()
|
||||
@@ -75,9 +79,11 @@ def peliculas(item):
|
||||
|
||||
def search(item, text):
|
||||
support.log(item, text)
|
||||
|
||||
itemlist = []
|
||||
item.url += text
|
||||
if 'all' in item.args:
|
||||
item.url += text
|
||||
else:
|
||||
item.url += text + '.html'
|
||||
try:
|
||||
return peliculas(item)
|
||||
# Cattura la eccezione così non interrompe la ricerca globle se il canale si rompe!
|
||||
|
||||
@@ -1505,18 +1505,8 @@ def play_torrent(item, xlistitem, mediaurl):
|
||||
mediaurl += "&library=&tmdb=%s&type=movie" % (item.infoLabels['tmdb_id'])
|
||||
|
||||
if torr_client in ['quasar', 'elementum'] and item.downloadFilename:
|
||||
# if torr_client == 'elementum':
|
||||
# config.set_setting('elementumtype', torr_setting.getSetting('download_storage'))
|
||||
# config.set_setting('elementumdl', torr_setting.getSetting('download_path'))
|
||||
# torr_setting.setSetting('download_storage', '0')
|
||||
# torr_setting.setSetting('download_path', config.get_setting('downloadpath'))
|
||||
# xbmc.sleep(1000)
|
||||
torrent.call_torrent_via_web(urllib.quote_plus(item.url), torr_client)
|
||||
torrent.elementum_monitor(item, torr_client)
|
||||
else:
|
||||
# if torr_client == 'elementum':
|
||||
# if config.get_setting('elementumtype'): torr_setting.setSetting('download_storage', config.get_setting('elementumtype'))
|
||||
# if config.get_setting('elementumdl'): torr_setting.setSetting('download_path', config.get_setting('elementumdl'))
|
||||
# xbmc.sleep(1000)
|
||||
xbmc.executebuiltin("PlayMedia(" + torrent_options[selection][1] % mediaurl + ")")
|
||||
|
||||
# Si es un archivo RAR, monitorizamos el cliente Torrent hasta que haya descargado el archivo,
|
||||
@@ -1568,5 +1558,4 @@ def play_torrent(item, xlistitem, mediaurl):
|
||||
|
||||
|
||||
def log(texto):
|
||||
xbmc.log(texto, xbmc.LOGNOTICE)
|
||||
|
||||
xbmc.log(texto, xbmc.LOGNOTICE)
|
||||
@@ -96,14 +96,19 @@
|
||||
<setting id="downloadenabled" type="bool" label="70689" default="false"/>
|
||||
<setting id="downloadpath" type="folder" label="30017" visible="eq(-1,true)" default="special://profile/addon_data/plugin.video.kod/downloads/" option="writeable"/>
|
||||
<setting id="settings_kod1" type="action" label="70789" action="" visible="eq(-2,true)"/>
|
||||
<setting id="downloadlistpath" type="folder" label="30018" visible="eq(-3,true)" default="special://profile/addon_data/plugin.video.kod/downloads/list/" option="writeable"/>
|
||||
<!-- <setting id="library_add" type="bool" label="70230" default="false"/>
|
||||
<setting id="library_move" type="bool" label="70231" default="false" visible="eq(-1,true)" subsetting="true"/> -->
|
||||
<setting id="downloadlistpath" type="folder" label="30018" visible="eq(-3,true)" default="special://profile/addon_data/plugin.video.kod/downloads/list/" option="writeable"/>
|
||||
<setting id="library_move" type="bool" label="70231" visible="eq(-4,true)" default="true"/>
|
||||
<setting id="browser" type="bool" label="70232" visible="eq(-5,true)" default="true"/>
|
||||
<setting id="server_speed" type="bool" label="70242" visible="eq(-6,true)" default="true"/>
|
||||
<setting id="quality" type="select" label="70240" lvalues="70241|70763|70764|70765" visible="eq(-7,true)" default="0"/>
|
||||
<setting id="download_adv" type="action" label="30030" visible="eq(-8,true)" action="RunPlugin(plugin://plugin.video.kod/?ew0KCSJhY3Rpb24iOiJjaGFubmVsX2NvbmZpZyIsDQoJImNvbmZpZyI6ImRvd25sb2FkcyIsDQogICAgImNoYW5uZWwiOiJzZXR0aW5nIg0KfQ==)"/>
|
||||
|
||||
<setting id="elementumtype" type="text" label="Elementum Download Type" visible="false"/>
|
||||
<setting id="quasartype" type="text" label="Quasar Download Type" visible="false"/>
|
||||
<setting id="elementumdl" type="folder" label="Elementum Download Backup" visible="false"/>
|
||||
<setting id="quasardl" type="folder" label="Quasar Download Backup" visible="false"/>
|
||||
</category>
|
||||
|
||||
<!-- News -->
|
||||
|
||||
@@ -1349,6 +1349,97 @@ def import_libtorrent(LIBTORRENT_PATH):
|
||||
return lt, e, e1, e2
|
||||
|
||||
|
||||
########################## ELEMENTUM MONITOR TEST ##########################
|
||||
|
||||
def elementum_monitor(item, torr_client):
|
||||
host = 'http://127.0.0.1:65220/torrents/'
|
||||
torr_setting = xbmcaddon.Addon(id="plugin.video.elementum")
|
||||
# from core.support import dbg;dbg()
|
||||
data = httptools.downloadpage(host, alfa_s=True).data
|
||||
items = jsontools.load(data)['items']
|
||||
if not items:
|
||||
set_elementum()
|
||||
call_torrent_via_web(urllib.quote_plus(item.url), torr_client)
|
||||
|
||||
result = 0
|
||||
while result < 100:
|
||||
data = httptools.downloadpage(host, alfa_s=True).data
|
||||
items = jsontools.load(data)['items']
|
||||
|
||||
partials = []
|
||||
files = []
|
||||
titles = []
|
||||
|
||||
for it in items:
|
||||
p = scrapertools.find_single_match(it['label'], r'(\d+\.\d+)%')
|
||||
f = scrapertools.find_single_match(it['path'], r'resume=([^&]+)')
|
||||
t = it['info']['title']
|
||||
partials.append(p)
|
||||
files.append(f)
|
||||
titles.append(t)
|
||||
|
||||
partial = 0
|
||||
for i, p in enumerate(partials):
|
||||
partial += float(p)
|
||||
update_download_info(files[i], p, titles[i])
|
||||
|
||||
result = partial / len(items)
|
||||
xbmc.sleep(5000)
|
||||
|
||||
log('All Torrent downloaded.')
|
||||
xbmc.sleep(1000)
|
||||
unset_elementum()
|
||||
|
||||
|
||||
def update_download_info(file, partial, title):
|
||||
extensions_list = ['aaf', '3gp', 'asf', 'avi', 'flv', 'mpeg', 'm1v', 'm2v', 'm4v', 'mkv', 'mov', 'mpg', 'mpe', 'mp4', 'ogg', 'wmv']
|
||||
path = xbmc.translatePath(config.get_setting('downloadlistpath'))
|
||||
dlpath = filetools.join(config.get_setting('downloadpath'), title)
|
||||
log('DL PATH: ' + dlpath)
|
||||
sep = '/' if dlpath.startswith('smb') else os.sep
|
||||
if filetools.isdir(dlpath) and partial > 0:
|
||||
dlfiles = filetools.listdir(dlpath)
|
||||
for f in dlfiles:
|
||||
log('FILE TYPE: ' + f.split('.')[-1])
|
||||
if f.split('.')[-1] in extensions_list:
|
||||
dlpath = filetools.join(dlpath.split(sep)[-1], f)
|
||||
else:
|
||||
dlpath = dlpath.split(sep)[-1]
|
||||
|
||||
files = filetools.listdir(path)
|
||||
for f in files:
|
||||
json = jsontools.load(filetools.read(filetools.join(path, f)))
|
||||
if 'downloadServer' in json and file in json['downloadServer']['url'] or \
|
||||
'url' in json and file in json['url']:
|
||||
jsontools.update_node(dlpath, f, "downloadFilename", path)
|
||||
jsontools.update_node(float(partial), f, "downloadProgress", path)
|
||||
if float(partial) == 100:
|
||||
jsontools.update_node(2, f, "downloadStatus", path)
|
||||
|
||||
def set_elementum():
|
||||
log('SET Elementum')
|
||||
torr_setting = xbmcaddon.Addon(id="plugin.video.elementum")
|
||||
config.set_setting('elementumtype', torr_setting.getSetting('download_storage'))
|
||||
config.set_setting('elementumdl', torr_setting.getSetting('download_path'))
|
||||
torr_setting.setSetting('download_storage', '0')
|
||||
torr_setting.setSetting('download_path', config.get_setting('downloadpath'))
|
||||
xbmc.sleep(3000)
|
||||
|
||||
def unset_elementum():
|
||||
log('UNSET Elementum')
|
||||
torr_setting = xbmcaddon.Addon(id="plugin.video.elementum")
|
||||
Sleep = False
|
||||
if config.get_setting('elementumtype'):
|
||||
torr_setting.setSetting('download_storage', str(config.get_setting('elementumtype')))
|
||||
Sleep = True
|
||||
if config.get_setting('elementumdl'):
|
||||
torr_setting.setSetting('download_path', config.get_setting('elementumdl'))
|
||||
Sleep = True
|
||||
if Sleep:
|
||||
xbmc.sleep(3000)
|
||||
|
||||
########################## ELEMENTUM MONITOR TEST ##########################
|
||||
|
||||
def log(texto):
|
||||
try:
|
||||
xbmc.log(texto, xbmc.LOGNOTICE)
|
||||
|
||||
@@ -152,7 +152,11 @@ def browser(item):
|
||||
if filetools.isdir(filetools.join(item.url, file)):
|
||||
itemlist.append(Item(channel=item.channel, title=file, action=item.action, url=filetools.join(item.url, file), context=[{ 'title': config.get_localized_string(30037), 'channel': 'downloads', 'action': "del_dir"}]))
|
||||
else:
|
||||
itemlist.append(Item(channel=item.channel, title=file, action="play", url=filetools.join(item.url, file), context=[{ 'title': config.get_localized_string(30039), 'channel': 'downloads', 'action': "del_file"}]))
|
||||
if not item.infoLabels:
|
||||
infoLabels = {"mediatype":"video"}
|
||||
else:
|
||||
infoLabels = item.infoLabels
|
||||
itemlist.append(Item(channel=item.channel, title=file, action="play", infoLabels=infoLabels, url=filetools.join(item.url, file), context=[{ 'title': config.get_localized_string(30039), 'channel': 'downloads', 'action': "del_file"}]))
|
||||
|
||||
return itemlist
|
||||
|
||||
|
||||
Reference in New Issue
Block a user