Path and template fixes
authorAndreas Frisch <andreas.frisch@multimedia-labs.de>
Fri, 12 Sep 2008 12:00:35 +0000 (12:00 +0000)
committerAndreas Frisch <andreas.frisch@multimedia-labs.de>
Fri, 12 Sep 2008 12:00:35 +0000 (12:00 +0000)
lib/python/Plugins/Extensions/DVDBurn/DVDProject.py
lib/python/Plugins/Extensions/DVDBurn/DreamboxDVDtemplate.ddvdp.xml [new file with mode: 0644]
lib/python/Plugins/Extensions/DVDBurn/Makefile.am
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/dreamdvd_boat.jpg [new file with mode: 0644]
lib/python/Plugins/Extensions/DVDBurn/silence.mp2 [new file with mode: 0644]
lib/python/Plugins/Extensions/DVDBurn/vmgmblank.mpg [new file with mode: 0644]
lib/python/Plugins/Extensions/DVDBurn/vmgmdream.mpg [new file with mode: 0644]

index cfad6774d92cf31202b2c60eec5dc4b46105ca42..962b34cb40af4e383e2a8fbdf25a1fef5e2df71f 100644 (file)
@@ -1,3 +1,4 @@
+
 from Tools.Directories import fileExists
 from Components.config import config, ConfigSubsection, ConfigInteger, ConfigYesNo, ConfigText, ConfigSelection, getConfigListEntry, ConfigSequence
 
 from Tools.Directories import fileExists
 from Components.config import config, ConfigSubsection, ConfigInteger, ConfigYesNo, ConfigText, ConfigSelection, getConfigListEntry, ConfigSequence
 
@@ -9,24 +10,41 @@ class ConfigPixelvals(ConfigSequence):
        def __init__(self):
                ConfigSequence.__init__(self, seperator = ",", limits = [(0,200),(0,200),(0,200)])
 
        def __init__(self):
                ConfigSequence.__init__(self, seperator = ",", limits = [(0,200),(0,200),(0,200)])
 
+class ConfigPixelvals(ConfigSequence):
+       def __init__(self):
+               ConfigSequence.__init__(self, seperator = ",", limits = [(0,200),(0,200),(0,200)])
+
+class ConfigFilename(ConfigText):
+       def __init__(self):
+               ConfigText.__init__(self, default = "", fixed_size = True, visible_width = False)
+
+       def getMulti(self, selected):
+               filename = (self.text.rstrip("/").rsplit("/",1))[1].encode("utf-8")[:40] + " "
+               print "ConfigFilename =", filename
+               if self.allmarked:
+                       mark = range(0, len(filename))
+               else:
+                       mark = [filename]
+               return ("mtext"[1-selected:], filename, mark)
+       
 class DVDProject:
        def __init__(self):
                self.titles = [ ]
                self.target = None
                self.settings = ConfigSubsection()
 class DVDProject:
        def __init__(self):
                self.titles = [ ]
                self.target = None
                self.settings = ConfigSubsection()
-               self.settings.name = ConfigText(visible_width = 40)
+               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")), ])
                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")), ])
-               self.settings.menubg = ConfigText(visible_width = 40)
-               self.settings.menuaudio = ConfigText(visible_width = 40)
-               self.settings.titleformat = ConfigText(visible_width = 40)
-               self.settings.subtitleformat = ConfigText(visible_width = 40)
+               self.settings.menubg = ConfigFilename()
+               self.settings.menuaudio = ConfigFilename()
+               self.settings.titleformat = ConfigText(fixed_size = False, visible_width = 40)
+               self.settings.subtitleformat = ConfigText(fixed_size = False, visible_width = 40)
                self.settings.color_headline = ConfigColor()
                self.settings.color_highlight = ConfigColor()
                self.settings.color_button = ConfigColor()
                self.settings.color_headline = ConfigColor()
                self.settings.color_highlight = ConfigColor()
                self.settings.color_button = ConfigColor()
-               self.settings.font_face = ConfigText(visible_width = 40)
+               self.settings.font_face = ConfigFilename()
                self.settings.font_size = ConfigPixelvals()
                self.settings.space = ConfigPixelvals()
                self.settings.font_size = ConfigPixelvals()
                self.settings.space = ConfigPixelvals()
