Fix Riproduzione e Download Torrent

This commit is contained in:
Alhaziel01
2021-11-03 19:58:29 +01:00
parent f3f86991c9
commit d4ab965974
19 changed files with 961 additions and 59 deletions
+29 -10
View File
@@ -13,7 +13,7 @@ if sys.version_info[0] >= 3:PY3 = True; unicode = str; unichr = chr; long = int
from core.item import Item
from core import filetools, jsontools
from platformcode import config, logger, platformtools
from platformcode import config, logger, platformtools, xbmc_videolibrary
from platformcode.logger import WebErrorException
temp_search_file = config.get_temp_file('temp-search')
@@ -261,7 +261,6 @@ def run(item=None):
# Special action for searching, first asks for the words then call the "search" function
elif item.action == "search":
# from core.support import dbg;dbg()
if filetools.isfile(temp_search_file) and config.get_setting('videolibrary_kodi'):
itemlist = []
f = filetools.read(temp_search_file)
@@ -445,21 +444,39 @@ def play_from_library(item):
"""
def get_played_time(item):
if item.contentType == 'movie': nfo_path = item.nfo
else: nfo_path = item.strm_path.replace('strm','nfo')
from core import videolibrarytools
if item.contentType == 'movie':
nfo_path = item.nfo
if nfo_path.startswith('\\') or nfo_path.startswith('/'):
nfo_path = filetools.join(videolibrarytools.MOVIES_PATH, nfo_path)
else:
nfo_path =item.strm_path.replace('strm','nfo')
if nfo_path.startswith('\\') or nfo_path.startswith('/'):
nfo_path = filetools.join(videolibrarytools.TVSHOWS_PATH, nfo_path)
if nfo_path and filetools.isfile(nfo_path):
from core import videolibrarytools
head_nfo, item_nfo = videolibrarytools.read_nfo(nfo_path)
sleep(1)
played_time = platformtools.get_played_time(item_nfo)
else: played_time = 0
return played_time
import xbmcgui, xbmcplugin, xbmc
from time import sleep
# logger.debug("item: \n" + item.tostring('\n'))
platformtools.prevent_busy(item)
# xbmc.Player().play(os.path.join(config.get_runtime_path(), "resources", "kod.mp4"))
if not item.autoplay:
xbmcplugin.setResolvedUrl(int(sys.argv[1]), True, xbmcgui.ListItem(path=os.path.join(config.get_runtime_path(), "resources", "kod.mp4")))
while not platformtools.is_playing():
xbmc.sleep(10)
xbmc.Player().stop()
platformtools.prevent_busy()
itemlist=[]
item.fromLibrary = True
@@ -469,7 +486,9 @@ def play_from_library(item):
# Modify the action (currently the video library needs "findvideos" since this is where the sources are searched
item.action = item.next_action if item.next_action else "findvideos"
window_type = config.get_setting("window_type", "videolibrary") if config.get_setting('next_ep') < 3 and item.contentType != 'movie' else 1
if item.contentType == 'movie' or item.contentType != 'movie' and config.get_setting('next_ep') < 3:
window_type = config.get_setting("window_type", "videolibrary")
else: window_type = 1
# and launch kodi again
if (xbmc.getCondVisibility('Window.IsMedia') and not window_type == 1) or item.action != 'findvideos':
@@ -490,10 +509,10 @@ def play_from_library(item):
if config.get_setting("max_links", "videolibrary") != 0: itemlist = limit_itemlist(itemlist)
# The list of links is slightly "cleaned"
if config.get_setting("replace_VD", "videolibrary") == 1: itemlist = reorder_itemlist(itemlist)
# from core.support import dbg;dbg()
if len(itemlist) > 0:
reopen = False
# from core.support import dbg;dbg()
while not xbmc.Monitor().abortRequested():
played = True
# if config.get_setting('next_ep') == 3 and xbmc.Player().playnext:
@@ -531,7 +550,7 @@ def play_from_library(item):
if selection == -1:
return
else:
item = videolibrary.play(itemlist[selection + selection_implementation])[0]
item = videolibrary.play(itemlist[selection + selection_implementation])[0]
platformtools.play_video(item)
reopen = True
# if (platformtools.is_playing() and item.action) or item.server == 'torrent' or config.get_setting('autoplay'): break