Add session API routes

This commit is contained in:
2021-03-07 21:43:47 -07:00
parent 0f0f6b1f7f
commit b1aaffa4db
2 changed files with 94 additions and 9 deletions
+7 -6
View File
@@ -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/'))