add auto chapter splitting, remove some debug
authorAndreas Frisch <andreas.frisch@multimedia-labs.de>
Tue, 9 Sep 2008 19:03:04 +0000 (19:03 +0000)
committerAndreas Frisch <andreas.frisch@multimedia-labs.de>
Tue, 9 Sep 2008 19:03:04 +0000 (19:03 +0000)
lib/python/Plugins/Extensions/DVDBurn/DVDProject.py
lib/python/Plugins/Extensions/DVDBurn/DVDTitle.py
lib/python/Plugins/Extensions/DVDBurn/ProjectSettings.py
lib/python/Plugins/Extensions/DVDBurn/TitleList.py

index 9ee3bdb955e50281a8d0327638b405cfabbd6f37..cfad6774d92cf31202b2c60eec5dc4b46105ca42 100644 (file)
@@ -27,6 +27,8 @@ class DVDProject:
                self.settings.font_size = ConfigPixelvals()
                self.settings.space = ConfigPixelvals()
                self.settings.vmgm = ConfigText(visible_width = 40)
                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
 
        def addService(self, service):
                import DVDTitle
@@ -100,8 +102,7 @@ class DVDProject:
                                                self.error = "unknown attribute '%s'" % (key)
                                                raise AttributeError
                                        i += 1
                                                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)
                                val = self.settings.dict()[key].getValue()
                                if not fileExists(val):
                                        self.error += "\n%s '%s' not found" % (key, val)
index 40aefafba552bb06b613689663fb2f4ae2f0ef99..3d19bc48e71b998905a7bd98c3e4f915a01f9af0 100644 (file)
@@ -32,8 +32,6 @@ class DVDTitle:
                self.length = info.getLength(service)
 
        def produceFinalCuesheet(self):
                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
                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)
                                
                                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 )
                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
                        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
index ba78e5e17e11901c0ea2f709c250b809e8d2f09f..3686722de58af3f589c88d5d4d013f5e7f4abfd7 100644 (file)
@@ -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(_("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 = {}
                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]]
                
        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):
                        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):
                        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)
                        if not self.project.loadProject(path):
                                self.session.open(MessageBox,self.project.error,MessageBox.TYPE_ERROR)
-               elif scope:
-                       self.settings.dict()[scope].setValue(path)
index 685f4b3b6b73ebe02463e17d73c85078603be4f9..6fcc326e227579797fdcb45cb6290340a83ff75c 100644 (file)
@@ -158,6 +158,10 @@ class TitleList(Screen):
                        return False
 
        def burnProject(self):
                        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):
                self.project.waitboxref = self.project.session.open(ProjectSettings.WaitBox,self.burnProjectCB)
 
        def burnProjectCB(self):