diff --git a/core/support.py b/core/support.py
index 077efd3d..4c552ec4 100755
--- a/core/support.py
+++ b/core/support.py
@@ -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
it.action = function
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
# for lg in list(set(listGroups).difference(known_keys)):
# 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):
# 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
-
+ # videoitem = item.clone()
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.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.action = "play"
videoitem.videolibrary_id = item.videolibrary_id
+ videoitem.from_library = item.from_library
return videoitem
# non threaded for webpdb
diff --git a/platformcode/launcher.py b/platformcode/launcher.py
index 2c854949..3a12529f 100644
--- a/platformcode/launcher.py
+++ b/platformcode/launcher.py
@@ -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
xbmcplugin.setResolvedUrl(int(sys.argv[1]), True, xbmcgui.ListItem(path=os.path.join(config.get_runtime_path(), "resources", "kod.mp4")))
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':
- 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:
it = videolibrarydb.videolibrarydb[item.contentType][item.videolibrary_id]['item']
- xbmc.executebuiltin("Container.Update(" + sys.argv[0] + "?" + it.tourl() + ")")
+ it.from_library = True
+ xbmc.executebuiltin("Container.Update(" + sys.argv[0] + "?" + it.tourl() + ")")
videolibrarydb.videolibrarydb.close()
else:
+ item.window = True
return videolibrary.findvideos(item)
diff --git a/platformcode/platformtools.py b/platformcode/platformtools.py
index 1f673268..213eb192 100644
--- a/platformcode/platformtools.py
+++ b/platformcode/platformtools.py
@@ -366,7 +366,7 @@ def render_items(itemlist, parent_item):
title = item.title
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:
episode = '{}x{:02d}'.format(item.contentSeason, item.contentEpisodeNumber)
elif type(item.contentEpisodeNumber) == int:
@@ -377,7 +377,7 @@ def render_items(itemlist, parent_item):
if episode: title = '{}. {}'.format(episode, title)
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 ''
quality = typo(item.quality, '_ [] color kod') if item.quality 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)
# 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
from platformcode import xbmc_videolibrary
xbmc_videolibrary.mark_auto_as_watched(item)
@@ -1460,16 +1460,13 @@ def add_next_to_playlist(item):
from core import filetools, videolibrarytools
from platformcode import xbmc_videolibrary
def add_to_playlist(item):
- if item.contentType != 'movie' and item.strm_path:
+ if item.contentType != 'movie':
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)
+ nextItem = xbmcgui.ListItem(path=next.url)
+ nextItem.setArt({"thumb": next.contentThumbnail if next.contentThumbnail else next.thumbnail})
+ set_infolabels(nextItem, next, True)
nexturl = "plugin://plugin.video.kod/?" + next.tourl()
playlist = xbmc.PlayList(xbmc.PLAYLIST_VIDEO)
playlist.add(nexturl, nextItem)
@@ -1861,7 +1858,16 @@ def serverwindow(item, itemlist):
name = jsontools.load(open(path, "rb").read())['name']
if name.startswith('@'): name = config.get_localized_string(int(name.replace('@','')))
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})
self.servers.append(it)
self.doModal()
diff --git a/platformcode/xbmc_videolibrary.py b/platformcode/xbmc_videolibrary.py
index 78fad40d..00208fc5 100644
--- a/platformcode/xbmc_videolibrary.py
+++ b/platformcode/xbmc_videolibrary.py
@@ -15,7 +15,7 @@ if PY3:
else:
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 core import scrapertools
from xml.dom import minidom
@@ -75,8 +75,8 @@ def mark_auto_as_watched(item):
break
# check for next Episode
- if next_episode and sync and time_from_end >= difference:
- nextdialog = NextDialog(ND, config.get_runtime_path())
+ if next_episode and marked and time_from_end >= difference:
+ nextdialog = NextDialog(ND, config.get_runtime_path(), item=next_episode)
while platformtools.is_playing() and not nextdialog.is_exit():
xbmc.sleep(100)
if nextdialog.continuewatching:
@@ -106,8 +106,8 @@ def mark_auto_as_watched(item):
videolibrary.mark_content_as_watched(item)
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)
+ from platformcode.launcher import run
+ run(next_episode)
# db need to be closed when not used, it will cause freezes
from core import db
@@ -1354,48 +1354,20 @@ def ask_set_content(silent=False):
def next_ep(item):
- from core.item import Item
- logger.debug()
- item.next_ep = False
+ logger.debug(item)
+ episode = '{}x{:02d}'.format(item.contentSeason, item.contentEpisodeNumber)
+ episodes = sorted(videolibrarydb.videolibrarydb['episode'][item.videolibrary_id].items())
+ videolibrarydb.videolibrarydb.close()
- # check if next file exist
- current_filename = filetools.basename(item.strm_path)
- base_path = filetools.basename(filetools.dirname(item.strm_path))
- 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"))
+ nextIndex = [k for k, v in episodes].index(episode) + 1
+ if nextIndex == 0 or nextIndex == len(episodes):
+ it = None
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):
item = None
@@ -1408,19 +1380,13 @@ class NextDialog(xbmcgui.WindowXMLDialog):
self.progress_control = None
# set info
- f = filetools.file_open(INFO, 'r')
- 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"]
+ info = kwargs.get('item').infoLabels
if "fanart" in info: img = info["fanart"]
elif "thumbnail" in info: img = info["thumbnail"]
else: img = filetools.join(config.get_runtime_path(), "resources", "noimage.png")
self.setProperty("next_img", img)
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()
def set_exit(self, EXIT):
diff --git a/resources/language/resource.language.en_gb/strings.po b/resources/language/resource.language.en_gb/strings.po
index 1edb251e..5f31a094 100644
--- a/resources/language/resource.language.en_gb/strings.po
+++ b/resources/language/resource.language.en_gb/strings.po
@@ -3369,7 +3369,7 @@ msgid "Server logo"
msgstr ""
msgctxt "#70134"
-msgid "Intelligent Titles"
+msgid "Format Titles"
msgstr ""
msgctxt "#70135"
diff --git a/resources/language/resource.language.it_it/strings.po b/resources/language/resource.language.it_it/strings.po
index 4997c968..2b670d9d 100644
--- a/resources/language/resource.language.it_it/strings.po
+++ b/resources/language/resource.language.it_it/strings.po
@@ -3368,8 +3368,8 @@ msgid "Server logo"
msgstr "Server logo"
msgctxt "#70134"
-msgid "Intelligent Titles"
-msgstr "Titoli Intelligenti"
+msgid "Format Titles"
+msgstr "Formatta Titoli"
msgctxt "#70135"
msgid "Custom Colours"
diff --git a/resources/settings.xml b/resources/settings.xml
index 656fd98e..bdd935c6 100644
--- a/resources/settings.xml
+++ b/resources/settings.xml
@@ -154,7 +154,7 @@
-
+
@@ -168,5 +168,6 @@
+
diff --git a/specials/videolibrary.py b/specials/videolibrary.py
index 52c19394..426f7fa2 100644
--- a/specials/videolibrary.py
+++ b/specials/videolibrary.py
@@ -286,7 +286,7 @@ def get_episodes(item):
if config.get_setting('no_pile_on_seasons', 'videolibrary') == 2 or item.all:
it.title = '{}x{}'.format(it.contentSeason, it.title)
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:
it.folder = False
it.from_library = item.from_library
@@ -309,7 +309,9 @@ def findvideos(item):
from core import autoplay
from platformcode import platformtools
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)
itemlist = []
@@ -415,6 +417,7 @@ def servers(item, ch, items):
it.videolibrary_id = item.videolibrary_id
it.contentTitle = it.fulltitle = item.title
it.contentChannel = 'videolibrary'
+ it.from_library = item.from_library
for item in getattr(channel, it.action)(it):
if item.server and item.channel:
item.ch_name = ch_name