Merge branch 'master' of fraxinas@git.opendreambox.org:/git/enigma2
authorFraxinas <andreas.frisch@multimedia-labs.de>
Wed, 12 Nov 2008 19:22:43 +0000 (20:22 +0100)
committerFraxinas <andreas.frisch@multimedia-labs.de>
Wed, 12 Nov 2008 19:22:43 +0000 (20:22 +0100)
lib/python/Plugins/Extensions/DVDBurn/DVDProject.py
lib/python/Plugins/Extensions/DVDBurn/DVDTitle.py
lib/python/Plugins/Extensions/DVDBurn/DreamboxDVDtemplate.ddvdp.xml
lib/python/Plugins/Extensions/DVDBurn/Process.py
lib/python/Plugins/Extensions/DVDBurn/ProjectSettings.py
lib/python/Plugins/Extensions/DVDBurn/TitleCutter.py
lib/python/Plugins/Extensions/DVDBurn/TitleList.py
lib/python/Plugins/Extensions/DVDBurn/TitleProperties.py

index 55a72c1..4923d4d 100644 (file)
@@ -32,6 +32,7 @@ class DVDProject:
                self.settings = ConfigSubsection()
                self.settings.name = ConfigText(fixed_size = False, visible_width = 40)
                self.settings.authormode = ConfigSelection(choices = [("menu_linked", _("Linked titles with a DVD menu")), ("just_linked", _("Direct playback of linked titles without menu")), ("menu_seperate", _("Seperate titles with a main menu")), ("data_ts", _("Dreambox format data DVD (HDTV compatible)"))])
+               self.settings.titlesetmode = ConfigSelection(choices = [("single", ("Simple titleset (compatibility for legacy players)")), ("multi", ("Complex (allows mixing audio tracks and aspects)"))], default="multi")
                self.settings.output = ConfigSelection(choices = [("iso", _("Create DVD-ISO")), ("dvd", _("Burn DVD"))])
                self.settings.isopath = ConfigText(fixed_size = False, visible_width = 40)
                self.settings.dataformat = ConfigSelection(choices = [("iso9660_1", ("ISO9660 Level 1")), ("iso9660_4", ("ISO9660 version 2")), ("udf", ("UDF"))])                      
@@ -46,7 +47,6 @@ class DVDProject:
                self.settings.font_size = ConfigPixelvals()
                self.settings.space = ConfigPixelvals()
                self.settings.vmgm = ConfigFilename()
-               self.settings.autochapter = ConfigInteger(default = 0, limits = (0, 99))
                self.filekeys = ["vmgm", "menubg", "menuaudio", "font_face", "isopath"]
 
        def addService(self, service):
index 1ada9ce..26f51e6 100644 (file)
@@ -6,10 +6,6 @@ class ConfigFixedText(ConfigText):
        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()
@@ -20,6 +16,7 @@ class DVDTitle:
                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.autochapter = ConfigInteger(default = 0, limits = (0, 60))
                self.properties.audiotracks = ConfigSubList()
                self.cuesheet = [ ]
                self.source = None
@@ -139,19 +136,22 @@ class DVDTitle:
                        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)
-
        def getChapterMarks(self):
-               timestamps = []
-               for p in self.chaptermarks:
+               timestamps = [ ]
+               chapters = [ ]
+               minutes = self.properties.autochapter.getValue()
+               if len(self.chaptermarks) < 1 and minutes > 0:
+                       chapterpts = 0
+                       while chapterpts < (self.length-60*minutes)*90000:
+                               chapterpts += 90000 * 60 * minutes
+                               chapters.append(chapterpts)
+               else:
+                       chapters = self.chaptermarks
+               for p in chapters:
                        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))
+               print "timestamps:", timestamps
                return timestamps
\ No newline at end of file
index 9a61214..7d8de8c 100644 (file)
@@ -3,6 +3,7 @@
        <settings
                name="Dreambox DVD record"
                authormode="menu_linked"
+               titlesetmode="multi"
                titleformat="$i. $t"
                subtitleformat="$D.$M.$Y, $T $C, $d"
                vmgm="/usr/lib/enigma2/python/Plugins/Extensions/DVDBurn/vmgmdream.mpg"
index 3cf874c..c1ba863 100644 (file)
@@ -599,7 +599,7 @@ class Menus:
                        menuoutputfilename = job.workspace+"/dvdmenu"+num+".mpg"
                        spumuxTask(job, spuxmlfilename, menubgmpgfilename, menuoutputfilename)
                
