Miglioria del precedente commit

This commit is contained in:
mac12m99
2021-11-02 19:58:01 +01:00
parent 9828908bfe
commit ebbf37222e
7 changed files with 25 additions and 18 deletions

View File

@@ -41,7 +41,7 @@ def start(itemlist, item):
import xbmc
control_item = Item().fromurl(xbmc.getInfoLabel('Container.FolderPath'))
if control_item.url == item.url:
if control_item == item:
return itemlist
if config.get_setting('autoplay') or item.autoplay:

View File

@@ -283,6 +283,9 @@ class Item(object):
def __str__(self):
return '\r\t' + self.tostring('\r\t')
def __eq__(self, other):
return self.__dict__ == other.__dict__
def set_parent_content(self, parentContent):
"""
Fill the contentDetails fields with the information of the item "parent"

View File

@@ -459,7 +459,7 @@ def play_from_library(item):
from time import sleep
# logger.debug("item: \n" + item.tostring('\n'))
platformtools.prevent_busy(item)
platformtools.prevent_busy()
itemlist=[]
item.fromLibrary = True

View File

@@ -1387,7 +1387,7 @@ def set_player(item, xlistitem, mediaurl, view, strm):
logger.info("mediaurl=" + mediaurl)
if player_mode in [0,1]:
prevent_busy(item)
prevent_busy()
if player_mode in [1]:
item.played_time = resume_playback(get_played_time(item))
@@ -1491,11 +1491,7 @@ def play_torrent(item, xlistitem, mediaurl):
selection = 0
if selection >= 0:
# if item.autoplay: 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()
prevent_busy(item)
prevent_busy()
mediaurl = urllib.quote_plus(item.url)
torr_client = torrent_options[selection][0]
@@ -1509,8 +1505,12 @@ def play_torrent(item, xlistitem, mediaurl):
if torr_client in ['elementum'] and item.downloadFilename:
torrent.elementum_download(item)
else:
time.sleep(3)
xbmc.executebuiltin("PlayMedia(" + torrent_options[selection][1] % mediaurl + ")")
# time.sleep(3)
if item.fromLibrary:
xlistitem.setPath(torrent_options[selection][1] % mediaurl)
xbmcplugin.setResolvedUrl(int(sys.argv[1]), True, xlistitem)
else:
xbmc.executebuiltin("PlayMedia(" + torrent_options[selection][1] % mediaurl + ")")
# torrent.mark_auto_as_watched(item)
@@ -1819,6 +1819,5 @@ def set_played_time(item):
del db['viewed'][ID]
def prevent_busy(item):
def prevent_busy():
xbmc.executebuiltin('Dialog.Close(all,true)')

View File

@@ -377,7 +377,12 @@ def set_watched_on_kod(data):
path = filetools.join(path, filename)
head_nfo, item = videolibrarytools.read_nfo(path)
item.library_playcounts.update({title: playcount})
from core.support import dbg
dbg()
if item.library_playcounts:
item.library_playcounts.update({title: playcount})
else:
item.library_playcounts = {title: playcount}
filetools.write(path, head_nfo + item.tojson())
if item.infoLabels['mediatype'] == "tvshow":

View File

@@ -812,7 +812,7 @@ class SearchWindow(xbmcgui.WindowXML):
def play(self, server=None):
platformtools.prevent_busy(server)
platformtools.prevent_busy()
server.window = True
server.globalsearch = True
return run(server)

View File

@@ -365,12 +365,12 @@ def findvideos(item):
else:
content_title = item.contentTitle.strip().lower()
if item.contentType == 'movie':
item.strm_path = filetools.join(videolibrarytools.MOVIES_PATH, item.strm_path)
path_dir = filetools.dirname(item.strm_path)
strm_path = filetools.join(videolibrarytools.MOVIES_PATH, item.strm_path)
path_dir = filetools.dirname(strm_path)
item.nfo = filetools.join(path_dir, filetools.basename(path_dir) + ".nfo")
else:
item.strm_path = filetools.join(videolibrarytools.TVSHOWS_PATH, item.strm_path)
path_dir = filetools.dirname(item.strm_path)
strm_path = filetools.join(videolibrarytools.TVSHOWS_PATH, item.strm_path)
path_dir = filetools.dirname(strm_path)
item.nfo = filetools.join(path_dir, 'tvshow.nfo')
for fd in filetools.listdir(path_dir):