Fix Installazione Elementum

This commit is contained in:
Alhaziel01
2021-10-29 11:40:25 +02:00
parent e8c5f335b3
commit 852588254a
3 changed files with 28 additions and 14 deletions
+18 -8
View File
@@ -15,6 +15,7 @@ kod_setting_file = filetools.join(addon_path,'plugin.video.kod', 'resources', 's
def download(item=None): def download(item=None):
ret = True
if filetools.exists(elementum_path): if filetools.exists(elementum_path):
if platformtools.dialog_yesno(config.get_localized_string(70784), config.get_localized_string(70783)): if platformtools.dialog_yesno(config.get_localized_string(70784), config.get_localized_string(70783)):
@@ -23,22 +24,31 @@ def download(item=None):
for r in required: xbmc.executebuiltin('InstallAddon(' + r + ')', wait=True) for r in required: xbmc.executebuiltin('InstallAddon(' + r + ')', wait=True)
setting() setting()
platformtools.dialog_ok('Elementum', config.get_localized_string(70783)) platformtools.dialog_ok('Elementum', config.get_localized_string(70783))
else:
ret = False
else: else:
if platformtools.dialog_yesno(config.get_localized_string(70784), config.get_localized_string(70782)): if platformtools.dialog_yesno(config.get_localized_string(70784), config.get_localized_string(70782)):
pform = get_platform() pform = get_platform()
url = support.match(elementum_url, patronBlock=r'<div class="release-entry">(.*?)<!-- /.release-body -->', patron=r'<a href="([a-zA-Z0-9/\.-]+%s.zip)' % pform).match url = support.match(elementum_url, patron=r'<a href="([a-zA-Z0-9/\.-]+{}.zip)'.format(pform)).match
support.info('OS:', pform) support.info('OS:', pform)
support.info('Extract IN:', elementum_path) support.info('Extract IN:', elementum_path)
support.info('URL:', url) support.info('URL:', url)
if url: if url:
downloadtools.downloadfile(host + url, filename) dl = downloadtools.downloadfile(host + url, filename)
extract() if dl == None:
xbmc.sleep(1000) extract()
addon_file = filetools.file_open(filetools.join(elementum_path,'addon.xml')).read() xbmc.sleep(1000)
required = support.match(addon_file, patron=r'addon="([^"]+)').matches addon_file = filetools.file_open(filetools.join(elementum_path,'addon.xml')).read()
for r in required: xbmc.executebuiltin('InstallAddon(' + r + ')', wait=True) required = support.match(addon_file, patron=r'addon="([^"]+)').matches
setting() for r in required: xbmc.executebuiltin('InstallAddon(' + r + ')', wait=True)
setting()
else:
ret = False
else:
ret = False
else:
ret = False
def extract(): def extract():
+5 -2
View File
@@ -1480,8 +1480,11 @@ def play_torrent(item, xlistitem, mediaurl):
torrent_options = torrent_client_installed(show_tuple=True) torrent_options = torrent_client_installed(show_tuple=True)
if len(torrent_options) == 0: if len(torrent_options) == 0:
from platformcode import elementum_download from platformcode import elementum_download
elementum_download.download() install = elementum_download.download()
return play_torrent(item, xlistitem, mediaurl) if install:
return play_torrent(item, xlistitem, mediaurl)
else:
selection = -1
elif len(torrent_options) > 1: elif len(torrent_options) > 1:
selection = dialog_select(config.get_localized_string(70193), [opcion[0] for opcion in torrent_options]) selection = dialog_select(config.get_localized_string(70193), [opcion[0] for opcion in torrent_options])
else: else:
+5 -4
View File
@@ -22,10 +22,11 @@ def test_video_exists(page_url):
# Returns an array of possible video url's from the page_url # Returns an array of possible video url's from the 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=''):
torrent_options = platformtools.torrent_client_installed(show_tuple=True) # torrent_options = platformtools.torrent_client_installed(show_tuple=True)
if len(torrent_options) == 0: # if len(torrent_options) == 0:
from platformcode import elementum_download # from platformcode import elementum_download
elementum_download.download() # if not elementum_download.download():
# return []
info('server=torrent, the url is the good') info('server=torrent, the url is the good')
if page_url.startswith('magnet:'): if page_url.startswith('magnet:'):