-               self.settings.vmgm = ConfigText(visible_width = 40)
+               self.settings.vmgm = ConfigFilename()
                self.settings.autochapter = ConfigInteger(default = 0, limits = (0, 99))
                self.filekeys = ["vmgm", "menubg", "menuaudio", "font_face"]
 
                self.settings.autochapter = ConfigInteger(default = 0, limits = (0, 99))
                self.filekeys = ["vmgm", "menubg", "menuaudio", "font_face"]
 
diff --git a/lib/python/Plugins/Extensions/DVDBurn/DreamboxDVDtemplate.ddvdp.xml b/lib/python/Plugins/Extensions/DVDBurn/DreamboxDVDtemplate.ddvdp.xml
new file mode 100644 (file)
index 0000000..cb35864
--- /dev/null
@@ -0,0 +1,18 @@
+<?xml version="1.0" encoding="utf-8" ?>
+<DreamDVDBurnerProject>
+       <settings
+               name="Dreambox DVD record"
+               authormode="linked_nomenu"
+               titleformat="$i. $t"
+               subtitleformat="$D.$M.$Y, $T $C, $d ($c chapters)"
+               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"
+               color_button="[8, 0, 0]"
+               color_highlight="[0, 192, 192]"
+               color_headline="[0, 0, 128]"
+               font_face="/usr/share/fonts/nmsbd.ttf"
+               font_size="[48, 28, 16]"
+               space="[120, 36, 30]" />
+       <titles> </titles>
+</DreamDVDBurnerProject>
index 886876cc5e55d1639495f2b1cc2c789a10e648a2..3b2f44843eb11ccb8782c493b5aef8b0cdbf4eb4 100644 (file)
@@ -5,6 +5,5 @@ install_PYTHON =        \
        plugin.py \
        DVDProject.py DVDTitle.py TitleCutter.py TitleList.py Process.py ProjectSettings.py
 
        plugin.py \
        DVDProject.py DVDTitle.py TitleCutter.py TitleList.py Process.py ProjectSettings.py
 
