Fix Episodio Successivo
This commit is contained in:
+3
-2
@@ -391,7 +391,7 @@ def scrapeBlock(item, args, block, patron, headers, action, pagination, debug, t
|
|||||||
if scraped['episode'] and group and not item.grouped: # some adjustment for grouping feature
|
if scraped['episode'] and group and not item.grouped: # some adjustment for grouping feature
|
||||||
it.action = function
|
it.action = function
|
||||||
if it.action == 'findvideos':
|
if it.action == 'findvideos':
|
||||||
it.window = True if item.window_type == 1 or (config.get_setting("window_type") == 0) else False
|
it.window = True if item.window_type == 0 or (config.get_setting("window_type") == 0) else False
|
||||||
if it.window: it.folder = False
|
if it.window: it.folder = False
|
||||||
# for lg in list(set(listGroups).difference(known_keys)):
|
# for lg in list(set(listGroups).difference(known_keys)):
|
||||||
# it.__setattr__(lg, match[listGroups.index(lg)])
|
# it.__setattr__(lg, match[listGroups.index(lg)])
|
||||||
@@ -1199,7 +1199,7 @@ def server(item, data='', itemlist=[], headers='', AutoPlay=True, CheckLinks=Tru
|
|||||||
if videoitem.video_urls or srv_param.get('active', False):
|
if videoitem.video_urls or srv_param.get('active', False):
|
||||||
# dbg()
|
# dbg()
|
||||||
item.title = item.contentTitle.strip() if item.contentType == 'movie' and item.contentTitle or (config.get_localized_string(30161) in item.fulltitle) else item.fulltitle
|
item.title = item.contentTitle.strip() if item.contentType == 'movie' and item.contentTitle or (config.get_localized_string(30161) in item.fulltitle) else item.fulltitle
|
||||||
|
# videoitem = item.clone()
|
||||||
quality = videoitem.quality if videoitem.quality else item.quality if item.quality else ''
|
quality = videoitem.quality if videoitem.quality else item.quality if item.quality else ''
|
||||||
videoitem.contentLanguage = videoitem.contentLanguage if videoitem.contentLanguage else item.contentLanguage if item.contentLanguage else 'ITA'
|
videoitem.contentLanguage = videoitem.contentLanguage if videoitem.contentLanguage else item.contentLanguage if item.contentLanguage else 'ITA'
|
||||||
videoitem.title = item.title
|
videoitem.title = item.title
|
||||||
@@ -1214,6 +1214,7 @@ def server(item, data='', itemlist=[], headers='', AutoPlay=True, CheckLinks=Tru
|
|||||||
videoitem.referer = item.referer if item.referer else item.url
|
videoitem.referer = item.referer if item.referer else item.url
|
||||||
videoitem.action = "play"
|
videoitem.action = "play"
|
||||||
videoitem.videolibrary_id = item.videolibrary_id
|
videoitem.videolibrary_id = item.videolibrary_id
|
||||||
|
videoitem.from_library = item.from_library
|
||||||
return videoitem
|
return videoitem
|
||||||
|
|
||||||
# non threaded for webpdb
|
# non threaded for webpdb
|
||||||
|
|||||||
@@ -458,12 +458,14 @@ def play_from_library(item):
|
|||||||
item.window_type = config.get_setting("window_type") if config.get_setting('next_ep') < 3 and item.contentType != 'movie' else 0
|
item.window_type = config.get_setting("window_type") if config.get_setting('next_ep') < 3 and item.contentType != 'movie' else 0
|
||||||
xbmcplugin.setResolvedUrl(int(sys.argv[1]), True, xbmcgui.ListItem(path=os.path.join(config.get_runtime_path(), "resources", "kod.mp4")))
|
xbmcplugin.setResolvedUrl(int(sys.argv[1]), True, xbmcgui.ListItem(path=os.path.join(config.get_runtime_path(), "resources", "kod.mp4")))
|
||||||
xbmc.Player().stop()
|
xbmc.Player().stop()
|
||||||
if xbmc.getCondVisibility('Window.IsMedia') and not item.window_type == 1:
|
if xbmc.getCondVisibility('Window.IsMedia') and not item.window_type == 0:
|
||||||
if item.contentType == 'episode':
|
if item.contentType == 'episode':
|
||||||
it = videolibrarydb.videolibrarydb[item.contentType][item.videolibrary_id]['{}x{:02d}'.format(item.infoLabels['season'], item.infoLabels['episode'])]
|
it = videolibrarydb.videolibrarydb[item.contentType][item.videolibrary_id]['{}x{:02d}'.format(item.infoLabels['season'], item.infoLabels['episode'])]['item']
|
||||||
else:
|
else:
|
||||||
it = videolibrarydb.videolibrarydb[item.contentType][item.videolibrary_id]['item']
|
it = videolibrarydb.videolibrarydb[item.contentType][item.videolibrary_id]['item']
|
||||||
|
it.from_library = True
|
||||||
xbmc.executebuiltin("Container.Update(" + sys.argv[0] + "?" + it.tourl() + ")")
|
xbmc.executebuiltin("Container.Update(" + sys.argv[0] + "?" + it.tourl() + ")")
|
||||||
videolibrarydb.videolibrarydb.close()
|
videolibrarydb.videolibrarydb.close()
|
||||||
else:
|
else:
|
||||||
|
item.window = True
|
||||||
return videolibrary.findvideos(item)
|
return videolibrary.findvideos(item)
|
||||||
|
|||||||
@@ -366,7 +366,7 @@ def render_items(itemlist, parent_item):
|
|||||||
title = item.title
|
title = item.title
|
||||||
episode = ''
|
episode = ''
|
||||||
|
|
||||||
if parent_item.channel not in ['videolibrary'] and title[:1] not in ['[', '•']:
|
if (parent_item.channel not in ['videolibrary'] or item.server) and title[:1] not in ['[', '•']:
|
||||||
if type(item.contentSeason) == int and type(item.contentEpisodeNumber) == int and not item.onlyep:
|
if type(item.contentSeason) == int and type(item.contentEpisodeNumber) == int and not item.onlyep:
|
||||||
episode = '{}x{:02d}'.format(item.contentSeason, item.contentEpisodeNumber)
|
episode = '{}x{:02d}'.format(item.contentSeason, item.contentEpisodeNumber)
|
||||||
elif type(item.contentEpisodeNumber) == int:
|
elif type(item.contentEpisodeNumber) == int:
|
||||||
@@ -377,7 +377,7 @@ def render_items(itemlist, parent_item):
|
|||||||
if episode: title = '{}. {}'.format(episode, title)
|
if episode: title = '{}. {}'.format(episode, title)
|
||||||
if item.title2: title = '{} - {}'.format(title, item.title2)
|
if item.title2: title = '{} - {}'.format(title, item.title2)
|
||||||
|
|
||||||
if not config.get_setting('format_title'):
|
if config.get_setting('format_title'):
|
||||||
server = typo(servertools.get_server_parameters(item.server).get('name', item.server.capitalize()), '_ []') if item.server else ''
|
server = typo(servertools.get_server_parameters(item.server).get('name', item.server.capitalize()), '_ []') if item.server else ''
|
||||||
quality = typo(item.quality, '_ [] color kod') if item.quality else ''
|
quality = typo(item.quality, '_ [] color kod') if item.quality else ''
|
||||||
lang = typo(item.contentLanguage, '_ [] color kod') if item.contentLanguage else ''
|
lang = typo(item.contentLanguage, '_ [] color kod') if item.contentLanguage else ''
|
||||||
@@ -1442,7 +1442,7 @@ def set_player(item, xlistitem, mediaurl, view, strm):
|
|||||||
xbmc_player.setSubtitles(item.subtitle)
|
xbmc_player.setSubtitles(item.subtitle)
|
||||||
|
|
||||||
# if it is a video library file send to mark as seen
|
# if it is a video library file send to mark as seen
|
||||||
if strm or item.strm_path: item.options['strm'] = True
|
if strm or item.strm_path or item.from_library: item.options['strm'] = True
|
||||||
# if player_mode == 1: item.options['continue'] = True
|
# if player_mode == 1: item.options['continue'] = True
|
||||||
from platformcode import xbmc_videolibrary
|
from platformcode import xbmc_videolibrary
|
||||||
xbmc_videolibrary.mark_auto_as_watched(item)
|
xbmc_videolibrary.mark_auto_as_watched(item)
|
||||||
@@ -1460,16 +1460,13 @@ def add_next_to_playlist(item):
|
|||||||
from core import filetools, videolibrarytools
|
from core import filetools, videolibrarytools
|
||||||
from platformcode import xbmc_videolibrary
|
from platformcode import xbmc_videolibrary
|
||||||
def add_to_playlist(item):
|
def add_to_playlist(item):
|
||||||
if item.contentType != 'movie' and item.strm_path:
|
if item.contentType != 'movie':
|
||||||
next= xbmc_videolibrary.next_ep(item)
|
next= xbmc_videolibrary.next_ep(item)
|
||||||
if next:
|
if next:
|
||||||
next.back = True
|
next.back = True
|
||||||
nfo_path = filetools.join(config.get_videolibrary_path(), config.get_setting("folder_tvshows"), next.strm_path.replace('strm','nfo'))
|
nextItem = xbmcgui.ListItem(path=next.url)
|
||||||
if nfo_path and filetools.isfile(nfo_path):
|
nextItem.setArt({"thumb": next.contentThumbnail if next.contentThumbnail else next.thumbnail})
|
||||||
head_nfo, item_nfo = videolibrarytools.read_nfo(nfo_path)
|
set_infolabels(nextItem, next, True)
|
||||||
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()
|
nexturl = "plugin://plugin.video.kod/?" + next.tourl()
|
||||||
playlist = xbmc.PlayList(xbmc.PLAYLIST_VIDEO)
|
playlist = xbmc.PlayList(xbmc.PLAYLIST_VIDEO)
|
||||||
playlist.add(nexturl, nextItem)
|
playlist.add(nexturl, nextItem)
|
||||||
@@ -1861,7 +1858,16 @@ def serverwindow(item, itemlist):
|
|||||||
name = jsontools.load(open(path, "rb").read())['name']
|
name = jsontools.load(open(path, "rb").read())['name']
|
||||||
if name.startswith('@'): name = config.get_localized_string(int(name.replace('@','')))
|
if name.startswith('@'): name = config.get_localized_string(int(name.replace('@','')))
|
||||||
it = xbmcgui.ListItem('{}{}'.format(name, quality))
|
it = xbmcgui.ListItem('{}{}'.format(name, quality))
|
||||||
it.setProperties({'name': self.item.title, 'channel': videoitem.ch_name, 'color': color if color else 'FF0082C2'})
|
|
||||||
|
# format Title
|
||||||
|
if self.item.contentSeason and self.item.contentEpisodeNumber:
|
||||||
|
title = '{}x{:02d}. {}'.format(self.item.contentSeason, self.item.contentEpisodeNumber, self.item.contentTitle)
|
||||||
|
elif self.item.contentEpisodeNumber:
|
||||||
|
title = '{:02d}. {}'.format(self.item.contentEpisodeNumber, self.item.contentTitle)
|
||||||
|
else:
|
||||||
|
title = self.item.contentTitle
|
||||||
|
|
||||||
|
it.setProperties({'name': title, 'channel': videoitem.ch_name, 'color': color if color else 'FF0082C2'})
|
||||||
it.setArt({'poster':self.item.contentThumbnail, 'thumb':videoitem.thumbnail, 'fanart':item.fanart})
|
it.setArt({'poster':self.item.contentThumbnail, 'thumb':videoitem.thumbnail, 'fanart':item.fanart})
|
||||||
self.servers.append(it)
|
self.servers.append(it)
|
||||||
self.doModal()
|
self.doModal()
|
||||||
|
|||||||
@@ -15,7 +15,7 @@ if PY3:
|
|||||||
else:
|
else:
|
||||||
import urllib2 # Usamos el nativo de PY2 que es más rápido
|
import urllib2 # Usamos el nativo de PY2 que es más rápido
|
||||||
|
|
||||||
from core import filetools, jsontools, support
|
from core import filetools, jsontools, support, videolibrarydb
|
||||||
from platformcode import config, logger, platformtools
|
from platformcode import config, logger, platformtools
|
||||||
from core import scrapertools
|
from core import scrapertools
|
||||||
from xml.dom import minidom
|
from xml.dom import minidom
|
||||||
@@ -75,8 +75,8 @@ def mark_auto_as_watched(item):
|
|||||||
break
|
break
|
||||||
|
|
||||||
# check for next Episode
|
# check for next Episode
|
||||||
if next_episode and sync and time_from_end >= difference:
|
if next_episode and marked and time_from_end >= difference:
|
||||||
nextdialog = NextDialog(ND, config.get_runtime_path())
|
nextdialog = NextDialog(ND, config.get_runtime_path(), item=next_episode)
|
||||||
while platformtools.is_playing() and not nextdialog.is_exit():
|
while platformtools.is_playing() and not nextdialog.is_exit():
|
||||||
xbmc.sleep(100)
|
xbmc.sleep(100)
|
||||||
if nextdialog.continuewatching:
|
if nextdialog.continuewatching:
|
||||||
@@ -106,8 +106,8 @@ def mark_auto_as_watched(item):
|
|||||||
videolibrary.mark_content_as_watched(item)
|
videolibrary.mark_content_as_watched(item)
|
||||||
|
|
||||||
if next_episode and next_episode.next_ep and config.get_setting('next_ep') == 1:
|
if next_episode and next_episode.next_ep and config.get_setting('next_ep') == 1:
|
||||||
from platformcode.launcher import play_from_library
|
from platformcode.launcher import run
|
||||||
play_from_library(next_episode)
|
run(next_episode)
|
||||||
|
|
||||||
# db need to be closed when not used, it will cause freezes
|
# db need to be closed when not used, it will cause freezes
|
||||||
from core import db
|
from core import db
|
||||||
@@ -1354,48 +1354,20 @@ def ask_set_content(silent=False):
|
|||||||
|
|
||||||
|
|
||||||
def next_ep(item):
|
def next_ep(item):
|
||||||
from core.item import Item
|
logger.debug(item)
|
||||||
logger.debug()
|
episode = '{}x{:02d}'.format(item.contentSeason, item.contentEpisodeNumber)
|
||||||
item.next_ep = False
|
episodes = sorted(videolibrarydb.videolibrarydb['episode'][item.videolibrary_id].items())
|
||||||
|
videolibrarydb.videolibrarydb.close()
|
||||||
|
|
||||||
# check if next file exist
|
nextIndex = [k for k, v in episodes].index(episode) + 1
|
||||||
current_filename = filetools.basename(item.strm_path)
|
if nextIndex == 0 or nextIndex == len(episodes):
|
||||||
base_path = filetools.basename(filetools.dirname(item.strm_path))
|
it = None
|
||||||
path = filetools.join(config.get_videolibrary_path(), config.get_setting("folder_tvshows"),base_path)
|
|
||||||
fileList = []
|
|
||||||
for file in filetools.listdir(path):
|
|
||||||
if file.endswith('.strm'):
|
|
||||||
fileList.append(file)
|
|
||||||
fileList.sort()
|
|
||||||
|
|
||||||
nextIndex = fileList.index(current_filename) + 1
|
|
||||||
if nextIndex == 0 or nextIndex == len(fileList): next_file = None
|
|
||||||
else: next_file = fileList[nextIndex]
|
|
||||||
logger.debug('Next File:' + str(next_file))
|
|
||||||
|
|
||||||
# start next episode window afther x time
|
|
||||||
if next_file:
|
|
||||||
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 = Item(
|
|
||||||
action= 'play_from_library',
|
|
||||||
channel= 'videolibrary',
|
|
||||||
contentEpisodeNumber= episode,
|
|
||||||
contentSeason= season,
|
|
||||||
contentTitle= next_ep,
|
|
||||||
contentType= 'episode',
|
|
||||||
infoLabels= {'episode': episode, 'mediatype': 'episode', 'season': season, 'title': next_ep},
|
|
||||||
strm_path= filetools.join(base_path, next_file),
|
|
||||||
window = item.window)
|
|
||||||
|
|
||||||
global INFO
|
|
||||||
INFO = filetools.join(path, next_file.replace("strm", "nfo"))
|
|
||||||
else:
|
else:
|
||||||
item=None
|
it = episodes[nextIndex][1]['item']
|
||||||
|
if item.from_library: it.action = 'play_from_library'
|
||||||
|
logger.debug('Next File:' + '{}x{:02d}. {}'.format(it.contentSeason, it.contentEpisodeNumber, it.title))
|
||||||
|
|
||||||
return item
|
return it
|
||||||
|
|
||||||
class NextDialog(xbmcgui.WindowXMLDialog):
|
class NextDialog(xbmcgui.WindowXMLDialog):
|
||||||
item = None
|
item = None
|
||||||
@@ -1408,19 +1380,13 @@ class NextDialog(xbmcgui.WindowXMLDialog):
|
|||||||
self.progress_control = None
|
self.progress_control = None
|
||||||
|
|
||||||
# set info
|
# set info
|
||||||
f = filetools.file_open(INFO, 'r')
|
info = kwargs.get('item').infoLabels
|
||||||
full_info = f.read().split('\n')
|
|
||||||
full_info = full_info[1:]
|
|
||||||
f.close()
|
|
||||||
full_info = "".join(full_info)
|
|
||||||
info = jsontools.load(full_info)
|
|
||||||
info = info["infoLabels"]
|
|
||||||
if "fanart" in info: img = info["fanart"]
|
if "fanart" in info: img = info["fanart"]
|
||||||
elif "thumbnail" in info: img = info["thumbnail"]
|
elif "thumbnail" in info: img = info["thumbnail"]
|
||||||
else: img = filetools.join(config.get_runtime_path(), "resources", "noimage.png")
|
else: img = filetools.join(config.get_runtime_path(), "resources", "noimage.png")
|
||||||
self.setProperty("next_img", img)
|
self.setProperty("next_img", img)
|
||||||
self.setProperty("title", info["tvshowtitle"])
|
self.setProperty("title", info["tvshowtitle"])
|
||||||
self.setProperty("ep_title", "%dx%02d - %s" % (info["season"], info["episode"], info["title"]))
|
self.setProperty("ep_title", "{}x{:02d}. {}".format(info["season"], info["episode"], info["title"]))
|
||||||
self.show()
|
self.show()
|
||||||
|
|
||||||
def set_exit(self, EXIT):
|
def set_exit(self, EXIT):
|
||||||
|
|||||||
@@ -3369,7 +3369,7 @@ msgid "Server logo"
|
|||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
msgctxt "#70134"
|
msgctxt "#70134"
|
||||||
msgid "Intelligent Titles"
|
msgid "Format Titles"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
msgctxt "#70135"
|
msgctxt "#70135"
|
||||||
|
|||||||
@@ -3368,8 +3368,8 @@ msgid "Server logo"
|
|||||||
msgstr "Server logo"
|
msgstr "Server logo"
|
||||||
|
|
||||||
msgctxt "#70134"
|
msgctxt "#70134"
|
||||||
msgid "Intelligent Titles"
|
msgid "Format Titles"
|
||||||
msgstr "Titoli Intelligenti"
|
msgstr "Formatta Titoli"
|
||||||
|
|
||||||
msgctxt "#70135"
|
msgctxt "#70135"
|
||||||
msgid "Custom Colours"
|
msgid "Custom Colours"
|
||||||
|
|||||||
@@ -154,7 +154,7 @@
|
|||||||
<setting id="quick_menu" type="bool" label="60360" default="true"/>
|
<setting id="quick_menu" type="bool" label="60360" default="true"/>
|
||||||
<!-- <setting id="side_menu" type="bool" label="70737" default="false"/> -->
|
<!-- <setting id="side_menu" type="bool" label="70737" default="false"/> -->
|
||||||
<!-- <setting id="kod_menu" type="bool" label="60026" default="true"/>-->
|
<!-- <setting id="kod_menu" type="bool" label="60026" default="true"/>-->
|
||||||
<setting id="infoplus" type="bool" label="70151" default="false"/>
|
<setting id="infoplus" type="bool" label="70151" default="true"/>
|
||||||
<!-- <setting id="infoplus_set" type="bool" label="70128" visible="eq(-1,true)" default="false" subsetting="true"/> -->
|
<!-- <setting id="infoplus_set" type="bool" label="70128" visible="eq(-1,true)" default="false" subsetting="true"/> -->
|
||||||
<!-- <setting id="extended_info" type="bool" label="70152" default="false"/> -->
|
<!-- <setting id="extended_info" type="bool" label="70152" default="false"/> -->
|
||||||
<!-- Shortcut -->
|
<!-- Shortcut -->
|
||||||
@@ -168,5 +168,6 @@
|
|||||||
<setting id="enable_custom_theme" type="bool" label="70564" default="false"/>
|
<setting id="enable_custom_theme" type="bool" label="70564" default="false"/>
|
||||||
<setting id="custom_theme" type="folder" label="70565" default="" visible="eq(-1,true)"/>
|
<setting id="custom_theme" type="folder" label="70565" default="" visible="eq(-1,true)"/>
|
||||||
<setting id="video_thumbnail_type" type="select" label="70131" lvalues="70132|70133" default="1"/>
|
<setting id="video_thumbnail_type" type="select" label="70131" lvalues="70132|70133" default="1"/>
|
||||||
|
<setting id="format_title" type="bool" label="70134" default="true"/>
|
||||||
</category>
|
</category>
|
||||||
</settings>
|
</settings>
|
||||||
|
|||||||
@@ -286,7 +286,7 @@ def get_episodes(item):
|
|||||||
if config.get_setting('no_pile_on_seasons', 'videolibrary') == 2 or item.all:
|
if config.get_setting('no_pile_on_seasons', 'videolibrary') == 2 or item.all:
|
||||||
it.title = '{}x{}'.format(it.contentSeason, it.title)
|
it.title = '{}x{}'.format(it.contentSeason, it.title)
|
||||||
it = get_host(it)
|
it = get_host(it)
|
||||||
it.window = True if item.window_type == 1 or (config.get_setting("window_type") == 0) else False
|
it.window = True if item.window_type == 0 or (config.get_setting("window_type") == 0) else False
|
||||||
if it.window:
|
if it.window:
|
||||||
it.folder = False
|
it.folder = False
|
||||||
it.from_library = item.from_library
|
it.from_library = item.from_library
|
||||||
@@ -309,7 +309,9 @@ def findvideos(item):
|
|||||||
from core import autoplay
|
from core import autoplay
|
||||||
from platformcode import platformtools
|
from platformcode import platformtools
|
||||||
logger.debug()
|
logger.debug()
|
||||||
# support.dbg()
|
if config.get_setting('next_ep') == 3 and item.contentType != 'movie':
|
||||||
|
platformtools.prevent_busy(item)
|
||||||
|
item.window = True
|
||||||
|
|
||||||
videolibrarytools.check_renumber_options(item)
|
videolibrarytools.check_renumber_options(item)
|
||||||
itemlist = []
|
itemlist = []
|
||||||
@@ -415,6 +417,7 @@ def servers(item, ch, items):
|
|||||||
it.videolibrary_id = item.videolibrary_id
|
it.videolibrary_id = item.videolibrary_id
|
||||||
it.contentTitle = it.fulltitle = item.title
|
it.contentTitle = it.fulltitle = item.title
|
||||||
it.contentChannel = 'videolibrary'
|
it.contentChannel = 'videolibrary'
|
||||||
|
it.from_library = item.from_library
|
||||||
for item in getattr(channel, it.action)(it):
|
for item in getattr(channel, it.action)(it):
|
||||||
if item.server and item.channel:
|
if item.server and item.channel:
|
||||||
item.ch_name = ch_name
|
item.ch_name = ch_name
|
||||||
|
|||||||
Reference in New Issue
Block a user