mirror of
https://github.com/dbarzin/pandora-box.git
synced 2025-08-04 05:15:26 +02:00
work in progress
This commit is contained in:
parent
f0d894f8b8
commit
bf7a29d173
1 changed files with 13 additions and 12 deletions
|
@ -22,25 +22,24 @@ NO_SCAN = True
|
||||||
USB_AUTO_MOUNT = False
|
USB_AUTO_MOUNT = False
|
||||||
PANDORA_ROOT_URL = "http://127.0.0.1:6100"
|
PANDORA_ROOT_URL = "http://127.0.0.1:6100"
|
||||||
FAKE_SCAN = False
|
FAKE_SCAN = False
|
||||||
|
QUARANTINE =
|
||||||
|
|
||||||
""" read configuration file """
|
""" read configuration file """
|
||||||
def config():
|
def config():
|
||||||
global NO_SCAN
|
global NO_SCAN, USB_AUTO_MOUNT, PANDORA_ROOT_URL
|
||||||
global USB_AUTO_MOUNT
|
global FAKE_SCAN, QUARANTINE, QUARANTINE_FOLDER
|
||||||
global PANDORA_ROOT_URL
|
|
||||||
global FAKE_SCAN
|
|
||||||
# intantiate a ConfirParser
|
# intantiate a ConfirParser
|
||||||
config = configparser.ConfigParser()
|
config = configparser.ConfigParser()
|
||||||
# read the config file
|
# read the config file
|
||||||
config.read('pandorabox.ini')
|
config.read('pandorabox.ini')
|
||||||
# set values
|
# set values
|
||||||
NO_SCAN=config['DEFAULT']['NO_SCAN'].lower()=="true"
|
NO_SCAN=config['DEFAULT']['NO_SCAN'].lower()=="true"
|
||||||
USB_AUTO_MOUNT=config['DEFAULT']['USB_AUTO_MOUNT'].lower()=="true"
|
|
||||||
print("USB_AUTO_MOUNT=%s" % USB_AUTO_MOUNT)
|
|
||||||
time.sleep(3)
|
|
||||||
PANDORA_ROOT_URL=config['DEFAULT']['PANDORA_ROOT_URL']
|
|
||||||
FAKE_SCAN=config['DEFAULT']['FAKE_SCAN'].lower()=="true"
|
FAKE_SCAN=config['DEFAULT']['FAKE_SCAN'].lower()=="true"
|
||||||
|
USB_AUTO_MOUNT=config['DEFAULT']['USB_AUTO_MOUNT'].lower()=="true"
|
||||||
|
PANDORA_ROOT_URL=config['DEFAULT']['PANDORA_ROOT_URL']
|
||||||
|
# Quarantine
|
||||||
|
QUARANTINE=config['DEFAULT']['QUARANTINE'].lower()=="true"
|
||||||
|
QUARANTINE_FOLDER = config['DEFAULT']['QUARANTINE_FOLDER']
|
||||||
# ----------------------------------------------------------
|
# ----------------------------------------------------------
|
||||||
|
|
||||||
""" Convert size to human readble string """
|
""" Convert size to human readble string """
|
||||||
|
@ -396,9 +395,11 @@ def scan(mount_point, used):
|
||||||
file_count += 1
|
file_count += 1
|
||||||
update_bar(scanned * 100 // used)
|
update_bar(scanned * 100 // used)
|
||||||
except Exception as e :
|
except Exception as e :
|
||||||
log("Unexpected error3: %s" % e)
|
log("Scan %s [%s] -> %s (%ds)" % (
|
||||||
logging.exception("An exception was thrown!")
|
file,
|
||||||
return False
|
human_readable_size(file_size),
|
||||||
|
"ERROR", -1))
|
||||||
|
log("Unexpected error: %s" % e)
|
||||||
update_bar(100)
|
update_bar(100)
|
||||||
log("Scan done in %ds" % (time.time() - scan_start_time))
|
log("Scan done in %ds" % (time.time() - scan_start_time))
|
||||||
log("%d files scanned" % file_count)
|
log("%d files scanned" % file_count)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue