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
+1 -1
View File
@@ -41,7 +41,7 @@ def start(itemlist, item):
import xbmc import xbmc
control_item = Item().fromurl(xbmc.getInfoLabel('Container.FolderPath')) control_item = Item().fromurl(xbmc.getInfoLabel('Container.FolderPath'))
if control_item.url == item.url: if control_item == item:
return itemlist return itemlist
if config.get_setting('autoplay') or item.autoplay: if config.get_setting('autoplay') or item.autoplay:
+3
View File
@@ -283,6 +283,9 @@ class Item(object):
def __str__(self): def __str__(self):
return '\r\t' + self.tostring('\r\t') return '\r\t' + self.tostring('\r\t')
def __eq__(self, other):
return self.__dict__ == other.__dict__
def set_parent_content(self, parentContent): def set_parent_content(self, parentContent):
""" """
Fill the contentDetails fields with the information of the item "parent" Fill the contentDetails fields with the information of the item "parent"
+1 -1
View File
@@ -459,7 +459,7 @@ def play_from_library(item):
from time import sleep from time import sleep
# logger.debug("item: \n" + item.tostring('\n')) # logger.debug("item: \n" + item.tostring('\n'))
platformtools.prevent_busy(item) platformtools.prevent_busy()
itemlist=[] itemlist=[]
item.fromLibrary = True item.fromLibrary = True
+9 -10
View File
@@ -1387,7 +1387,7 @@ def set_player(item, xlistitem, mediaurl, view, strm):
logger.info("mediaurl=" + mediaurl) logger.info("mediaurl=" + mediaurl)
if player_mode in [0,1]: if player_mode in [0,1]:
prevent_busy(item) prevent_busy()
if player_mode in [1]: if player_mode in [1]:
item.played_time = resume_playback(get_played_time(item)) item.played_time = resume_playback(get_played_time(item))
@@ -1491,11 +1491,7 @@ def play_torrent(item, xlistitem, mediaurl):
selection = 0 selection = 0
if selection >= 0: if selection >= 0:
# if item.autoplay: xbmc.Player().play(os.path.join(config.get_runtime_path(), "resources", "kod.mp4")) prevent_busy()
# 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)
mediaurl = urllib.quote_plus(item.url) mediaurl = urllib.quote_plus(item.url)
torr_client = torrent_options[selection][0] torr_client = torrent_options[selection][0]
@@ -1509,8 +1505,12 @@ def play_torrent(item, xlistitem, mediaurl):
if torr_client in ['elementum'] and item.downloadFilename: if torr_client in ['elementum'] and item.downloadFilename:
torrent.elementum_download(item) torrent.elementum_download(item)
else: else:
time.sleep(3) # time.sleep(3)
xbmc.executebuiltin("PlayMedia(" + torrent_options[selection][1] % mediaurl + ")") 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) # torrent.mark_auto_as_watched(item)
@@ -1819,6 +1819,5 @@ def set_played_time(item):
del db['viewed'][ID] del db['viewed'][ID]
def prevent_busy():
def prevent_busy(item):
xbmc.executebuiltin('Dialog.Close(all,true)') xbmc.executebuiltin('Dialog.Close(all,true)')
+6 -1
View File
@@ -377,7 +377,12 @@ def set_watched_on_kod(data):
path = filetools.join(path, filename) path = filetools.join(path, filename)
head_nfo, item = videolibrarytools.read_nfo(path) 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()) filetools.write(path, head_nfo + item.tojson())
if item.infoLabels['mediatype'] == "tvshow": if item.infoLabels['mediatype'] == "tvshow":
+1 -1
View File
@@ -812,7 +812,7 @@ class SearchWindow(xbmcgui.WindowXML):
def play(self, server=None): def play(self, server=None):
platformtools.prevent_busy(server) platformtools.prevent_busy()
server.window = True server.window = True
server.globalsearch = True server.globalsearch = True
return run(server) return run(server)
+4 -4
View File
@@ -365,12 +365,12 @@ def findvideos(item):
else: else:
content_title = item.contentTitle.strip().lower() content_title = item.contentTitle.strip().lower()
if item.contentType == 'movie': if item.contentType == 'movie':
item.strm_path = filetools.join(videolibrarytools.MOVIES_PATH, item.strm_path) strm_path = filetools.join(videolibrarytools.MOVIES_PATH, item.strm_path)
path_dir = filetools.dirname(item.strm_path) path_dir = filetools.dirname(strm_path)
item.nfo = filetools.join(path_dir, filetools.basename(path_dir) + ".nfo") item.nfo = filetools.join(path_dir, filetools.basename(path_dir) + ".nfo")
else: else:
item.strm_path = filetools.join(videolibrarytools.TVSHOWS_PATH, item.strm_path) strm_path = filetools.join(videolibrarytools.TVSHOWS_PATH, item.strm_path)
path_dir = filetools.dirname(item.strm_path) path_dir = filetools.dirname(strm_path)
item.nfo = filetools.join(path_dir, 'tvshow.nfo') item.nfo = filetools.join(path_dir, 'tvshow.nfo')
for fd in filetools.listdir(path_dir): for fd in filetools.listdir(path_dir):