2015-10-14 05:26:55 +02:00
|
|
|
#!/usr/bin/env python
|
|
|
|
|
|
|
|
import os
|
|
|
|
import shutil
|
|
|
|
import sys
|
|
|
|
|
|
|
|
from elodie import arguments
|
|
|
|
from elodie.media.photo import Photo
|
|
|
|
from elodie.media.video import Video
|
|
|
|
|
|
|
|
def main(argv):
|
|
|
|
args = arguments.parse(argv, None, ['file=','type='], './import.py --type=<photo or video> --file=<path to file>')
|
|
|
|
|
|
|
|
if('file' not in args):
|
|
|
|
print 'No file specified'
|
|
|
|
sys.exit(1)
|
|
|
|
|
2015-10-15 06:27:42 +02:00
|
|
|
if('type' in args and args['type'] == 'video'):
|
2015-10-14 05:26:55 +02:00
|
|
|
media_type = Video
|
2015-10-15 06:27:42 +02:00
|
|
|
else:
|
|
|
|
media_type = Photo
|
2015-10-14 05:26:55 +02:00
|
|
|
|
|
|
|
media = media_type(args['file'])
|
|
|
|
metadata = media.get_metadata()
|
|
|
|
|
2015-10-15 06:27:42 +02:00
|
|
|
print '%r' % metadata
|
|
|
|
|
2015-10-14 05:26:55 +02:00
|
|
|
output = {'date_taken': metadata['date_taken']}
|
|
|
|
print '%r' % output
|
|
|
|
|
|
|
|
|
|
|
|
if __name__ == '__main__':
|
|
|
|
main(sys.argv[1:])
|
|
|
|
sys.exit(0)
|