mirror of
https://gitlab.sectorq.eu/jaydee/auto_import.git
synced 2025-12-14 10:34:53 +01:00
build
This commit is contained in:
@@ -87,52 +87,20 @@ f.close()
|
||||
# Set destination and initialize variables
|
||||
_DEST = "/media/nas/nas-photo/imported"
|
||||
_DEV = ""
|
||||
import_drives = []
|
||||
|
||||
drives = ["6362-3938","3239-3439", "5766-67E6","5766-67A3", "60C2-1369"]
|
||||
|
||||
# Log current user and id
|
||||
myCmd = "id"
|
||||
status, output = subprocess.getstatusoutput(myCmd)
|
||||
logging.debug(output)
|
||||
myCmd = "whoami"
|
||||
status, output = subprocess.getstatusoutput(myCmd)
|
||||
logging.debug(output)
|
||||
myCmd = "ls /dev/disk/by-uuid"
|
||||
status, output = subprocess.getstatusoutput(myCmd)
|
||||
|
||||
|
||||
files_imported = 0
|
||||
|
||||
# Find drives to import
|
||||
for l in output.splitlines():
|
||||
if l in drives:
|
||||
logging.debug(l)
|
||||
import_drives.append(l)
|
||||
|
||||
# Main import loop for each drive
|
||||
|
||||
myCmd = "mount| grep /share/external/DEV3301_1"
|
||||
while True:
|
||||
status, output = subprocess.getstatusoutput(myCmd)
|
||||
print(status)
|
||||
time.sleep(10)
|
||||
if status == 90:
|
||||
for d in import_drives:
|
||||
logging.debug(f"Working on {d}")
|
||||
_DEV_MOUNT = f"/mnt/{d}"
|
||||
if status == 0:
|
||||
_DEV_MOUNT = f"/share/external/DEV3301_1"
|
||||
_DEV_DIR = f"{_DEV_MOUNT}/DCIM"
|
||||
_IMP_FILE = f"{_DEV_MOUNT}/auto_import"
|
||||
_DEV_DATA = f"{_DEV_MOUNT}/MISC/version.txt"
|
||||
myCmd = f"mkdir -p {_DEV_MOUNT}"
|
||||
logging.debug(myCmd)
|
||||
status, output = subprocess.getstatusoutput(myCmd)
|
||||
myCmd = f"sudo mount --uuid {d} {_DEV_MOUNT}"
|
||||
#myCmd = f"sudo mount /dev/sde1 {_DEV_MOUNT}"
|
||||
logging.debug(myCmd)
|
||||
status, output = subprocess.getstatusoutput(myCmd)
|
||||
logging.debug(output)
|
||||
if os.path.ismount(_DEV_MOUNT):
|
||||
|
||||
# If version.txt exists, parse device info
|
||||
if os.path.exists(_DEV_DATA):
|
||||
file = open(_DEV_DATA, 'r')
|
||||
|
||||
Reference in New Issue
Block a user