diff options
| author | ghost <andreas.monzner@multimedia-labs.de> | 2009-07-30 12:07:43 +0200 |
|---|---|---|
| committer | ghost <andreas.monzner@multimedia-labs.de> | 2009-07-30 12:07:43 +0200 |
| commit | 7a33f3edf33fcd2291957c05d883d80af3f058ce (patch) | |
| tree | ab983ab5747c3928587a593366528873932aa3de | |
| parent | a6e5bb5ef14da6f61cf974d0f9d35a2a1bbbc51f (diff) | |
| parent | ed817937df0a68c0b222a4e48fdf24984d87c2fb (diff) | |
| download | enigma2-7a33f3edf33fcd2291957c05d883d80af3f058ce.tar.gz enigma2-7a33f3edf33fcd2291957c05d883d80af3f058ce.zip | |
Merge branch 'master' of git.opendreambox.org:/git/enigma2
| -rw-r--r-- | lib/python/Plugins/Extensions/DVDBurn/DVDProject.py | 10 | ||||
| -rw-r--r-- | lib/python/Plugins/Extensions/DVDBurn/Process.py | 13 | ||||
| -rw-r--r-- | lib/python/Plugins/Extensions/DVDBurn/TitleList.py | 29 | ||||
| -rw-r--r-- | lib/python/Plugins/Extensions/DVDBurn/TitleProperties.py | 2 | ||||
| -rwxr-xr-x | lib/python/Tools/Directories.py | 11 |
5 files changed, 47 insertions, 18 deletions
diff --git a/lib/python/Plugins/Extensions/DVDBurn/DVDProject.py b/lib/python/Plugins/Extensions/DVDBurn/DVDProject.py index 96fc380a..83672460 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 = 4480 + MAX_DL = 8150 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 80e5899b..44075d64 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 fd4c7134..83bafd74 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,25 @@ 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/(1024*1024) + MAX_DL = self.project.MAX_DL-100 + MAX_SL = self.project.MAX_SL-100 + print "updateSize:", size, "MAX_DL:", MAX_DL, "MAX_SL:", MAX_SL + if size > MAX_DL: + percent = 100 * size / float(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 < 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 > MAX_SL: + percent = 100 * size / float(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 < 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 < MAX_SL: + percent = 100 * size / float(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 1c2099fb..86d21c25 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) diff --git a/lib/python/Tools/Directories.py b/lib/python/Tools/Directories.py index f9394978..aaa2a9da 100755 --- a/lib/python/Tools/Directories.py +++ b/lib/python/Tools/Directories.py @@ -262,3 +262,14 @@ def copytree(src, dst, symlinks=False): utime(dst, (st.st_atime, st.st_mtime)) except: print "copy stats for", src, "failed!" + +def getSize(path, pattern=".*"): + path_size = 0 + if os_path.isdir(path): + files = crawlDirectory(path, pattern) + for file in files: + filepath = os_path.join(file[0], file[1]) + path_size += os_path.getsize(filepath) + elif os_path.isfile(path): + path_size = os_path.getsize(path) + return path_size |
