summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorAndreas Brachold <vdr07@deltab.de>2007-11-09 15:18:21 +0000
committerAndreas Brachold <vdr07@deltab.de>2007-11-09 15:18:21 +0000
commitaa99123685e85b53583a491febe269c9dceb8222 (patch)
treed94900136de0a3a4139dc83832e35b2ad0158c46 /lib
parentc66187b33b7cbbd88697167a583154372705e119 (diff)
downloadxxv-aa99123685e85b53583a491febe269c9dceb8222.tar.gz
xxv-aa99123685e85b53583a491febe269c9dceb8222.tar.bz2
* RECORDS: fix div zero, if none recording present
Diffstat (limited to 'lib')
-rw-r--r--lib/XXV/MODULES/RECORDS.pm6
1 files changed, 5 insertions, 1 deletions
diff --git a/lib/XXV/MODULES/RECORDS.pm b/lib/XXV/MODULES/RECORDS.pm
index 7ff3801..9b46053 100644
--- a/lib/XXV/MODULES/RECORDS.pm
+++ b/lib/XXV/MODULES/RECORDS.pm
@@ -564,7 +564,11 @@ sub readData {
error sprintf("Unsupported unit '%s' to calc free capacity",$freeUnit) unless($freeUnit eq 'MB');
# use store capacity and recordings length to calc free capacity
$obj->{CapacityTotal} = $totalDuration;
- $obj->{CapacityFree} = ($free * $totalDuration) / $totalSpace;
+ if($totalSpace > 1) {
+ $obj->{CapacityFree} = ($free * $totalDuration) / $totalSpace;
+ } else {
+ $obj->{CapacityFree} = $free * 3600 / 2000; # use 2GB at one hour as base
+ }
$obj->{CapacityPercent} = ($totalSpace * 100 / ($free + $totalSpace))
unless($obj->{CapacityPercent});