fix possible crash on mediainfo parsing
[enigma2.git] / lib / python / Plugins / Extensions / DVDBurn / Process.py
index 0fcbab045b17e41a6ed1d029848d2f20c1ba5c33..71f7c99801bdf1676dbb8733351789ace5781389 100644 (file)
@@ -1,4 +1,5 @@
 from Components.Task import Task, Job, job_manager, DiskspacePrecondition, Condition, ToolExistsPrecondition
+from Components.Harddisk import harddiskmanager
 from Screens.MessageBox import MessageBox
 
 class png2yuvTask(Task):
@@ -264,9 +265,8 @@ class BurnTask(Task):
                self.postconditions.append(BurnTaskPostcondition())
                self.setTool("/bin/growisofs")
                volName = self.getASCIIname(job.project.settings.name.getValue())
-               self.args += [ "-dvd-compat", "-Z", "/dev/cdroms/cdrom0", "-V", volName, "-publisher", "Dreambox", "-use-the-force-luke=dummy" ]
+               self.args += [ "-dvd-compat", "-Z", harddiskmanager.getCD(), "-V", volName, "-publisher", "Dreambox", "-use-the-force-luke=dummy" ]
                self.args += extra_args
-               self.args += [ self.job.workspace + "/dvd" ]
 
        def getASCIIname(self, name):
                ASCIIname = ""
@@ -303,7 +303,7 @@ class BurnTask(Task):
                                self.error = self.ERROR_SIZE
                        elif line.find("write failed") != -1:
                                self.error = self.ERROR_WRITE_FAILED
-                       elif line.find("unable to open64(\"/dev/cdroms/cdrom0\",O_RDONLY): No such file or directory") != -1: # fixme
+                       elif line.find("unable to open64(") != -1 and line.find(",O_RDONLY): No such file or directory") != -1:
                                self.error = self.ERROR_DVDROM
                        elif line.find("media is not recognized as recordable DVD") != -1:
                                self.error = self.ERROR_NOTWRITEABLE
@@ -392,7 +392,7 @@ class ImagingPostcondition(Condition):
                return task.returncode == 0
 
        def getErrorMessage(self, task):
-               return "python-imaging " + _("failed")
+               return _("Failed") + ": python-imaging"
 
 class ImagePrepareTask(Task):
        def __init__(self, job):
@@ -677,7 +677,7 @@ class DVDJob(Job):
                                RemoveESFiles(self, demux)
                        WaitForResidentTasks(self)
                        PreviewTask(self)
-                       BurnTask(self,["-dvd-video"])
+                       BurnTask(self, ["-dvd-video", self.workspace + "/dvd"])
                RemoveDVDFolder(self)
 
 class DVDdataJob(Job):
@@ -704,7 +704,7 @@ class DVDdataJob(Job):
                        link_name =  self.workspace + filename
                        LinkTS(self, title.inputfile, link_name)
                        CopyMeta(self, title.inputfile)
-               BurnTask(self)
+               BurnTask(self, ["-follow-links", self.workspace])
                RemoveDVDFolder(self)
 
 def Burn(session, project):