- Fix per dispositivi lenti

- Aggiungi ai preferiti in ricerca globale
- Fix server in finestra Pop-Up
This commit is contained in:
Alhaziel01
2020-12-19 15:22:24 +01:00
parent 82fb4e75e6
commit 2b8c3f4d44
3 changed files with 44 additions and 39 deletions

View File

@@ -464,8 +464,7 @@ def play_from_library(item):
# logger.debug("item: \n" + item.tostring('\n'))
# Try to reproduce an image (this does nothing and also does not give an error)
xbmcplugin.setResolvedUrl(int(sys.argv[1]), True, xbmcgui.ListItem(path=os.path.join(config.get_runtime_path(), "resources", "kod.mp4")))
xbmc.Player().stop()
platformtools.prevent_busy(item)
# Modify the action (currently the video library needs "findvideos" since this is where the sources are searched
item.action = "findvideos"
@@ -485,12 +484,12 @@ def play_from_library(item):
itemlist = videolibrary.findvideos(item)
p_dialog.update(100, ''); sleep(0.5); p_dialog.close()
while platformtools.is_playing(): sleep(1)
# from core.support import dbg;dbg()
if item.contentType == 'movie': nfo_path = item.nfo
else: nfo_path = item.strm_path.replace('strm','nfo')
if nfo_path and filetools.isfile(nfo_path):
from core import videolibrarytools
head_nfo, item_nfo = videolibrarytools.read_nfo(nfo_path)
item_nfo.window = True
played_time = platformtools.get_played_time(item_nfo)
else: played_time = 0
@@ -505,27 +504,28 @@ def play_from_library(item):
if len(itemlist) > 0:
while not xbmc.Monitor().abortRequested():
# The user chooses the mirror
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, "r").read())['name']
if name.startswith('@'): name = config.get_localized_string(int(name.replace('@','')))
it = xbmcgui.ListItem('\n[B]%s[/B] %s - %s' % (name, quality, item.contentTitle))
it.setArt({'thumb':item.thumbnail})
options.append(it)
if not platformtools.is_playing():
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, "r").read())['name']
if name.startswith('@'): name = config.get_localized_string(int(name.replace('@','')))
it = xbmcgui.ListItem('\n[B]%s[/B] %s - %s' % (name, quality, item.contentTitle))
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:
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)
if (platformtools.is_playing() and item.action) or item.server == 'torrent' or config.get_setting('autoplay'): break
item = videolibrary.play(itemlist[selection + selection_implementation])[0]
platformtools.play_video(item)
# if (platformtools.is_playing() and item.action) or item.server == 'torrent' or config.get_setting('autoplay'): break

View File

@@ -555,6 +555,9 @@ def set_context_commands(item, item_url, parent_item, **kwargs):
# Add to kodfavoritos (My links)
if item.channel not in ["favorites", "videolibrary", "help", ""] and parent_item.channel != "favorites":
context_commands.append( (config.get_localized_string(70557), "RunPlugin(%s?%s&%s)" % (sys.argv[0], item_url, urllib.urlencode({'channel': "kodfavorites", 'action': "addFavourite", 'from_channel': item.channel, 'from_action': item.action}))))
# Add to kodfavoritos
if parent_item.channel == 'globalsearch':
context_commands.append( (config.get_localized_string(30155), "RunPlugin(%s?%s&%s)" % (sys.argv[0], item_url, urllib.urlencode({'channel': "favorites", 'action': "addFavourite", 'from_channel': item.channel, 'from_action': item.action}))))
# Search in other channels
if item.contentTitle and item.contentType in ['movie', 'tvshow'] and parent_item.channel != 'search' and item.action not in ['play'] and parent_item.action != 'mainlist':
@@ -1012,12 +1015,6 @@ def set_player(item, xlistitem, mediaurl, view, strm):
item.options = {'strm':False, 'continue':False}
# logger.debug("item:\n" + item.tostring('\n'))
# Prevent Busy
if not item.autoplay:
if item.globalsearch: xbmc.executebuiltin("PlayMedia(" + os.path.join(config.get_runtime_path(), "resources", "kod.mp4") + ")")
else: xbmcplugin.setResolvedUrl(int(sys.argv[1]), True, xbmcgui.ListItem(path=os.path.join(config.get_runtime_path(), "resources", "kod.mp4")))
xbmc.Player().stop()
# Moved del conector "torrent" here
if item.server == "torrent":
play_torrent(item, xlistitem, mediaurl)
@@ -1039,14 +1036,12 @@ def set_player(item, xlistitem, mediaurl, view, strm):
logger.info("mediaurl=" + mediaurl)
if player_mode in [0,1]:
prevent_busy(item)
logger.info('Player Mode:' + ['Direct', 'Bookmark'][player_mode])
# Add the listitem to a playlist
playlist = xbmc.PlayList(xbmc.PLAYLIST_VIDEO)
playlist.clear()
playlist.add(mediaurl, xlistitem)
# played_time = resume_playback(get_played_time(item))
# Reproduce
xbmc_player.play(playlist, xlistitem)
# viewed(item, played_time)
@@ -1441,3 +1436,12 @@ def set_played_time(item):
else: c.execute("INSERT INTO viewed (tmdb_id, episode, played_time) VALUES (?, ?, ?)", (ID, E, item.played_time))
conn.commit()
conn.close()
def prevent_busy(item):
logger.debug()
if not item.autoplay and not item.window:
if item.globalsearch: xbmc.Player().play(os.path.join(config.get_runtime_path(), "resources", "kod.mp4"))
else: xbmcplugin.setResolvedUrl(int(sys.argv[1]), True, xbmcgui.ListItem(path=os.path.join(config.get_runtime_path(), "resources", "kod.mp4")))
xbmc.sleep(500)
xbmc.Player().stop()
xbmc.sleep(500)

View File

@@ -1,7 +1,7 @@
# -*- coding: utf-8 -*-
import xbmc, xbmcgui, sys, channelselector, time, gc
from core.support import dbg, typo, tmdb
import xbmc, xbmcgui, sys, channelselector, time, os
from core.support import dbg, tmdb
from core.item import Item
from core import channeltools, servertools, scrapertools
from platformcode import platformtools, config, logger
@@ -329,7 +329,6 @@ class SearchWindow(xbmcgui.WindowXMLDialog):
def makeItem(self, url):
item = Item().fromurl(url)
logger.debug(item)
channelParams = channeltools.get_channel_parameters(item.channel)
thumb = item.thumbnail if item.thumbnail else 'Infoplus/' + item.contentType.replace('show', '') + '.png'
logger.info('THUMB', thumb)
@@ -434,7 +433,7 @@ class SearchWindow(xbmcgui.WindowXMLDialog):
self.PROGRESS = self.getControl(PROGRESS)
self.COUNT = self.getControl(COUNT)
self.MAINTITLE = self.getControl(MAINTITLE)
self.MAINTITLE.setText(typo(config.get_localized_string(30993).replace('...', '') % '"%s"' % self.item.text, 'bold'))
self.MAINTITLE.setText(config.get_localized_string(30993).replace('...', '') % '"%s"' % self.item.text)
self.SEARCH = self.getControl(SEARCH)
self.EPISODES = self.getControl(EPISODES)
self.EPISODESLIST = self.getControl(EPISODESLIST)
@@ -743,7 +742,9 @@ class SearchWindow(xbmcgui.WindowXMLDialog):
def playmonitor(self, server=None):
if server:
server.window = True
server.globalsearch = True
platformtools.prevent_busy(server)
run(server)
try:
while not xbmc.Player().getTime() > 0: