From 87053e99e6f26b1f6f5036aad20f8b76be00ad8c Mon Sep 17 00:00:00 2001 From: Jaisen Mathai Date: Tue, 13 Sep 2016 20:19:03 -0700 Subject: [PATCH] gh-40 Remove unused modules and files --- elodie/arguments.py | 35 ----------------------------------- elodie/media/video.py | 16 ---------------- tools/__init__.py | 0 tools/scripts/__init__.py | 0 tools/scripts/datetime.py | 32 -------------------------------- tools/scripts/geolocation.py | 36 ------------------------------------ 6 files changed, 119 deletions(-) delete mode 100644 elodie/arguments.py delete mode 100644 tools/__init__.py delete mode 100644 tools/scripts/__init__.py delete mode 100755 tools/scripts/datetime.py delete mode 100755 tools/scripts/geolocation.py diff --git a/elodie/arguments.py b/elodie/arguments.py deleted file mode 100644 index f181b18..0000000 --- a/elodie/arguments.py +++ /dev/null @@ -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 diff --git a/elodie/media/video.py b/elodie/media/video.py index 2becef6..72065fa 100644 --- a/elodie/media/video.py +++ b/elodie/media/video.py @@ -9,7 +9,6 @@ from __future__ import absolute_import from __future__ import division # load modules -from distutils.spawn import find_executable from datetime import datetime import os @@ -53,21 +52,6 @@ class Video(Media): self.longitude_ref_key = 'EXIF:GPSLongitudeRef' 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): """Get the date which the photo was taken. diff --git a/tools/__init__.py b/tools/__init__.py deleted file mode 100644 index e69de29..0000000 diff --git a/tools/scripts/__init__.py b/tools/scripts/__init__.py deleted file mode 100644 index e69de29..0000000 diff --git a/tools/scripts/datetime.py b/tools/scripts/datetime.py deleted file mode 100755 index 7c882a8..0000000 --- a/tools/scripts/datetime.py +++ /dev/null @@ -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=') - - 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) diff --git a/tools/scripts/geolocation.py b/tools/scripts/geolocation.py deleted file mode 100755 index 93318bb..0000000 --- a/tools/scripts/geolocation.py +++ /dev/null @@ -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= --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)