Possibilie Fix autoplay e episodio successivo
This commit is contained in:
+1
-1
@@ -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 == item:
|
if control_item.action == item.action:
|
||||||
return itemlist
|
return itemlist
|
||||||
|
|
||||||
if config.get_setting('autoplay') or item.autoplay:
|
if config.get_setting('autoplay') or item.autoplay:
|
||||||
|
|||||||
+27
-13
@@ -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.item import Item
|
||||||
from core import filetools, jsontools
|
from core import filetools, jsontools
|
||||||
from platformcode import config, logger, platformtools
|
from platformcode import config, logger, platformtools, xbmc_videolibrary
|
||||||
from platformcode.logger import WebErrorException
|
from platformcode.logger import WebErrorException
|
||||||
temp_search_file = config.get_temp_file('temp-search')
|
temp_search_file = config.get_temp_file('temp-search')
|
||||||
|
|
||||||
@@ -445,25 +445,37 @@ def play_from_library(item):
|
|||||||
"""
|
"""
|
||||||
|
|
||||||
def get_played_time(item):
|
def get_played_time(item):
|
||||||
if item.contentType == 'movie': nfo_path = item.nfo
|
from core import videolibrarytools
|
||||||
else: nfo_path = item.strm_path.replace('strm','nfo')
|
|
||||||
|
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):
|
if nfo_path and filetools.isfile(nfo_path):
|
||||||
from core import videolibrarytools
|
|
||||||
head_nfo, item_nfo = videolibrarytools.read_nfo(nfo_path)
|
head_nfo, item_nfo = videolibrarytools.read_nfo(nfo_path)
|
||||||
sleep(1)
|
sleep(1)
|
||||||
played_time = platformtools.get_played_time(item_nfo)
|
played_time = platformtools.get_played_time(item_nfo)
|
||||||
|
|
||||||
else: played_time = 0
|
else: played_time = 0
|
||||||
|
|
||||||
return played_time
|
return played_time
|
||||||
|
|
||||||
import xbmcgui, xbmcplugin, xbmc
|
import xbmcgui, xbmcplugin, xbmc
|
||||||
from time import sleep
|
from time import sleep
|
||||||
|
|
||||||
# logger.debug("item: \n" + item.tostring('\n'))
|
# logger.debug("item: \n" + item.tostring('\n'))
|
||||||
xbmcplugin.setResolvedUrl(int(sys.argv[1]), True,
|
# xbmc.Player().play(os.path.join(config.get_runtime_path(), "resources", "kod.mp4"))
|
||||||
xbmcgui.ListItem(path=os.path.join(config.get_runtime_path(), "resources", "kod.mp4")))
|
if not item.autoplay:
|
||||||
while not platformtools.is_playing():
|
xbmcplugin.setResolvedUrl(int(sys.argv[1]), True, xbmcgui.ListItem(path=os.path.join(config.get_runtime_path(), "resources", "kod.mp4")))
|
||||||
xbmc.sleep(10)
|
while not platformtools.is_playing():
|
||||||
xbmc.Player().stop()
|
xbmc.sleep(10)
|
||||||
|
xbmc.Player().stop()
|
||||||
platformtools.prevent_busy()
|
platformtools.prevent_busy()
|
||||||
|
|
||||||
|
|
||||||
@@ -474,8 +486,10 @@ def play_from_library(item):
|
|||||||
|
|
||||||
# Modify the action (currently the video library needs "findvideos" since this is where the sources are searched
|
# 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"
|
item.action = item.next_action if item.next_action else "findvideos"
|
||||||
|
# from core.support import dbg;dbg()
|
||||||
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
|
# and launch kodi again
|
||||||
if (xbmc.getCondVisibility('Window.IsMedia') and not window_type == 1) or item.action != 'findvideos':
|
if (xbmc.getCondVisibility('Window.IsMedia') and not window_type == 1) or item.action != 'findvideos':
|
||||||
@@ -496,10 +510,10 @@ def play_from_library(item):
|
|||||||
if config.get_setting("max_links", "videolibrary") != 0: itemlist = limit_itemlist(itemlist)
|
if config.get_setting("max_links", "videolibrary") != 0: itemlist = limit_itemlist(itemlist)
|
||||||
# The list of links is slightly "cleaned"
|
# The list of links is slightly "cleaned"
|
||||||
if config.get_setting("replace_VD", "videolibrary") == 1: itemlist = reorder_itemlist(itemlist)
|
if config.get_setting("replace_VD", "videolibrary") == 1: itemlist = reorder_itemlist(itemlist)
|
||||||
# from core.support import dbg;dbg()
|
|
||||||
if len(itemlist) > 0:
|
if len(itemlist) > 0:
|
||||||
reopen = False
|
reopen = False
|
||||||
# from core.support import dbg;dbg()
|
|
||||||
while not xbmc.Monitor().abortRequested():
|
while not xbmc.Monitor().abortRequested():
|
||||||
played = True
|
played = True
|
||||||
# if config.get_setting('next_ep') == 3 and xbmc.Player().playnext:
|
# if config.get_setting('next_ep') == 3 and xbmc.Player().playnext:
|
||||||
|
|||||||
@@ -1506,9 +1506,13 @@ def play_torrent(item, xlistitem, mediaurl):
|
|||||||
torrent.elementum_download(item)
|
torrent.elementum_download(item)
|
||||||
else:
|
else:
|
||||||
# time.sleep(3)
|
# time.sleep(3)
|
||||||
if item.fromLibrary:
|
# from core.support import dbg;dbg()
|
||||||
|
if item.fromLibrary and item.play_from == 'window':
|
||||||
xlistitem.setPath(torrent_options[selection][1] % mediaurl)
|
xlistitem.setPath(torrent_options[selection][1] % mediaurl)
|
||||||
xbmcplugin.setResolvedUrl(int(sys.argv[1]), True, xlistitem)
|
playlist = xbmc.PlayList(xbmc.PLAYLIST_VIDEO)
|
||||||
|
playlist.clear()
|
||||||
|
playlist.add(torrent_options[selection][1] % mediaurl, xlistitem)
|
||||||
|
xbmc_player.play(playlist, xlistitem)
|
||||||
else:
|
else:
|
||||||
xbmc.executebuiltin("PlayMedia(" + torrent_options[selection][1] % mediaurl + ")")
|
xbmc.executebuiltin("PlayMedia(" + torrent_options[selection][1] % mediaurl + ")")
|
||||||
|
|
||||||
|
|||||||
@@ -100,10 +100,10 @@ def mark_auto_as_watched(item):
|
|||||||
xbmc.sleep(700)
|
xbmc.sleep(700)
|
||||||
xbmc.executebuiltin('Action(ParentDir)')
|
xbmc.executebuiltin('Action(ParentDir)')
|
||||||
xbmc.sleep(500)
|
xbmc.sleep(500)
|
||||||
|
# from core.support import dbg;dbg()
|
||||||
if next_episode and next_episode.next_ep and config.get_setting('next_ep') < 3:
|
if next_episode and next_episode.next_ep and config.get_setting('next_ep') < 3:
|
||||||
from platformcode.launcher import play_from_library
|
from platformcode.launcher import run
|
||||||
play_from_library(next_episode)
|
run(next_episode)
|
||||||
|
|
||||||
# db need to be closed when not used, it will cause freezes
|
# db need to be closed when not used, it will cause freezes
|
||||||
from core import db
|
from core import db
|
||||||
|
|||||||
Reference in New Issue
Block a user