mirror of
https://github.com/dbarzin/pandora-box.git
synced 2025-08-04 13:25:27 +02:00
work in progress
This commit is contained in:
parent
b3bfaed9cf
commit
f0d894f8b8
1 changed files with 14 additions and 6 deletions
|
@ -25,15 +25,21 @@ FAKE_SCAN = False
|
||||||
|
|
||||||
""" read configuration file """
|
""" read configuration file """
|
||||||
def config():
|
def config():
|
||||||
|
global NO_SCAN
|
||||||
|
global USB_AUTO_MOUNT
|
||||||
|
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']
|
NO_SCAN=config['DEFAULT']['NO_SCAN'].lower()=="true"
|
||||||
USB_AUTO_MOUNT=config['DEFAULT']['USB_AUTO_MOUNT']
|
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']
|
PANDORA_ROOT_URL=config['DEFAULT']['PANDORA_ROOT_URL']
|
||||||
FAKE_SCAN=config['DEFAULT']['FAKE_SCAN']
|
FAKE_SCAN=config['DEFAULT']['FAKE_SCAN'].lower()=="true"
|
||||||
|
|
||||||
# ----------------------------------------------------------
|
# ----------------------------------------------------------
|
||||||
|
|
||||||
|
@ -130,7 +136,7 @@ def update_bar(progress):
|
||||||
time.sleep(0)
|
time.sleep(0)
|
||||||
progress_win.addstr(0, 1, "Progress:")
|
progress_win.addstr(0, 1, "Progress:")
|
||||||
else:
|
else:
|
||||||
pos = ((curses.COLS-12) * progress) // 100
|
pos = ((curses.COLS-14) * progress) // 100
|
||||||
progress_win.addstr(1, 1, "#"*pos)
|
progress_win.addstr(1, 1, "#"*pos)
|
||||||
progress_win.addstr(0, 1, "Progress: %d%%" % progress)
|
progress_win.addstr(0, 1, "Progress: %d%%" % progress)
|
||||||
progress_win.refresh()
|
progress_win.refresh()
|
||||||
|
@ -237,7 +243,7 @@ def mount_device(device):
|
||||||
if loop < 10:
|
if loop < 10:
|
||||||
return partition.mountpoint
|
return partition.mountpoint
|
||||||
else:
|
else:
|
||||||
return ""
|
return None
|
||||||
else:
|
else:
|
||||||
res = os.system("pmount " + device.device_node + " /media/box")
|
res = os.system("pmount " + device.device_node + " /media/box")
|
||||||
found = False
|
found = False
|
||||||
|
@ -253,7 +259,6 @@ def mount_device(device):
|
||||||
log("Device mounted at /media/box")
|
log("Device mounted at /media/box")
|
||||||
return "/media/box"
|
return "/media/box"
|
||||||
|
|
||||||
|
|
||||||
"""Unmount USB device"""
|
"""Unmount USB device"""
|
||||||
def umount_device():
|
def umount_device():
|
||||||
if not USB_AUTO_MOUNT:
|
if not USB_AUTO_MOUNT:
|
||||||
|
@ -281,6 +286,9 @@ def device_loop():
|
||||||
print_serial(device.get("ID_SERIAL_SHORT"))
|
print_serial(device.get("ID_SERIAL_SHORT"))
|
||||||
# Mount device
|
# Mount device
|
||||||
mount_point = mount_device(device)
|
mount_point = mount_device(device)
|
||||||
|
if mount_point == None:
|
||||||
|
# no partition (?)
|
||||||
|
continue
|
||||||
try:
|
try:
|
||||||
statvfs=os.statvfs(mount_point)
|
statvfs=os.statvfs(mount_point)
|
||||||
except Exception as e :
|
except Exception as e :
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue