from Components.Label import Label
from Components.Pixmap import Pixmap
from enigma import eTimer, eServiceReference, eServiceCenter, iServiceInformation, eConsoleAppContainer
-from os import WIFEXITED, WEXITSTATUS
+from os import access, chmod, X_OK
+
+mcut_path = "/usr/lib/enigma2/python/Plugins/Extensions/MovieCut/bin/mcut"
+# Hack to make sure it is executable
+if not access(mcut_path, X_OK):
+ chmod(mcut_path, 493)
def main(session, service, **kwargs):
session.open(MovieCut, service, **kwargs)
def Plugins(**kwargs):
- return PluginDescriptor(name="MovieCut", description="Execute cuts...", where = PluginDescriptor.WHERE_MOVIELIST, fnc=main)
+ return PluginDescriptor(name="MovieCut", description=_("Execute cuts..."), where = PluginDescriptor.WHERE_MOVIELIST, fnc=main)
class MovieCut(ChoiceBox):
else:
self.name = info.getName(self.service)
tlist = []
- tlist.append(("Don't cut", "CALLFUNC", self.confirmed0))
- tlist.append(("Replace the original movie with the cut movie", "CALLFUNC", self.confirmed1))
- tlist.append(("Place the cut movie in a new file ending with \" cut\"", "CALLFUNC", self.confirmed2))
- tlist.append(("Advanced cut parameter settings...", "CALLFUNC", self.confirmed3))
+ tlist.append((_("Don't cut"), "CALLFUNC", self.confirmed0))
+ tlist.append((_("Replace the original movie with the cut movie"), "CALLFUNC", self.confirmed1))
+ tlist.append((_("Place the cut movie in a new file ending with \" cut\""), "CALLFUNC", self.confirmed2))
+ tlist.append((_("Advanced cut specification..."), "CALLFUNC", self.confirmed3))
ChoiceBox.__init__(self, session, _("How would you like to cut \"%s\"?") % (self.name), list = tlist, selection = 0)
self.skinName = "ChoiceBox"
self.close()
def confirmed1(self, arg):
- MovieCutSpawn(self.session, self, ["/usr/bin/mcut", "-r", self.service.getPath()], self.name)
+ MovieCutSpawn(self.session, self, [mcut_path, "-r", self.service.getPath()], self.name)
def confirmed2(self, arg):
- MovieCutSpawn(self.session, self, ["/usr/bin/mcut", self.service.getPath()], self.name)
+ MovieCutSpawn(self.session, self, [mcut_path, self.service.getPath()], self.name)
def confirmed3(self, arg):
serviceHandler = eServiceCenter.getInstance()
if len(ret) <= 1 or not ret[0]:
self.close()
return
- clist = ["/usr/bin/mcut"]
+ clist = [mcut_path]
if ret[1] == True:
clist.append("-r")
clist.append(self.service.getPath())
self.entry_dir = getConfigListEntry(_("New location:"), self.input_dir)
self.entry_manual = getConfigListEntry(_("Cut source:"), self.input_manual)
self.entry_space = getConfigListEntry(_("Cuts (an IN OUT IN OUT ... sequence of hour:min:sec)"), self.input_space)
- self.entry_manualcuts = getConfigListEntry(_(":"), self.input_manualcuts)
+ self.entry_manualcuts = getConfigListEntry(":", self.input_manualcuts)
self.createSetup(self["config"])
def createSetup(self, configlist):
class MovieCutQueue:
def __init__(self):
self.container = eConsoleAppContainer()
- self.container.appClosed.get().append(self.runDone)
+ self.container.appClosed.append(self.runDone)
self.queue = []
self.running = False
if not self.queue:
self.running = False
else:
- self.container.execute(self.queue[0][1][0], self.queue[0][1])
+ self.container.execute(*self.queue[0][1])
def runDone(self, retval):
cb = self.queue[0][0]
cb(retval)
self.runNext()
-global_mcut_errors = ["The movie \"%s\" is successfully cut",
- "Cutting failed for movie \"%s\":\nBad arguments",
- "Cutting failed for movie \"%s\":\nCouldn't open input .ts file",
- "Cutting failed for movie \"%s\":\nCouldn't open input .cuts file",
- "Cutting failed for movie \"%s\":\nCouldn't open input .ap file",
- "Cutting failed for movie \"%s\":\nCouldn't open output .ts file",
- "Cutting failed for movie \"%s\":\nCouldn't open output .cuts file",
- "Cutting failed for movie \"%s\":\nCouldn't open output .ap file",
- "Cutting failed for movie \"%s\":\nEmpty .ap file",
- "Cutting failed for movie \"%s\":\nNo cuts specified",
- "Cutting failed for movie \"%s\":\nRead/write error (disk full?)",
- "Cutting was aborted for movie \"%s\""]
+global_mcut_errors = [_("The movie \"%s\" is successfully cut"),
+ _("Cutting failed for movie \"%s\"")+":\n"+_("Bad arguments"),
+ _("Cutting failed for movie \"%s\"")+":\n"+_("Couldn't open input .ts file"),
+ _("Cutting failed for movie \"%s\"")+":\n"+_("Couldn't open input .cuts file"),
+ _("Cutting failed for movie \"%s\"")+":\n"+_("Couldn't open input .ap file"),
+ _("Cutting failed for movie \"%s\"")+":\n"+_("Couldn't open output .ts file"),
+ _("Cutting failed for movie \"%s\"")+":\n"+_("Couldn't open output .cuts file"),
+ _("Cutting failed for movie \"%s\"")+":\n"+_("Couldn't open output .ap file"),
+ _("Cutting failed for movie \"%s\"")+":\n"+_("Empty .ap file"),
+ _("Cutting failed for movie \"%s\"")+":\n"+_("No cuts specified"),
+ _("Cutting failed for movie \"%s\"")+":\n"+_("Read/write error (disk full?)"),
+ _("Cutting was aborted for movie \"%s\"")]
global_mcut_queue = MovieCutQueue()
self.session = session
self.parent = parent
self.name = name
- self.clist = clist
+ self.clist = [clist[0]] + clist
self.mess = ""
self.dialog = False
self.waitTimer = eTimer()
self.waitTimer.callback.append(self.doWaitAck)
- if global_mcut_queue.enqueue(self.doAck, clist):
+ if global_mcut_queue.enqueue(self.doAck, self.clist):
mess = _("The movie \"%s\" is cut in the background.") % (self.name)
else:
mess = _("Another movie is currently cut.\nThe movie \"%s\" will be cut in the background after it.") % (self.name)