From 83d724ff9bfe884bc4ee7d65fbc3846082a3fcca Mon Sep 17 00:00:00 2001
From: Britney Fransen <brfransen@gmail.com>
Date: Thu, 5 Mar 2015 19:47:39 +0000
Subject: LinHES-system: find_orphans.py: add quit option to list

---
 abs/core/LinHES-system/PKGBUILD        |  4 ++--
 abs/core/LinHES-system/find_orphans.py | 24 +++++++++++++++++-------
 2 files changed, 19 insertions(+), 9 deletions(-)

diff --git a/abs/core/LinHES-system/PKGBUILD b/abs/core/LinHES-system/PKGBUILD
index d6b4bac..a0f182b 100755
--- a/abs/core/LinHES-system/PKGBUILD
+++ b/abs/core/LinHES-system/PKGBUILD
@@ -1,6 +1,6 @@
 pkgname=LinHES-system
 pkgver=8.3
-pkgrel=9
+pkgrel=10
 arch=('i686' 'x86_64')
 install=system.install
 pkgdesc="Everything that makes LinHES an automated system"
@@ -120,7 +120,7 @@ md5sums=('8415c4b2587a8a1e6a312484c1edafcb'
          '8e02efe1ad0df9a179075147eebb05b9'
          '8b0298f70f97cc1dc2a58b9a73c64bd3'
          '716710e0db42147b079c9ec1c7080efa'
-         '34fc1f58ad1eabf4eff4979d420760c0'
+         'cd28dd67a78f3b7da704e31db0298916'
          '69ecfe682f1b61c2c4c95d890b9f523c'
          'a94fe6d980f4b810f2e2ae5352084b39'
          '384956b4fd9bf40907856bab0e67b169'
diff --git a/abs/core/LinHES-system/find_orphans.py b/abs/core/LinHES-system/find_orphans.py
index cdc03d4..c134e82 100644
--- a/abs/core/LinHES-system/find_orphans.py
+++ b/abs/core/LinHES-system/find_orphans.py
@@ -12,7 +12,7 @@ def human_size(s):
     while s > 1000:
         s /= 1000
         o += 1
-    return str(round(s,1))+('B ','KB','MB','GB')[o]
+    return str(round(s,1))+('B ','KB','MB','GB','TB')[o]
 
 class File( str ):
     def __new__(self, host, group, path, name, size):
@@ -120,7 +120,7 @@ def populate(host=None):
 
 def delete_recs(recs):
     printrecs('The following recordings will be deleted', recs)
-    print 'Are you sure you want to continue?'
+    print 'Are you sure you want to continue? (yes/no)'
     try:
         res = raw_input('> ')
         while True:
@@ -144,7 +144,7 @@ def delete_recs(recs):
 
 def delete_files(files):
     printfiles('The following files will be deleted', files)
-    print 'Are you sure you want to continue?'
+    print 'Are you sure you want to continue? (yes/no)'
     try:
         res = raw_input('> ')
         while True:
@@ -190,10 +190,15 @@ def main(host=None):
             if len(unfiltered):
                 opts.append(['Delete other files', delete_files, unfiltered])
             opts.append(['Refresh list', None, None])
-            print 'Please select from the following'
+            print 'Please select from the following:'
             for i, opt in enumerate(opts):
-                print ' {0}. {1}'.format(i+1, opt[0])
+                if opt[0] == "Refresh list":
+                    print ' R. {1}'.format(i+1, opt[0])
+                    refreshNum=i+1
+                else:
+                    print ' {0}. {1}'.format(i+1, opt[0])
 
+            print ' Q. Quit'
             try:
                 inner = True
                 res = raw_input('> ')
@@ -201,10 +206,15 @@ def main(host=None):
                     try:
                         res = int(res)
                     except:
-                        res = raw_input('input number. ctrl-c to exit > ')
+                        if res == "Q" or res == "q":
+                            sys.exit(0)
+                        elif res == "R" or res == "r":
+                            res = refreshNum
+                        else:
+                            res = raw_input('Invalid selection > ')
                         continue
                     if (res <= 0) or (res > len(opts)):
-                        res = raw_input('input number within range > ')
+                        res = raw_input('Invalid selection > ')
                         continue
                     break
                 opt = opts[res-1]
-- 
cgit v0.12