aboutsummaryrefslogtreecommitdiff
path: root/lib/python
diff options
context:
space:
mode:
authorAndreas Frisch <andreas.frisch@multimedia-labs.de>2008-10-08 12:34:27 +0000
committerAndreas Frisch <andreas.frisch@multimedia-labs.de>2008-10-08 12:34:27 +0000
commitc913cb3336b5ff9fd6a1f49e5a039fea3e647cd4 (patch)
treeff3e121d5847b32fc7b7bc699b417951e444fc22 /lib/python
parent0d889870ea740ee9ad49a03a52c82007e3de6c24 (diff)
downloadenigma2-c913cb3336b5ff9fd6a1f49e5a039fea3e647cd4.tar.gz
enigma2-c913cb3336b5ff9fd6a1f49e5a039fea3e647cd4.zip
fix free/used capacity parsing for dvd+rw (plus) media and fix possible division-by-zero condition
Diffstat (limited to 'lib/python')
-rw-r--r--lib/python/Plugins/Extensions/DVDBurn/DVDToolbox.py9
1 files changed, 8 insertions, 1 deletions
diff --git a/lib/python/Plugins/Extensions/DVDBurn/DVDToolbox.py b/lib/python/Plugins/Extensions/DVDBurn/DVDToolbox.py
index 02ed75ad..c766ad52 100644
--- a/lib/python/Plugins/Extensions/DVDBurn/DVDToolbox.py
+++ b/lib/python/Plugins/Extensions/DVDBurn/DVDToolbox.py
@@ -94,13 +94,20 @@ class DVDToolbox(Screen):
print "[Disc status] capacity=%d, used=0" % (capacity)
capacity = used
used = 0
+ elif line.find("Free Blocks:") > -1:
+ size = line[15:-3].split('*')
+ size = int(size[0])*int(size[1])*1024
+ if size > 0:
+ capacity = size
+ used = capacity-used
+ print "[free blocks] capacity=%d, used=%d" % (capacity, used)
infotext += line
self["details"].setText(infotext)
if self.formattable:
self["key_yellow"].text = _("Format")
else:
self["key_yellow"].text = ""
- percent = 100 * used / capacity
+ percent = 100 * used / (capacity or 1)
if capacity > 4600:
self["space_label"].text = "%d / %d MB" % (used, capacity) + " (%.2f%% " % percent + _("of a DUAL layer medium used.") + ")"
self["space_bar"].value = int(percent)