diff --git a/core/support.py b/core/support.py
index a0f6954a..5cf8dacb 100755
--- a/core/support.py
+++ b/core/support.py
@@ -981,7 +981,7 @@ def controls(itemlist, item, AutoPlay=True, CheckLinks=True, down_load=True):
channel_node = autoplay_node.get(item.channel, {})
settings_node = channel_node.get('settings', {})
AP = get_setting('autoplay') or settings_node['active']
- APS = get_setting('autoplay_server_list')
+ HS = config.get_setting('next_ep')
if CL and not AP:
if get_setting('checklinks', item.channel):
@@ -1010,7 +1010,7 @@ def controls(itemlist, item, AutoPlay=True, CheckLinks=True, down_load=True):
VL = True
except:
pass
- if not AP or VL or not APS:
+ if not AP or VL or HS == 0:
return itemlist
def filterLang(item, itemlist):
diff --git a/platformcode/launcher.py b/platformcode/launcher.py
index 1a53acc0..4e967acc 100644
--- a/platformcode/launcher.py
+++ b/platformcode/launcher.py
@@ -449,12 +449,6 @@ def play_from_library(item):
import xbmc
from time import sleep, time
- from core import jsontools
- path = filetools.join(config.get_videolibrary_path(), config.get_setting("folder_tvshows"))
- AP = config.get_setting('autoplay')
- APS = config.get_setting('autoplay_server_list')
- NE = config.get_setting('autoplay_next')
-
# Intentamos reproducir una imagen (esto no hace nada y ademas no da error)
xbmcplugin.setResolvedUrl(int(sys.argv[1]), True,
xbmcgui.ListItem(
@@ -468,50 +462,14 @@ def play_from_library(item):
item.action = "findvideos"
window_type = config.get_setting("window_type", "videolibrary")
- episodes = scrapertools.find_single_match(item.strm_path, '(\d+)x(\d+)')
- season = int(episodes[0])
- episode = int(episodes[1])
-
# y volvemos a lanzar kodi
if xbmc.getCondVisibility('Window.IsMedia') and not window_type == 1:
# Ventana convencional
xbmc.executebuiltin("Container.Update(" + sys.argv[0] + "?" + item.tourl() + ")")
- if AP and NE:
- while not platformtools.is_playing():
- pass
- while platformtools.is_playing():
- pass
- sleep(0.5)
- xbmc.executebuiltin('Action(Back)')
- ep = '%dx%02d' % (season, episode)
- next_ep = '%dx%02d' % (season, episode+1)
- next_season = '%dx%02d' % (season+1, 1)
- next_ep_path = item.strm_path.replace(ep,next_ep)
- next_season_path = item.strm_path.replace(ep,next_ep)
- play_next = False
- if os.path.isfile(path+next_ep_path):
- item.contentEpisodeNumber = item.infoLabels['episode'] = episode+1
- item.contentTitle = item.infoLabels['title'] = next_ep
- item.strm_path = next_ep_path
- play_next = True
- elif os.path.isfile(path+next_season_path):
- item.contentSeason = item.infoLabels['season'] = season+1
- item.contentEpisodeNumber = item.infoLabels['episode'] = 1
- item.contentTitle = item.infoLabels['title'] = next_season
- item.strm_path = next_season_path
- play = True
-
- if play_next == True and platformtools.dialog_yesno('Prossimo Episodio?', item.contentTitle, nolabel="Sì", yeslabel="No", autoclose=5000) == 0:
- play_from_library(item)
-
- elif AP and APS:
- while not platformtools.is_playing():
- pass
- while platformtools.is_playing():
- pass
- sleep(0.5)
- xbmc.executebuiltin('Action(Back)')
+ if config.get_setting('next_ep') > 0:
+ from specials.nextep import afther_stop
+ afther_stop(item)
else:
# Ventana emergente
diff --git a/resources/language/English/strings.po b/resources/language/English/strings.po
index c2ccc5db..11016eeb 100644
--- a/resources/language/English/strings.po
+++ b/resources/language/English/strings.po
@@ -5702,7 +5702,31 @@ msgid "Enter another year..."
msgstr ""
msgctxt "#70746"
-msgid "Hide server selection from Autoplay"
+msgid "When playback ends"
+msgstr ""
+
+msgctxt "#70747"
+msgid "Hide server selection"
+msgstr ""
+
+msgctxt "#70748"
+msgid "Go to the next episode"
+msgstr ""
+
+msgctxt "#70749"
+msgid "Seconds before notification"
+msgstr ""
+
+msgctxt "#70750"
+msgid "Next Episode in"
+msgstr ""
+
+msgctxt "#70751"
+msgid "seconds"
+msgstr ""
+
+msgctxt "#70752"
+msgid "Do nothing"
msgstr ""
# DNS start [ settings and declaration ]
diff --git a/resources/language/Italian/strings.po b/resources/language/Italian/strings.po
index adc60e7a..cea6f08c 100644
--- a/resources/language/Italian/strings.po
+++ b/resources/language/Italian/strings.po
@@ -5706,8 +5706,32 @@ msgid "Enter another year..."
msgstr "Inserisci un altro anno..."
msgctxt "#70746"
-msgid "Hide server selection from Autoplay"
-msgstr "Nascondi la selezione del server da Autoplay"
+msgid "When playback ends"
+msgstr "Al termine della riproduzione"
+
+msgctxt "#70747"
+msgid "Hide server selection"
+msgstr "Nascondi la selezione del server"
+
+msgctxt "#70748"
+msgid "Go to the next episode"
+msgstr "Vai all'episodio successivo"
+
+msgctxt "#70749"
+msgid "Seconds before notification"
+msgstr "Secondi prima della notifica"
+
+msgctxt "#70750"
+msgid "Next Episode in"
+msgstr "Episodio Successivo fra"
+
+msgctxt "#70751"
+msgid "seconds"
+msgstr "secondi"
+
+msgctxt "#70752"
+msgid "Do nothing"
+msgstr "Non fare nulla"
# DNS start [ settings and declaration ]
msgctxt "#707401"
diff --git a/resources/settings.xml b/resources/settings.xml
index 8bca2334..e41ce2a5 100644
--- a/resources/settings.xml
+++ b/resources/settings.xml
@@ -5,14 +5,15 @@
-
-
+
+
+
diff --git a/resources/skins/Default/720p/NextDialog.xml b/resources/skins/Default/720p/NextDialog.xml
new file mode 100644
index 00000000..fa36f5bb
--- /dev/null
+++ b/resources/skins/Default/720p/NextDialog.xml
@@ -0,0 +1,100 @@
+
+
+ 20
+ Dialog.Close(fullscreeninfo,true)
+ Dialog.Close(videoosd,true)
+
+
+
+
+
+
+
+
+
+
+
+ 0
+ 50
+ 45%
+
+
+ 0
+ 100%
+ 50
+ Shortcut/dialog-bg-solid.png
+
+
+ 0
+ 0
+ 100%
+
+
+ -1000
+ -1000
+ 1
+ 1
+
+
+ horizontal
+ 50
+ 10
+ left
+
+
+ SendClick(3012)
+ Integer.IsGreater(Player.TimeRemaining,59)
+ 50
+ auto
+ font30_title
+ 55
+ ddffffff
+ eeffffff
+ ddffffff
+ 22000000
+ center
+ center
+ Shortcut/button-fo.png
+ Shortcut/button-fo.png
+ no
+
+
+
+ SendClick(3012)
+ !Integer.IsGreater(Player.TimeRemaining,59)
+ 50
+ auto
+ font30_title
+ 55
+ ddffffff
+ eeffffff
+ ddffffff
+ 22000000
+ center
+ center
+ Shortcut/button-fo.png
+ Shortcut/button-fo.png
+ no
+
+
+
+ 50
+ auto
+ font30_title
+ 15
+ ddffffff
+ eeffffff
+ ddffffff
+ 22000000
+ center
+ center
+ Shortcut/button-fo.png
+ Shortcut/button-fo.png
+ no
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/specials/nextep.py b/specials/nextep.py
new file mode 100644
index 00000000..d950a84f
--- /dev/null
+++ b/specials/nextep.py
@@ -0,0 +1,130 @@
+# -*- coding: utf-8 -*-
+import xbmc, os, urlparse
+from platformcode import config, platformtools, logger
+from time import time, sleep
+from core import scrapertools
+from core import jsontools, filetools
+
+
+def afther_stop(item):
+ condition = config.get_setting('next_ep')
+
+ if condition == 1: # Hide servers afther stop video
+ while not platformtools.is_playing():
+ pass
+ while platformtools.is_playing():
+ pass
+ sleep(0.5)
+ xbmc.executebuiltin('Action(Back)')
+
+ elif condition == 2: # Bring servers afther stop video
+ from platformcode.launcher import play_from_library
+ # Check if next episode exist
+ current_filename = os.path.basename(item.strm_path)
+ path = filetools.join(config.get_videolibrary_path(), config.get_setting("folder_tvshows"),os.path.dirname(item.strm_path))
+ fileList = []
+ for file in os.listdir(path):
+ if file.endswith('.strm'):
+ fileList.append(file)
+ nextIndex = fileList.index(current_filename) + 1
+ if nextIndex == 0 or nextIndex == len(fileList):
+ next_file = None
+ else:
+ next_file = fileList[nextIndex]
+
+ # start next episode window afther x time
+ if next_file:
+ play_next = False
+ time_limit = time() + 30
+ TimeFromEnd = congig.get_setting('next_ep_seconds')
+ while not platformtools.is_playing() and time() < time_limit:
+ sleep(1)
+ while platformtools.is_playing() and play_next == False:
+ Difference = xbmc.Player().getTotalTime() - xbmc.Player().getTime()
+ if 0 < Difference <= 60:
+ logger.info('Exit '+str(Difference))
+ play_next = True
+
+ if play_next:
+ play_next = False
+ season_ep = next_file.split('.')[0]
+ season = season_ep.split('x')[0]
+ episode = season_ep.split('x')[1]
+ next_ep = '%sx%s' % (season, episode)
+ item.contentSeason = item.infoLabels['season'] = season
+ item.contentEpisodeNumber = item.infoLabels['episode'] = episode
+ item.contentTitle = item.infoLabels['title'] = next_ep
+ item.strm_path = filetools.join(os.path.dirname(item.strm_path), next_file)
+ # from core.support import dbg; dbg()
+
+ global ITEM
+ ITEM = item
+ nextDialog = NextDialog('NextDialog.xml', config.get_runtime_path())
+ nextDialog.show()
+ while platformtools.is_playing() and not nextDialog.is_still_watching():
+ xbmc.sleep(100)
+ pass
+
+ nextDialog.close()
+ logger.info('CONTINUA: ' +str(nextDialog.stillwatching))
+
+ if nextDialog.stillwatching or nextDialog.continuewatching:
+ xbmc.Player().stop()
+ sleep(0.5)
+ xbmc.executebuiltin('Action(Back)')
+ sleep(0.5)
+ play_from_library(item)
+ else:
+ sleep(0.5)
+ xbmc.executebuiltin('Action(Back)')
+
+
+import xbmcgui
+
+PLAYER_STOP = 13
+
+
+class NextDialog(xbmcgui.WindowXMLDialog):
+ item = None
+ cancel = False
+ stillwatching = False
+ continuewatching = True
+
+ def __init__(self, *args, **kwargs):
+ logger.info()
+ self.action_exitkeys_id = [10, 13]
+ self.progress_control = None
+ self.item = ITEM
+
+ def set_still_watching(self, stillwatching):
+ self.stillwatching = stillwatching
+
+ def set_continue_watching(self, continuewatching):
+ self.continuewatching = continuewatching
+
+ def is_still_watching(self):
+ return self.stillwatching
+
+ def onFocus(self, controlId):
+ pass
+
+ def doAction(self):
+ pass
+
+ def closeDialog(self):
+ self.close()
+
+ def onClick(self, controlId):
+ if controlId == 3012: # Still watching
+ self.set_still_watching(True)
+ self.set_continue_watching(False)
+ self.close()
+ elif controlId == 3013: # Cancel
+ self.set_continue_watching(False)
+ self.close()
+
+ def onAction(self, action):
+ logger.info()
+ if action == PLAYER_STOP:
+ self.set_continue_watching(False)
+ self.close()