def genisoimageCallback2(self, yesno): if yesno: cmd = ("rm -R %s/%s" % (config.plugins.DVDBackup.directory.value, config.plugins.DVDBackup.name.value)).replace("//", "/") try: eConsole().ePopen(cmd) except: pass self.finished()
def gotInfo(self, result, retval, extra_args): if result and result.__contains__("File Structure DVD") and result.__contains__("Main feature:"): result = result[result.index("File Structure DVD"): result.index("Main feature:")] lines = result.split("\n") folder = "" for line in lines: tmp = line.split("\t") if len(tmp) == 1: folder = tmp[0] elif len(tmp) == 4: name = folder+tmp[1] size = tmp[2] if size.__contains__("."): size = size[:size.index(".")] if not name.__contains__("VTS_00_0."): self.files.append(DVDBackupFile(name, int(size))) if len(self.files) > 0: if not self.console: self.console = eConsole() if config.plugins.DVDBackup.log.value: log = " 2>> /tmp/dvdbackup.log" else: log = "" cmd = 'dvdbackup -M -v -i %s -o "%s" -n "%s"%s'%(config.plugins.DVDBackup.device.value, config.plugins.DVDBackup.directory.value, config.plugins.DVDBackup.name.value, log) self.console.ePopen(cmd, self.dvdbackupFinished) else: message(_("Could not find any file to backup!")) self.working = False else: message(_("Could not read the DVD informations!")) print("[DVD Backup]",result) self.working = False
def gotInfo(self, result, retval, extra_args): if result and result.__contains__("File Structure DVD") and result.__contains__("Main feature:"): result = result[result.index("File Structure DVD"): result.index("Main feature:")] lines = result.split("\n") folder = "" for line in lines: tmp = line.split("\t") if len(tmp) == 1: folder = tmp[0] elif len(tmp) == 4: name = folder+tmp[1] size = tmp[2] if size.__contains__("."): size = size[:size.index(".")] if not name.__contains__("VTS_00_0."): self.files.append(DVDBackupFile(name, int(size))) if len(self.files) > 0: if not self.console: self.console = eConsole() if config.plugins.DVDBackup.log.value: log = " 2>> /tmp/dvdbackup.log" else: log = "" cmd = 'dvdbackup -M -v -i %s -o "%s" -n "%s"%s'%(config.plugins.DVDBackup.device.value, config.plugins.DVDBackup.directory.value, config.plugins.DVDBackup.name.value, log) self.console.ePopen(cmd, self.dvdbackupFinished) else: message(_("Could not find any file to backup!")) self.working = False else: message(_("Could not read the DVD informations!")) print "[DVD Backup]",result self.working = False
def getName(self): self.working = True if not self.console: self.console = eConsole() self.console.ePopen( "dvdbackup --info -i %s" % config.plugins.DVDBackup.device.value, self.gotInfo)
def getInfo(self): if not self.console: self.console = eConsole() if cfg.create_iso.value == "dd": self.console.ePopen("dvdbackup --info -i %s" % cfg.device.value, self.isoWithDD) else: self.console.ePopen("dvdbackup --info -i %s" % cfg.device.value, self.gotInfo)
def abort(self): if self.working == False and dvdbackup.working: self.working = True if not self.console: self.console = eConsole() tool = "dvdbackup" for file in dvdbackup.files: if file.name == "genisoimage": tool = "genisoimage" self.console.ePopen("killall -9 %s"%tool, self.abortCallback)
def abort(self): if self.working == False and dvdbackup.working: self.working = True if not self.console: self.console = eConsole() tool = "dvdbackup" for file in dvdbackup.files: if file.name == "mkisofs": tool = "mkisofs" self.console.ePopen("killall -9 %s"%tool, self.abortCallback)
def abort(self): if self.working == False and dvdbackup.working: self.working = True if not self.console: self.console = eConsole() tool = "dvdbackup" for file in dvdbackup.files: if file.name == "mkisofs": tool = "mkisofs" elif file.name.endswith(".iso"): tool = "dd" self.console.ePopen("killall -9 %s" % tool, self.abortCallback) if tool == "dd": try: os.system("rm %s" % file.name) except: pass
def dvdbackupFinished(self, result, retval, extra_args): if retval != 0: message(_("Error while backup of DVD!")) print("[DVD Backup]", retval, result) self.working = False else: if config.plugins.DVDBackup.create_iso.value: path = ("%s/%s"%(config.plugins.DVDBackup.directory.value, config.plugins.DVDBackup.name.value)).replace("//", "/") if not self.console: self.console = eConsole() self.genisoimage = DVDBackupFile("genisoimage", 0) self.files.append(self.genisoimage) cmd = 'genisoimage -dvd-video -udf -o "%s.iso" "%s"'%(path, path) self.console.ePopen(cmd, self.genisoimageCallback) self.console.appContainers[cmd].dataAvail.append(boundFunction(self.genisoimageProgress, cmd)) else: self.finished()
def dvdbackupFinished(self, result, retval, extra_args): if retval != 0: message(_("Error while backup of DVD!")) print "[DVD Backup]", retval, result self.working = False else: if config.plugins.DVDBackup.create_iso.value: path = ("%s/%s"%(config.plugins.DVDBackup.directory.value, config.plugins.DVDBackup.name.value)).replace("//", "/") if not self.console: self.console = eConsole() self.mkisofs = DVDBackupFile("mkisofs", 0) self.files.append(self.mkisofs) cmd = 'mkisofs -dvd-video -udf -o "%s.iso" "%s"'%(path, path) self.console.ePopen(cmd, self.mkisofsCallback) self.console.appContainers[cmd].dataAvail.append(boundFunction(self.mkisofsProgress, cmd)) else: self.finished()
def dvdbackupFinished(self, result, retval, extra_args): if retval != 0: message(_("Error while backup of DVD!")) print "[DVD Backup]", retval, result self.working = False else: if cfg.create_iso.value == "mkisofs": path = ("%s/%s" % (cfg.directory.value, cfg.name.value)).replace("//", "/") if not self.console: self.console = eConsole() self.mkisofs = DVDBackupFile("mkisofs", 0) self.files.append(self.mkisofs) cmd = 'mkisofs -dvd-video -udf -o "%s.iso" "%s"' % (path, path) self.console.ePopen(cmd, self.mkisofsCallback) self.console.appContainers[cmd].dataAvail.append(boundFunction(self.mkisofsProgress, cmd)) else: self.finished()
def getName(self): self.working = True if not self.console: self.console = eConsole() self.console.ePopen("dvdbackup --info -i %s"%config.plugins.DVDBackup.device.value, self.gotInfo)
def execHotkey(self, selected): if selected: selected = selected[1].split("/") if selected[0] == "Plugins": twinPlugins = [] twinPaths = {} pluginlist = plugins.getPlugins( PluginDescriptor.WHERE_EVENTINFO) pluginlist.sort(key=lambda p: p.name) for plugin in pluginlist: if plugin.name not in twinPlugins and plugin.path and 'selectedevent' not in plugin.__call__.func_code.co_varnames: if plugin.path[24:] in twinPaths: twinPaths[plugin.path[24:]] += 1 else: twinPaths[plugin.path[24:]] = 1 if plugin.path[24:] + "/" + str(twinPaths[ plugin.path[24:]]) == "/".join(selected): self.runPlugin(plugin) return twinPlugins.append(plugin.name) pluginlist = plugins.getPlugins([ PluginDescriptor.WHERE_PLUGINMENU, PluginDescriptor.WHERE_EXTENSIONSMENU ]) pluginlist.sort(key=lambda p: p.name) for plugin in pluginlist: if plugin.name not in twinPlugins and plugin.path: if plugin.path[24:] in twinPaths: twinPaths[plugin.path[24:]] += 1 else: twinPaths[plugin.path[24:]] = 1 if plugin.path[24:] + "/" + str(twinPaths[ plugin.path[24:]]) == "/".join(selected): self.runPlugin(plugin) return twinPlugins.append(plugin.name) elif selected[0] == "MenuPlugin": for plugin in plugins.getPluginsForMenu(selected[1]): if plugin[2] == selected[2]: self.runPlugin(plugin[1]) return elif selected[0] == "Infobar": if hasattr(self, selected[1]): exec "self." + ".".join(selected[1:]) + "()" else: return 0 elif selected[0] == "Module": try: exec "from " + selected[1] + " import " + selected[2] exec "self.session.open(" + ",".join(selected[2:]) + ")" except: print "[Hotkey] error during executing module %s, screen %s" % ( selected[1], selected[2]) elif selected[0] == "SoftcamSetup" and SystemInfo[ "HasSoftcamInstalled"]: from Screens.SoftcamSetup import SoftcamSetup self.session.open(SoftcamSetup) elif selected[0] == "Setup": from Screens.Setup import * exec "self.session.open(Setup, \"" + selected[1] + "\")" elif selected[0][:3] == "Zap": if selected[0] == "ZapPanic": self.servicelist.history = [] self.servicelist.servicelist.setCurrent( eServiceReference("/".join(selected[1:]))) self.servicelist.zap(enable_pipzap=True) if hasattr(self, "lastservice"): self.lastservice = eServiceReference("/".join( selected[1:])) self.close() else: self.show() from Screens.MovieSelection import defaultMoviePath moviepath = defaultMoviePath() if moviepath: config.movielist.last_videodir.value = moviepath elif selected[0] == "PPanel": ppanelFileName = '/etc/ppanels/' + selected[1] + ".xml" if os.path.isfile(ppanelFileName) and os.path.isdir( '/usr/lib/enigma2/python/Plugins/Extensions/PPanel'): from Plugins.Extensions.PPanel.ppanel import PPanel self.session.open(PPanel, name=selected[1] + ' PPanel', node=None, filename=ppanelFileName, deletenode=None) elif selected[0][-6:] == "script": command = '/usr/script/' + selected[1] + ".sh" if os.path.isfile(command): if selected[0] == "Backgroundscript": from Components.Console import Console as eConsole message = _("Execute %s") % (selected[1] + ".sh") self.session.open(MessageBox, message, type=MessageBox.TYPE_INFO, timeout=2) eConsole().ePopen(command) elif os.path.isdir( '/usr/lib/enigma2/python/Plugins/Extensions/PPanel' ): from Plugins.Extensions.PPanel.ppanel import Execute self.session.open(Execute, selected[1] + " shellscript", None, command) else: from Screens.Console import Console as sConsole self.session.open(sConsole, cmdlist=[command]) elif selected[0] == "Menu": from Screens.Menu import MainMenu, mdom root = mdom.getroot() for x in root.findall("menu"): y = x.find("id") if y is not None: id = y.get("val") if id and id == selected[1]: menu_screen = self.session.open(MainMenu, x) break
def execHotkey(self, selected): if selected: selected = selected[1].split("/") if selected[0] == "Plugins": twinPlugins = [] twinPaths = {} pluginlist = plugins.getPlugins(PluginDescriptor.WHERE_EVENTINFO) pluginlist.sort(key=lambda p: p.name) for plugin in pluginlist: if plugin.name not in twinPlugins and plugin.path and 'selectedevent' not in plugin.__call__.func_code.co_varnames: if twinPaths.has_key(plugin.path[24:]): twinPaths[plugin.path[24:]] += 1 else: twinPaths[plugin.path[24:]] = 1 if plugin.path[24:] + "/" + str(twinPaths[plugin.path[24:]]) == "/".join(selected): self.runPlugin(plugin) return twinPlugins.append(plugin.name) pluginlist = plugins.getPlugins([PluginDescriptor.WHERE_PLUGINMENU, PluginDescriptor.WHERE_EXTENSIONSMENU]) pluginlist.sort(key=lambda p: p.name) for plugin in pluginlist: if plugin.name not in twinPlugins and plugin.path: if twinPaths.has_key(plugin.path[24:]): twinPaths[plugin.path[24:]] += 1 else: twinPaths[plugin.path[24:]] = 1 if plugin.path[24:] + "/" + str(twinPaths[plugin.path[24:]]) == "/".join(selected): self.runPlugin(plugin) return twinPlugins.append(plugin.name) elif selected[0] == "MenuPlugin": for plugin in plugins.getPluginsForMenu(selected[1]): if plugin[2] == selected[2]: self.runPlugin(plugin[1]) return elif selected[0] == "Infobar": if hasattr(self, selected[1]): exec "self." + ".".join(selected[1:]) + "()" else: return 0 elif selected[0] == "Module": try: exec "from " + selected[1] + " import " + selected[2] exec "self.session.open(" + ",".join(selected[2:]) + ")" except: print "[Hotkey] error during executing module %s, screen %s" % (selected[1], selected[2]) elif selected[0] == "Setup": from Screens.Setup import Setup exec "self.session.open(Setup, \"" + selected[1] + "\")" elif selected[0][:3] == "Zap": if selected[0] == "ZapPanic": self.servicelist.history = [] self.servicelist.servicelist.setCurrent(eServiceReference("/".join(selected[1:]))) self.servicelist.zap(enable_pipzap = True) if hasattr(self, "lastservice"): self.lastservice = eServiceReference("/".join(selected[1:])) self.close() else: self.show() from Screens.MovieSelection import defaultMoviePath moviepath = defaultMoviePath() if moviepath: config.movielist.last_videodir.value = moviepath elif selected[0] == "PPanel": ppanelFileName = '/etc/ppanels/' + selected[1] + ".xml" if os.path.isfile(ppanelFileName) and os.path.isdir('/usr/lib/enigma2/python/Plugins/Extensions/PPanel'): from Plugins.Extensions.PPanel.ppanel import PPanel self.session.open(PPanel, name=selected[1] + ' PPanel', node=None, filename=ppanelFileName, deletenode=None) elif selected[0][-6:] == "script": command = '/usr/script/' + selected[1] + ".sh" if os.path.isfile(command): if selected[0] == "Backgroundscript": from Components.Console import Console as eConsole message = _("Execute %s") % (selected[1] + ".sh") self.session.open(MessageBox, message, type = MessageBox.TYPE_INFO, timeout = 2) eConsole().ePopen(command) elif os.path.isdir('/usr/lib/enigma2/python/Plugins/Extensions/PPanel'): from Plugins.Extensions.PPanel.ppanel import Execute self.session.open(Execute, selected[1] + " shellscript", None, command) else: from Screens.Console import Console as sConsole self.session.open(sConsole, cmdlist = [command]) elif selected[0] == "Menu": from Screens.Menu import MainMenu, mdom root = mdom.getroot() for x in root.findall("menu"): y = x.find("id") if y is not None: id = y.get("val") if id and id == selected[1]: menu_screen = self.session.open(MainMenu, x) break