summaryrefslogtreecommitdiff
path: root/bin
diff options
context:
space:
mode:
authorluxagraf <sng@luxagraf.net>2020-04-03 09:58:54 -0400
committerluxagraf <sng@luxagraf.net>2020-04-03 09:58:54 -0400
commit4f2609a1ce3a625389d653ce6e1ef5e65cd73ba9 (patch)
tree61e0012686aed9ea1951006cc5ee10c17f156f7a /bin
parent521cfbe22456fc1fa777eb0bf632b82423926c2c (diff)
rolled in sway changes
Diffstat (limited to 'bin')
-rwxr-xr-xbin/download-images-pano.py32
-rwxr-xr-xbin/download-images.py2
2 files changed, 34 insertions, 0 deletions
diff --git a/bin/download-images-pano.py b/bin/download-images-pano.py
new file mode 100755
index 0000000..fcbf472
--- /dev/null
+++ b/bin/download-images-pano.py
@@ -0,0 +1,32 @@
+#! /bin/python
+import os
+from shutil import copyfile
+import sys
+
+
+if os.path.exists(sys.argv[1]):
+ path = os.path.abspath(sys.argv[1])
+else:
+ print("Cannot find " + sys.argv[1])
+ exit()
+with open('/home/lxf/.panocopyrc', 'r') as f:
+ lastfile = str(f.readline().rstrip())
+sorter = []
+for (dirname, dirs, files) in os.walk(path):
+ dirn = os.path.abspath(dirname)
+ for filename in files:
+ if filename.endswith('.RW2'):
+ if int(filename.split('P')[1].split(".RW2")[0]) > int(lastfile.split('P')[1].split(".RW2")[0]):
+ sorter.append([int(filename.split('P')[1].split(".RW2")[0]), filename])
+for f in sorted(sorter):
+ dest = '/home/lxf/pictures/inbox/'
+ if not os.path.exists(dest):
+ os.makedirs(dest)
+ print("copying:", dirn+'/'+f[1], "--->", dest+f[1])
+ copyfile(dirn+'/'+f[1], dest+f[1])
+ try:
+ out = sorted(sorter)[-1]
+ with open('/home/lxf/.panocopyrc', 'w') as f:
+ f.write(out[1])
+ except IndexError:
+ pass
diff --git a/bin/download-images.py b/bin/download-images.py
index 5ad7e73..4ff583a 100755
--- a/bin/download-images.py
+++ b/bin/download-images.py
@@ -2,6 +2,8 @@
import os
from shutil import copyfile
import sys
+
+
if os.path.exists(sys.argv[1]):
path = os.path.abspath(sys.argv[1])
else: