From be5e9b704e6ff159091583735ff643c801354bec Mon Sep 17 00:00:00 2001 From: Andreas Frisch Date: Tue, 9 Sep 2008 19:03:04 +0000 Subject: [PATCH] add auto chapter splitting, remove some debug --- lib/python/Plugins/Extensions/DVDBurn/DVDProject.py | 5 +++-- lib/python/Plugins/Extensions/DVDBurn/DVDTitle.py | 12 +++++++----- .../Plugins/Extensions/DVDBurn/ProjectSettings.py | 10 +++++----- lib/python/Plugins/Extensions/DVDBurn/TitleList.py | 4 ++++ 4 files changed, 19 insertions(+), 12 deletions(-) diff --git a/lib/python/Plugins/Extensions/DVDBurn/DVDProject.py b/lib/python/Plugins/Extensions/DVDBurn/DVDProject.py index 9ee3bdb9..cfad6774 100644 --- a/lib/python/Plugins/Extensions/DVDBurn/DVDProject.py +++ b/lib/python/Plugins/Extensions/DVDBurn/DVDProject.py @@ -27,6 +27,8 @@ class DVDProject: self.settings.font_size = ConfigPixelvals() self.settings.space = ConfigPixelvals() self.settings.vmgm = ConfigText(visible_width = 40) + self.settings.autochapter = ConfigInteger(default = 0, limits = (0, 99)) + self.filekeys = ["vmgm", "menubg", "menuaudio", "font_face"] def addService(self, service): import DVDTitle @@ -100,8 +102,7 @@ class DVDProject: self.error = "unknown attribute '%s'" % (key) raise AttributeError i += 1 - checkfiles = ["vmgm", "menubg", "menuaudio", "font_face"] - for key in checkfiles: + for key in self.filekeys: val = self.settings.dict()[key].getValue() if not fileExists(val): self.error += "\n%s '%s' not found" % (key, val) diff --git a/lib/python/Plugins/Extensions/DVDBurn/DVDTitle.py b/lib/python/Plugins/Extensions/DVDBurn/DVDTitle.py index 40aefafb..3d19bc48 100644 --- a/lib/python/Plugins/Extensions/DVDBurn/DVDTitle.py +++ b/lib/python/Plugins/Extensions/DVDBurn/DVDTitle.py @@ -32,8 +32,6 @@ class DVDTitle: self.length = info.getLength(service) def produceFinalCuesheet(self): - print "[produceFinalCuesheet] >>> ", self.inputfile, self.cuesheet - CUT_TYPE_IN = 0 CUT_TYPE_OUT = 1 CUT_TYPE_MARK = 2 @@ -72,11 +70,15 @@ class DVDTitle: reloc_pts = pts - last_in + accumulated_in self.chaptermarks.append(reloc_pts) - print "cutlist =", self.cutlist, "chaptermarks =", self.chaptermarks, "accumulated_in =", accumulated_in - if len(self.cutlist) > 1: part = accumulated_in / (self.length*90000.0) usedsize = int ( part * self.filesize ) - print "part=", part, "filesize=", self.filesize, "estimatedDiskspace=", usedsize self.estimatedDiskspace = usedsize self.length = accumulated_in / 90000 + + def produceAutoChapter(self, minutes): + if len(self.chaptermarks) < 1: + chapterpts = self.cutlist[0] + while chapterpts < self.length*90000: + chapterpts += 90000 * 60 * minutes + self.chaptermarks.append(chapterpts) \ No newline at end of file diff --git a/lib/python/Plugins/Extensions/DVDBurn/ProjectSettings.py b/lib/python/Plugins/Extensions/DVDBurn/ProjectSettings.py index ba78e5e1..3686722d 100644 --- a/lib/python/Plugins/Extensions/DVDBurn/ProjectSettings.py +++ b/lib/python/Plugins/Extensions/DVDBurn/ProjectSettings.py @@ -124,6 +124,7 @@ class ProjectSettings(Screen,ConfigListScreen): self.list.append(getConfigListEntry(_("Menu")+' '+_("spaces (top, between rows, left)"), self.settings.space)) self.list.append(getConfigListEntry(_("Menu")+' '+_("Audio"), self.settings.menuaudio)) self.list.append(getConfigListEntry(_("VMGM (intro trailer)"), self.settings.vmgm)) + self.list.append(getConfigListEntry(_("Auto chapter split every ? minutes (0=never)"), self.settings.autochapter)) ConfigListScreen.__init__(self, self.list) self.keydict = {} @@ -150,8 +151,7 @@ class ProjectSettings(Screen,ConfigListScreen): def ok(self): key = self.keydict[self["config"].getCurrent()[1]] - browseKeys = ["menubg", "menuaudio", "vmgm", "font_face"] - if key in browseKeys: + if key in self.project.filekeys: self.session.openWithCallback(self.FileBrowserClosed, FileBrowser, key, self.settings) def cancel(self): @@ -171,8 +171,8 @@ class ProjectSettings(Screen,ConfigListScreen): self.session.open(MessageBox,text,type = MessageBox.TYPE_ERROR) def FileBrowserClosed(self, path, scope): - if scope == "project": + if scope in self.project.filekeys: + self.settings.dict()[scope].setValue(path) + elif scope == "project": if not self.project.loadProject(path): self.session.open(MessageBox,self.project.error,MessageBox.TYPE_ERROR) - elif scope: - self.settings.dict()[scope].setValue(path) diff --git a/lib/python/Plugins/Extensions/DVDBurn/TitleList.py b/lib/python/Plugins/Extensions/DVDBurn/TitleList.py index 685f4b3b..6fcc326e 100644 --- a/lib/python/Plugins/Extensions/DVDBurn/TitleList.py +++ b/lib/python/Plugins/Extensions/DVDBurn/TitleList.py @@ -158,6 +158,10 @@ class TitleList(Screen): return False def burnProject(self): + autochapter = self.project.settings.autochapter.getValue() + if autochapter > 0: + for title in self.project.titles: + title.produceAutoChapter(autochapter) self.project.waitboxref = self.project.session.open(ProjectSettings.WaitBox,self.burnProjectCB) def burnProjectCB(self): -- 2.30.2