diff --git a/rc/rc.py b/rc/rc.py index 78d49a4..1a8afb2 100755 --- a/rc/rc.py +++ b/rc/rc.py @@ -19,8 +19,14 @@ import os @route('/') @route('/', method='POST') def remote_control(): - st = os.statvfs("/home") - free = "%.2f" % float((st.f_bavail * st.f_frsize)/1.073741824e9) + st_home = os.statvfs("/home") + free_home = "%.2f" % float((st_home.f_bavail * st_home.f_frsize)/1.073741824e9) + if os.path.isdir("/media/storage"): + st_storage = os.statvfs("/media/storage") + free_storage = "%.2f" % float((st_storage.f_bavail * st_storage.f_frsize)/1.073741824e9) + else: + free_storage="N/A" + if (request.POST.get("cardbackup")): os.system("sudo /home/pi/little-backup-box/scripts/card-backup.sh") return ('Backup started. You can close this page.') @@ -34,7 +40,7 @@ def remote_control(): if (request.POST.get("shutdown")): os.system("sudo shutdown -h now") return ('Shutdown request sent. You can close this page.') - return template('rc.tpl', freespace=free) + return template('rc.tpl', freespace_home=free_home, freespace_storage=free_storage) @route('/static/:path#.+#', name='static') def static(path): diff --git a/rc/rc.tpl b/rc/rc.tpl index 03f6240..8fa5711 100644 --- a/rc/rc.tpl +++ b/rc/rc.tpl @@ -46,7 +46,8 @@