Migliorie contextmenu

This commit is contained in:
Alhaziel01
2022-08-20 11:32:22 +02:00
parent 5383448d44
commit f590067983
3 changed files with 26 additions and 14 deletions
+1 -13
View File
@@ -43,14 +43,6 @@ def build_menu():
contextmenuitems.extend([item for item, fn in module_item_actions])
contextmenuactions.extend([fn for item, fn in module_item_actions])
if 'kod' in filePath and mediatype in ['movie', 'episode'] and config.get_setting('autoplay'):
logger.debug('Add Select server menu item')
contextmenuitems.append(config.get_localized_string(70192))
from core import filetools
item = Item().fromurl(filetools.read(filePath))
item.disableAutoplay = True
contextmenuactions.append(item)
if len(contextmenuitems) == 0:
logger.debug('No contextmodule found, build an empty one')
contextmenuitems.append(empty_item())
@@ -60,11 +52,7 @@ def build_menu():
if ret > -1:
logger.debug('Contextmenu module index', ret, ', label=' + contextmenuitems[ret])
if type(contextmenuactions[ret]) == Item:
from platformcode.launcher import run
run(contextmenuactions[ret])
else:
contextmenuactions[ret]()
contextmenuactions[ret]()
def empty_item():
+2 -1
View File
@@ -1,5 +1,6 @@
[
"platformcode.contextmenu.search",
"platformcode.contextmenu.tvshow_options",
"platformcode.contextmenu.trailer"
"platformcode.contextmenu.trailer",
"platformcode.contextmenu.show_servers"
]
+23
View File
@@ -0,0 +1,23 @@
import xbmc
from core.item import Item
from platformcode import config
def get_menu_items():
mediatype = xbmc.getInfoLabel('ListItem.DBTYPE')
filePath = xbmc.getInfoLabel('ListItem.FileNameAndPath')
res = []
if 'kod' in filePath and mediatype in ['movie', 'episode'] and config.get_setting('autoplay'):
res = [(config.get_localized_string(70192), execute)]
return res
def execute():
from core import filetools
from platformcode.launcher import run
filePath = xbmc.getInfoLabel('ListItem.FileNameAndPath')
item = Item().fromurl(filetools.read(filePath))
item.disableAutoplay = True
run(item)