Merge pull request #14 from patricksan/develop
Closes gh-9 by adding support to expand a user's home directory
This commit is contained in:
commit
25baf39fff
11
elodie.py
11
elodie.py
|
@ -28,10 +28,10 @@ def usage():
|
||||||
"""
|
"""
|
||||||
|
|
||||||
def _import(params):
|
def _import(params):
|
||||||
destination = params['--destination']
|
destination = os.path.expanduser(params['--destination'])
|
||||||
|
|
||||||
if(params['--source'] is not None):
|
if(params['--source'] is not None):
|
||||||
source = params['--source']
|
source = os.path.expanduser(params['--source'])
|
||||||
|
|
||||||
for current_file in filesystem.get_all_files(source, None):
|
for current_file in filesystem.get_all_files(source, None):
|
||||||
media = Media.get_class_by_file(current_file, [Photo, Video])
|
media = Media.get_class_by_file(current_file, [Photo, Video])
|
||||||
|
@ -45,7 +45,7 @@ def _import(params):
|
||||||
if(dest_path is not None):
|
if(dest_path is not None):
|
||||||
print '%s -> %s' % (current_file, dest_path)
|
print '%s -> %s' % (current_file, dest_path)
|
||||||
elif(params['--file'] is not None):
|
elif(params['--file'] is not None):
|
||||||
current_file = params['--file']
|
current_file = os.path.expanduser(params['--file'])
|
||||||
media = Media.get_class_by_file(current_file, [Photo, Video])
|
media = Media.get_class_by_file(current_file, [Photo, Video])
|
||||||
if(media.__name__ == 'Video'):
|
if(media.__name__ == 'Video'):
|
||||||
filesystem.set_date_from_path_video(media)
|
filesystem.set_date_from_path_video(media)
|
||||||
|
@ -63,8 +63,9 @@ def _update(params):
|
||||||
print '{"source":"%s", "error_msg":"Could not find %s"}' % (file_path, file_path)
|
print '{"source":"%s", "error_msg":"Could not find %s"}' % (file_path, file_path)
|
||||||
continue
|
continue
|
||||||
|
|
||||||
destination = os.path.dirname(os.path.dirname(os.path.dirname(file_path)))
|
file_path = os.path.expanduser(file_path)
|
||||||
|
destination = os.path.expanduser(os.path.dirname(os.path.dirname(os.path.dirname(file_path))))
|
||||||
|
|
||||||
media = Media.get_class_by_file(file_path, [Photo, Video])
|
media = Media.get_class_by_file(file_path, [Photo, Video])
|
||||||
if(media is None):
|
if(media is None):
|
||||||
continue
|
continue
|
||||||
|
|
Loading…
Reference in New Issue