gh-40 Remove unused modules and files
This commit is contained in:
parent
fbaef53033
commit
87053e99e6
|
@ -1,35 +0,0 @@
|
||||||
"""
|
|
||||||
Command line argument parsing for helper scripts.
|
|
||||||
"""
|
|
||||||
from __future__ import print_function
|
|
||||||
|
|
||||||
import getopt
|
|
||||||
import sys
|
|
||||||
from re import sub
|
|
||||||
|
|
||||||
|
|
||||||
def parse(argv, options, long_options, usage):
|
|
||||||
"""Parse command line arguments.
|
|
||||||
|
|
||||||
:param list(str) argv: Arguments passed to the program.
|
|
||||||
:param str options: String of characters for allowed short options.
|
|
||||||
:param list(str) long_options: List of strings of allowed long options.
|
|
||||||
:param str usage: Help text, to print in the case of an error or when
|
|
||||||
the user asks for it.
|
|
||||||
:returns: dict
|
|
||||||
"""
|
|
||||||
try:
|
|
||||||
opts, args = getopt.getopt(argv, options, long_options)
|
|
||||||
except getopt.GetoptError:
|
|
||||||
print(usage)
|
|
||||||
sys.exit(2)
|
|
||||||
|
|
||||||
return_arguments = {}
|
|
||||||
for opt, arg in opts:
|
|
||||||
if opt == '-h':
|
|
||||||
print(usage)
|
|
||||||
sys.exit()
|
|
||||||
else:
|
|
||||||
return_arguments[sub('^-+', '', opt)] = arg
|
|
||||||
|
|
||||||
return return_arguments
|
|
|
@ -9,7 +9,6 @@ from __future__ import absolute_import
|
||||||
from __future__ import division
|
from __future__ import division
|
||||||
|
|
||||||
# load modules
|
# load modules
|
||||||
from distutils.spawn import find_executable
|
|
||||||
from datetime import datetime
|
from datetime import datetime
|
||||||
|
|
||||||
import os
|
import os
|
||||||
|
@ -53,21 +52,6 @@ class Video(Media):
|
||||||
self.longitude_ref_key = 'EXIF:GPSLongitudeRef'
|
self.longitude_ref_key = 'EXIF:GPSLongitudeRef'
|
||||||
self.set_gps_ref = False
|
self.set_gps_ref = False
|
||||||
|
|
||||||
def get_avmetareadwrite(self):
|
|
||||||
"""Get path to executable avmetareadwrite binary.
|
|
||||||
|
|
||||||
We wrap this since we call it in a few places and we do a fallback.
|
|
||||||
|
|
||||||
:returns: None or string
|
|
||||||
"""
|
|
||||||
avmetareadwrite = find_executable('avmetareadwrite')
|
|
||||||
if(avmetareadwrite is None):
|
|
||||||
avmetareadwrite = '/usr/bin/avmetareadwrite'
|
|
||||||
if(not os.path.isfile(avmetareadwrite) or not os.access(avmetareadwrite, os.X_OK)): # noqa
|
|
||||||
return None
|
|
||||||
|
|
||||||
return avmetareadwrite
|
|
||||||
|
|
||||||
def get_date_taken(self):
|
def get_date_taken(self):
|
||||||
"""Get the date which the photo was taken.
|
"""Get the date which the photo was taken.
|
||||||
|
|
||||||
|
|
|
@ -1,32 +0,0 @@
|
||||||
#!/usr/bin/env python
|
|
||||||
|
|
||||||
import os
|
|
||||||
import shutil
|
|
||||||
import sys
|
|
||||||
|
|
||||||
from elodie import arguments
|
|
||||||
from elodie.media.photo import Media
|
|
||||||
from elodie.media.photo import Photo
|
|
||||||
from elodie.media.video import Video
|
|
||||||
|
|
||||||
def main(argv):
|
|
||||||
args = arguments.parse(argv, None, ['file='], './import.py --file=<path to file>')
|
|
||||||
|
|
||||||
if('file' not in args):
|
|
||||||
print 'No file specified'
|
|
||||||
sys.exit(1)
|
|
||||||
|
|
||||||
media = Media.get_class_by_file(args['file'], [Photo, Video])
|
|
||||||
|
|
||||||
if(media is None):
|
|
||||||
print 'Not a valid file'
|
|
||||||
sys.exit(1)
|
|
||||||
|
|
||||||
metadata = media.get_metadata()
|
|
||||||
output = {'date_taken': metadata['date_taken']}
|
|
||||||
print '%r' % output
|
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
|
||||||
main(sys.argv[1:])
|
|
||||||
sys.exit(0)
|
|
|
@ -1,36 +0,0 @@
|
||||||
#!/usr/bin/env python
|
|
||||||
|
|
||||||
import os
|
|
||||||
import shutil
|
|
||||||
import sys
|
|
||||||
|
|
||||||
from elodie import arguments
|
|
||||||
from elodie import geolocation
|
|
||||||
from elodie.media.photo import Media
|
|
||||||
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)
|
|
||||||
|
|
||||||
media = Media.get_class_by_file(args['file'], [Photo, Video])
|
|
||||||
|
|
||||||
if(media is None):
|
|
||||||
print 'Not a valid file'
|
|
||||||
sys.exit(1)
|
|
||||||
|
|
||||||
metadata = media.get_metadata()
|
|
||||||
|
|
||||||
place_name = geolocation.place_name(metadata['latitude'], metadata['longitude'])
|
|
||||||
|
|
||||||
output = {'latitude': metadata['latitude'], 'longitude': metadata['longitude'], 'place_name': place_name}
|
|
||||||
print '%r' % output
|
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
|
||||||
main(sys.argv[1:])
|
|
||||||
sys.exit(0)
|
|
Loading…
Reference in New Issue