From c731d02c3499e0ccb5c03f5f68d339214b6f5e60 Mon Sep 17 00:00:00 2001 From: andy Date: Thu, 30 Oct 2008 15:09:21 +0100 Subject: add plugin list icon for dvdburn --- lib/python/Plugins/Extensions/DVDBurn/dvdburn.png | Bin 0 -> 3869 bytes 1 file changed, 0 insertions(+), 0 deletions(-) create mode 100755 lib/python/Plugins/Extensions/DVDBurn/dvdburn.png (limited to 'lib/python/Plugins/Extensions') diff --git a/lib/python/Plugins/Extensions/DVDBurn/dvdburn.png b/lib/python/Plugins/Extensions/DVDBurn/dvdburn.png new file mode 100755 index 00000000..7e7adead Binary files /dev/null and b/lib/python/Plugins/Extensions/DVDBurn/dvdburn.png differ -- cgit v1.2.3 From 1b586ab3e622c38f22280ad21d2cd5a08c4424b9 Mon Sep 17 00:00:00 2001 From: Fraxinas Date: Fri, 31 Oct 2008 14:11:59 +0100 Subject: actually burn and not just simulate burning to dvd-MINUS-r(w) media --- lib/python/Plugins/Extensions/DVDBurn/Process.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'lib/python/Plugins/Extensions') diff --git a/lib/python/Plugins/Extensions/DVDBurn/Process.py b/lib/python/Plugins/Extensions/DVDBurn/Process.py index b8a3788e..1cc11e2d 100644 --- a/lib/python/Plugins/Extensions/DVDBurn/Process.py +++ b/lib/python/Plugins/Extensions/DVDBurn/Process.py @@ -701,7 +701,7 @@ class DVDJob(Job): if output == "dvd": self.name = _("Burn DVD") tool = "/bin/growisofs" - burnargs = [ "-Z", "/dev/" + harddiskmanager.getCD(), "-dvd-compat", "-use-the-force-luke=dummy" ] + burnargs = [ "-Z", "/dev/" + harddiskmanager.getCD(), "-dvd-compat" ] elif output == "iso": self.name = _("Create DVD-ISO") tool = "/usr/bin/mkisofs" @@ -739,7 +739,7 @@ class DVDdataJob(Job): tool = "/bin/growisofs" if output == "dvd": self.name = _("Burn DVD") - burnargs = [ "-Z", "/dev/" + harddiskmanager.getCD(), "-dvd-compat", "-use-the-force-luke=dummy" ] + burnargs = [ "-Z", "/dev/" + harddiskmanager.getCD(), "-dvd-compat" ] elif output == "iso": tool = "/usr/bin/mkisofs" self.name = _("Create DVD-ISO") @@ -762,11 +762,11 @@ class DVDisoJob(Job): self.menupreview = False if imagepath.endswith(".iso"): PreviewTask(self, imagepath) - burnargs = [ "-Z", "/dev/" + harddiskmanager.getCD() + '='+imagepath, "-dvd-compat", "-use-the-force-luke=dummy" ] + burnargs = [ "-Z", "/dev/" + harddiskmanager.getCD() + '='+imagepath, "-dvd-compat" ] else: PreviewTask(self, imagepath + "/VIDEO_TS/") volName = self.project.settings.name.getValue() - burnargs = [ "-Z", "/dev/" + harddiskmanager.getCD(), "-dvd-compat", "-use-the-force-luke=dummy" ] + burnargs = [ "-Z", "/dev/" + harddiskmanager.getCD(), "-dvd-compat" ] burnargs += [ "-dvd-video", "-publisher", "Dreambox", "-V", volName, imagepath ] tool = "/bin/growisofs" BurnTask(self, burnargs, tool) -- cgit v1.2.3 From 14ccf994868546b74185de6404739b2eb77e6cfe Mon Sep 17 00:00:00 2001 From: Fraxinas Date: Fri, 31 Oct 2008 15:08:48 +0100 Subject: add additional clear text error messages for burntask --- lib/python/Plugins/Extensions/DVDBurn/Process.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'lib/python/Plugins/Extensions') diff --git a/lib/python/Plugins/Extensions/DVDBurn/Process.py b/lib/python/Plugins/Extensions/DVDBurn/Process.py index 1cc11e2d..7a03b7eb 100644 --- a/lib/python/Plugins/Extensions/DVDBurn/Process.py +++ b/lib/python/Plugins/Extensions/DVDBurn/Process.py @@ -251,11 +251,13 @@ class BurnTaskPostcondition(Condition): task.ERROR_WRITE_FAILED: _("Write failed!"), task.ERROR_DVDROM: _("No (supported) DVDROM found!"), task.ERROR_ISOFS: _("Medium is not empty!"), + task.ERROR_FILETOOLARGE: _("TS file is too large for ISO9660 level 1!"), + task.ERROR_ISOTOOLARGE: _("ISO file is too large for this filesystem!"), task.ERROR_UNKNOWN: _("An unknown error occured!") }[task.error] class BurnTask(Task): - ERROR_NOTWRITEABLE, ERROR_LOAD, ERROR_SIZE, ERROR_WRITE_FAILED, ERROR_DVDROM, ERROR_ISOFS, ERROR_UNKNOWN = range(7) + ERROR_NOTWRITEABLE, ERROR_LOAD, ERROR_SIZE, ERROR_WRITE_FAILED, ERROR_DVDROM, ERROR_ISOFS, ERROR_FILETOOLARGE, ERROR_ISOTOOLARGE, ERROR_UNKNOWN = range(9) def __init__(self, job, extra_args=[], tool="/bin/growisofs"): Task.__init__(self, job, job.name) self.weighting = 500 @@ -303,6 +305,10 @@ class BurnTask(Task): else: self.error = self.ERROR_UNKNOWN print "BurnTask: unknown error %s" % line + elif line.find("-allow-limited-size was not specified. There is no way do represent this file size. Aborting.") != -1: + self.error = self.ERROR_FILETOOLARGE + elif line.startswith("genisoimage: File too large."): + self.error = self.ERROR_ISOTOOLARGE class RemoveDVDFolder(Task): def __init__(self, job): -- cgit v1.2.3 From 355537a6ba6eac5030b1d8b9edb6e5902913453d Mon Sep 17 00:00:00 2001 From: Fraxinas Date: Sat, 1 Nov 2008 00:34:47 +0100 Subject: add icon to be installed. remove deprecated directories --- .../Plugins/Extensions/DVDBurn/data/Makefile.am | 6 ------ .../Plugins/Extensions/DVDBurn/data/dreamdvd_boat.jpg | Bin 187417 -> 0 bytes .../Plugins/Extensions/DVDBurn/data/dreamvmgm.mpg | Bin 575488 -> 0 bytes .../Plugins/Extensions/DVDBurn/data/silence.mp2 | Bin 8340 -> 0 bytes .../DVDBurn/template/DreamboxDVDtemplate.ddvdp.xml | 18 ------------------ .../Plugins/Extensions/DVDBurn/template/Makefile.am | 7 ------- 6 files changed, 31 deletions(-) delete mode 100644 lib/python/Plugins/Extensions/DVDBurn/data/Makefile.am delete mode 100755 lib/python/Plugins/Extensions/DVDBurn/data/dreamdvd_boat.jpg delete mode 100644 lib/python/Plugins/Extensions/DVDBurn/data/dreamvmgm.mpg delete mode 100644 lib/python/Plugins/Extensions/DVDBurn/data/silence.mp2 delete mode 100644 lib/python/Plugins/Extensions/DVDBurn/template/DreamboxDVDtemplate.ddvdp.xml delete mode 100644 lib/python/Plugins/Extensions/DVDBurn/template/Makefile.am (limited to 'lib/python/Plugins/Extensions') diff --git a/lib/python/Plugins/Extensions/DVDBurn/data/Makefile.am b/lib/python/Plugins/Extensions/DVDBurn/data/Makefile.am deleted file mode 100644 index e5992b9c..00000000 --- a/lib/python/Plugins/Extensions/DVDBurn/data/Makefile.am +++ /dev/null @@ -1,6 +0,0 @@ -AUTOMAKE_OPTIONS = gnu - -installdir = $(DATADIR)/enigma2 - -install_DATA = \ - dreamdvd_boat.jpg dreamvmgm.mpg silence.mp2 diff --git a/lib/python/Plugins/Extensions/DVDBurn/data/dreamdvd_boat.jpg b/lib/python/Plugins/Extensions/DVDBurn/data/dreamdvd_boat.jpg deleted file mode 100755 index a5256e28..00000000 Binary files a/lib/python/Plugins/Extensions/DVDBurn/data/dreamdvd_boat.jpg and /dev/null differ diff --git a/lib/python/Plugins/Extensions/DVDBurn/data/dreamvmgm.mpg b/lib/python/Plugins/Extensions/DVDBurn/data/dreamvmgm.mpg deleted file mode 100644 index 4797986f..00000000 Binary files a/lib/python/Plugins/Extensions/DVDBurn/data/dreamvmgm.mpg and /dev/null differ diff --git a/lib/python/Plugins/Extensions/DVDBurn/data/silence.mp2 b/lib/python/Plugins/Extensions/DVDBurn/data/silence.mp2 deleted file mode 100644 index e8a817f8..00000000 Binary files a/lib/python/Plugins/Extensions/DVDBurn/data/silence.mp2 and /dev/null differ diff --git a/lib/python/Plugins/Extensions/DVDBurn/template/DreamboxDVDtemplate.ddvdp.xml b/lib/python/Plugins/Extensions/DVDBurn/template/DreamboxDVDtemplate.ddvdp.xml deleted file mode 100644 index b839ad8a..00000000 --- a/lib/python/Plugins/Extensions/DVDBurn/template/DreamboxDVDtemplate.ddvdp.xml +++ /dev/null @@ -1,18 +0,0 @@ - - - - - diff --git a/lib/python/Plugins/Extensions/DVDBurn/template/Makefile.am b/lib/python/Plugins/Extensions/DVDBurn/template/Makefile.am deleted file mode 100644 index f0d9e8a0..00000000 --- a/lib/python/Plugins/Extensions/DVDBurn/template/Makefile.am +++ /dev/null @@ -1,7 +0,0 @@ -AUTOMAKE_OPTIONS = gnu - -installdir = /etc/enigma2/playlist - -install_DATA = \ - DreamboxDVDtemplate.ddvdp.xml - -- cgit v1.2.3 From ce8e939502fb096515b84a16087bdcb2c498bfdc Mon Sep 17 00:00:00 2001 From: ghost Date: Sun, 2 Nov 2008 11:14:33 +0100 Subject: add .mp2 as supported filetype --- lib/python/Components/FileList.py | 1 + lib/python/Plugins/Extensions/MediaPlayer/plugin.py | 6 +++--- lib/service/servicemp3.cpp | 1 + 3 files changed, 5 insertions(+), 3 deletions(-) (limited to 'lib/python/Plugins/Extensions') diff --git a/lib/python/Components/FileList.py b/lib/python/Components/FileList.py index 7801c556..e028ec3a 100644 --- a/lib/python/Components/FileList.py +++ b/lib/python/Components/FileList.py @@ -10,6 +10,7 @@ from enigma import RT_HALIGN_LEFT, eListboxPythonMultiContent, \ from Tools.LoadPixmap import LoadPixmap EXTENSIONS = { + "mp2": "music", "mp3": "music", "wav": "music", "ogg": "music", diff --git a/lib/python/Plugins/Extensions/MediaPlayer/plugin.py b/lib/python/Plugins/Extensions/MediaPlayer/plugin.py index a144f2cd..841ad614 100644 --- a/lib/python/Plugins/Extensions/MediaPlayer/plugin.py +++ b/lib/python/Plugins/Extensions/MediaPlayer/plugin.py @@ -66,7 +66,7 @@ class MediaPlayer(Screen, InfoBarBase, InfoBarSeek, InfoBarAudioSelection, InfoB self.addPlaylistParser(PlaylistIOInternal, "e2pls") # 'None' is magic to start at the list of mountpoints - self.filelist = FileList(None, matchingPattern = "(?i)^.*\.(mp3|ogg|ts|wav|wave|m3u|pls|e2pls|mpg|vob|avi|mkv|mp4|dat|flac)", useServiceRef = True, additionalExtensions = "4098:m3u 4098:e2pls 4098:pls") + self.filelist = FileList(None, matchingPattern = "(?i)^.*\.(mp2|mp3|ogg|ts|wav|wave|m3u|pls|e2pls|mpg|vob|avi|mkv|mp4|dat|flac)", useServiceRef = True, additionalExtensions = "4098:m3u 4098:e2pls 4098:pls") self["filelist"] = self.filelist self.playlist = MyPlayList() @@ -727,7 +727,7 @@ class MediaPlayer(Screen, InfoBarBase, InfoBarSeek, InfoBarAudioSelection, InfoB ext = text[-4:].lower() # FIXME: the information if the service contains video (and we should hide our window) should com from the service instead - if ext not in [".mp3", ".wav", ".ogg", "flac"] and not self.isAudioCD: + if ext not in [".mp2", ".mp3", ".wav", ".ogg", "flac"] and not self.isAudioCD: self.hide() else: needsInfoUpdate = True @@ -754,7 +754,7 @@ class MediaPlayer(Screen, InfoBarBase, InfoBarSeek, InfoBarAudioSelection, InfoB currref = self.playlist.getServiceRefList()[idx] text = currref.getPath() ext = text[-4:].lower() - if ext not in [".mp3", ".wav", ".ogg", "flac"] and not self.isAudioCD: + if ext not in [".mp2", ".mp3", ".wav", ".ogg", "flac"] and not self.isAudioCD: self.hide() else: needsInfoUpdate = True diff --git a/lib/service/servicemp3.cpp b/lib/service/servicemp3.cpp index 5c982aa1..c76e346e 100644 --- a/lib/service/servicemp3.cpp +++ b/lib/service/servicemp3.cpp @@ -27,6 +27,7 @@ eServiceFactoryMP3::eServiceFactoryMP3() if (sc) { std::list extensions; + extensions.push_back("mp2"); extensions.push_back("mp3"); extensions.push_back("ogg"); extensions.push_back("mpg"); -- cgit v1.2.3 From 58fe3de03d974c022df060acdf5d0e3dbc5bac90 Mon Sep 17 00:00:00 2001 From: Fraxinas Date: Mon, 3 Nov 2008 09:01:50 +0100 Subject: user correct playlist parser from dict --- lib/python/Plugins/Extensions/MediaPlayer/plugin.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'lib/python/Plugins/Extensions') diff --git a/lib/python/Plugins/Extensions/MediaPlayer/plugin.py b/lib/python/Plugins/Extensions/MediaPlayer/plugin.py index 841ad614..ed1a8874 100644 --- a/lib/python/Plugins/Extensions/MediaPlayer/plugin.py +++ b/lib/python/Plugins/Extensions/MediaPlayer/plugin.py @@ -592,12 +592,13 @@ class MediaPlayer(Screen, InfoBarBase, InfoBarSeek, InfoBarAudioSelection, InfoB def PlaylistSelected(self,path): if path is not None: self.clear_playlist() - self.playlistIOInternal = PlaylistIOInternal() - list = self.playlistIOInternal.open(path[1]) - if list: + extension = path[0].rsplit('.',1)[-1] + if self.playlistparsers.has_key(extension): + playlist = self.playlistparsers[extension]() + list = playlist.open(path[1]) for x in list: self.playlist.addFile(x.ref) - self.playlist.updateList() + self.playlist.updateList() def delete_saved_playlist(self): listpath = [] -- cgit v1.2.3 From 70e2fc28acaa3fb20a095acac7079377f8e1eb51 Mon Sep 17 00:00:00 2001 From: Fraxinas Date: Tue, 4 Nov 2008 15:27:06 +0100 Subject: implement blanking of dvd minus rw media --- lib/python/Plugins/Extensions/DVDBurn/DVDToolbox.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'lib/python/Plugins/Extensions') diff --git a/lib/python/Plugins/Extensions/DVDBurn/DVDToolbox.py b/lib/python/Plugins/Extensions/DVDBurn/DVDToolbox.py index 0c375129..d4e6a375 100644 --- a/lib/python/Plugins/Extensions/DVDBurn/DVDToolbox.py +++ b/lib/python/Plugins/Extensions/DVDBurn/DVDToolbox.py @@ -150,7 +150,7 @@ class DVDformatJob(Job): DVDformatTask(self) def retry(self): - self.tasks[0].args += [ "-force" ] + self.tasks[0].args += self.tasks[0].retryargs Job.retry(self) class DVDformatTaskPostcondition(Condition): @@ -174,6 +174,7 @@ class DVDformatTask(Task): self.setTool("/bin/dvd+rw-format") self.args += [ "/dev/" + harddiskmanager.getCD() ] self.end = 1100 + self.retryargs = [ ] def prepare(self): self.error = None @@ -181,7 +182,10 @@ class DVDformatTask(Task): def processOutputLine(self, line): if line.startswith("- media is already formatted"): self.error = self.ERROR_ALREADYFORMATTED - self.force = True + self.retryargs = [ "-force" ] + if line.startswith("- media is not blank"): + self.error = self.ERROR_ALREADYFORMATTED + self.retryargs = [ "-blank" ] if line.startswith(":-( mounted media doesn't appear to be"): self.error = self.ERROR_NOTWRITEABLE -- cgit v1.2.3 From 2977b2dfa5d96055c5abc10ec31adb4dbf8f9e2a Mon Sep 17 00:00:00 2001 From: Fraxinas Date: Tue, 4 Nov 2008 23:03:42 +0100 Subject: don't crash when exitting dvd image selection without selection --- lib/python/Plugins/Extensions/DVDBurn/TitleList.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'lib/python/Plugins/Extensions') diff --git a/lib/python/Plugins/Extensions/DVDBurn/TitleList.py b/lib/python/Plugins/Extensions/DVDBurn/TitleList.py index 600411ce..19380af4 100644 --- a/lib/python/Plugins/Extensions/DVDBurn/TitleList.py +++ b/lib/python/Plugins/Extensions/DVDBurn/TitleList.py @@ -207,10 +207,11 @@ class TitleList(Screen, HelpableScreen): self.session.openWithCallback(self.JobViewCB, JobView, job) def burnISO(self, path, scope): - job = Process.DVDisoJob(self.project, path) - job_manager.AddJob(job) - job_manager.in_background = False - self.session.openWithCallback(self.JobViewCB, JobView, job) + if path: + job = Process.DVDisoJob(self.project, path) + job_manager.AddJob(job) + job_manager.in_background = False + self.session.openWithCallback(self.JobViewCB, JobView, job) def JobViewCB(self, in_background): job_manager.in_background = in_background -- cgit v1.2.3 From 6eecc2f4fcc1e40f9fb093d08271dca3000d4b8d Mon Sep 17 00:00:00 2001 From: Fraxinas Date: Wed, 5 Nov 2008 12:52:46 +0100 Subject: nastily pretend the dvd minus rw bruning error never happened --- lib/python/Plugins/Extensions/DVDBurn/Process.py | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) (limited to 'lib/python/Plugins/Extensions') diff --git a/lib/python/Plugins/Extensions/DVDBurn/Process.py b/lib/python/Plugins/Extensions/DVDBurn/Process.py index 7a03b7eb..9cca8f70 100644 --- a/lib/python/Plugins/Extensions/DVDBurn/Process.py +++ b/lib/python/Plugins/Extensions/DVDBurn/Process.py @@ -241,7 +241,11 @@ class WaitForResidentTasks(Task): class BurnTaskPostcondition(Condition): RECOVERABLE = True def check(self, task): - return task.error is None + if task.returncode == 0: + return True + elif task.error is None or task.error is task.ERROR_MINUSRWBUG: + return True + return False def getErrorMessage(self, task): return { @@ -257,7 +261,7 @@ class BurnTaskPostcondition(Condition): }[task.error] class BurnTask(Task): - ERROR_NOTWRITEABLE, ERROR_LOAD, ERROR_SIZE, ERROR_WRITE_FAILED, ERROR_DVDROM, ERROR_ISOFS, ERROR_FILETOOLARGE, ERROR_ISOTOOLARGE, ERROR_UNKNOWN = range(9) + ERROR_NOTWRITEABLE, ERROR_LOAD, ERROR_SIZE, ERROR_WRITE_FAILED, ERROR_DVDROM, ERROR_ISOFS, ERROR_FILETOOLARGE, ERROR_ISOTOOLARGE, ERROR_MINUSRWBUG, ERROR_UNKNOWN = range(10) def __init__(self, job, extra_args=[], tool="/bin/growisofs"): Task.__init__(self, job, job.name) self.weighting = 500 @@ -284,12 +288,17 @@ class BurnTask(Task): self.error = self.ERROR_NOTWRITEABLE if line.find("ASC=24h") != -1: self.error = self.ERROR_LOAD + if line.find("SK=5h/ASC=A8h/ACQ=04h") != -1: + self.error = self.ERROR_MINUSRWBUG else: self.error = self.ERROR_UNKNOWN print "BurnTask: unknown error %s" % line elif line.startswith(":-("): if line.find("No space left on device") != -1: self.error = self.ERROR_SIZE + elif self.error == self.ERROR_MINUSRWBUG: + print "*sigh* this is a known bug. we're simply gonna assume everything is fine." + self.postconditions = [] elif line.find("write failed") != -1: self.error = self.ERROR_WRITE_FAILED elif line.find("unable to open64(") != -1 and line.find(",O_RDONLY): No such file or directory") != -1: @@ -309,6 +318,11 @@ class BurnTask(Task): self.error = self.ERROR_FILETOOLARGE elif line.startswith("genisoimage: File too large."): self.error = self.ERROR_ISOTOOLARGE + + def setTool(self, tool): + self.cmd = tool + self.args = [tool] + self.global_preconditions.append(ToolExistsPrecondition()) class RemoveDVDFolder(Task): def __init__(self, job): -- cgit v1.2.3 From be7ed059a249fd76b9acb3db00c5d22dff6d6694 Mon Sep 17 00:00:00 2001 From: Fraxinas Date: Wed, 5 Nov 2008 14:32:25 +0100 Subject: try to add dvdburn icon once again --- lib/python/Plugins/Extensions/DVDBurn/Makefile.am | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'lib/python/Plugins/Extensions') diff --git a/lib/python/Plugins/Extensions/DVDBurn/Makefile.am b/lib/python/Plugins/Extensions/DVDBurn/Makefile.am index d5c558d1..cb65f56a 100644 --- a/lib/python/Plugins/Extensions/DVDBurn/Makefile.am +++ b/lib/python/Plugins/Extensions/DVDBurn/Makefile.am @@ -5,5 +5,5 @@ install_PYTHON = \ plugin.py \ DVDProject.py DVDTitle.py TitleCutter.py TitleList.py Process.py ProjectSettings.py DVDToolbox.py -install_DATA = *.xml *.jpg *.mpg *.mp2 +install_DATA = *.xml *.jpg *.mpg *.mp2 *.png -- cgit v1.2.3 From d14da9c99de7d25b8811292e53cc745e30594234 Mon Sep 17 00:00:00 2001 From: Fraxinas Date: Wed, 5 Nov 2008 17:25:52 +0100 Subject: allow setting progress for current task from within resident task, implement rudimentary progress for mplextask in dvdburn (requires dvdauthor patch) --- lib/python/Components/Task.py | 12 ++++--- lib/python/Plugins/Extensions/DVDBurn/Process.py | 45 ++++++++++++++---------- 2 files changed, 33 insertions(+), 24 deletions(-) (limited to 'lib/python/Plugins/Extensions') diff --git a/lib/python/Components/Task.py b/lib/python/Components/Task.py index b276438f..9a768425 100644 --- a/lib/python/Components/Task.py +++ b/lib/python/Components/Task.py @@ -45,6 +45,7 @@ class Job(object): def addTask(self, task): task.job = self + task.task_progress_changed = self.task_progress_changed_CB self.tasks.append(task) def start(self, callback): @@ -70,7 +71,7 @@ class Job(object): else: print "still waiting for %d resident task(s) %s to finish" % (len(self.resident_tasks), str(self.resident_tasks)) else: - self.tasks[self.current_task].run(self.taskCallback, self.task_progress_changed_CB) + self.tasks[self.current_task].run(self.taskCallback) self.state_changed() def taskCallback(self, task, res, stay_resident = False): @@ -151,7 +152,7 @@ class Task(object): not_met.append(precondition) return not_met - def run(self, callback, task_progress_changed): + def run(self, callback): failed_preconditions = self.checkPreconditions(True) + self.checkPreconditions(False) if len(failed_preconditions): callback(self, failed_preconditions) @@ -159,7 +160,6 @@ class Task(object): self.prepare() self.callback = callback - self.task_progress_changed = task_progress_changed from enigma import eConsoleAppContainer self.container = eConsoleAppContainer() self.container.appClosed.append(self.processFinished) @@ -235,7 +235,8 @@ class Task(object): if progress < 0: progress = 0 self.__progress = progress - self.task_progress_changed() + if self.task_progress_changed: + self.task_progress_changed() progress = property(getProgress, setProgress) @@ -372,7 +373,8 @@ class ToolExistsPrecondition(Condition): return _("A required tool (%s) was not found.") % (self.realpath) class AbortedPostcondition(Condition): - pass + def getErrorMessage(self, task): + return "Cancelled upon user request" class ReturncodePostcondition(Condition): def check(self, task): diff --git a/lib/python/Plugins/Extensions/DVDBurn/Process.py b/lib/python/Plugins/Extensions/DVDBurn/Process.py index 9cca8f70..49054596 100644 --- a/lib/python/Plugins/Extensions/DVDBurn/Process.py +++ b/lib/python/Plugins/Extensions/DVDBurn/Process.py @@ -10,8 +10,8 @@ class png2yuvTask(Task): self.dumpFile = outputfile self.weighting = 15 - def run(self, callback, task_progress_changed): - Task.run(self, callback, task_progress_changed) + def run(self, callback): + Task.run(self, callback) self.container.stdoutAvail.remove(self.processStdout) self.container.dumpToFile(self.dumpFile) @@ -26,8 +26,8 @@ class mpeg2encTask(Task): self.inputFile = inputfile self.weighting = 25 - def run(self, callback, task_progress_changed): - Task.run(self, callback, task_progress_changed) + def run(self, callback): + Task.run(self, callback) self.container.readFromFile(self.inputFile) def processOutputLine(self, line): @@ -42,8 +42,8 @@ class spumuxTask(Task): self.dumpFile = outputfile self.weighting = 15 - def run(self, callback, task_progress_changed): - Task.run(self, callback, task_progress_changed) + def run(self, callback): + Task.run(self, callback) self.container.stdoutAvail.remove(self.processStdout) self.container.dumpToFile(self.dumpFile) self.container.readFromFile(self.inputFile) @@ -212,7 +212,7 @@ class RemoveESFiles(Task): class DVDAuthorTask(Task): def __init__(self, job): Task.__init__(self, job, "Authoring DVD") - self.weighting = 300 + self.weighting = 20 self.setTool("/usr/bin/dvdauthor") self.CWD = self.job.workspace self.args += ["-x", self.job.workspace+"/dvdauthor.xml"] @@ -222,6 +222,14 @@ class DVDAuthorTask(Task): print "[DVDAuthorTask] ", line[:-1] if not self.menupreview and line.startswith("STAT: Processing"): self.callback(self, [], stay_resident=True) + elif line.startswith("STAT: VOBU"): + try: + progress = int(line.split("MB")[0].split(" ")[-1]) + if progress: + self.job.mplextask.progress = progress + print "[DVDAuthorTask] update mplextask progress:", self.job.mplextask.progress, "of", self.job.mplextask.end + except: + print "couldn't set mux progress" class DVDAuthorFinalTask(Task): def __init__(self, job): @@ -233,7 +241,7 @@ class WaitForResidentTasks(Task): def __init__(self, job): Task.__init__(self, job, "waiting for dvdauthor to finalize") - def run(self, callback, task_progress_changed): + def run(self, callback): print "waiting for %d resident task(s) %s to finish..." % (len(self.job.resident_tasks),str(self.job.resident_tasks)) if self.job.resident_tasks == 0: callback(self, []) @@ -334,23 +342,24 @@ class RemoveDVDFolder(Task): class CheckDiskspaceTask(Task): def __init__(self, job): Task.__init__(self, job, "Checking free space") - totalsize = 50*1024*1024 # require an extra safety 50 MB + totalsize = 0 # require an extra safety 50 MB maxsize = 0 for title in job.project.titles: titlesize = title.estimatedDiskspace if titlesize > maxsize: maxsize = titlesize totalsize += titlesize diskSpaceNeeded = totalsize + maxsize + job.estimateddvdsize = totalsize / 1024 / 1024 + totalsize += 50*1024*1024 # require an extra safety 50 MB self.global_preconditions.append(DiskspacePrecondition(diskSpaceNeeded)) self.weighting = 5 - def run(self, callback, task_progress_changed): + def run(self, callback): failed_preconditions = self.checkPreconditions(True) + self.checkPreconditions(False) if len(failed_preconditions): callback(self, failed_preconditions) return self.callback = callback - self.task_progress_changed = task_progress_changed Task.processFinished(self, 0) class PreviewTask(Task): @@ -361,9 +370,8 @@ class PreviewTask(Task): self.path = path self.weighting = 10 - def run(self, callback, task_progress_changed): + def run(self, callback): self.callback = callback - self.task_progress_changed = task_progress_changed if self.job.menupreview: self.previewProject() else: @@ -439,9 +447,8 @@ class ImagePrepareTask(Task): self.job = job self.Menus = job.Menus - def run(self, callback, task_progress_changed): + def run(self, callback): self.callback = callback - self.task_progress_changed = task_progress_changed # we are doing it this weird way so that the TaskView Screen actually pops up before the spinner comes from enigma import eTimer self.delayTimer = eTimer() @@ -451,7 +458,7 @@ class ImagePrepareTask(Task): def conduct(self): try: from ImageFont import truetype - from Image import open as Image_open + from Image import open as Image_open s = self.job.project.settings self.Menus.im_bg_orig = Image_open(s.menubg.getValue()) if self.Menus.im_bg_orig.size != (self.Menus.imgwidth, self.Menus.imgheight): @@ -475,9 +482,8 @@ class MenuImageTask(Task): self.menubgpngfilename = menubgpngfilename self.highlightpngfilename = highlightpngfilename - def run(self, callback, task_progress_changed): + def run(self, callback): self.callback = callback - self.task_progress_changed = task_progress_changed try: import ImageDraw, Image, os s = self.job.project.settings @@ -712,7 +718,8 @@ class DVDJob(Job): title_filename = self.workspace + "/dvd_title_%d.mpg" % (self.i+1) LinkTS(self, title.inputfile, link_name) demux = DemuxTask(self, link_name) - MplexTask(self, outputfile=title_filename, demux_task=demux) + self.mplextask = MplexTask(self, outputfile=title_filename, demux_task=demux) + self.mplextask.end = self.estimateddvdsize RemoveESFiles(self, demux) WaitForResidentTasks(self) PreviewTask(self, self.workspace + "/dvd/VIDEO_TS/") -- cgit v1.2.3 From 99c296ce8c61a4393dae09fd78ae54b4510ec6fd Mon Sep 17 00:00:00 2001 From: ghost Date: Thu, 6 Nov 2008 12:38:03 +0100 Subject: DVDPlayer/plugin.py: more robust code --- lib/python/Plugins/Extensions/DVDPlayer/plugin.py | 107 ++++++++++++---------- 1 file changed, 59 insertions(+), 48 deletions(-) (limited to 'lib/python/Plugins/Extensions') diff --git a/lib/python/Plugins/Extensions/DVDPlayer/plugin.py b/lib/python/Plugins/Extensions/DVDPlayer/plugin.py index 4298642c..cb5f0e0d 100644 --- a/lib/python/Plugins/Extensions/DVDPlayer/plugin.py +++ b/lib/python/Plugins/Extensions/DVDPlayer/plugin.py @@ -371,13 +371,25 @@ class DVDPlayer(Screen, InfoBarBase, InfoBarNotifications, InfoBarSeek, InfoBarP if retval > 0: self.zapToNumber(retval) + def getServiceInterface(self, iface): + service = self.service + if service: + attr = getattr(service, iface, None) + if callable(attr): + return attr() + return None + def __serviceStopped(self): self.dvdScreen.hide() - self.service.subtitle().disableSubtitles(self.session.current_dialog.instance) + subs = self.getServiceInterface("subtitle") + if subs: + subs.disableSubtitles(self.session.current_dialog.instance) def serviceStarted(self): #override InfoBarShowHide function self.dvdScreen.show() - self.service.subtitle().enableSubtitles(self.dvdScreen.instance, None) + subs = self.getServiceInterface("subtitle") + if subs: + subs.enableSubtitles(self.dvdScreen.instance, None) def doEofInternal(self, playing): if self.in_menu: @@ -435,17 +447,19 @@ class DVDPlayer(Screen, InfoBarBase, InfoBarNotifications, InfoBarSeek, InfoBarP print "StringAvail" def __osdAudioInfoAvail(self): - audioTuple = self.service.info().getInfoObject(iServiceInformation.sUser+6) + info = self.getServiceInterface("info") + audioTuple = info and info.getInfoObject(iServiceInformation.sUser+6) print "AudioInfoAvail ", repr(audioTuple) if audioTuple: audioString = "%d: %s (%s)" % (audioTuple[0],audioTuple[1],audioTuple[2]) self["audioLabel"].setText(audioString) if audioTuple != self.last_audioTuple and not self.in_menu: self.doShow() - self.last_audioTuple = audioTuple + self.last_audioTuple = audioTuple def __osdSubtitleInfoAvail(self): - subtitleTuple = self.service.info().getInfoObject(iServiceInformation.sUser+7) + info = self.getServiceInterface("info") + subtitleTuple = info and info.getInfoObject(iServiceInformation.sUser+7) print "SubtitleInfoAvail ", repr(subtitleTuple) if subtitleTuple: subtitleString = "" @@ -454,21 +468,25 @@ class DVDPlayer(Screen, InfoBarBase, InfoBarNotifications, InfoBarSeek, InfoBarP self["subtitleLabel"].setText(subtitleString) if subtitleTuple != self.last_subtitleTuple and not self.in_menu: self.doShow() - self.last_subtitleTuple = subtitleTuple + self.last_subtitleTuple = subtitleTuple def __chapterUpdated(self): - self.currentChapter = self.service.info().getInfo(iServiceInformation.sCurrentChapter) - self.totalChapters = self.service.info().getInfo(iServiceInformation.sTotalChapters) - self.setChapterLabel() - print "__chapterUpdated: %d/%d" % (self.currentChapter, self.totalChapters) + info = self.getServiceInterface("info") + if info: + self.currentChapter = info.getInfo(iServiceInformation.sCurrentChapter) + self.totalChapters = info.getInfo(iServiceInformation.sTotalChapters) + self.setChapterLabel() + print "__chapterUpdated: %d/%d" % (self.currentChapter, self.totalChapters) def __titleUpdated(self): - self.currentTitle = self.service.info().getInfo(iServiceInformation.sCurrentTitle) - self.totalTitles = self.service.info().getInfo(iServiceInformation.sTotalTitles) - self.setChapterLabel() - print "__titleUpdated: %d/%d" % (self.currentTitle, self.totalTitles) - if not self.in_menu: - self.doShow() + info = self.getServiceInterface("info") + if info: + self.currentTitle = info.getInfo(iServiceInformation.sCurrentTitle) + self.totalTitles = info.getInfo(iServiceInformation.sTotalTitles) + self.setChapterLabel() + print "__titleUpdated: %d/%d" % (self.currentTitle, self.totalTitles) + if not self.in_menu: + self.doShow() def askLeavePlayer(self): choices = [(_("Continue playing"), "play"), (_("Exit"), "exit")] @@ -476,73 +494,65 @@ class DVDPlayer(Screen, InfoBarBase, InfoBarNotifications, InfoBarSeek, InfoBarP choices.insert(1,(_("Return to file browser"), "browser")) self.session.openWithCallback(self.exitCB, ChoiceBox, title=_("Leave DVD Player?"), list = choices) + def sendKey(self, key): + keys = self.getServiceInterface("keys") + if keys: + keys.keyPressed(key) + return keys + def nextAudioTrack(self): - if self.service: - self.service.keys().keyPressed(iServiceKeys.keyUser) + self.sendKey(iServiceKeys.keyUser) def nextSubtitleTrack(self): - if self.service: - self.service.keys().keyPressed(iServiceKeys.keyUser+1) + self.sendKey(iServiceKeys.keyUser+1) def enterDVDAudioMenu(self): - if self.service: - self.service.keys().keyPressed(iServiceKeys.keyUser+2) + self.sendKey(iServiceKeys.keyUser+2) def nextChapter(self): - if self.service: - self.service.keys().keyPressed(iServiceKeys.keyUser+3) + self.sendKey(iServiceKeys.keyUser+3) def prevChapter(self): - if self.service: - self.service.keys().keyPressed(iServiceKeys.keyUser+4) + self.sendKey(iServiceKeys.keyUser+4) def nextTitle(self): - if self.service: - self.service.keys().keyPressed(iServiceKeys.keyUser+5) + self.sendKey(iServiceKeys.keyUser+5) def prevTitle(self): - if self.service: - self.service.keys().keyPressed(iServiceKeys.keyUser+6) + self.sendKey(iServiceKeys.keyUser+6) def enterDVDMenu(self): - if self.service: - self.service.keys().keyPressed(iServiceKeys.keyUser+7) + self.sendKey(iServiceKeys.keyUser+7) def seekBeginning(self): if self.service: seekable = self.getSeek() - if seekable is not None: + if seekable: seekable.seekTo(0) def zapToNumber(self, number): if self.service: seekable = self.getSeek() - if seekable is not None: + if seekable: print "seek to chapter %d" % number seekable.seekChapter(number) # MENU ACTIONS def keyRight(self): - if self.service: - self.service.keys().keyPressed(iServiceKeys.keyRight) + self.sendKey(iServiceKeys.keyRight) def keyLeft(self): - if self.service: - self.service.keys().keyPressed(iServiceKeys.keyLeft) + self.sendKey(iServiceKeys.keyLeft) def keyUp(self): - if self.service: - self.service.keys().keyPressed(iServiceKeys.keyUp) + self.sendKey(iServiceKeys.keyUp) def keyDown(self): - if self.service: - self.service.keys().keyPressed(iServiceKeys.keyDown) + self.sendKey(iServiceKeys.keyDown) def keyOk(self): - if self.service: - if not self.in_menu: - self.toggleInfo() - self.service.keys().keyPressed(iServiceKeys.keyOk) + if self.sendKey(iServiceKeys.keyOk) and not self.in_menu: + self.toggleInfo() def keyCancel(self): self.askLeavePlayer() @@ -606,9 +616,10 @@ class DVDPlayer(Screen, InfoBarBase, InfoBarNotifications, InfoBarSeek, InfoBarP def playLastCB(self, answer): # overwrite infobar cuesheet function print "playLastCB", answer, self.resume_point if self.service: - seek = self.service.seek() if answer == True: - seek.seekTo(self.resume_point) + seekable = self.getSeek() + if seekable: + seekable.seekTo(self.resume_point) pause = self.service.pause() pause.unpause() self.hideAfterResume() -- cgit v1.2.3 From fde1aa8770d42e9a5abb598f1db3c54045f0d8c8 Mon Sep 17 00:00:00 2001 From: Fraxinas Date: Thu, 6 Nov 2008 19:32:18 +0100 Subject: allow reading jfif embedded exif thumbnails from jpeg files and use them to speed up thumbnail view in pictureplayer plugin --- lib/gdi/picload.cpp | 159 ++++++++++++++++++++- lib/gdi/picload.h | 2 +- .../Plugins/Extensions/PicturePlayer/plugin.py | 4 +- 3 files changed, 159 insertions(+), 6 deletions(-) (limited to 'lib/python/Plugins/Extensions') diff --git a/lib/gdi/picload.cpp b/lib/gdi/picload.cpp index 94cb35b1..1f9bed48 100644 --- a/lib/gdi/picload.cpp +++ b/lib/gdi/picload.cpp @@ -10,6 +10,8 @@ #include // savePNG need it +#define JDCT_DEFAULT JDCT_IFAST + extern "C" { #include #include @@ -163,6 +165,151 @@ static int jpeg_save(unsigned char *image_buffer, const char * filename, int qua return 0; } +/* Expanded data source object for memory buffer input */ +typedef struct +{ + struct jpeg_source_mgr pub; /* public fields */ + FILE *infile; /* source stream */ + JOCTET *buffer; /* start of buffer */ + boolean start_of_file; /* have we gotten any data yet? */ +} mem_source_mgr; + +typedef mem_source_mgr *mem_src_ptr; + +static void init_source (j_decompress_ptr cinfo) +{ + mem_src_ptr src = (mem_src_ptr) cinfo->src; + src->start_of_file = TRUE; +} + +static boolean fill_input_buffer (j_decompress_ptr cinfo) +{ + /* no-op */ (void)cinfo; + return TRUE; + } + +static void skip_input_data (j_decompress_ptr cinfo, long num_bytes) +{ + mem_src_ptr src = (mem_src_ptr) cinfo->src; + + if (num_bytes > 0) + { + src->pub.next_input_byte += (size_t) num_bytes; + src->pub.bytes_in_buffer -= (size_t) num_bytes; + } +} + +static void term_source (j_decompress_ptr cinfo) +{ + /* no-op */ (void)cinfo; +} + +static void jpeg_memory_src (j_decompress_ptr cinfo, unsigned char *inbfr, int len) +{ + mem_src_ptr src; + if (cinfo->src == NULL) + { + cinfo->src = (struct jpeg_source_mgr *) + (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_PERMANENT, (size_t)sizeof(mem_source_mgr)); + src = (mem_src_ptr) cinfo->src; + src->buffer = (JOCTET *) inbfr; + } + src = (mem_src_ptr) cinfo->src; + src->pub.init_source = init_source; + src->pub.fill_input_buffer = fill_input_buffer; + src->pub.skip_input_data = skip_input_data; + src->pub.resync_to_restart = jpeg_resync_to_restart; /* use default method */ + src->pub.term_source = term_source; + src->infile = 0L; + src->pub.bytes_in_buffer = len; /* sets to entire file len */ + src->pub.next_input_byte = (JOCTET *)inbfr; /* at start of buffer */ +} + +static int jpeg_load_thumb(const char *filename, int *x, int *y) +{ + struct jpeg_decompress_struct cinfo; + struct jpeg_decompress_struct *ciptr = &cinfo; + struct r_jpeg_error_mgr emgr; + FILE *fh; + + if (!(fh = fopen(filename, "rb"))) + return 0; + + ciptr->err = jpeg_std_error(&emgr.pub); + emgr.pub.error_exit = jpeg_cb_error_exit; + if (setjmp(emgr.envbuffer) == 1) + { + jpeg_destroy_decompress(ciptr); + fclose(fh); + return 0; + } + + jpeg_create_decompress(ciptr); + jpeg_stdio_src(ciptr, fh); + + jpeg_save_markers (ciptr, JPEG_APP0 + 1, 0xffff); + + jpeg_read_header(ciptr, TRUE); + + struct jpeg_marker_struct *m = cinfo.marker_list; + + unsigned char *thumb_buf = NULL; + size_t bufsize; + + if ( m ) + { + unsigned char *p_data = m->data; + while ( p_data < m->data+m->data_length ) + { + if ( p_data[0] == 0xFF && p_data[1] == 0xD8 ) + { + bufsize = (size_t) m->data_length - (size_t) (p_data-m->data); + thumb_buf = new unsigned char[bufsize]; + bufsize = 0; + do { + thumb_buf[bufsize++] = *p_data; + } while ( !(*p_data++ == 0xFF && *p_data == 0xD9) && p_data < m->data+m->data_length ); + thumb_buf[bufsize++] = *p_data; + } + p_data++; + } + } + + if ( thumb_buf != NULL ) + { + jpeg_create_decompress(ciptr); + jpeg_memory_src(ciptr, thumb_buf, bufsize-2); + jpeg_read_header(ciptr, TRUE); + } + else + eDebug("no exif thumbnail found! loading actual image instead"); + + ciptr->out_color_space = JCS_RGB; + ciptr->scale_denom = 1; + + jpeg_start_decompress(ciptr); + + *x=ciptr->output_width; + *y=ciptr->output_height; + + if(ciptr->output_components == 3) + { + JSAMPLE *lb = (JSAMPLE *)(*ciptr->mem->alloc_small)((j_common_ptr) ciptr, JPOOL_PERMANENT, ciptr->output_width * ciptr->output_components); + pic_buffer = new unsigned char[ciptr->output_height * ciptr->output_width * ciptr->output_components]; + unsigned char *bp = pic_buffer; + + while (ciptr->output_scanline < ciptr->output_height) + { + jpeg_read_scanlines(ciptr, &lb, 1); + memcpy(bp, lb, ciptr->output_width * ciptr->output_components); + bp += ciptr->output_width * ciptr->output_components; + } + } + jpeg_finish_decompress(ciptr); + jpeg_destroy_decompress(ciptr); + fclose(fh); + return 1; +} static int jpeg_load(const char *filename, int *x, int *y) { @@ -410,7 +557,7 @@ static int png_load(const char *filename, int *x, int *y) if (width * height > 1000000) // 1000x1000 or equiv. { - eDebug("[png_load] image size is %d x %d, which is \"too large\".", width, height); + eDebug("[png_load] image size is %d x %d, which is \"too large\".", (int)width, (int)height); png_read_end(png_ptr, info_ptr); png_destroy_read_struct(&png_ptr, &info_ptr, (png_infopp)NULL); fclose(fh); @@ -632,7 +779,7 @@ static int pic_id(const char *name) return F_NONE; } -int loadPic(ePtr &result, std::string filename, int w, int h, int aspect, int resize_mode, int rotate, int background, std::string cachefile) +int loadPic(ePtr &result, std::string filename, int w, int h, int aspect, int resize_mode, int rotate, int background, std::string cachefile, int thumbnail) { result = 0; int ox=0, oy=0, imx, imy; @@ -650,7 +797,13 @@ int loadPic(ePtr &result, std::string filename, int w, int h, int aspec switch(pic_id(filename.c_str())) { case F_PNG: png_load(filename.c_str(), &ox, &oy);break; - case F_JPEG: jpeg_load(filename.c_str(), &ox, &oy);pic_buffer = conv24to32(pic_buffer, ox*oy, 1); break; + case F_JPEG: { + if (thumbnail) + jpeg_load_thumb(filename.c_str(), &ox, &oy); + else + jpeg_load(filename.c_str(), &ox, &oy); + pic_buffer = conv24to32(pic_buffer, ox*oy, 1); + break; } case F_BMP: bmp_load(filename.c_str(), &ox, &oy);pic_buffer = conv24to32(pic_buffer, ox*oy, 1); break; case F_GIF: gif_load(filename.c_str(), &ox, &oy);pic_buffer = conv24to32(pic_buffer, ox*oy, 1); break; default: diff --git a/lib/gdi/picload.h b/lib/gdi/picload.h index 7d5d8b2a..7bb9adf1 100644 --- a/lib/gdi/picload.h +++ b/lib/gdi/picload.h @@ -5,7 +5,7 @@ #include #include -SWIG_VOID(int) loadPic(ePtr &SWIG_OUTPUT, std::string filename, int x, int y, int aspect, int resize_mode=0, int rotate=0, int background=0, std::string cachefile=""); +SWIG_VOID(int) loadPic(ePtr &SWIG_OUTPUT, std::string filename, int x, int y, int aspect, int resize_mode=0, int rotate=0, int background=0, std::string cachefile="", int thumbnail=0); PyObject *getExif(const char *filename); #endif // __picload_h__ diff --git a/lib/python/Plugins/Extensions/PicturePlayer/plugin.py b/lib/python/Plugins/Extensions/PicturePlayer/plugin.py index a9d61ed9..ea906f0d 100644 --- a/lib/python/Plugins/Extensions/PicturePlayer/plugin.py +++ b/lib/python/Plugins/Extensions/PicturePlayer/plugin.py @@ -155,7 +155,7 @@ class ThumbView(Screen): if not createDir(cachedir): cachefile = "" - ptr = loadPic(self.path + self.thumblist[self.thumbindex], 180, 160, self.aspect, int(config.pic.resize.value), int(config.pic.rotate.value),1, cachefile) + ptr = loadPic(self.path + self.thumblist[self.thumbindex], 180, 160, self.aspect, int(config.pic.resize.value), int(config.pic.rotate.value), 1, cachefile, 1) if ptr != None: self["thumb"+str(self.thumbindex)].show() self["thumb"+str(self.thumbindex)].instance.setPixmap(ptr) @@ -486,7 +486,7 @@ class picmain(Screen): if not createDir(cachedir): cachefile = "" - ptr = loadPic(self.filelist.getCurrentDirectory() + self.filelist.getFilename(), 180, 160, self.aspect, int(config.pic.resize.value), 0, 0, cachefile) + ptr = loadPic(self.filelist.getCurrentDirectory() + self.filelist.getFilename(), 180, 160, self.aspect, int(config.pic.resize.value), 0, 0, cachefile, 1) if ptr != None: self["thumbnail"].show() self["thumbnail"].instance.setPixmap(ptr) -- cgit v1.2.3 From cef8f42aa76d0ebf17b5b7ddf9883d6d6128c280 Mon Sep 17 00:00:00 2001 From: Fraxinas Date: Fri, 7 Nov 2008 09:21:24 +0100 Subject: refresh playlist when adding playlist via filelist. when copying directory to playlist, only add media files and no playlist files --- lib/python/Plugins/Extensions/MediaPlayer/plugin.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'lib/python/Plugins/Extensions') diff --git a/lib/python/Plugins/Extensions/MediaPlayer/plugin.py b/lib/python/Plugins/Extensions/MediaPlayer/plugin.py index ed1a8874..2233998c 100644 --- a/lib/python/Plugins/Extensions/MediaPlayer/plugin.py +++ b/lib/python/Plugins/Extensions/MediaPlayer/plugin.py @@ -632,7 +632,7 @@ class MediaPlayer(Screen, InfoBarBase, InfoBarSeek, InfoBarAudioSelection, InfoB if x[0][1] == True: #isDir if recursive: self.copyDirectory(x[0][0]) - else: + elif filelist.getServiceRef().type != 4098: self.playlist.addFile(x[0][0]) self.playlist.updateList() @@ -646,6 +646,7 @@ class MediaPlayer(Screen, InfoBarBase, InfoBarSeek, InfoBarAudioSelection, InfoB list = playlist.open(ServiceRef.getPath()) for x in list: self.playlist.addFile(x.ref) + self.playlist.updateList() else: self.playlist.addFile(self.filelist.getServiceRef()) self.playlist.updateList() -- cgit v1.2.3 From f5dc0e14397ef85ad77df165de061264dd2166fd Mon Sep 17 00:00:00 2001 From: Fraxinas Date: Fri, 7 Nov 2008 11:14:18 +0100 Subject: fix coverart displaying, allow using cover art with all different image formats, remove some debug prints --- .../Plugins/Extensions/MediaPlayer/plugin.py | 27 ++++++++++++---------- 1 file changed, 15 insertions(+), 12 deletions(-) (limited to 'lib/python/Plugins/Extensions') diff --git a/lib/python/Plugins/Extensions/MediaPlayer/plugin.py b/lib/python/Plugins/Extensions/MediaPlayer/plugin.py index 2233998c..963247d6 100644 --- a/lib/python/Plugins/Extensions/MediaPlayer/plugin.py +++ b/lib/python/Plugins/Extensions/MediaPlayer/plugin.py @@ -1,6 +1,6 @@ from os import path as os_path, remove as os_remove, listdir as os_listdir from time import strftime -from enigma import iPlayableService, eTimer, eServiceCenter, iServiceInformation +from enigma import iPlayableService, eTimer, eServiceCenter, iServiceInformation, loadPic from Screens.Screen import Screen from Screens.MessageBox import MessageBox from Screens.InputBox import InputBox @@ -14,6 +14,7 @@ from Tools.Directories import resolveFilename, SCOPE_CONFIG, SCOPE_PLAYLIST, SCO from Components.ServicePosition import ServicePositionGauge from Components.ServiceEventTracker import ServiceEventTracker, InfoBarBase from Components.Playlist import PlaylistIOInternal, PlaylistIOM3U, PlaylistIOPLS +from Components.AVSwitch import AVSwitch from Screens.InfoBarGenerics import InfoBarSeek, InfoBarAudioSelection, InfoBarCueSheetSupport, InfoBarNotifications, InfoBarSubtitleSupport from ServiceReference import ServiceReference from Screens.ChoiceBox import ChoiceBox @@ -42,6 +43,7 @@ class MediaPixmap(Pixmap): break if self.default_pixmap is None: self.default_pixmap = resolveFilename(SCOPE_SKIN_IMAGE, "skin_default/no_coverArt.png") + self.coverFileNames = ["folder.png", "folder.jpg"] return Pixmap.applySkin(self, desktop, screen) class MediaPlayer(Screen, InfoBarBase, InfoBarSeek, InfoBarAudioSelection, InfoBarCueSheetSupport, InfoBarNotifications, InfoBarSubtitleSupport, HelpableScreen): @@ -283,13 +285,15 @@ class MediaPlayer(Screen, InfoBarBase, InfoBarSeek, InfoBarAudioSelection, InfoB def updateCoverArtPixmap(self, path): while not path.endswith("/"): path = path[:-1] - pngname = path + "folder.png" - - if not fileExists(pngname): - pngname = self["coverArt"].default_pixmap - if self.coverArtFileName != pngname: - self.coverArtFileName = pngname - self["coverArt"].instance.setPixmapFromFile(self.coverArtFileName) + new_coverArtFileName = self["coverArt"].default_pixmap + for filename in self["coverArt"].coverFileNames: + if fileExists(path + filename): + new_coverArtFileName = path + filename + if self.coverArtFileName != new_coverArtFileName: + self.coverArtFileName = new_coverArtFileName + pixmap = loadPic(self.coverArtFileName, 116, 116, AVSwitch().getAspectRatioSetting()/2,1,0,0) + if pixmap is not None: + self["coverArt"].instance.setPixmap(pixmap.__deref__()) def leftDown(self): self.lefttimer = True @@ -632,7 +636,7 @@ class MediaPlayer(Screen, InfoBarBase, InfoBarSeek, InfoBarAudioSelection, InfoB if x[0][1] == True: #isDir if recursive: self.copyDirectory(x[0][0]) - elif filelist.getServiceRef().type != 4098: + elif filelist.getServiceRef() and filelist.getServiceRef().type == 4097: self.playlist.addFile(x[0][0]) self.playlist.updateList() @@ -640,7 +644,6 @@ class MediaPlayer(Screen, InfoBarBase, InfoBarSeek, InfoBarAudioSelection, InfoB if self.filelist.getServiceRef().type == 4098: # playlist ServiceRef = self.filelist.getServiceRef() extension = ServiceRef.getPath()[ServiceRef.getPath().rfind('.') + 1:] - print "extension:", extension if self.playlistparsers.has_key(extension): playlist = self.playlistparsers[extension]() list = playlist.open(ServiceRef.getPath()) @@ -763,7 +766,8 @@ class MediaPlayer(Screen, InfoBarBase, InfoBarSeek, InfoBarAudioSelection, InfoB self.unPauseService() if needsInfoUpdate == True: - self.updateCoverArtPixmap(currref.getPath()) + path = self.playlist.getServiceRefList()[self.playlist.getCurrentIndex()].getPath() + self.updateCoverArtPixmap(path) else: pngname = self["coverArt"].default_pixmap self.coverArtFileName = pngname @@ -815,7 +819,6 @@ class MediaPlayerLCDScreen(Screen): self["text4"] = Label("") def setText(self, text, line): - print "lcd set text:", text, line if len(text) > 10: if text[-4:] == ".mp3": text = text[:-4] -- cgit v1.2.3 From acbad24424304473f967b678bd9deb51f73acf27 Mon Sep 17 00:00:00 2001 From: Fraxinas Date: Mon, 10 Nov 2008 10:12:53 +0100 Subject: long keypress on INFO key either brings up single servie EPG view screen like right now or, if any plugins of new type WHERE_EVENTINFO are installed (e.g. GraphMultiEPG, IMDB, OFDB), a choicebox with the relevant plugins. consequence: GraphMultiEPG is no longer ran from extensions menu (blue button) but by long keypress on INFO button instead! --- data/keymap.xml | 4 ++-- .../Plugins/Extensions/GraphMultiEPG/plugin.py | 2 +- lib/python/Plugins/Plugin.py | 4 ++++ lib/python/Screens/InfoBarGenerics.py | 22 +++++++++++++++++++--- 4 files changed, 26 insertions(+), 6 deletions(-) (limited to 'lib/python/Plugins/Extensions') diff --git a/data/keymap.xml b/data/keymap.xml index 5e73490e..6b8b583d 100644 --- a/data/keymap.xml +++ b/data/keymap.xml @@ -77,8 +77,8 @@ - - + + diff --git a/lib/python/Plugins/Extensions/GraphMultiEPG/plugin.py b/lib/python/Plugins/Extensions/GraphMultiEPG/plugin.py index 7afbe14a..21d1bfe8 100644 --- a/lib/python/Plugins/Extensions/GraphMultiEPG/plugin.py +++ b/lib/python/Plugins/Extensions/GraphMultiEPG/plugin.py @@ -93,4 +93,4 @@ def main(session, servicelist, **kwargs): def Plugins(**kwargs): name = _("Graphical Multi EPG") descr = _("A graphical EPG for all services of an specific bouquet") - return [ PluginDescriptor(name=name, description=descr, where = PluginDescriptor.WHERE_EXTENSIONSMENU, fnc=main) ] + return [ PluginDescriptor(name=name, description=descr, where = PluginDescriptor.WHERE_EVENTINFO, fnc=main) ] diff --git a/lib/python/Plugins/Plugin.py b/lib/python/Plugins/Plugin.py index a0db1d66..6df4fce7 100644 --- a/lib/python/Plugins/Plugin.py +++ b/lib/python/Plugins/Plugin.py @@ -45,6 +45,10 @@ class PluginDescriptor: # or return a function which is called with session and the interface name for extended setup of this interface WHERE_NETWORKSETUP = 10 + # show up this plugin (or a choicebox with all of them) for long INFO keypress + # or return a function which is called with session and the interface name for extended setup of this interface + WHERE_EVENTINFO = 11 + def __init__(self, name = "Plugin", where = [ ], description = "", icon = None, fnc = None, wakeupfnc = None, internal = False): self.name = name self.internal = internal diff --git a/lib/python/Screens/InfoBarGenerics.py b/lib/python/Screens/InfoBarGenerics.py index aab2b649..cdaa2c1e 100644 --- a/lib/python/Screens/InfoBarGenerics.py +++ b/lib/python/Screens/InfoBarGenerics.py @@ -403,8 +403,8 @@ class InfoBarEPG: self.eventView = None self["EPGActions"] = HelpableActionMap(self, "InfobarEPGActions", { - "showEventInfo": (self.openEventView, _("show EPG...")), - "showSingleServiceEPG": (self.openSingleServiceEPG, _("show single service EPG...")), + "showEventView": (self.openEventView, _("show EPG...")), + "showEventInfoPlugin": (self.showEventInfoPlugins, _("show single service EPG...")), "showInfobarOrEpgWhenInfobarAlreadyVisible": self.showEventInfoWhenNotVisible, }) @@ -489,6 +489,23 @@ class InfoBarEPG: ref=self.session.nav.getCurrentlyPlayingServiceReference() self.session.open(EPGSelection, ref) + def showEventInfoPlugins(self): + list = [] + for p in plugins.getPlugins(where = PluginDescriptor.WHERE_EVENTINFO): + list.append((p.name, boundFunction(self.runPlugin, p))) + if len(list): + list.append((_("show single service EPG..."), self.openSingleServiceEPG)) + self.session.openWithCallback(self.EventInfoPluginChosen, ChoiceBox, title=_("Please choose an extension..."), list = list) + else: + self.openSingleServiceEPG() + + def runPlugin(self, plugin): + plugin(session = self.session, servicelist = self.servicelist) + + def EventInfoPluginChosen(self, answer): + if answer is not None: + answer[1]() + def openSimilarList(self, eventid, refstr): self.session.open(EPGSelection, refstr, None, eventid) @@ -1258,7 +1275,6 @@ class InfoBarExtensions: from Tools.BoundFunction import boundFunction # depends on InfoBarExtensions -from Components.PluginComponent import plugins class InfoBarPlugins: def __init__(self): -- cgit v1.2.3 From a6bde254f00e1cab9871d60f583c18999c08ca71 Mon Sep 17 00:00:00 2001 From: Fraxinas Date: Tue, 11 Nov 2008 19:19:09 +0100 Subject: use multiple titlesets for dvd authoring which allows correct burning of videos with different audio tracks introduce title properties screen. this is still a draft version. --- .../Plugins/Extensions/DVDBurn/DVDProject.py | 2 +- lib/python/Plugins/Extensions/DVDBurn/DVDTitle.py | 85 +++++++++++- .../DVDBurn/DreamboxDVDtemplate.ddvdp.xml | 2 +- lib/python/Plugins/Extensions/DVDBurn/Makefile.am | 2 +- lib/python/Plugins/Extensions/DVDBurn/Process.py | 154 +++++++++++++++------ .../Plugins/Extensions/DVDBurn/TitleCutter.py | 23 ++- lib/python/Plugins/Extensions/DVDBurn/TitleList.py | 69 +++++---- .../Plugins/Extensions/DVDBurn/TitleProperties.py | 152 ++++++++++++++++++++ lib/python/Plugins/Extensions/DVDBurn/keymap.xml | 2 +- 9 files changed, 398 insertions(+), 93 deletions(-) create mode 100644 lib/python/Plugins/Extensions/DVDBurn/TitleProperties.py (limited to 'lib/python/Plugins/Extensions') diff --git a/lib/python/Plugins/Extensions/DVDBurn/DVDProject.py b/lib/python/Plugins/Extensions/DVDBurn/DVDProject.py index 8d02cb22..55a72c10 100644 --- a/lib/python/Plugins/Extensions/DVDBurn/DVDProject.py +++ b/lib/python/Plugins/Extensions/DVDBurn/DVDProject.py @@ -1,5 +1,5 @@ from Tools.Directories import fileExists -from Components.config import config, ConfigSubsection, ConfigInteger, ConfigYesNo, ConfigText, ConfigSelection, getConfigListEntry, ConfigSequence +from Components.config import config, ConfigSubsection, ConfigInteger, ConfigText, ConfigSelection, getConfigListEntry, ConfigSequence class ConfigColor(ConfigSequence): def __init__(self): diff --git a/lib/python/Plugins/Extensions/DVDBurn/DVDTitle.py b/lib/python/Plugins/Extensions/DVDBurn/DVDTitle.py index 1bfb3d64..1ada9ce2 100644 --- a/lib/python/Plugins/Extensions/DVDBurn/DVDTitle.py +++ b/lib/python/Plugins/Extensions/DVDBurn/DVDTitle.py @@ -1,17 +1,35 @@ +from Components.config import config, ConfigSubsection, ConfigSubList, ConfigInteger, ConfigText, ConfigSelection, getConfigListEntry, ConfigSequence, ConfigYesNo + +class ConfigFixedText(ConfigText): + def __init__(self, text, visible_width=60): + ConfigText.__init__(self, default = text, fixed_size = True, visible_width = visible_width) + def handleKey(self, key): + pass + +class ConfigActiveTrack(ConfigYesNo): + def __init__(self, default = True): + ConfigYesNo.__init__(self, default) + class DVDTitle: def __init__(self): + self.properties = ConfigSubsection() + self.properties.menutitle = ConfigText(fixed_size = False, visible_width = 80) + self.properties.menusubtitle = ConfigText(fixed_size = False, visible_width = 80) + self.DVBname = _("Title") + self.DVBdescr = _("Description") + self.DVBchannel = _("Channel") + self.properties.aspect = ConfigSelection(choices = [("4:3", "4:3"), ("16:9", "16:9")]) + self.properties.widescreen = ConfigSelection(choices = [("nopanscan", "nopanscan"), ("noletterbox", "noletterbox")]) + self.properties.audiotracks = ConfigSubList() self.cuesheet = [ ] self.source = None - self.name = "" - self.descr = "" self.filesize = 0 self.estimatedDiskspace = 0 self.inputfile = "" self.cutlist = [ ] self.chaptermarks = [ ] - self.audiotracks = [ ] self.timeCreate = None - self.sVideoType = -1 + self.VideoType = -1 def addService(self, service): from os import path @@ -21,18 +39,61 @@ class DVDTitle: self.source = service serviceHandler = eServiceCenter.getInstance() info = serviceHandler.info(service) - self.descr = info and " " + info.getInfoString(service, iServiceInformation.sDescription) or "" + sDescr = info and " " + info.getInfoString(service, iServiceInformation.sDescription) or "" + self.DVBdescr = sDescr sTimeCreate = info.getInfo(service, iServiceInformation.sTimeCreate) if sTimeCreate > 1: self.timeCreate = localtime(sTimeCreate) serviceref = ServiceReference(info.getInfoString(service, iServiceInformation.sServiceref)) - self.name = info and info.getName(service) or "Title" + t.descr - self.channel = serviceref.getServiceName() + name = info and info.getName(service) or "Title" + sDescr + self.DVBname = name + self.DVBchannel = serviceref.getServiceName() self.inputfile = service.getPath() self.filesize = path.getsize(self.inputfile) self.estimatedDiskspace = self.filesize self.length = info.getLength(service) + def initDVDmenuText(self, project, track): + self.properties.menutitle.setValue(self.formatDVDmenuText(project.settings.titleformat.getValue(), track)) + self.properties.menusubtitle.setValue(self.formatDVDmenuText(project.settings.subtitleformat.getValue(), track)) + + def formatDVDmenuText(self, template, track): + properties = self.properties + template = template.replace("$i", str(track)) + template = template.replace("$t", self.DVBname) + template = template.replace("$d", self.DVBdescr) + template = template.replace("$c", str(len(self.chaptermarks)+1)) + template = template.replace("$f", self.inputfile) + template = template.replace("$C", self.DVBchannel) + + #if template.find("$A") >= 0: + from TitleProperties import languageChoices + audiolist = [ ] + for audiotrack in self.properties.audiotracks: + active = audiotrack.active.getValue() + if active: + trackstring = audiotrack.format.getValue() + language = audiotrack.language.getValue() + if languageChoices.langdict.has_key(language): + trackstring += ' (' + languageChoices.langdict[language] + ')' + audiolist.append(trackstring) + audiostring = ', '.join(audiolist) + template = template.replace("$A", audiostring) + + if template.find("$l") >= 0: + l = self.length + lengthstring = "%d:%02d:%02d" % (l/3600, l%3600/60, l%60) + template = template.replace("$l", lengthstring) + if self.timeCreate: + template = template.replace("$Y", str(self.timeCreate[0])) + template = template.replace("$M", str(self.timeCreate[1])) + template = template.replace("$D", str(self.timeCreate[2])) + timestring = "%d:%02d" % (self.timeCreate[3], self.timeCreate[4]) + template = template.replace("$T", timestring) + else: + template = template.replace("$Y", "").replace("$M", "").replace("$D", "").replace("$T", "") + return template + def produceFinalCuesheet(self): CUT_TYPE_IN = 0 CUT_TYPE_OUT = 1 @@ -84,3 +145,13 @@ class DVDTitle: while chapterpts < self.length*90000: chapterpts += 90000 * 60 * minutes self.chaptermarks.append(chapterpts) + + def getChapterMarks(self): + timestamps = [] + for p in self.chaptermarks: + h = p / (90000 * 3600) + m = p % (90000 * 3600) / (90000 * 60) + s = p % (90000 * 60) / 90000 + ms = (p % 90000) / 90 + timestamps.append("%d:%02d:%02d.%03d" % (h, m, s, ms)) + return timestamps \ No newline at end of file diff --git a/lib/python/Plugins/Extensions/DVDBurn/DreamboxDVDtemplate.ddvdp.xml b/lib/python/Plugins/Extensions/DVDBurn/DreamboxDVDtemplate.ddvdp.xml index d9831e63..9a61214a 100644 --- a/lib/python/Plugins/Extensions/DVDBurn/DreamboxDVDtemplate.ddvdp.xml +++ b/lib/python/Plugins/Extensions/DVDBurn/DreamboxDVDtemplate.ddvdp.xml @@ -4,7 +4,7 @@ name="Dreambox DVD record" authormode="menu_linked" titleformat="$i. $t" - subtitleformat="$D.$M.$Y, $T $C, $d ($c chapters)" + subtitleformat="$D.$M.$Y, $T $C, $d" vmgm="/usr/lib/enigma2/python/Plugins/Extensions/DVDBurn/vmgmdream.mpg" menubg="/usr/lib/enigma2/python/Plugins/Extensions/DVDBurn/dreamdvd_boat.jpg" menuaudio="/usr/lib/enigma2/python/Plugins/Extensions/DVDBurn/silence.mp2" diff --git a/lib/python/Plugins/Extensions/DVDBurn/Makefile.am b/lib/python/Plugins/Extensions/DVDBurn/Makefile.am index cb65f56a..be89ebaa 100644 --- a/lib/python/Plugins/Extensions/DVDBurn/Makefile.am +++ b/lib/python/Plugins/Extensions/DVDBurn/Makefile.am @@ -3,7 +3,7 @@ installdir = $(LIBDIR)/enigma2/python/Plugins/Extensions/DVDBurn install_PYTHON = \ __init__.py \ plugin.py \ - DVDProject.py DVDTitle.py TitleCutter.py TitleList.py Process.py ProjectSettings.py DVDToolbox.py + DVDProject.py DVDTitle.py TitleCutter.py TitleList.py TitleProperties.py Process.py ProjectSettings.py DVDToolbox.py install_DATA = *.xml *.jpg *.mpg *.mp2 *.png diff --git a/lib/python/Plugins/Extensions/DVDBurn/Process.py b/lib/python/Plugins/Extensions/DVDBurn/Process.py index 49054596..3cf874c0 100644 --- a/lib/python/Plugins/Extensions/DVDBurn/Process.py +++ b/lib/python/Plugins/Extensions/DVDBurn/Process.py @@ -85,23 +85,34 @@ class DemuxTask(Task): title = job.project.titles[job.i] self.global_preconditions.append(DiskspacePrecondition(title.estimatedDiskspace)) self.setTool("/usr/bin/projectx") - self.generated_files = [ ] + self.args += [inputfile, "-demux", "-out", self.job.workspace ] self.end = 300 self.prog_state = 0 self.weighting = 1000 self.cutfile = self.job.workspace + "/cut_%d.Xcl" % (job.i+1) self.cutlist = title.cutlist - self.args += [inputfile, "-demux", "-out", self.job.workspace ] + self.currentPID = None + self.relevantAudioPIDs = [ ] + self.getRelevantAudioPIDs(title) + self.generated_files = [ ] + self.mplex_streamfiles = [ ] if len(self.cutlist) > 1: self.args += [ "-cut", self.cutfile ] def prepare(self): self.writeCutfile() + def getRelevantAudioPIDs(self, title): + for audiotrack in title.properties.audiotracks: + if audiotrack.active.getValue(): + self.relevantAudioPIDs.append(audiotrack.pid.getValue()) + def processOutputLine(self, line): line = line[:-1] MSG_NEW_FILE = "---> new File: " MSG_PROGRESS = "[PROGRESS] " + MSG_NEW_MP2 = "--> MPEG Audio (0x" + MSG_NEW_AC3 = "--> AC-3/DTS Audio on PID " if line.startswith(MSG_NEW_FILE): file = line[len(MSG_NEW_FILE):] @@ -111,10 +122,14 @@ class DemuxTask(Task): elif line.startswith(MSG_PROGRESS): progress = line[len(MSG_PROGRESS):] self.haveProgress(progress) + elif line.startswith(MSG_NEW_MP2) or line.startswith(MSG_NEW_AC3): + self.currentPID = str(int(line.rstrip()[-6:].rsplit('0x',1)[-1],16)) def haveNewFile(self, file): - print "PRODUCED FILE [%s]" % file + print "[DemuxTask] produced file:", file self.generated_files.append(file) + if self.currentPID in self.relevantAudioPIDs or file.endswith("m2v"): + self.mplex_streamfiles.append(file) def haveProgress(self, progress): #print "PROGRESS [%s]" % progress @@ -131,7 +146,6 @@ class DemuxTask(Task): if p > self.progress: self.progress = p except ValueError: - print "val error" pass def writeCutfile(self): @@ -151,8 +165,8 @@ class DemuxTask(Task): def cleanup(self, failed): if failed: import os - for f in self.generated_files: - os.remove(f) + for file in self.generated_files.itervalues(): + os.remove(file) class MplexTaskPostcondition(Condition): def check(self, task): @@ -185,9 +199,9 @@ class MplexTask(Task): # we don't want the ReturncodePostcondition in this case because for right now we're just gonna ignore the fact that mplex fails with a buffer underrun error on some streams (this always at the very end) def prepare(self): - self.error = None + self.error = None if self.demux_task: - self.args += self.demux_task.generated_files + self.args += self.demux_task.mplex_streamfiles def processOutputLine(self, line): print "[MplexTask] ", line[:-1] @@ -206,7 +220,7 @@ class RemoveESFiles(Task): def prepare(self): self.args += ["-f"] - self.args += self.demux_task.generated_files + self.args += self.demux_task.generated_files.values() self.args += [self.demux_task.cutfile] class DVDAuthorTask(Task): @@ -411,27 +425,6 @@ class PreviewTaskPostcondition(Condition): def getErrorMessage(self, task): return "Cancel" -def formatTitle(template, title, track): - 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) - 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("$T", "") - return template.decode("utf-8") - class ImagingPostcondition(Condition): def check(self, task): return task.returncode == 0 @@ -518,14 +511,13 @@ class MenuImageTask(Task): menu_end_title = nr_titles+1 menu_i = 0 for title_no in range( menu_start_title , menu_end_title ): - i = title_no-1 - top = s_top + ( menu_i * rowheight ) menu_i += 1 - title = self.job.project.titles[i] - titleText = formatTitle(s.titleformat.getValue(), title, title_no) + title = self.job.project.titles[title_no-1] + top = s_top + ( menu_i * rowheight ) + titleText = title.formatDVDmenuText(s.titleformat.getValue(), title_no).decode("utf-8") draw_bg.text((s_left,top), titleText, fill=self.Menus.color_button, font=fonts[1]) draw_high.text((s_left,top), titleText, fill=1, font=self.Menus.fonts[1]) - subtitleText = formatTitle(s.subtitleformat.getValue(), title, title_no) + subtitleText = title.formatDVDmenuText(s.subtitleformat.getValue(), title_no).decode("utf-8") draw_bg.text((s_left,top+36), subtitleText, fill=self.Menus.color_button, font=fonts[2]) bottom = top+rowheight if bottom > self.Menus.imgheight: @@ -607,7 +599,7 @@ class Menus: menuoutputfilename = job.workspace+"/dvdmenu"+num+".mpg" spumuxTask(job, spuxmlfilename, menubgmpgfilename, menuoutputfilename) -def CreateAuthoringXML(job): +def CreateAuthoringXML_simple(job): nr_titles = len(job.project.titles) mode = job.project.settings.authormode.getValue() authorxml = [] @@ -649,9 +641,7 @@ 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('