- 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
+26 -26
View File
@@ -464,8 +464,7 @@ def play_from_library(item):
# logger.debug("item: \n" + item.tostring('\n')) # logger.debug("item: \n" + item.tostring('\n'))
# Try to reproduce an image (this does nothing and also does not give an error) # 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"))) platformtools.prevent_busy(item)
xbmc.Player().stop()
# Modify the action (currently the video library needs "findvideos" since this is where the sources are searched # Modify the action (currently the video library needs "findvideos" since this is where the sources are searched
item.action = "findvideos" item.action = "findvideos"
@@ -485,12 +484,12 @@ def play_from_library(item):
itemlist = videolibrary.findvideos(item) itemlist = videolibrary.findvideos(item)
p_dialog.update(100, ''); sleep(0.5); p_dialog.close() p_dialog.update(100, ''); sleep(0.5); p_dialog.close()
while platformtools.is_playing(): sleep(1) while platformtools.is_playing(): sleep(1)
# from core.support import dbg;dbg()
if item.contentType == 'movie': nfo_path = item.nfo if item.contentType == 'movie': nfo_path = item.nfo
else: nfo_path = item.strm_path.replace('strm','nfo') else: nfo_path = item.strm_path.replace('strm','nfo')
if nfo_path and filetools.isfile(nfo_path): if nfo_path and filetools.isfile(nfo_path):
from core import videolibrarytools from core import videolibrarytools
head_nfo, item_nfo = videolibrarytools.read_nfo(nfo_path) head_nfo, item_nfo = videolibrarytools.read_nfo(nfo_path)
item_nfo.window = True
played_time = platformtools.get_played_time(item_nfo) played_time = platformtools.get_played_time(item_nfo)
else: played_time = 0 else: played_time = 0
@@ -505,27 +504,28 @@ def play_from_library(item):
if len(itemlist) > 0: if len(itemlist) > 0:
while not xbmc.Monitor().abortRequested(): while not xbmc.Monitor().abortRequested():
# The user chooses the mirror # The user chooses the mirror
options = [] if not platformtools.is_playing():
selection_implementation = 0 options = []
for item in itemlist: selection_implementation = 0
item.thumbnail = config.get_online_server_thumb(item.server) for item in itemlist:
quality = '[B][' + item.quality + '][/B]' if item.quality else '' item.thumbnail = config.get_online_server_thumb(item.server)
if item.server: quality = '[B][' + item.quality + '][/B]' if item.quality else ''
path = filetools.join(config.get_runtime_path(), 'servers', item.server.lower() + '.json') if item.server:
name = jsontools.load(open(path, "r").read())['name'] path = filetools.join(config.get_runtime_path(), 'servers', item.server.lower() + '.json')
if name.startswith('@'): name = config.get_localized_string(int(name.replace('@',''))) name = jsontools.load(open(path, "r").read())['name']
it = xbmcgui.ListItem('\n[B]%s[/B] %s - %s' % (name, quality, item.contentTitle)) if name.startswith('@'): name = config.get_localized_string(int(name.replace('@','')))
it.setArt({'thumb':item.thumbnail}) it = xbmcgui.ListItem('\n[B]%s[/B] %s - %s' % (name, quality, item.contentTitle))
options.append(it) 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: else:
selection_implementation += 1 item = videolibrary.play(itemlist[selection + selection_implementation])[0]
# The selection window opens platformtools.play_video(item)
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))) # if (platformtools.is_playing() and item.action) or item.server == 'torrent' or config.get_setting('autoplay'): break
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
+13 -9
View File
@@ -555,6 +555,9 @@ def set_context_commands(item, item_url, parent_item, **kwargs):
# Add to kodfavoritos (My links) # Add to kodfavoritos (My links)
if item.channel not in ["favorites", "videolibrary", "help", ""] and parent_item.channel != "favorites": 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})))) 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 # 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': 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} item.options = {'strm':False, 'continue':False}
# logger.debug("item:\n" + item.tostring('\n')) # 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 # Moved del conector "torrent" here
if item.server == "torrent": if item.server == "torrent":
play_torrent(item, xlistitem, mediaurl) play_torrent(item, xlistitem, mediaurl)
@@ -1039,14 +1036,12 @@ def set_player(item, xlistitem, mediaurl, view, strm):
logger.info("mediaurl=" + mediaurl) logger.info("mediaurl=" + mediaurl)
if player_mode in [0,1]: if player_mode in [0,1]:
prevent_busy(item)
logger.info('Player Mode:' + ['Direct', 'Bookmark'][player_mode]) logger.info('Player Mode:' + ['Direct', 'Bookmark'][player_mode])
# Add the listitem to a playlist # Add the listitem to a playlist
playlist = xbmc.PlayList(xbmc.PLAYLIST_VIDEO) playlist = xbmc.PlayList(xbmc.PLAYLIST_VIDEO)
playlist.clear() playlist.clear()
playlist.add(mediaurl, xlistitem) playlist.add(mediaurl, xlistitem)
# played_time = resume_playback(get_played_time(item))
# Reproduce # Reproduce
xbmc_player.play(playlist, xlistitem) xbmc_player.play(playlist, xlistitem)
# viewed(item, played_time) # 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)) else: c.execute("INSERT INTO viewed (tmdb_id, episode, played_time) VALUES (?, ?, ?)", (ID, E, item.played_time))
conn.commit() conn.commit()
conn.close() 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)
+5 -4
View File
@@ -1,7 +1,7 @@
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
import xbmc, xbmcgui, sys, channelselector, time, gc import xbmc, xbmcgui, sys, channelselector, time, os
from core.support import dbg, typo, tmdb from core.support import dbg, tmdb
from core.item import Item from core.item import Item
from core import channeltools, servertools, scrapertools from core import channeltools, servertools, scrapertools
from platformcode import platformtools, config, logger from platformcode import platformtools, config, logger
@@ -329,7 +329,6 @@ class SearchWindow(xbmcgui.WindowXMLDialog):
def makeItem(self, url): def makeItem(self, url):
item = Item().fromurl(url) item = Item().fromurl(url)
logger.debug(item)
channelParams = channeltools.get_channel_parameters(item.channel) channelParams = channeltools.get_channel_parameters(item.channel)
thumb = item.thumbnail if item.thumbnail else 'Infoplus/' + item.contentType.replace('show', '') + '.png' thumb = item.thumbnail if item.thumbnail else 'Infoplus/' + item.contentType.replace('show', '') + '.png'
logger.info('THUMB', thumb) logger.info('THUMB', thumb)
@@ -434,7 +433,7 @@ class SearchWindow(xbmcgui.WindowXMLDialog):
self.PROGRESS = self.getControl(PROGRESS) self.PROGRESS = self.getControl(PROGRESS)
self.COUNT = self.getControl(COUNT) self.COUNT = self.getControl(COUNT)
self.MAINTITLE = self.getControl(MAINTITLE) 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.SEARCH = self.getControl(SEARCH)
self.EPISODES = self.getControl(EPISODES) self.EPISODES = self.getControl(EPISODES)
self.EPISODESLIST = self.getControl(EPISODESLIST) self.EPISODESLIST = self.getControl(EPISODESLIST)
@@ -743,7 +742,9 @@ class SearchWindow(xbmcgui.WindowXMLDialog):
def playmonitor(self, server=None): def playmonitor(self, server=None):
if server: if server:
server.window = True
server.globalsearch = True server.globalsearch = True
platformtools.prevent_busy(server)
run(server) run(server)
try: try:
while not xbmc.Player().getTime() > 0: while not xbmc.Player().getTime() > 0: