Probabile Fix Autoplay Torrent

This commit is contained in:
Alhaziel01
2021-10-29 16:25:53 +02:00
parent e74337c07b
commit b807b41f48
3 changed files with 14 additions and 11 deletions

View File

@@ -103,7 +103,7 @@ def start(itemlist, item):
pass
# sleep(3)
try:
if platformtools.is_playing():
if platformtools.is_playing() or autoplay_elem.server == 'torrent':
PLAYED = True
break
except:

View File

@@ -36,6 +36,9 @@ def download(item=None):
support.info('URL:', url)
if url:
dl = downloadtools.downloadfile(host + url, filename)
if dl == -3:
filetools.remove(filename)
dl = downloadtools.downloadfile(host + url, filename)
if dl == None:
extract()
xbmc.sleep(1000)

View File

@@ -1461,6 +1461,7 @@ def play_torrent(item, xlistitem, mediaurl):
from servers import torrent
torrent_options = torrent_client_installed(show_tuple=True)
# from core.support import dbg;dbg()
if len(torrent_options) == 0:
from platformcode import elementum_download
install = elementum_download.download()
@@ -1474,7 +1475,9 @@ def play_torrent(item, xlistitem, mediaurl):
selection = 0
if selection >= 0:
prevent_busy(item)
xbmc.Player().play(os.path.join(config.get_runtime_path(), "resources", "kod.mp4"))
xbmc.sleep(200)
xbmc.Player().stop()
mediaurl = urllib.quote_plus(item.url)
torr_client = torrent_options[selection][0]
@@ -1489,13 +1492,14 @@ def play_torrent(item, xlistitem, mediaurl):
torrent.elementum_download(item)
else:
time.sleep(3)
# xbmc.Player().play(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)
if not item.globalsearch:
while is_playing() and not xbmc.Monitor().abortRequested():
time.sleep(3)
# if not item.globalsearch:
# while is_playing() and not xbmc.Monitor().abortRequested():
# time.sleep(3)
def resume_playback(played_time):
@@ -1805,8 +1809,4 @@ def prevent_busy(item):
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)
xbmc.Player().stop()
# xbmc.executebuiltin('Action(Stop)')
# xbmc.sleep(500)
# xbmc.Player().stop()
# xbmc.sleep(500)
xbmc.Player().stop()