-def CreateAuthoringXML_simple(job):
+def CreateAuthoringXML_singleset(job):
        nr_titles = len(job.project.titles)
        mode = job.project.settings.authormode.getValue()
        authorxml = []
@@ -771,7 +771,10 @@ class DVDJob(Job):
                CheckDiskspaceTask(self)
                if self.project.settings.authormode.getValue().startswith("menu") or self.menupreview:
                        Menus(self)
-               CreateAuthoringXML_multiset(self)
+               if self.project.settings.titlesetmode.getValue() == "multi":
+                       CreateAuthoringXML_multiset(self)
+               else:
+                       CreateAuthoringXML_singleset(self)
 
                DVDAuthorTask(self)
                
index 7491e04..b77383c 100644 (file)
@@ -148,8 +148,9 @@ 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))
                if authormode != "data_ts":
-                       self.list.append(getConfigListEntry(_("VMGM (intro trailer)"), self.settings.vmgm))
-                       self.list.append(getConfigListEntry(_("Auto chapter split every ? minutes (0=never)"), self.settings.autochapter))
+                       self.list.append(getConfigListEntry(_("Titleset mode"), self.settings.titlesetmode))
+                       if self.settings.titlesetmode.getValue() == "single" or authormode == "just_linked":
+                               self.list.append(getConfigListEntry(_("VMGM (intro trailer)"), self.settings.vmgm))
                else:
                        self.list.append(getConfigListEntry(("DVD data format"), self.settings.dataformat))
                
@@ -158,13 +159,13 @@ class ProjectSettings(Screen,ConfigListScreen):
        def keyLeft(self):
                ConfigListScreen.keyLeft(self)
                key = self.keydict[self["config"].getCurrent()[1]]
-               if key == "authormode" or key == "output":
+               if key == "authormode" or key == "output" or key=="titlesetmode":
                        self.initConfigList()
 
        def keyRight(self):
                ConfigListScreen.keyRight(self)
                key = self.keydict[self["config"].getCurrent()[1]]
-               if key == "authormode" or key == "output":
+               if key == "authormode" or key == "output" or key=="titlesetmode":
                        self.initConfigList()
 
        def exit(self):
index be5ad24..5cbd5d5 100644 (file)
@@ -20,9 +20,10 @@ class TitleCutter(CutListEditor):
                audio = service and service.audioTracks()
                n = audio and audio.getNumberOfTracks() or 0
                if n > 0:
-                       from DVDTitle import ConfigFixedText, ConfigActiveTrack
+                       from DVDTitle import ConfigFixedText
                        from TitleProperties import languageChoices
-                       from Components.config import config, ConfigSubsection, ConfigSelection
+                       from Components.config import config, ConfigSubsection, ConfigSubList, ConfigSelection, ConfigYesNo
+                       self.t.properties.audiotracks = ConfigSubList()
                        for x in range(n):
                                i = audio.getTrackInfo(x)
                                language = i.getLanguage()
@@ -34,7 +35,7 @@ class TitleCutter(CutListEditor):
                                        language="nolang"
                                print "[audiotrack] pid:", pid, "description:", description, "language:", language
                                self.t.properties.audiotracks.append(ConfigSubsection())
-                               self.t.properties.audiotracks[-1].active = ConfigActiveTrack()
+                               self.t.properties.audiotracks[-1].active = ConfigYesNo(default = True)
                                self.t.properties.audiotracks[-1].format = ConfigFixedText(description)
                                self.t.properties.audiotracks[-1].language = ConfigSelection(choices = languageChoices.choices, default=language)
                                self.t.properties.audiotracks[-1].pid = ConfigFixedText(pid)
index caec619..416c14e 100644 (file)
@@ -188,10 +188,6 @@ class TitleList(Screen, HelpableScreen):
                        job_manager.in_background = False
                        self.session.openWithCallback(self.JobViewCB, JobView, job)
                else:
-                       autochapter = self.project.settings.autochapter.getValue()
-                       if autochapter > 0:
-                               for title in self.project.titles:
-                                       title.produceAutoChapter(autochapter)
                        job = Process.DVDJob(self.project)
                        job_manager.AddJob(job)
                        job_manager.in_background = False
