Initial prototype of album update support
This commit is contained in:
parent
5316261b7d
commit
52e9a3b7c0
11
update.py
11
update.py
|
@ -21,6 +21,7 @@ def parse_arguments(args):
|
||||||
config = {
|
config = {
|
||||||
'time': None,
|
'time': None,
|
||||||
'location': None,
|
'location': None,
|
||||||
|
'album': None,
|
||||||
'process': 'yes'
|
'process': 'yes'
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -28,6 +29,10 @@ def parse_arguments(args):
|
||||||
return config
|
return config
|
||||||
|
|
||||||
def main(config, args):
|
def main(config, args):
|
||||||
|
try:
|
||||||
|
pyexiv2.xmp.register_namespace('https://github.com/jmathai/elodie/', 'elodie')
|
||||||
|
except KeyError:
|
||||||
|
pass
|
||||||
location_coords = None
|
location_coords = None
|
||||||
for arg in args:
|
for arg in args:
|
||||||
if(arg[:2] == '--'):
|
if(arg[:2] == '--'):
|
||||||
|
@ -78,6 +83,10 @@ def main(config, args):
|
||||||
exif_metadata['Exif.Image.DateTime'].value = datetime.strptime(time_string, time_format)
|
exif_metadata['Exif.Image.DateTime'].value = datetime.strptime(time_string, time_format)
|
||||||
write = True
|
write = True
|
||||||
|
|
||||||
|
if(config['album'] is not None):
|
||||||
|
exif_metadata['Xmp.elodie.album'] = config['album']
|
||||||
|
write = True
|
||||||
|
|
||||||
if(write == True):
|
if(write == True):
|
||||||
exif_metadata.write()
|
exif_metadata.write()
|
||||||
|
|
||||||
|
@ -94,7 +103,7 @@ def main(config, args):
|
||||||
|
|
||||||
db = Db()
|
db = Db()
|
||||||
filesystem = FileSystem()
|
filesystem = FileSystem()
|
||||||
args = arguments.parse(sys.argv[1:], None, ['time=','location=','process='], './update.py --time=<string time> --location=<string location> --process=no file1 file2...fileN')
|
args = arguments.parse(sys.argv[1:], None, ['album=','time=','location=','process='], './update.py --time=<string time> --location=<string location> --process=no file1 file2...fileN')
|
||||||
config = parse_arguments(args)
|
config = parse_arguments(args)
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
|
|
Loading…
Reference in New Issue