summaryrefslogtreecommitdiff
path: root/download-images.py
diff options
context:
space:
mode:
authorluxagraf <sng@luxagraf.net>2024-09-11 20:09:18 -0500
committerluxagraf <sng@luxagraf.net>2024-09-11 20:09:18 -0500
commit93fc6a27f01fbe325c95008b7f336627152ea3c7 (patch)
tree73171981a4a9b7b145687b10995fb98c051982d0 /download-images.py
parent558d3c8503879871c9b291839ef4b15fe85c5e88 (diff)
added new download tools
Diffstat (limited to 'download-images.py')
-rwxr-xr-xdownload-images.py12
1 files changed, 6 insertions, 6 deletions
diff --git a/download-images.py b/download-images.py
index a0cbf31..5fa6a98 100755
--- a/download-images.py
+++ b/download-images.py
@@ -3,13 +3,13 @@ import os
from shutil import copyfile
import sys
-
+home_directory = os.path.expanduser('~')
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/.photocopyrc', 'r') as f:
+with open(os.path.join(home_directory, '.photocopyrc'), 'r') as f:
lastfile = str(f.readline().rstrip())
sorter = []
for (dirname, dirs, files) in os.walk(path):
@@ -19,14 +19,14 @@ for (dirname, dirs, files) in os.walk(path):
if int(filename.split('DSC')[1].split(".ARW")[0]) > int(lastfile.split('DSC')[1].split(".ARW")[0]):
sorter.append([int(filename.split('DSC')[1].split(".ARW")[0]), filename])
for f in sorted(sorter):
- dest = '/home/lxf/pictures/inbox/'
+ dest = os.path.join(home_directory, '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])
+ print("copying:", dirn+'/'+f[1], "--->", dest+'/'+f[1])
+ copyfile(dirn+'/'+f[1], os.path.join(dest, f[1]))
try:
out = sorted(sorter)[-1]
- with open('/home/lxf/.photocopyrc', 'w') as f:
+ with open(os.path.join(home_directory, '.photocopyrc'), 'w') as f:
f.write(out[1])
except IndexError:
pass