- Migliorie Videoteca

- Finestra selezione server
 - Fix Autorenumber (sincronizzazione fra videoteca a canali)
 - Fix Autoplay
This commit is contained in:
Alhaziel01
2021-05-29 18:17:40 +02:00
parent dc2140f2ca
commit 01059eb373
10 changed files with 564 additions and 488 deletions

View File

@@ -94,7 +94,7 @@ def start(itemlist, item=None):
if item.channel in ['autorenumber']:
item.channel = item.from_channel
item.action = item.from_action
item.renumber = True
item.setrenumber = True
busy(True)
itemlist = find_episodes(item)
busy(False)
@@ -114,11 +114,12 @@ class autorenumber():
if match(self.itemlist[0].title, patron=r'[Ss]?(\d+)(?:x|_|\s+)[Ee]?[Pp]?(\d+)').match:
item.exit = True
return
elif self.item.channel in self.item.channel_prefs and RENUMBER in self.item.channel_prefs[item.channel] and self.title not in self.renumberdict:
elif (self.item.channel in self.item.channel_prefs and RENUMBER in self.item.channel_prefs[item.channel] and self.title not in self.renumberdict) or self.item.renumber:
from core.videolibrarytools import check_renumber_options
from specials.videolibrary import update_videolibrary
check_renumber_options(self.item)
update_videolibrary(self.item)
self.series = self.renumberdict.get(self.title,{})
self.id = self.series.get(ID, 0)
self.episodes = self.series.get(EPISODES,{})
@@ -128,9 +129,9 @@ class autorenumber():
self.manual = self.series.get(MANUALMODE, False)
self.specials = self.series.get(SPECIALEPISODES, {})
if self.id and self.episodes and self.season >= 0 and self.episode >= 0:
if self.item.renumber: self.config()
if self.item.setrenumber: self.config()
else:self.renumber()
elif self.auto or self.item.renumber:
elif self.auto or self.item.setrenumber:
self.episodes = {}
self.config()
else:
@@ -161,7 +162,7 @@ class autorenumber():
else:self.item = platformtools.dialog_info(self.item, 'tmdb')
# Rinumerazione Automatica
if (not self.id and self.auto) or self.item.renumber:
if (not self.id and self.auto) or self.item.setrenumber:
self.id = self.item.infoLabels['tmdb_id'] if 'tmdb_id' in self.item.infoLabels else 0
if self.id:
self.series = {ID: self.id}
@@ -183,7 +184,7 @@ class autorenumber():
item.title = '{} - {}'.format(typo(self.episodes[number], 'bold'), item.title)
item.contentSeason = int(self.episodes[number].split('x')[0])
item.contentEpisodeNumber = int(self.episodes[number].split('x')[1])
if not self.item.renumber and self.itemlist:
if not self.item.setrenumber and self.itemlist:
with futures.ThreadPoolExecutor() as executor:
renumber_list = [executor.submit(sub_thread, item,) for item in self.itemlist]
@@ -225,8 +226,8 @@ class autorenumber():
count += 1
self.epdict[count] = '{}x{:02d}'.format(s, e + fe - 1)
if self.item.renumber or self.manual:
self.item.renumber = False
if self.item.setrenumber or self.manual:
self.item.setrenumber = False
self.season, self.episode, self.manual, self.specials, Manual, Exit = SelectreNumeration(self, itemlist)
if Exit:
self.item.exit = True

View File

