Add session API routes
This commit is contained in:
+7
-6
@@ -18,10 +18,10 @@ def download(ip, dest):
|
||||
|
||||
for f in files:
|
||||
source_file = '/3dscan/' + f
|
||||
dest_file = dest + f
|
||||
dest_file = dest / f
|
||||
print('Grabbing file', source_file)
|
||||
sftp.get(source_file, dest_file)
|
||||
sftp.remove(source_file)
|
||||
#sftp.remove(source_file)
|
||||
|
||||
if sftp: sftp.close()
|
||||
if transport: transport.close()
|
||||
@@ -29,10 +29,7 @@ def download(ip, dest):
|
||||
print('Finished downloading from', ip)
|
||||
|
||||
def download_all_photos(dest):
|
||||
if not dest.endswith('/'):
|
||||
raise Exception('Destination must end with /')
|
||||
|
||||
if not os.path.exists(dest):
|
||||
if not dest.exists():
|
||||
raise Exception('Destination does not exist')
|
||||
|
||||
print('Downloading all photos to', dest)
|
||||
@@ -40,3 +37,7 @@ def download_all_photos(dest):
|
||||
for ip in settings.RASPBERRY_IPS:
|
||||
t = threading.Thread(target=download, args=(ip, dest))
|
||||
t.start()
|
||||
|
||||
if __name__ == '__main__':
|
||||
from pathlib import Path
|
||||
download_all_photos(Path('test/'))
|
||||
|
||||
Reference in New Issue
Block a user