From 8416cb8d5925d4a07944cc8093cbe43053f47ad4 Mon Sep 17 00:00:00 2001 From: Alhaziel01 Date: Thu, 21 May 2020 10:18:27 +0200 Subject: [PATCH] Torrent: in caso di cartella di rete --- resources/language/English/strings.po | 4 ++++ resources/language/Italian/strings.po | 4 ++++ servers/torrent.py | 17 +++++++++++------ 3 files changed, 19 insertions(+), 6 deletions(-) diff --git a/resources/language/English/strings.po b/resources/language/English/strings.po index e8eeecb9..60ce9bbd 100644 --- a/resources/language/English/strings.po +++ b/resources/language/English/strings.po @@ -6011,6 +6011,10 @@ msgctxt "#70806" msgid "Changing this parameter permanently overwrites the Elementum settings.\nDo you want to continue?" msgstr "" +msgctxt "#70807" +msgid "Elementum does not support network folder downloads, do you want to change the download location?" +msgstr "Elementum non supporta i download su cartella di rete, vuoi cambiare il percorso di download?" + # DNS start [ settings and declaration ] msgctxt "#707401" msgid "Enable DNS check alert" diff --git a/resources/language/Italian/strings.po b/resources/language/Italian/strings.po index 4d226744..19007ca4 100644 --- a/resources/language/Italian/strings.po +++ b/resources/language/Italian/strings.po @@ -6011,6 +6011,10 @@ msgctxt "#70806" msgid "Changing this parameter permanently overwrites the Elementum settings.\nDo you want to continue?" msgstr "Modificando questo parametro vengono sovrascritte permanentemente le impostazioni di Elementum.\nVuoi continuare?" +msgctxt "#70807" +msgid "Elementum does not support network folder downloads, do you want to change the download location?" +msgstr "Elementum non supporta i download su cartella di rete, vuoi cambiare il percorso di download?" + # DNS start [ settings and declaration ] msgctxt "#707401" msgid "Enable DNS check alert" diff --git a/servers/torrent.py b/servers/torrent.py index 416419e0..f7fc2bf5 100755 --- a/servers/torrent.py +++ b/servers/torrent.py @@ -73,13 +73,18 @@ def elementum_download(item): if elementum_setting: set_elementum(True) time.sleep(3) - TorrentName = match(item.url, patron=r'btih(?::|%3A)([^&%]+)', string=True).match - post = 'uri=%s&file=null&all=1' % urllib.quote_plus(item.url) - match(elementum_host + 'add', post=post, timeout=5, alfa_s=True, ignore_response_code=True) - while not filetools.isfile(filetools.join(elementum_setting.getSetting('torrents_path'), TorrentName + '.torrent')): - time.sleep(1) + if config.get_setting('downloadpath').startswith('smb'): + select = platformtools.dialog_yesno('Elementum', config.get_localized_string(70807)) + if select: + xbmc.executebuiltin("RunPlugin(plugin://plugin.video.kod/?eyJjaGFubmVsIjoic2hvcnRjdXRzIiwgImFjdGlvbiI6IlNldHRpbmdPblBvc2l0aW9uIiwgImNhdGVnb3J5Ijo2LCAic2V0dGluZyI6MX0=)") + else: + TorrentName = match(item.url, patron=r'btih(?::|%3A)([^&%]+)', string=True).match + post = 'uri=%s&file=null&all=1' % urllib.quote_plus(item.url) + match(elementum_host + 'add', post=post, timeout=5, alfa_s=True, ignore_response_code=True) + while not filetools.isfile(filetools.join(elementum_setting.getSetting('torrents_path'), TorrentName + '.torrent')): + time.sleep(1) - monitor_update(TorrentPath, TorrentName) + monitor_update(TorrentPath, TorrentName) def elementum_monitor():