diff --git a/platformcode/launcher.py b/platformcode/launcher.py
index 68a13d5c..b6e6553d 100644
--- a/platformcode/launcher.py
+++ b/platformcode/launcher.py
@@ -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() + ")")
diff --git a/platformcode/platformtools.py b/platformcode/platformtools.py
index 3fef5ab9..1c897767 100644
--- a/platformcode/platformtools.py
+++ b/platformcode/platformtools.py
@@ -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
diff --git a/platformcode/xbmc_videolibrary.py b/platformcode/xbmc_videolibrary.py
index a9ac204c..9f33ad59 100644
--- a/platformcode/xbmc_videolibrary.py
+++ b/platformcode/xbmc_videolibrary.py
@@ -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
diff --git a/resources/language/resource.language.en_gb/strings.po b/resources/language/resource.language.en_gb/strings.po
index 3804a0e6..6a60f680 100644
--- a/resources/language/resource.language.en_gb/strings.po
+++ b/resources/language/resource.language.en_gb/strings.po
@@ -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"
diff --git a/resources/language/resource.language.it_it/strings.po b/resources/language/resource.language.it_it/strings.po
index 0b117d67..c53a7fd4 100644
--- a/resources/language/resource.language.it_it/strings.po
+++ b/resources/language/resource.language.it_it/strings.po
@@ -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"
diff --git a/resources/settings.xml b/resources/settings.xml
index 09e2c430..880344eb 100644
--- a/resources/settings.xml
+++ b/resources/settings.xml
@@ -39,7 +39,7 @@
-
+