From 5d441513d7c81c7e52399801dd34c97480f4e136 Mon Sep 17 00:00:00 2001 From: Fraxinas Date: Wed, 29 Jul 2009 10:24:08 +0200 Subject: [PATCH] change disc size determination and tweak dual layer growisofs arguments --- .../Plugins/Extensions/DVDBurn/DVDProject.py | 10 +++++++++ lib/python/Plugins/Extensions/DVDBurn/Process.py | 13 +++++++++-- lib/python/Plugins/Extensions/DVDBurn/TitleList.py | 26 +++++++++------------- .../Plugins/Extensions/DVDBurn/TitleProperties.py | 2 +- 4 files changed, 33 insertions(+), 18 deletions(-) diff --git a/lib/python/Plugins/Extensions/DVDBurn/DVDProject.py b/lib/python/Plugins/Extensions/DVDBurn/DVDProject.py index 96fc380..9a3bd64 100644 --- a/lib/python/Plugins/Extensions/DVDBurn/DVDProject.py +++ b/lib/python/Plugins/Extensions/DVDBurn/DVDProject.py @@ -18,6 +18,8 @@ class ConfigFilename(ConfigText): return ("mtext"[1-selected:], filename, mark) class DVDProject: + MAX_SL = 4370 + MAX_DL = 7950 def __init__(self): self.titles = [ ] self.target = None @@ -140,6 +142,14 @@ class DVDProject: return False return True + def getSize(self): + totalsize = 0 + for title in self.titles: + totalsize += title.estimatedDiskspace + return totalsize + + size = property(getSize) + class MenuTemplate(DVDProject): def __init__(self): self.settings = ConfigSubsection() diff --git a/lib/python/Plugins/Extensions/DVDBurn/Process.py b/lib/python/Plugins/Extensions/DVDBurn/Process.py index 80e5899..44075d6 100644 --- a/lib/python/Plugins/Extensions/DVDBurn/Process.py +++ b/lib/python/Plugins/Extensions/DVDBurn/Process.py @@ -315,9 +315,9 @@ class BurnTask(Task): elif line.startswith(":-["): if line.find("ASC=30h") != -1: self.error = self.ERROR_NOTWRITEABLE - if line.find("ASC=24h") != -1: + elif line.find("ASC=24h") != -1: self.error = self.ERROR_LOAD - if line.find("SK=5h/ASC=A8h/ACQ=04h") != -1: + elif line.find("SK=5h/ASC=A8h/ACQ=04h") != -1: self.error = self.ERROR_MINUSRWBUG else: self.error = self.ERROR_UNKNOWN @@ -883,6 +883,8 @@ class DVDJob(Job): self.name = _("Burn DVD") tool = "/bin/growisofs" burnargs = [ "-Z", "/dev/" + harddiskmanager.getCD(), "-dvd-compat" ] + if self.project.size/(1024*1024) > self.project.MAX_SL: + burnargs += [ "-use-the-force-luke=4gms", "-speed=1", "-R" ] elif output == "iso": self.name = _("Create DVD-ISO") tool = "/usr/bin/mkisofs" @@ -921,6 +923,8 @@ class DVDdataJob(Job): if output == "dvd": self.name = _("Burn DVD") burnargs = [ "-Z", "/dev/" + harddiskmanager.getCD(), "-dvd-compat" ] + if self.project.size/(1024*1024) > self.project.MAX_SL: + burnargs += [ "-use-the-force-luke=4gms", "-speed=1", "-R" ] elif output == "iso": tool = "/usr/bin/mkisofs" self.name = _("Create DVD-ISO") @@ -941,13 +945,18 @@ class DVDisoJob(Job): Job.__init__(self, _("Burn DVD")) self.project = project self.menupreview = False + from Tools.Directories import getSize if imagepath.endswith(".iso"): PreviewTask(self, imagepath) burnargs = [ "-Z", "/dev/" + harddiskmanager.getCD() + '='+imagepath, "-dvd-compat" ] + if getSize(imagepath)/(1024*1024) > self.project.MAX_SL: + burnargs += [ "-use-the-force-luke=4gms", "-speed=1", "-R" ] else: PreviewTask(self, imagepath + "/VIDEO_TS/") volName = self.project.settings.name.getValue() burnargs = [ "-Z", "/dev/" + harddiskmanager.getCD(), "-dvd-compat" ] + if getSize(imagepath)/(1024*1024) > self.project.MAX_SL: + burnargs += [ "-use-the-force-luke=4gms", "-speed=1", "-R" ] burnargs += [ "-dvd-video", "-publisher", "Dreambox", "-V", volName, imagepath ] tool = "/bin/growisofs" BurnTask(self, burnargs, tool) diff --git a/lib/python/Plugins/Extensions/DVDBurn/TitleList.py b/lib/python/Plugins/Extensions/DVDBurn/TitleList.py index fd4c713..aeb163f 100644 --- a/lib/python/Plugins/Extensions/DVDBurn/TitleList.py +++ b/lib/python/Plugins/Extensions/DVDBurn/TitleList.py @@ -232,13 +232,11 @@ class TitleList(Screen, HelpableScreen): def updateTitleList(self): res = [ ] - totalsize = 0 for title in self.project.titles: a = [ title, (eListboxPythonMultiContent.TYPE_TEXT, 0, 5, 500, 25, 0, RT_HALIGN_LEFT, title.properties.menutitle.getValue()) ] res.append(a) - totalsize += title.estimatedDiskspace self["titles"].list = res - self.updateSize(totalsize) + self.updateSize() if len(res): self["key_red"].text = _("Remove title") self["key_yellow"].text = _("Title properties") @@ -246,24 +244,22 @@ class TitleList(Screen, HelpableScreen): self["key_red"].text = "" self["key_yellow"].text = "" - def updateSize(self, totalsize): - size = int((totalsize/1024)/1024) - max_SL = 4370 - max_DL = 7950 - if size > max_DL: - percent = 100 * size / float(max_DL) + def updateSize(self): + size = self.project.size + if size > self.project.MAX_DL: + percent = 100 * size / float(self.project.MAX_DL) self["space_label"].text = "%d MB - " % size + _("exceeds dual layer medium!") + " (%.2f%% " % (100-percent) + _("free") + ")" self["space_bar"].value = int(percent) - if self.previous_size < max_DL: + if self.previous_size < self.project.MAX_DL: self.session.open(MessageBox,text = _("exceeds dual layer medium!"), type = MessageBox.TYPE_ERROR) - elif size > max_SL: - percent = 100 * size / float(max_DL) + elif size > self.project.MAX_SL: + percent = 100 * size / float(self.project.MAX_DL) self["space_label"].text = "%d MB " % size + _("of a DUAL layer medium used.") + " (%.2f%% " % (100-percent) + _("free") + ")" self["space_bar"].value = int(percent) - if self.previous_size < max_SL: + if self.previous_size < self.project.MAX_SL: self.session.open(MessageBox,text = _("Your collection exceeds the size of a single layer medium, you will need a blank dual layer DVD!"), type = MessageBox.TYPE_INFO) - elif size < max_SL: - percent = 100 * size / float(max_SL) + elif size < self.project.MAX_SL: + percent = 100 * size / float(self.project.MAX_SL) self["space_label"].text = "%d MB " % size + _("of a SINGLE layer medium used.") + " (%.2f%% " % (100-percent) + _("free") + ")" self["space_bar"].value = int(percent) self.previous_size = size diff --git a/lib/python/Plugins/Extensions/DVDBurn/TitleProperties.py b/lib/python/Plugins/Extensions/DVDBurn/TitleProperties.py index 1c2099f..86d21c2 100644 --- a/lib/python/Plugins/Extensions/DVDBurn/TitleProperties.py +++ b/lib/python/Plugins/Extensions/DVDBurn/TitleProperties.py @@ -91,7 +91,7 @@ class TitleProperties(Screen,ConfigListScreen): chaptermarks = title.getChapterMarks(template="$h:$m:$s") chapters_count = len(chaptermarks) if chapters_count >= 1: - infotext += '\n' + str(chapters_count+1) + ' ' + _("chapters") + ': ' + infotext += str(chapters_count+1) + ' ' + _("chapters") + ': ' infotext += ' / '.join(chaptermarks) self["serviceinfo"].setText(infotext) self["config"].setList(self.list) -- 2.7.4