X-Git-Url: https://git.cweiske.de/enigma2.git/blobdiff_plain/3728486e40b02d9d316a7491d2b7b1e3577c1872..addc55dea655c3d4cdde664d4127c40481fc93b5:/lib/python/Plugins/Extensions/DVDBurn/Process.py diff --git a/lib/python/Plugins/Extensions/DVDBurn/Process.py b/lib/python/Plugins/Extensions/DVDBurn/Process.py index 072085ef..ec674ef2 100644 --- a/lib/python/Plugins/Extensions/DVDBurn/Process.py +++ b/lib/python/Plugins/Extensions/DVDBurn/Process.py @@ -32,7 +32,7 @@ class mpeg2encTask(Task): self.container.readFromFile(self.inputFile) def processOutputLine(self, line): - print "[mpeg2encTask]", line + print "[mpeg2encTask]", line[:-1] class spumuxTask(Task): def __init__(self, job, xmlfile, inputfile, outputfile): @@ -49,7 +49,7 @@ class spumuxTask(Task): self.container.readFromFile(self.inputFile) def processStderr(self, data): - print "[spumuxTask]", data + print "[spumuxTask]", data[:-1] def processStdout(self, data): pass @@ -107,7 +107,7 @@ class DemuxTask(Task): self.generated_files.append(file) def haveProgress(self, progress): - print "PROGRESS [%s]" % progress + #print "PROGRESS [%s]" % progress MSG_CHECK = "check & synchronize audio file" MSG_DONE = "done..." if progress == "preparing collection(s)...": @@ -144,22 +144,42 @@ class DemuxTask(Task): for f in self.generated_files: os.remove(f) +class MplexTaskPostcondition(Condition): + def check(self, task): + return task.error is None + + def getErrorMessage(self, task): + print "[MplexTaskPostcondition] getErrorMessage", task + return { + task.ERROR_UNDERRUN: ("Can't multiplex source video!"), + task.ERROR_UNKNOWN: ("An unknown error occured!") + }[task.error] + class MplexTask(Task): + ERROR_UNDERRUN, ERROR_UNKNOWN = range(2) def __init__(self, job, outputfile, inputfiles=None, demux_task=None): Task.__init__(self, job, "Mux ES into PS") self.weighting = 500 self.demux_task = demux_task + self.postconditions.append(MplexTaskPostcondition()) self.setTool("/usr/bin/mplex") self.args += ["-f8", "-o", outputfile, "-v1"] if inputfiles: self.args += inputfiles def prepare(self): + self.error = None if self.demux_task: self.args += self.demux_task.generated_files def processOutputLine(self, line): - print "[MplexTask] processOutputLine=", line + print "[MplexTask] processOutputLine=", line[:-1] + if line.startswith("**ERROR:"): + if line.find("Frame data under-runs detected") != -1: + self.error = self.ERROR_UNDERRUN + print "BUFFER UNDERRUN ERROR !!!" + else: + self.error = self.ERROR_UNKNOWN class RemoveESFiles(Task): def __init__(self, job, demux_task): @@ -184,7 +204,7 @@ class DVDAuthorTask(Task): self.menupreview = job.menupreview def processOutputLine(self, line): - print "[DVDAuthorTask] processOutputLine=", line + print "[DVDAuthorTask] processOutputLine=", line[:-1] if not self.menupreview and line.startswith("STAT: Processing"): self.callback(self, [], stay_resident=True) @@ -204,6 +224,7 @@ class WaitForResidentTasks(Task): callback(self, []) class BurnTaskPostcondition(Condition): + RECOVERABLE = True def check(self, task): return task.error is None @@ -296,7 +317,7 @@ class PreviewTask(Task): if self.job.menupreview: self.waitAndOpenPlayer() else: - self.job.project.session.openWithCallback(self.previewCB, MessageBox, _("Do you want to preview this project before burning?"), timeout = 60, default = False) + self.job.project.session.openWithCallback(self.previewCB, MessageBox, _("Do you want to preview this DVD before burning?"), timeout = 60, default = False) def previewCB(self, answer): if answer == True: @@ -308,7 +329,7 @@ class PreviewTask(Task): if self.job.menupreview: self.closedCB(True) else: - self.job.project.session.openWithCallback(self.closedCB, MessageBox, _("Do you want to burn this project to DVD medium?") ) + self.job.project.session.openWithCallback(self.closedCB, MessageBox, _("Do you want to burn this collection to DVD medium?") ) def closedCB(self, answer): if answer == True: @@ -341,24 +362,24 @@ def getTitlesPerMenu(nr_titles): return titles_per_menu def formatTitle(template, title, track): - import re template = template.replace("$i", str(track)) template = template.replace("$t", title.name) template = template.replace("$d", title.descr) template = template.replace("$c", str(len(title.chaptermarks)+1)) + template = template.replace("$A", str(title.audiotracks)) template = template.replace("$f", title.inputfile) + template = template.replace("$C", title.channel) l = title.length lengthstring = "%d:%02d:%02d" % (l/3600, l%3600/60, l%60) template = template.replace("$l", lengthstring) - res = re.search("(?:/.*?).*/(?P\d{4})(?P\d{2})(?P\d{2}).(?P\d{2})(?P\d{2}).-.*.?.ts", title.inputfile) - if res: - template = template.replace("$Y", res.group("year")) - template = template.replace("$M", res.group("month")) - template = template.replace("$D", res.group("day")) - template = template.replace("$h", res.group("hour")) - template = template.replace("$m", res.group("minute")) + if title.timeCreate: + template = template.replace("$Y", str(title.timeCreate[0])) + template = template.replace("$M", str(title.timeCreate[1])) + template = template.replace("$D", str(title.timeCreate[2])) + timestring = "%d:%02d" % (title.timeCreate[3], title.timeCreate[4]) + template = template.replace("$T", timestring) else: - template = template.replace("$Y", "").replace("$M", "").replace("$D", "").replace("$h", "").replace("$m", "") + template = template.replace("$Y", "").replace("$M", "").replace("$D", "").replace("$T", "") return template.decode("utf-8") def CreateMenus(job): @@ -524,6 +545,8 @@ def CreateAuthoringXML(job): authorxml.append(' \n') authorxml.append(' \n') for i in range( nr_titles ): + for audiotrack in job.project.titles[i].audiotracks: + authorxml.append('