Possibile Fix Episodio Successivo
This commit is contained in:
@@ -3,7 +3,7 @@
|
||||
# XBMC Launcher (xbmc / kodi)
|
||||
# ------------------------------------------------------------
|
||||
|
||||
import sys
|
||||
import sys, xbmc
|
||||
from core.item import Item
|
||||
from core import filetools
|
||||
from platformcode import config, logger, platformtools
|
||||
@@ -86,7 +86,6 @@ def run(item=None):
|
||||
elif item.action == "open_browser":
|
||||
import webbrowser
|
||||
if not webbrowser.open(item.url):
|
||||
import xbmc
|
||||
if xbmc.getCondVisibility('system.platform.linux') and xbmc.getCondVisibility('system.platform.android'): # android
|
||||
xbmc.executebuiltin('StartAndroidActivity("", "android.intent.action.VIEW", "", "%s")' % item.url)
|
||||
else:
|
||||
@@ -96,7 +95,6 @@ def run(item=None):
|
||||
elif item.action == "gotopage":
|
||||
page = platformtools.dialog_numeric(0, config.get_localized_string(70513))
|
||||
if page:
|
||||
import xbmc
|
||||
item.action = item.real_action
|
||||
if item.page:
|
||||
item.page = int(page)
|
||||
@@ -184,6 +182,7 @@ def run(item=None):
|
||||
finally:
|
||||
# db need to be closed when not used, it will cause freezes
|
||||
from core import db
|
||||
xbmc.sleep(100)
|
||||
db.close()
|
||||
import threading
|
||||
logger.debug(threading.enumerate())
|
||||
@@ -374,7 +373,6 @@ def actions(item):
|
||||
if not token_auth:
|
||||
trakt_tools.auth_trakt()
|
||||
else:
|
||||
import xbmc
|
||||
if not xbmc.getCondVisibility('System.HasAddon(script.trakt)') and config.get_setting('install_trakt'):
|
||||
trakt_tools.ask_install_script()
|
||||
itemlist = trakt_tools.trakt_check(itemlist)
|
||||
|
||||
@@ -42,8 +42,10 @@ def mark_auto_as_watched(item):
|
||||
next_dialogs = ['NextDialog.xml', 'NextDialogExtended.xml', 'NextDialogCompact.xml']
|
||||
next_ep_type = config.get_setting('next_ep_type')
|
||||
ND = next_dialogs[next_ep_type]
|
||||
try: next_episode = next_ep(item)
|
||||
except: next_episode = False
|
||||
try:
|
||||
next_episode = next_ep(item)
|
||||
except:
|
||||
next_episode = False
|
||||
logger.debug(next_episode)
|
||||
|
||||
while not xbmc.Monitor().abortRequested():
|
||||
@@ -1333,39 +1335,39 @@ def next_ep(item):
|
||||
item.next_ep = False
|
||||
|
||||
# check if next file exist
|
||||
current_filename = filetools.basename(item.strm_path)
|
||||
current_filename = filetools.basename(item.strm_path).replace('.strm', '')
|
||||
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()
|
||||
fileList.append(file.replace('.strm', ''))
|
||||
|
||||
fileList.sort(key=lambda ep: (int(ep.split('x')[0]), int(ep.split('x')[1])))
|
||||
|
||||
nextIndex = fileList.index(current_filename) + 1
|
||||
if nextIndex == 0 or nextIndex == len(fileList): next_file = None
|
||||
else: next_file = fileList[nextIndex]
|
||||
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)
|
||||
season = int(next_file.split('x')[0])
|
||||
episode = int(next_file.split('x')[1])
|
||||
# next_ep = '%sx%s' % (season, episode)
|
||||
item = Item(
|
||||
action= 'play_from_library',
|
||||
channel= 'videolibrary',
|
||||
contentEpisodeNumber= episode,
|
||||
contentSeason= season,
|
||||
contentTitle= next_ep,
|
||||
contentTitle= next_file,
|
||||
contentType= 'episode',
|
||||
infoLabels= {'episode': episode, 'mediatype': 'episode', 'season': season, 'title': next_ep},
|
||||
strm_path= filetools.join(base_path, next_file),
|
||||
infoLabels= {'episode': episode, 'mediatype': 'episode', 'season': season, 'title': next_file},
|
||||
strm_path= filetools.join(base_path, next_file + '.strm'),
|
||||
play_from = item.play_from)
|
||||
|
||||
global INFO
|
||||
INFO = filetools.join(path, next_file.replace("strm", "nfo"))
|
||||
INFO = filetools.join(path, next_file + '.nfo')
|
||||
else:
|
||||
item=None
|
||||
|
||||
@@ -1394,7 +1396,10 @@ class NextDialog(xbmcgui.WindowXMLDialog):
|
||||
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.get("title",'')))
|
||||
ep_title = f'{info["season"]}x{info["episode"]:02d}'
|
||||
if info.get("title",''):
|
||||
ep_title += f' - {info["title"]}'
|
||||
self.setProperty("ep_title", ep_title)
|
||||
self.show()
|
||||
|
||||
def set_exit(self, EXIT):
|
||||
|
||||
Reference in New Issue
Block a user