-install_DATA = keymap.xml
+install_DATA = *.xml *.jpg *.mpg *.mp2
 
 
-SUBDIRS = data template
index 12d85b450c6a2d38be364ea449e7171191c60be3..67654f619e3f0e054d85db664c185612f3af390d 100644 (file)
@@ -345,6 +345,7 @@ def formatTitle(template, title, 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("$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
        template = template.replace("$f", title.inputfile)
        template = template.replace("$C", title.channel)
        l = title.length
@@ -524,7 +525,7 @@ def CreateAuthoringXML(job):
        authorxml.append('   <titles>\n')
        for i in range( nr_titles ):
                for audiotrack in job.project.titles[i].audiotracks:
        authorxml.append('   <titles>\n')
        for i in range( nr_titles ):
                for audiotrack in job.project.titles[i].audiotracks:
-                       authorxml.append('    <audio format="'+audiotrack[0]+'" lang="'+audiotrack[1]+'" />\n')
+                       authorxml.append('    <audio lang="'+audiotrack[0][:2]+'" format="'+audiotrack[1]+'" />\n')
                chapters = ','.join(["%d:%02d:%02d.%03d" % (p / (90000 * 3600), p % (90000 * 3600) / (90000 * 60), p % (90000 * 60) / 90000, (p % 90000) / 90) for p in job.project.titles[i].chaptermarks])
                title_no = i+1
                title_filename = job.workspace + "/dvd_title_%d.mpg" % (title_no)
                chapters = ','.join(["%d:%02d:%02d.%03d" % (p / (90000 * 3600), p % (90000 * 3600) / (90000 * 60), p % (90000 * 60) / 90000, (p % 90000) / 90) for p in job.project.titles[i].chaptermarks])
                title_no = i+1
                title_filename = job.workspace + "/dvd_title_%d.mpg" % (title_no)
index 3686722de58af3f589c88d5d4d013f5e7f4abfd7..fc8672c5557363f0ce797195e5efc675db6dfc41 100644 (file)
@@ -9,7 +9,7 @@ from Components.Sources.StaticText import StaticText
 from Components.Sources.Progress import Progress
 from Components.FileList import FileList
 from enigma import eListboxPythonMultiContent, gFont, RT_HALIGN_LEFT
 from Components.Sources.Progress import Progress
 from Components.FileList import FileList
 from enigma import eListboxPythonMultiContent, gFont, RT_HALIGN_LEFT
-from Tools.Directories import resolveFilename, SCOPE_PLAYLIST, SCOPE_SKIN, SCOPE_FONTS
+from Tools.Directories import resolveFilename, SCOPE_PLUGINS, SCOPE_FONTS
 from Components.config import config, getConfigListEntry
 from Components.ConfigList import ConfigListScreen
 
 from Components.config import config, getConfigListEntry
 from Components.ConfigList import ConfigListScreen
 
@@ -41,16 +41,16 @@ class FileBrowser(Screen, HelpableScreen):
                pattern = ""
                currDir = "/"
                if self.scope == "project":
                pattern = ""
                currDir = "/"
                if self.scope == "project":
-                       currDir = resolveFilename(SCOPE_PLAYLIST)
+                       currDir = self.getDir()
                        pattern = "(?i)^.*\.(ddvdp\.xml)"               
                if self.scope == "menubg":
                        pattern = "(?i)^.*\.(ddvdp\.xml)"               
                if self.scope == "menubg":
-                       currDir = self.getDir(settings.menubg, resolveFilename(SCOPE_SKIN))
+                       currDir = self.getDir(settings.menubg)
                        pattern = "(?i)^.*\.(jpeg|jpg|jpe|png|bmp)"
                elif self.scope == "menuaudio":
                        pattern = "(?i)^.*\.(jpeg|jpg|jpe|png|bmp)"
                elif self.scope == "menuaudio":
-                       currDir = self.getDir(settings.menuaudio, resolveFilename(SCOPE_SKIN))
+                       currDir = self.getDir(settings.menuaudio)
                        pattern = "(?i)^.*\.(mp2|m2a|ac3)"
                elif self.scope == "vmgm":
                        pattern = "(?i)^.*\.(mp2|m2a|ac3)"
                elif self.scope == "vmgm":
-                       currDir = self.getDir(settings.vmgm, resolveFilename(SCOPE_SKIN))
+                       currDir = self.getDir(settings.vmgm)
                        pattern = "(?i)^.*\.(mpg|mpeg)"
                elif self.scope == "font_face":
                        currDir = self.getDir(settings.font_face, resolveFilename(SCOPE_FONTS))
                        pattern = "(?i)^.*\.(mpg|mpeg)"
                elif self.scope == "font_face":
                        currDir = self.getDir(settings.font_face, resolveFilename(SCOPE_FONTS))
@@ -65,12 +65,12 @@ class FileBrowser(Screen, HelpableScreen):
                                "cancel": self.exit
                        })
 
                                "cancel": self.exit
                        })
 
-       def getDir(self, key, defaultDir):
-               settingDir = key.getValue()
-               if len(settingDir) > 1:
-                       return (settingDir.rstrip("/").rsplit("/",1))[0]
-               else:
-                       return defaultDir
+       def getDir(self, key=None, defaultDir=None):
+               if key:
+                       settingDir = key.getValue()
+                       if len(settingDir) > 1:
+                               return (settingDir.rstrip("/").rsplit("/",1))[0]
+               return defaultDir or (resolveFilename(SCOPE_PLUGINS)+"Extensions/DVDBurn/")
 
        def ok(self):
                if self.filelist.canDescent():
 
        def ok(self):
                if self.filelist.canDescent():
@@ -106,7 +106,7 @@ class ProjectSettings(Screen,ConfigListScreen):
                self["key_yellow"] = StaticText(_("Load"))
                self["key_blue"] = StaticText(_("Save"))
                
                self["key_yellow"] = StaticText(_("Load"))
                self["key_blue"] = StaticText(_("Save"))
                
-               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%C=" + _("Channel") + ", %f=" + _("filename")
+               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)
 
                self.settings = project.settings
                self["info"] = StaticText(infotext)
 
                self.settings = project.settings
index 8f1adf1aa83042d0ed28e54e650cf388f4db6428..75a53a0858dd03c5fae8dbfa5045e45776399cec 100644 (file)
@@ -1,5 +1,6 @@
 from Plugins.Extensions.CutListEditor.plugin import CutListEditor
 from Components.ServiceEventTracker import ServiceEventTracker
 from Plugins.Extensions.CutListEditor.plugin import CutListEditor
 from Components.ServiceEventTracker import ServiceEventTracker
+from enigma import iPlayableService
 
 class TitleCutter(CutListEditor):
        def __init__(self, session, t):
 
 class TitleCutter(CutListEditor):
        def __init__(self, session, t):