index 72071a5..fdd331d 100644 (file)
@@ -25,9 +25,9 @@ class TitleProperties(Screen,ConfigListScreen):
                    <widget source="key_green" render="Label" position="140,0" zPosition="1" size="140,40" font="Regular;20" halign="center" valign="center" backgroundColor="#1f771f" transparent="1" />
                    <widget source="key_yellow" render="Label" position="280,0" zPosition="1" size="140,40" font="Regular;20" halign="center" valign="center" backgroundColor="#a08500" transparent="1" />
                    <widget source="key_blue" render="Label" position="420,0" zPosition="1" size="140,40" font="Regular;20" halign="center" valign="center" backgroundColor="#18188b" transparent="1" />
-                   <widget name="config" position="10,50" size="540,276" scrollbarMode="showOnDemand" />
-                   <widget source="serviceinfo_headline" render="Label" position="20,350" size="520,20" font="Regular;20" />
-                   <widget source="serviceinfo" render="Label" position="20,374" size="520,66" font="Regular;16" />
+                   <widget name="config" position="10,50" size="540,300" scrollbarMode="showOnDemand" />
+                   <widget source="serviceinfo_headline" render="Label" position="20,360" size="520,20" font="Regular;20" />
+                   <widget source="serviceinfo" render="Label" position="20,382" size="520,66" font="Regular;16" />
                </screen>"""
 
        def __init__(self, session, parent, project, title_idx):
@@ -46,6 +46,11 @@ class TitleProperties(Screen,ConfigListScreen):
                self.properties = project.titles[title_idx].properties
                ConfigListScreen.__init__(self, [])
                self.properties.crop = DVDTitle.ConfigFixedText("crop")
+               self.properties.autochapter.addNotifier(self.initConfigList)
+               self.properties.aspect.addNotifier(self.initConfigList)
+               for audiotrack in self.properties.audiotracks:
+                       audiotrack.active.addNotifier(self.initConfigList)
+               
                self.initConfigList()
                        
                self["setupActions"] = ActionMap(["SetupActions", "ColorActions"],
@@ -58,7 +63,7 @@ class TitleProperties(Screen,ConfigListScreen):
                    "ok": self.ok,
                }, -2)
 
-       def initConfigList(self):
+       def initConfigList(self, element=None):
                self.properties.position = ConfigInteger(default = self.title_idx+1, limits = (1, len(self.project.titles)))
                title = self.project.titles[self.title_idx]
                self.list = []
@@ -78,17 +83,19 @@ class TitleProperties(Screen,ConfigListScreen):
                else:
                        self.list.append(getConfigListEntry("DVD " + "widescreen", self.properties.crop))
                
-               self["config"].setList(self.list)
-               
                infotext = _("Available format variables") + ":\n$i=" + _("Track") + ", $t=" + _("Title") + ", $d=" + _("Description") + ", $l=" + _("length") + ", $c=" + _("chapters") + ",\n" + _("Record") + " $T=" + _("Begin time") + ", $Y=" + _("year") + ", $M=" + _("month") + ", $D=" + _("day") + ",\n$A=" + _("audio tracks") + ", $C=" + _("Channel") + ", $f=" + _("filename")
                self["info"] = StaticText(infotext)
                
-               chapters_count = len(title.chaptermarks)
+               if len(title.chaptermarks) == 0:
+                       self.list.append(getConfigListEntry(_("Auto chapter split every ? minutes (0=never)"), self.properties.autochapter))
                infotext = _("Title") + ': ' + title.DVBname + "\n" + _("Description") + ': ' + title.DVBdescr + "\n" + _("Channel") + ': ' + title.DVBchannel
-               if chapters_count:
+               chaptermarks = title.getChapterMarks()
+               chapters_count = len(chaptermarks)
+               if chapters_count >= 1:
                        infotext += ', ' + str(chapters_count+1) + ' ' + _("chapters") + ' ('
-                       infotext += ' / '.join(title.getChapterMarks()) + ')'
+                       infotext += ' / '.join(chaptermarks) + ')'
                self["serviceinfo"].setText(infotext)
+               self["config"].setList(self.list)
 
        def editTitle(self):
                self.parent.editTitle()
@@ -96,16 +103,6 @@ class TitleProperties(Screen,ConfigListScreen):
 
        def changedConfigList(self):
                self.initConfigList()
-       
-       def keyLeft(self):
-               ConfigListScreen.keyLeft(self)
-               if type(self["config"].getCurrent()[1]) in [DVDTitle.ConfigActiveTrack, ConfigSelection]:
-                       self.initConfigList()
-
-       def keyRight(self):
-               ConfigListScreen.keyRight(self)
-               if type(self["config"].getCurrent()[1]) in [DVDTitle.ConfigActiveTrack, ConfigSelection]:
-                       self.initConfigList()
 
        def exit(self):
                self.applySettings()