Skip to content

Commit

Permalink
[hotkey] fix execute shellscripts
Browse files Browse the repository at this point in the history
  • Loading branch information
koivo committed Oct 27, 2022
1 parent e45f695 commit d0adf47
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 5 deletions.
11 changes: 9 additions & 2 deletions lib/python/Screens/Console.py
Expand Up @@ -44,19 +44,26 @@ def __init__(self, session, title="Console", cmdlist=None, finishedCallback=None
def updateTitle(self):
self.setTitle(self.newtitle)

def doExec(self, cmd):
if isinstance(cmd, (list, tuple)):
return self.container.execute(cmd[0], *cmd)
else:
return self.container.execute(cmd)

def startRun(self):
self["text"].setText(_("Start Execution:") + "\n\n")
self["summary_description"].setText(_("Execution:"))
print("Console: executing in run", self.run, " the command:", self.cmdlist[self.run])
if self.container.execute(self.cmdlist[self.run]): #start of container application failed...
if self.doExec(self.cmdlist[self.run]): #start of container application failed...
self.runFinished(-1) # so we must call runFinished manual

def runFinished(self, retval):
if retval:
self.errorOcurred = True
self.toggleScreenHide = True
self.run += 1
if self.run != len(self.cmdlist):
if self.container.execute(self.cmdlist[self.run]): #start of container application failed...
if self.doExec(self.cmdlist[self.run]): #start of container application failed...
self.runFinished(-1) # so we must call runFinished manual
else:
lastpage = self["text"].isAtLastPage()
Expand Down
7 changes: 4 additions & 3 deletions lib/python/Screens/Hotkey.py
Expand Up @@ -3,6 +3,7 @@
from os import environ, listdir
from os import path as os_path
from os import pathsep, uname
from os.path import isdir, isfile

from boxbranding import getHaveCI, getHaveHDMIinFHD, getHaveHDMIinHD
from enigma import eServiceReference
Expand All @@ -21,7 +22,7 @@
from ServiceReference import ServiceReference
from Tools.BoundFunction import boundFunction

updateversion = "22.10.2022"
updateversion = "27.10.2022"

if uname()[4] == "aarch64":
pathLen = 26
Expand Down Expand Up @@ -696,14 +697,14 @@ def execHotkey(self, selected):
from Plugins.Extensions.PPanel.ppanel import PPanel
self.session.open(PPanel, name=selected[1] + ' PPanel', node=None, filename=ppanelFileName, deletenode=None)
elif selected[0] == "Shellscript":
command = '/usr/script/' + selected[1] + ".sh"
command = "/usr/scripts/%s.sh" % selected[1]
if os_path.isfile(command):
if ".hidden." in command:
from enigma import eConsoleAppContainer
eConsoleAppContainer().execute(command)
else:
from Screens.Console import Console
self.session.open(Console, selected[1] + " shellscript", command, closeOnSuccess=selected[1].startswith('!'), showStartStopText=False)
self.session.open(Console, selected[1], [command])
elif selected[0] == "EMC":
try:
from Plugins.Extensions.EnhancedMovieCenter.plugin import showMoviesNew
Expand Down

0 comments on commit d0adf47

Please sign in to comment.