Añadir opción para reduir el item en context
Se añade una opción que permite activar o desactivar (por defecto desactivado) la posibilidad de generar Items con menos elementos en el método de set_context_menu. Esto genera un speedup considerable (aprox 2x) y parece que no daña mucho las funcionalidades actuales al realizar este filtrado.
This commit is contained in:
@@ -372,6 +372,44 @@ def set_context_commands(item, parent_item):
|
||||
else:
|
||||
context = []
|
||||
|
||||
if config.get_setting("faster_item_serialization"):
|
||||
# logger.info("Reducing serialization!")
|
||||
itemBK = item
|
||||
item = Item()
|
||||
item.action = itemBK.action
|
||||
item.channel = itemBK.channel
|
||||
infoLabels = {}
|
||||
if itemBK.infoLabels["year"]: infoLabels["year"] = itemBK.infoLabels["year"]
|
||||
if itemBK.infoLabels["imdb_id"]: infoLabels["imdb_id"] = itemBK.infoLabels["imdb_id"]
|
||||
if itemBK.infoLabels["tmdb_id"]: infoLabels["tmdb_id"] = itemBK.infoLabels["tmdb_id"]
|
||||
if itemBK.infoLabels["tvdb_id"]: infoLabels["tvdb_id"] = itemBK.infoLabels["tvdb_id"]
|
||||
if itemBK.infoLabels["noscrap_id"]: infoLabels["noscrap_id"] = itemBK.infoLabels["noscrap_id"]
|
||||
if len(infoLabels) > 0: item.infoLabels = infoLabels
|
||||
|
||||
if itemBK.thumbnail: item.thumbnail = itemBK.thumbnail
|
||||
if itemBK.extra: item.extra = itemBK.extra
|
||||
if itemBK.contentEpisodeNumber: item.contentEpisodeNumber = itemBK.contentEpisodeNumber
|
||||
if itemBK.contentEpisodeTitle: item.contentEpisodeTitle = itemBK.contentEpisodeTitle
|
||||
if itemBK.contentPlot: item.contentPlot = itemBK.contentPlot
|
||||
if itemBK.contentQuality: item.contentQuality = itemBK.contentQuality
|
||||
if itemBK.contentSeason: item.contentSeason = itemBK.contentSeason
|
||||
if itemBK.contentSerieName: item.contentSerieName = itemBK.contentSerieName
|
||||
if itemBK.contentThumbnail: item.contentThumbnail = itemBK.contentThumbnail
|
||||
if itemBK.contentTitle: item.contentTitle = itemBK.contentTitle
|
||||
if itemBK.contentType: item.contentType = itemBK.contentType
|
||||
if itemBK.duration: item.duration = itemBK.duration
|
||||
if itemBK.fulltitle: item.fulltitle = itemBK.fulltitle
|
||||
if itemBK.plot: item.plot = itemBK.plot
|
||||
if itemBK.quality: item.quality = itemBK.quality
|
||||
if itemBK.show: item.show = itemBK.show
|
||||
if itemBK.title: item.title = itemBK.title
|
||||
if itemBK.viewcontent: item.viewcontent = itemBK.viewcontent
|
||||
|
||||
# itemJson = item.tojson()
|
||||
# logger.info("Elemento: {0} bytes".format(len(itemJson)))
|
||||
# logger.info(itemJson)
|
||||
# logger.info("--------------------------------------------------------------")
|
||||
|
||||
# Opciones segun item.context
|
||||
for command in context:
|
||||
# Predefinidos
|
||||
@@ -507,14 +545,14 @@ def set_context_commands(item, parent_item):
|
||||
from_action=item.action).tourl())))
|
||||
|
||||
# Descargar episodio
|
||||
if item.contentType == "episode":
|
||||
elif item.contentType == "episode":
|
||||
context_commands.append(("Descargar Episodio", "XBMC.RunPlugin(%s?%s)" %
|
||||
(sys.argv[0], item.clone(channel="downloads", action="save_download",
|
||||
from_channel=item.channel,
|
||||
from_action=item.action).tourl())))
|
||||
|
||||
# Descargar temporada
|
||||
if item.contentType == "season":
|
||||
elif item.contentType == "season":
|
||||
context_commands.append(("Descargar Temporada", "XBMC.RunPlugin(%s?%s)" %
|
||||
(sys.argv[0], item.clone(channel="downloads", action="save_download",
|
||||
from_channel=item.channel,
|
||||
|
||||
Reference in New Issue
Block a user