Fix per dispositivi lenti

This commit is contained in:
Alhaziel01
2020-12-19 11:18:24 +01:00
parent d8592bc0ba
commit 2489e8ed6c
3 changed files with 16 additions and 16 deletions
+2 -3
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
+9 -9
View File
@@ -1012,12 +1012,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 +1033,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 +1433,11 @@ 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()
+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: