Episodio Successivo (aggiornamento)

This commit is contained in:
Alhaziel
2020-01-08 20:14:07 +01:00
parent a155f808d4
commit c19a506be7
7 changed files with 289 additions and 52 deletions

View File

@@ -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):

View File

@@ -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="", 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

View File

@@ -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 ]

View File

@@ -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"

View File

@@ -5,14 +5,15 @@
<setting id="player_mode" type="enum" values="Direct|SetResolvedUrl|Built-In|Download and Play" label="30044" default="1"/>
<setting id="default_action" type="enum" lvalues="30006|30007|30008" label="30005" default="0"/>
<setting id="autoplay" type="bool" label="70562" default="false" visible="true"/>
<!-- <setting id="autoplay_next" type="bool" label="Riproduci episodio successivo" default="false" visible="true"/>-->
<setting id="autoplay_server_list" type="bool" label="70746" default="false" visible="true"/>
<setting id="next_ep" type="enum" label="70746" lvalues="70752|70747|70748" default="0"/>
<setting id="next_ep_seconds" type="enum" values="20|30|40|50|60" label="secondi prima della finestra" default="3" visible="eq(-1,2)"/>
<setting id="checklinks" type="bool" label="30020" default="false"/>
<setting id="checklinks_number" type="enum" values="5|10|15|20" label="30021" default="0" visible="eq(-1,true)"/>
<setting id="thumbnail_type" type="enum" lvalues="30011|30012|30200" label="30010" default="2"/>
<setting id="channel_language" type="labelenum" values="auto|all|ita" label="30019" default="all"/>
<setting id="trakt_sync" type="bool" label="70109" default="false"/>
<setting id="forceview" type="bool" label="30043" default="false"/>
<setting id="faster_item_serialization" type="bool" label="30300" default="false"/>
<setting id="resolver_dns" type="bool" label="707408" default="true" enable="true" visible="true"/>
<setting id="debug" type="bool" label="30003" default="false"/>
<setting label="70169" type="lsep"/>

View File

@@ -0,0 +1,100 @@
<?xml version="1.0" encoding="UTF-8"?>
<window>
<defaultcontrol always="true">20</defaultcontrol>
<onload>Dialog.Close(fullscreeninfo,true)</onload>
<onload>Dialog.Close(videoosd,true)</onload>
<controls>
<control type="group">
<animation type="WindowOpen" reversible="false">
<effect type="fade" start="0" end="100" time="600" />
<effect type="slide" start="-115,-0" end="0,0" time="600" />
</animation>
<animation type="WindowClose" reversible="false">
<effect type="fade" start="100" end="0" time="400" />
<effect type="slide" start="0,0" end="-115,0" time="400" />
</animation>
<control type="group">
<right>0</right>
<height>50</height>
<width>45%</width>
<!-- Background -->
<control type="image">
<top>0</top>
<width>100%</width>
<height>50</height>
<texture colordiffuse="88232323">Shortcut/dialog-bg-solid.png</texture>
</control>
<control type="group">
<top>0</top>
<left>0</left>
<width>100%</width>
<!-- buttons -->
<control type="button" id="3012">
<left>-1000</left>
<top>-1000</top>
<height>1</height>
<width>1</width>
</control>
<control type="grouplist" id="20">
<orientation>horizontal</orientation>
<height>50</height>
<itemgap>10</itemgap>
<align>left</align>
<control type="button" id="10">
<label>$ADDON[plugin.video.kod 70750]</label>
<onclick>SendClick(3012)</onclick>
<visible>Integer.IsGreater(Player.TimeRemaining,59)</visible>
<height>50</height>
<width min="50">auto</width>
<font>font30_title</font>
<textoffsetx>55</textoffsetx>
<textcolor>ddffffff</textcolor>
<focusedcolor>eeffffff</focusedcolor>
<selectedcolor>ddffffff</selectedcolor>
<shadowcolor>22000000</shadowcolor>
<aligny>center</aligny>
<align>center</align>
<texturefocus border="10" colordiffuse="FF65B3DA">Shortcut/button-fo.png</texturefocus>
<texturenofocus border="10" colordiffuse="0065B3DA">Shortcut/button-fo.png</texturenofocus>
<pulseonselect>no</pulseonselect>
</control>
<control type="button" id="11">
<label>$ADDON[plugin.video.kod 70750] $INFO[Player.TimeRemaining(ss),,] $ADDON[plugin.video.kod 70751]</label>
<onclick>SendClick(3012)</onclick>
<visible>!Integer.IsGreater(Player.TimeRemaining,59)</visible>
<height>50</height>
<width min="50">auto</width>
<font>font30_title</font>
<textoffsetx>55</textoffsetx>
<textcolor>ddffffff</textcolor>
<focusedcolor>eeffffff</focusedcolor>
<selectedcolor>ddffffff</selectedcolor>
<shadowcolor>22000000</shadowcolor>
<aligny>center</aligny>
<align>center</align>
<texturefocus border="10" colordiffuse="FF65B3DA">Shortcut/button-fo.png</texturefocus>
<texturenofocus border="10" colordiffuse="0065B3DA">Shortcut/button-fo.png</texturenofocus>
<pulseonselect>no</pulseonselect>
</control>
<control type="button" id="3013">
<label>$ADDON[plugin.video.kod 60396]</label>
<height>50</height>
<width min="50">auto</width>
<font>font30_title</font>
<textoffsetx>15</textoffsetx>
<textcolor>ddffffff</textcolor>
<focusedcolor>eeffffff</focusedcolor>
<selectedcolor>ddffffff</selectedcolor>
<shadowcolor>22000000</shadowcolor>
<aligny>center</aligny>
<align>center</align>
<texturefocus border="10" colordiffuse="FF65B3DA">Shortcut/button-fo.png</texturefocus>
<texturenofocus border="10" colordiffuse="0065B3DA">Shortcut/button-fo.png</texturenofocus>
<pulseonselect>no</pulseonselect>
</control>
</control>
</control>
</control>
</control>
</controls>
</window>

130
specials/nextep.py Normal file
View File

@@ -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()