@@ -23,11 +24,11 @@ class TitleCutter(CutListEditor):
                if n > 0:
                        for x in range(n):
                                i = audio.getTrackInfo(x)
                if n > 0:
                        for x in range(n):
                                i = audio.getTrackInfo(x)
-                               language = i.getLanguage()[:2]
+                               language = i.getLanguage()
                                description = i.getDescription()
                                if description == "MPEG":
                                description = i.getDescription()
                                if description == "MPEG":
-                                       description = "mp2"
-                               self.t.audiotracks.append((description, language))
+                                       description = "MP2"
+                               self.t.audiotracks.append((language, description))
                print "audiotracks", self.t.audiotracks
 
        def exit(self):
                print "audiotracks", self.t.audiotracks
 
        def exit(self):
index 6fcc326e227579797fdcb45cb6290340a83ff75c..fc4460e3aebfaf5ca11f957fb0f2d758b4bafaee 100644 (file)
@@ -11,7 +11,7 @@ from Components.Sources.Progress import Progress
 from Components.FileList import FileList
 from Components.Label import Label
 from enigma import eListboxPythonMultiContent, gFont, RT_HALIGN_LEFT
 from Components.FileList import FileList
 from Components.Label import Label
 from enigma import eListboxPythonMultiContent, gFont, RT_HALIGN_LEFT
-from Tools.Directories import resolveFilename, SCOPE_PLAYLIST
+from Tools.Directories import resolveFilename, SCOPE_PLUGINS
 
 class TitleList(Screen):
        skin = """
 
 class TitleList(Screen):
        skin = """
@@ -130,7 +130,7 @@ class TitleList(Screen):
                if source is None:
                        return None
                t = self.project.addService(source)
                if source is None:
                        return None
                t = self.project.addService(source)
-               self.editTitle(t, readOnly=True)
+               self.editTitle(t, readOnly=False)
 
        def removeCurrentTitle(self):
                title = self.getCurrentTitle()
 
        def removeCurrentTitle(self):
                title = self.getCurrentTitle()
@@ -147,7 +147,7 @@ class TitleList(Screen):
                self["title_label"].text = _("Table of content for collection") + " \"" + self.project.settings.name.getValue() + "\":"
 
        def loadTemplate(self):
                self["title_label"].text = _("Table of content for collection") + " \"" + self.project.settings.name.getValue() + "\":"
 
        def loadTemplate(self):
-               filename = resolveFilename(SCOPE_PLAYLIST)+"DreamboxDVDtemplate.ddvdp.xml"
+               filename = resolveFilename(SCOPE_PLUGINS)+"Extensions/DVDBurn/DreamboxDVDtemplate.ddvdp.xml"
                if self.project.loadProject(filename):
                        self["error_label"].hide()
                        return True
                if self.project.loadProject(filename):
                        self["error_label"].hide()
                        return True
diff --git a/lib/python/Plugins/Extensions/DVDBurn/dreamdvd_boat.jpg b/lib/python/Plugins/Extensions/DVDBurn/dreamdvd_boat.jpg
new file mode 100644 (file)
index 0000000..a5256e2
Binary files /dev/null and b/lib/python/Plugins/Extensions/DVDBurn/dreamdvd_boat.jpg differ
diff --git a/lib/python/Plugins/Extensions/DVDBurn/silence.mp2 b/lib/python/Plugins/Extensions/DVDBurn/silence.mp2
new file mode 100644 (file)
index 0000000..e8a817f
Binary files /dev/null and b/lib/python/Plugins/Extensions/DVDBurn/silence.mp2 differ
diff --git a/lib/python/Plugins/Extensions/DVDBurn/vmgmblank.mpg b/lib/python/Plugins/Extensions/DVDBurn/vmgmblank.mpg
new file mode 100644 (file)
index 0000000..8e66168
Binary files /dev/null and b/lib/python/Plugins/Extensions/DVDBurn/vmgmblank.mpg differ
diff --git a/lib/python/Plugins/Extensions/DVDBurn/vmgmdream.mpg b/lib/python/Plugins/Extensions/DVDBurn/vmgmdream.mpg
new file mode 100644 (file)
index 0000000..4797986
Binary files /dev/null and b/lib/python/Plugins/Extensions/DVDBurn/vmgmdream.mpg differ