diff --git a/elodie/external/pyexiftool.py b/elodie/external/pyexiftool.py index 52b187e..f6850f6 100644 --- a/elodie/external/pyexiftool.py +++ b/elodie/external/pyexiftool.py @@ -402,13 +402,13 @@ class ExifTool(object): "an iterable of strings") params = [] - params_b = [] + params_utf8 = [] for tag, value in tags.items(): params.append(u'-%s=%s' % (tag, value)) params.extend(filenames) - params_b = [x.encode('utf-8') for x in params] - return self.execute(*params_b) + params_utf8 = [x.encode('utf-8') for x in params] + return self.execute(*params_utf8) def set_tags(self, tags, filename): """Writes the values of the specified tags for the given file. diff --git a/elodie/geolocation.py b/elodie/geolocation.py index 925bc83..e0f4780 100644 --- a/elodie/geolocation.py +++ b/elodie/geolocation.py @@ -2,15 +2,17 @@ from __future__ import print_function from __future__ import division from future import standard_library -standard_library.install_aliases() from past.utils import old_div from os import path from configparser import ConfigParser -import fractions + +standard_library.install_aliases() # noqa import requests -import urllib.request, urllib.parse, urllib.error +import urllib.request +import urllib.parse +import urllib.error from elodie import constants from elodie.localstorage import Db @@ -77,7 +79,8 @@ def dms_to_decimal(degrees, minutes, seconds, direction=' '): if(direction[0] in 'WSws'): sign = -1 return ( - float(degrees) + old_div(float(minutes), 60) + old_div(float(seconds), 3600) + float(degrees) + old_div(float(minutes), 60) + + old_div(float(seconds), 3600) ) * sign @@ -148,7 +151,7 @@ def reverse_lookup(lat, lon): headers = {"Accept-Language": constants.accepted_language} r = requests.get( 'http://open.mapquestapi.com/nominatim/v1/reverse.php?%s' % - urllib.parse.urlencode(params),headers=headers + urllib.parse.urlencode(params), headers=headers ) return r.json() except requests.exceptions.RequestException as e: diff --git a/elodie/media/base.py b/elodie/media/base.py index 167ad7d..2d1410b 100644 --- a/elodie/media/base.py +++ b/elodie/media/base.py @@ -13,10 +13,11 @@ are used to represent the actual files. import mimetypes import os -try: - basestring +try: # Py3k compatibility + basestring except NameError: - basestring = str + basestring = (bytes, str) + class Base(object): diff --git a/elodie/media/media.py b/elodie/media/media.py index ddfd9b8..ae2e82d 100644 --- a/elodie/media/media.py +++ b/elodie/media/media.py @@ -9,7 +9,6 @@ are used to represent the actual files. .. moduleauthor:: Jaisen Mathai """ from __future__ import print_function -from builtins import object # load modules from elodie import constants diff --git a/elodie/media/photo.py b/elodie/media/photo.py index cca402c..221438b 100644 --- a/elodie/media/photo.py +++ b/elodie/media/photo.py @@ -6,7 +6,6 @@ image objects (JPG, DNG, etc.). """ from __future__ import print_function from __future__ import absolute_import -from builtins import str import imghdr import os diff --git a/elodie/media/video.py b/elodie/media/video.py index d13885c..2becef6 100644 --- a/elodie/media/video.py +++ b/elodie/media/video.py @@ -7,9 +7,6 @@ objects (AVI, MOV, etc.). from __future__ import print_function from __future__ import absolute_import from __future__ import division -from builtins import str -from builtins import object -from past.utils import old_div # load modules from distutils.spawn import find_executable diff --git a/elodie/tests/media/audio_test.py b/elodie/tests/media/audio_test.py index cdc4f70..cfc9cd2 100644 --- a/elodie/tests/media/audio_test.py +++ b/elodie/tests/media/audio_test.py @@ -57,7 +57,6 @@ def test_get_date_taken(): audio = Audio(helper.get_file('audio.m4a')) date_taken = audio.get_date_taken() - print('%r' % date_taken) assert date_taken == (2016, 1, 4, 5, 24, 15, 0, 19, 0), date_taken def test_get_exiftool_attributes():