Test Fix Torrent 3

This commit is contained in:
Alhaziel01
2021-11-20 10:22:17 +01:00
parent 37e40653a8
commit 547839f0b0
2 changed files with 27 additions and 15 deletions
+17 -10
View File
@@ -1504,18 +1504,25 @@ def play_torrent(item, xlistitem, mediaurl):
torrent.elementum_download(item) torrent.elementum_download(item)
else: else:
import xbmcaddon
addon = xbmcaddon.Addon(id='plugin.video.elementum')
# from core.support import dbg;dbg()
if addon.getSetting('download_storage') == '0':
addon.setSetting('download_storage', '1')
xbmc.sleep(3000)
xbmc.executebuiltin("PlayMedia(" + torrent_options[selection][1] % mediaurl + ")")
# import xbmcaddon # import xbmcaddon
# xbmcaddon.Addon(id='plugin.video.elementum').setSetting('download_storage', '1') # xbmcaddon.Addon(id='plugin.video.elementum').setSetting('download_storage', '1')
if (item.fromLibrary and item.play_from == 'window') or item.window: # if (item.fromLibrary and item.play_from == 'window') or item.window:
xlistitem.setPath(torrent_options[selection][1] % mediaurl) # xlistitem.setPath(torrent_options[selection][1] % mediaurl)
playlist = xbmc.PlayList(xbmc.PLAYLIST_VIDEO) # playlist = xbmc.PlayList(xbmc.PLAYLIST_VIDEO)
playlist.clear() # playlist.clear()
playlist.add(torrent_options[selection][1] % mediaurl, xlistitem) # playlist.add(torrent_options[selection][1] % mediaurl, xlistitem)
xbmc_player.play(playlist, xlistitem) # xbmc_player.play(playlist, xlistitem)
else: # else:
if not item.autoplay and item.channel != 'videolibrary': fakeVideo() # if not item.autoplay and item.channel != 'videolibrary': fakeVideo()
if xbmc.getCondVisibility("system.platform.android"): xbmc.sleep(3000) # if xbmc.getCondVisibility("system.platform.android"): xbmc.sleep(3000)
xbmc.executebuiltin("PlayMedia(" + torrent_options[selection][1] % mediaurl + ")") # xbmc.executebuiltin("PlayMedia(" + torrent_options[selection][1] % mediaurl + ")")
# torrent.mark_auto_as_watched(item) # torrent.mark_auto_as_watched(item)
+10 -5
View File
@@ -4,9 +4,9 @@ import re, os, sys, time, requests, xbmc, xbmcaddon
from core import filetools, httptools, jsontools from core import filetools, httptools, jsontools
from core.support import info, match from core.support import info, match
from platformcode import config, platformtools from platformcode import config, platformtools, logger
from lib.guessit import guessit from lib.guessit import guessit
from torrentool.api import Torrent from lib.torrentool.api import Torrent
if sys.version_info[0] >= 3: if sys.version_info[0] >= 3:
import urllib.parse as urllib import urllib.parse as urllib
@@ -92,13 +92,15 @@ def elementum_download(item):
while not filetools.isfile(filetools.join(elementum_setting.getSetting('torrents_path'), TorrentName + '.torrent')): while not filetools.isfile(filetools.join(elementum_setting.getSetting('torrents_path'), TorrentName + '.torrent')):
time.sleep(1) time.sleep(1)
monitor_update(TorrentPath, TorrentName) monitor_update(TorrentPath, TorrentName)
def elementum_monitor(): def elementum_monitor():
# from core.support import dbg;dbg()
path = xbmc.translatePath(config.get_setting('downloadlistpath')) path = xbmc.translatePath(config.get_setting('downloadlistpath'))
elementum_setting, elementum_host, TorrentPath = setting() elementum_setting, elementum_host, TorrentPath = setting()
# active_torrent = filetools.listdir(TorrentPath) # active_torrent = filetools.listdir(TorrentPath)
# logger.debug('ELEMENTUM:', elementum_setting, elementum_host, TorrentPath)
if elementum_setting: if elementum_setting:
# check if command file exist # check if command file exist
@@ -117,6 +119,7 @@ def elementum_monitor():
except: except:
data = '' data = ''
if data: if data:
# from core.support import dbg;dbg()
for it in data: for it in data:
progress = round(it['progress'], 2) progress = round(it['progress'], 2)
status = it['status'] status = it['status']
@@ -143,6 +146,7 @@ def monitor_update(TorrentPath, value, remove=False):
json = jsontools.load(open(monitor, "r").read()) json = jsontools.load(open(monitor, "r").read())
Monitor = json['monitor'] Monitor = json['monitor']
info = Torrent.from_file(filetools.join(TorrentPath, value + '.torrent')) info = Torrent.from_file(filetools.join(TorrentPath, value + '.torrent'))
logger.debug('ELEMENTUM MONITOR', Monitor)
path = xbmc.translatePath(config.get_setting('downloadlistpath')) path = xbmc.translatePath(config.get_setting('downloadlistpath'))
if not value in Monitor: if not value in Monitor:
@@ -174,7 +178,7 @@ def set_elementum(SET=False):
backup_setting = json['settings'] backup_setting = json['settings']
write = False write = False
if SET: if SET:
elementum_setting.setSetting('download_storage', '1') elementum_setting.setSetting('download_storage', '0')
if elementum_setting.getSetting('logger_silent') == False or not 'logger_silent' in backup_setting: if elementum_setting.getSetting('logger_silent') == False or not 'logger_silent' in backup_setting:
elementum_setting.setSetting('logger_silent', 'true') elementum_setting.setSetting('logger_silent', 'true')
backup_setting['logger_silent'] = 'false' backup_setting['logger_silent'] = 'false'
@@ -190,7 +194,8 @@ def set_elementum(SET=False):
elif backup_setting: elif backup_setting:
elementum_setting.setSetting('logger_silent', backup_setting['logger_silent']) elementum_setting.setSetting('logger_silent', backup_setting['logger_silent'])
elementum_setting.setSetting('download_storage', backup_setting['download_storage']) elementum_setting.setSetting('download_storage', '1')
# elementum_setting.setSetting('download_storage', backup_setting['download_storage'])
elementum_setting.setSetting('download_path', backup_setting['download_path']) elementum_setting.setSetting('download_path', backup_setting['download_path'])
json['settings'] = {} json['settings'] = {}
write = True write = True