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

View File

@@ -6129,11 +6129,15 @@ msgstr ""
msgctxt "#70832"
msgid "Disabled"
msgstr "Disabilitato"
msgstr ""
msgctxt "#70833"
msgid "Automatic"
msgstr "Automatico"
msgstr ""
msgctxt "#70834"
msgid "Playlist"
msgstr ""
# DNS start [ settings and declaration ]
msgctxt "#707401"

View File

@@ -6136,6 +6136,10 @@ msgctxt "#70833"
msgid "Automatic"
msgstr "Automatico"
msgctxt "#70834"
msgid "Playlist"
msgstr "Playlist"
# DNS start [ settings and declaration ]
msgctxt "#707401"
msgid "Enable DNS check alert"

View File

@@ -39,7 +39,7 @@
<setting id="videolibrary_kodi" type="bool" label="70120" default="false"/>
<setting label="59997" type="lsep"/>
<setting id="videolibrary_max_quality" type="bool" label="70729" default="false" visible="true"/>
<setting id="next_ep" type="select" label="70748" lvalues="70832|70833|70732" default="1"/>
<setting id="next_ep" type="select" label="70748" lvalues="70832|70833|70732|70834" default="1"/>
<setting id="next_ep_type" type="select" label="70754" lvalues="70755|70756|70757" default="0" visible="!eq(-1,0)" subsetting="true"/>
<setting id="next_ep_seconds" type="slider" option="int" range="20,10,240" label="70749" default="40" visible="!eq(-2,0)" subsetting="true"/>
<setting id="watched_setting" type="slider" option="int" range="20,5,90" label="60634" default="80"/>