@@ -446,13 +446,11 @@ def play_from_library(item):
# logger.debug("item: \n" + item.tostring('\n'))
# from core.support import dbg; dbg()
import xbmc
import xbmc, xbmcgui, xbmcplugin
item.window_type = config.get_setting("window_type", "videolibrary") if config.get_setting('next_ep') < 3 and item.contentType != 'movie' else 1
xbmc.Player().stop()
xbmcplugin.setResolvedUrl(int(sys.argv[1]), True, xbmcgui.ListItem(path=os.path.join(config.get_runtime_path(), "resources", "kod.mp4")))
if xbmc.getCondVisibility('Window.IsMedia') and not item.window_type == 1:
import xbmcgui, xbmcplugin
xbmcplugin.setResolvedUrl(int(sys.argv[1]), True, xbmcgui.ListItem(path=os.path.join(config.get_runtime_path(), "resources", "kod.mp4")))
xbmc.Player().stop()
if item.contentType == 'episode':
it = videolibrarydb.videolibrarydb[item.contentType][item.videolibrary_id]['{}x{:02d}'.format(item.infoLabels['season'], item.infoLabels['episode'])]
else:
@@ -461,82 +459,3 @@ def play_from_library(item):
videolibrarydb.videolibrarydb.close()
else:
return videolibrary.findvideos(item)
# else:
# xbmc.executebuiltin('ActivateWindow(10025,' + sys.argv[0] + "?" + item.tourl() + ")")
# itemlist = videolibrary.findvideos(it)
# platformtools.render_items(itemlist, item)
# itemlist=[]
# item.fromLibrary = True
# item.window = True
# logger.debug()
# # Modify the action (currently the video library needs "findvideos" since this is where the sources are searched
# item.action = "findvideos"
# window_type = config.get_setting("window_type", "videolibrary") if config.get_setting('next_ep') < 3 and item.contentType != 'movie' else 1
# # and launch kodi again
# if xbmc.getCondVisibility('Window.IsMedia') and not window_type == 1:
# xbmc.executebuiltin("Container.Update(" + sys.argv[0] + "?" + item.tourl() + ")")
# else:
# # Pop-up window
# from specials import videolibrary
# from core.channeltools import get_channel_parameters
# p_dialog = platformtools.dialog_progress_bg(config.get_localized_string(20000), config.get_localized_string(60683))
# p_dialog.update(0, '')
# item.play_from = 'window'
# itemlist = videolibrary.findvideos(item)
# p_dialog.update(100, ''); sleep(0.5); p_dialog.close()
# played = False
# # The number of links to show is limited
# if config.get_setting("max_links", "videolibrary") != 0: itemlist = limit_itemlist(itemlist)
# # The list of links is slightly "cleaned"
# if config.get_setting("replace_VD", "videolibrary") == 1: itemlist = reorder_itemlist(itemlist)
# # from core.support import dbg;dbg()
# if len(itemlist) > 0:
# reopen = False
# # from core.support import dbg;dbg()
# while not xbmc.Monitor().abortRequested():
# played = True
# # if config.get_setting('next_ep') == 3 and xbmc.Player().playnext:
# # return
# # The user chooses the mirror
# if not platformtools.is_playing():
# if config.get_setting('next_ep') == 3:
# xbmc.sleep(500)
# if platformtools.is_playing():
# return
# # if config.get_setting('autoplay') or reopen:
# # played_time = get_played_time(item)
# # if not played_time and played:
# # return
# options = []
# selection_implementation = 0
# for item in itemlist:
# item.thumbnail = config.get_online_server_thumb(item.server)
# quality = '[B][' + item.quality + '][/B]' if item.quality else ''
# if item.server:
# path = filetools.join(config.get_runtime_path(), 'servers', item.server.lower() + '.json')
# name = jsontools.load(open(path, "rb").read())['name']
# if name.startswith('@'): name = config.get_localized_string(int(name.replace('@','')))
# it = xbmcgui.ListItem('\n[B]%s[/B] %s - %s [%s]' % (name, quality, item.contentTitle, get_channel_parameters(item.channel).get('title', '')))
# it.setArt({'thumb':item.thumbnail})
# options.append(it)
# else:
# selection_implementation += 1
# # The selection window opens
# if (item.contentSerieName and item.contentSeason and item.contentEpisodeNumber): head = ("%s - %sx%s | %s" % (item.contentSerieName, item.contentSeason, item.contentEpisodeNumber, config.get_localized_string(30163)))
# else: head = config.get_localized_string(30163)
# selection = platformtools.dialog_select(head, options, preselect= -1, useDetails=True)
# if selection == -1:
# return
# else:
# item = videolibrary.play(itemlist[selection + selection_implementation])[0]
# platformtools.play_video(item)
# reopen = True
# if (platformtools.is_playing() and item.action) or item.server == 'torrent' or config.get_setting('autoplay'): break

View File

@@ -744,7 +744,7 @@ def play_video(item, strm=False, force_direct=False, autoplay=False):
xlistitem.setProperty("inputstream.adaptive.license_key", item.license)
xlistitem.setMimeType('application/dash+xml')
if force_direct: item.play_from = 'window'
if force_direct: item.window = True
set_player(item, xlistitem, mediaurl, view, strm)
return True
@@ -1085,7 +1085,6 @@ def get_video_seleccionado(item, seleccion, video_urls, autoplay=False):
def set_player(item, xlistitem, mediaurl, view, strm):
logger.debug()
# from core.support import dbg;dbg()
item.options = {'strm':False}
# logger.debug("item:\n" + item.tostring('\n'))

View File

@@ -95,10 +95,12 @@ def mark_auto_as_watched(item):
while platformtools.is_playing():
xbmc.sleep(100)
if not show_server and item.play_from != 'window' and not item.no_return:
if not show_server and not item.window and not item.no_return:
xbmc.sleep(700)
xbmc.executebuiltin('Action(ParentDir)')
# xbmc.sleep(500)
else:
videolibrary.serverwindow.close()
if marked:
from specials import videolibrary
@@ -1384,7 +1386,7 @@ def next_ep(item):
contentType= 'episode',
infoLabels= {'episode': episode, 'mediatype': 'episode', 'season': season, 'title': next_ep},
strm_path= filetools.join(base_path, next_file),
play_from = item.play_from)
window = item.window)
global INFO
INFO = filetools.join(path, next_file.replace("strm", "nfo"))