Possibile Fix Episodio Successivo

This commit is contained in:
Alhaziel01
2022-07-05 11:59:08 +02:00
parent 005236f52e
commit 2198e6a8a8
2 changed files with 22 additions and 19 deletions
+2 -4
View File
@@ -3,7 +3,7 @@
# XBMC Launcher (xbmc / kodi) # XBMC Launcher (xbmc / kodi)
# ------------------------------------------------------------ # ------------------------------------------------------------
import sys import sys, xbmc
from core.item import Item from core.item import Item
from core import filetools from core import filetools
from platformcode import config, logger, platformtools from platformcode import config, logger, platformtools
@@ -86,7 +86,6 @@ def run(item=None):
elif item.action == "open_browser": elif item.action == "open_browser":
import webbrowser import webbrowser
if not webbrowser.open(item.url): if not webbrowser.open(item.url):
import xbmc
if xbmc.getCondVisibility('system.platform.linux') and xbmc.getCondVisibility('system.platform.android'): # android if xbmc.getCondVisibility('system.platform.linux') and xbmc.getCondVisibility('system.platform.android'): # android
xbmc.executebuiltin('StartAndroidActivity("", "android.intent.action.VIEW", "", "%s")' % item.url) xbmc.executebuiltin('StartAndroidActivity("", "android.intent.action.VIEW", "", "%s")' % item.url)
else: else:
@@ -96,7 +95,6 @@ def run(item=None):
elif item.action == "gotopage": elif item.action == "gotopage":
page = platformtools.dialog_numeric(0, config.get_localized_string(70513)) page = platformtools.dialog_numeric(0, config.get_localized_string(70513))
if page: if page:
import xbmc
item.action = item.real_action item.action = item.real_action
if item.page: if item.page:
item.page = int(page) item.page = int(page)
@@ -184,6 +182,7 @@ def run(item=None):
finally: finally:
# 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
xbmc.sleep(100)
db.close() db.close()
import threading import threading
logger.debug(threading.enumerate()) logger.debug(threading.enumerate())
@@ -374,7 +373,6 @@ def actions(item):
if not token_auth: if not token_auth:
trakt_tools.auth_trakt() trakt_tools.auth_trakt()
else: else:
import xbmc
if not xbmc.getCondVisibility('System.HasAddon(script.trakt)') and config.get_setting('install_trakt'): if not xbmc.getCondVisibility('System.HasAddon(script.trakt)') and config.get_setting('install_trakt'):
trakt_tools.ask_install_script() trakt_tools.ask_install_script()
itemlist = trakt_tools.trakt_check(itemlist) itemlist = trakt_tools.trakt_check(itemlist)
+20 -15
View File
@@ -42,8 +42,10 @@ def mark_auto_as_watched(item):
next_dialogs = ['NextDialog.xml', 'NextDialogExtended.xml', 'NextDialogCompact.xml'] next_dialogs = ['NextDialog.xml', 'NextDialogExtended.xml', 'NextDialogCompact.xml']
next_ep_type = config.get_setting('next_ep_type') next_ep_type = config.get_setting('next_ep_type')
ND = next_dialogs[next_ep_type] ND = next_dialogs[next_ep_type]
try: next_episode = next_ep(item) try:
except: next_episode = False next_episode = next_ep(item)
except:
next_episode = False
logger.debug(next_episode) logger.debug(next_episode)
while not xbmc.Monitor().abortRequested(): while not xbmc.Monitor().abortRequested():
@@ -1333,39 +1335,39 @@ def next_ep(item):
item.next_ep = False item.next_ep = False
# check if next file exist # 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)) base_path = filetools.basename(filetools.dirname(item.strm_path))
path = filetools.join(config.get_videolibrary_path(), config.get_setting("folder_tvshows"),base_path) path = filetools.join(config.get_videolibrary_path(), config.get_setting("folder_tvshows"),base_path)
fileList = [] fileList = []
for file in filetools.listdir(path): for file in filetools.listdir(path):
if file.endswith('.strm'): if file.endswith('.strm'):
fileList.append(file) fileList.append(file.replace('.strm', ''))
fileList.sort()
fileList.sort(key=lambda ep: (int(ep.split('x')[0]), int(ep.split('x')[1])))
nextIndex = fileList.index(current_filename) + 1 nextIndex = fileList.index(current_filename) + 1
if nextIndex == 0 or nextIndex == len(fileList): next_file = None 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)) logger.debug('Next File:' + str(next_file))
# start next episode window afther x time # start next episode window afther x time
if next_file: if next_file:
season_ep = next_file.split('.')[0] season = int(next_file.split('x')[0])
season = season_ep.split('x')[0] episode = int(next_file.split('x')[1])
episode = season_ep.split('x')[1] # next_ep = '%sx%s' % (season, episode)
next_ep = '%sx%s' % (season, episode)
item = Item( item = Item(
action= 'play_from_library', action= 'play_from_library',
channel= 'videolibrary', channel= 'videolibrary',
contentEpisodeNumber= episode, contentEpisodeNumber= episode,
contentSeason= season, contentSeason= season,
contentTitle= next_ep, contentTitle= next_file,
contentType= 'episode', contentType= 'episode',
infoLabels= {'episode': episode, 'mediatype': 'episode', 'season': season, 'title': next_ep}, infoLabels= {'episode': episode, 'mediatype': 'episode', 'season': season, 'title': next_file},
strm_path= filetools.join(base_path, next_file), strm_path= filetools.join(base_path, next_file + '.strm'),
play_from = item.play_from) play_from = item.play_from)
global INFO global INFO
INFO = filetools.join(path, next_file.replace("strm", "nfo")) INFO = filetools.join(path, next_file + '.nfo')
else: else:
item=None item=None
@@ -1394,7 +1396,10 @@ class NextDialog(xbmcgui.WindowXMLDialog):
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.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() self.show()
def set_exit(self, EXIT): def set_exit(self, EXIT):