Test Episodio successivo in playlist

This commit is contained in:
Alhaziel01
2021-03-18 17:59:48 +01:00
parent 485691e6fd
commit 4ee336aae9
6 changed files with 42 additions and 7 deletions

View File

@@ -461,7 +461,8 @@ def play_from_library(item):
# Modify the action (currently the video library needs "findvideos" since this is where the sources are searched
item.action = "findvideos"
window_type = config.get_setting("window_type", "videolibrary")
window_type = config.get_setting("window_type", "videolibrary") if config.get_setting('next_ep') < 3 else 1
# and launch kodi again
if xbmc.getCondVisibility('Window.IsMedia') and not window_type == 1:
xbmc.executebuiltin("Container.Update(" + sys.argv[0] + "?" + item.tourl() + ")")

View File

@@ -1088,6 +1088,7 @@ def set_player(item, xlistitem, mediaurl, view, strm):
playlist.add(mediaurl, xlistitem)
# Reproduce
xbmc_player.play(playlist, xlistitem)
add_next_to_playlist(item)
if config.get_setting('trakt_sync'):
from core import trakt_tools
@@ -1123,6 +1124,29 @@ def set_player(item, xlistitem, mediaurl, view, strm):
xbmcgui.Window(12005).show()
def add_next_to_playlist(item):
import threading
from core import filetools, videolibrarytools
from platformcode import xbmc_videolibrary
def add_to_playlist(item):
if item.contentType != 'movie' and item.strm_path:
next= xbmc_videolibrary.next_ep(item)
if next:
next.back = True
nfo_path = filetools.join(config.get_videolibrary_path(), config.get_setting("folder_tvshows"), next.strm_path.replace('strm','nfo'))
if nfo_path and filetools.isfile(nfo_path):
head_nfo, item_nfo = videolibrarytools.read_nfo(nfo_path)
nextItem = xbmcgui.ListItem(path=item_nfo.url)
nextItem.setArt({"thumb": item_nfo.contentThumbnail if item_nfo.contentThumbnail else item_nfo.thumbnail})
set_infolabels(nextItem, item_nfo, True)
nexturl = "plugin://plugin.video.kod/?" + next.tourl()
playlist = xbmc.PlayList(xbmc.PLAYLIST_VIDEO)
playlist.add(nexturl, nextItem)
add_to_playlist(next)
if item.contentType != 'movie' and config.get_setting('next_ep') == 3:
threading.Thread(target=add_to_playlist, args=[item]).start()
def torrent_client_installed(show_tuple=False):
# External plugins found in servers / torrent.json node clients
from core import filetools

View File

@@ -40,7 +40,7 @@ def mark_auto_as_watched(item):
percentage = float(config.get_setting("watched_setting")) / 100
time_from_end = config.get_setting('next_ep_seconds')
if item.contentType != 'movie' and config.get_setting('next_ep'):
if item.contentType != 'movie' and config.get_setting('next_ep') < 3:
next_dialogs = ['NextDialog.xml', 'NextDialogExtended.xml', 'NextDialogCompact.xml']
next_ep_type = config.get_setting('next_ep_type')
ND = next_dialogs[next_ep_type]
@@ -49,6 +49,7 @@ def mark_auto_as_watched(item):
logger.debug(next_episode)
while platformtools.is_playing():
xbmc.sleep(1000)
actual_time = xbmc.Player().getTime()
total_time = xbmc.Player().getTotalTime()
if item.played_time and xbmcgui.getCurrentWindowId() == 12005:
@@ -83,7 +84,6 @@ def mark_auto_as_watched(item):
xbmc.Player().stop()
nextdialog.close()
break
xbmc.sleep(1000)
# if item.options['continue']:
if 10 < actual_time < mark_time:
@@ -96,13 +96,16 @@ def mark_auto_as_watched(item):
while platformtools.is_playing():
xbmc.sleep(100)
if not show_server and item.play_from != 'window' and not item.no_return:
xbmc.sleep(700)
xbmc.executebuiltin('Action(ParentDir)')
xbmc.sleep(500)
if next_episode and next_episode.next_ep and config.get_setting('next_ep') == 1:
from platformcode.launcher import play_from_library
play_from_library(next_episode)
# db need to be closed when not used, it will cause freezes
from core import db
db.close()
@@ -1368,7 +1371,6 @@ def next_ep(item):
return item
class NextDialog(xbmcgui.WindowXMLDialog):
item = None
cancel = False