Merge pull request #59 from Kraymer/master
Fix pyflakes warnings reported in non-test files. gh-40
This commit is contained in:
commit
8e3e5d63f5
|
@ -121,8 +121,7 @@ class FileSystem:
|
||||||
metadata['date_taken']
|
metadata['date_taken']
|
||||||
),
|
),
|
||||||
base_name,
|
base_name,
|
||||||
metadata['extension']
|
metadata['extension'])
|
||||||
)
|
|
||||||
return file_name.lower()
|
return file_name.lower()
|
||||||
|
|
||||||
"""
|
"""
|
||||||
|
@ -170,9 +169,9 @@ class FileSystem:
|
||||||
if('move' in kwargs):
|
if('move' in kwargs):
|
||||||
move = kwargs['move']
|
move = kwargs['move']
|
||||||
|
|
||||||
allowDuplicate = False
|
allow_duplicate = False
|
||||||
if('allowDuplicate' in kwargs):
|
if('allowDuplicate' in kwargs):
|
||||||
allowDuplicate = kwargs['allowDuplicate']
|
allow_duplicate = kwargs['allowDuplicate']
|
||||||
|
|
||||||
metadata = media.get_metadata()
|
metadata = media.get_metadata()
|
||||||
|
|
||||||
|
@ -191,7 +190,7 @@ class FileSystem:
|
||||||
|
|
||||||
# If duplicates are not allowed and this hash exists in the db then we
|
# If duplicates are not allowed and this hash exists in the db then we
|
||||||
# return
|
# return
|
||||||
if(allowDuplicate is False and db.check_hash(checksum) is True):
|
if(allow_duplicate is False and db.check_hash(checksum) is True):
|
||||||
if(constants.debug is True):
|
if(constants.debug is True):
|
||||||
print '%s already exists at %s. Skipping...' % (
|
print '%s already exists at %s. Skipping...' % (
|
||||||
_file,
|
_file,
|
||||||
|
|
|
@ -3,9 +3,7 @@ from ConfigParser import ConfigParser
|
||||||
import fractions
|
import fractions
|
||||||
import pyexiv2
|
import pyexiv2
|
||||||
|
|
||||||
import math
|
|
||||||
import requests
|
import requests
|
||||||
import sys
|
|
||||||
import urllib
|
import urllib
|
||||||
|
|
||||||
from elodie import constants
|
from elodie import constants
|
||||||
|
|
|
@ -108,10 +108,10 @@ class Db(object):
|
||||||
[longitude, latitude, data['long'], data['lat']]
|
[longitude, latitude, data['long'], data['lat']]
|
||||||
)
|
)
|
||||||
|
|
||||||
R = 6371000 # radius of the earth in m
|
r = 6371000 # radius of the earth in m
|
||||||
x = (lon2 - lon1) * cos(0.5*(lat2+lat1))
|
x = (lon2 - lon1) * cos(0.5 * (lat2 + lat1))
|
||||||
y = lat2 - lat1
|
y = lat2 - lat1
|
||||||
d = R * sqrt(x*x + y*y)
|
d = r * sqrt(x * x + y * y)
|
||||||
# Use if closer then threshold_km reuse lookup
|
# Use if closer then threshold_km reuse lookup
|
||||||
if(d <= threshold_m and d < last_d):
|
if(d <= threshold_m and d < last_d):
|
||||||
name = data['name']
|
name = data['name']
|
||||||
|
|
|
@ -1 +0,0 @@
|
||||||
from media import *
|
|
|
@ -4,18 +4,14 @@ Media package that's a parent class for media objects
|
||||||
"""
|
"""
|
||||||
|
|
||||||
# load modules
|
# load modules
|
||||||
from datetime import datetime
|
|
||||||
from distutils.spawn import find_executable
|
from distutils.spawn import find_executable
|
||||||
from elodie import constants
|
from elodie import constants
|
||||||
from fractions import Fraction
|
|
||||||
from sys import argv
|
|
||||||
|
|
||||||
import mimetypes
|
import mimetypes
|
||||||
import os
|
import os
|
||||||
import pyexiv2
|
import pyexiv2
|
||||||
import re
|
import re
|
||||||
import subprocess
|
import subprocess
|
||||||
import time
|
|
||||||
|
|
||||||
|
|
||||||
class Media(object):
|
class Media(object):
|
||||||
|
@ -241,7 +237,7 @@ class Media(object):
|
||||||
stdout=subprocess.PIPE,
|
stdout=subprocess.PIPE,
|
||||||
shell=True
|
shell=True
|
||||||
)
|
)
|
||||||
streamdata = process_output.communicate()[0]
|
process_output.communicate()
|
||||||
|
|
||||||
if(process_output.returncode != 0):
|
if(process_output.returncode != 0):
|
||||||
return False
|
return False
|
||||||
|
@ -299,7 +295,7 @@ class Media(object):
|
||||||
self.metadata[key] = kwargs[key]
|
self.metadata[key] = kwargs[key]
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def get_class_by_file(Media, _file, classes):
|
def get_class_by_file(cls, _file, classes):
|
||||||
extension = os.path.splitext(_file)[1][1:].lower()
|
extension = os.path.splitext(_file)[1][1:].lower()
|
||||||
|
|
||||||
for i in classes:
|
for i in classes:
|
||||||
|
|
|
@ -3,12 +3,7 @@ Author: Jaisen Mathai <jaisen@jmathai.com>
|
||||||
Photo package that handles all photo operations
|
Photo package that handles all photo operations
|
||||||
"""
|
"""
|
||||||
|
|
||||||
# load modules
|
|
||||||
from datetime import datetime
|
|
||||||
from sys import argv
|
|
||||||
|
|
||||||
import imghdr
|
import imghdr
|
||||||
import mimetypes
|
|
||||||
import LatLon
|
import LatLon
|
||||||
import os
|
import os
|
||||||
import pyexiv2
|
import pyexiv2
|
||||||
|
@ -228,5 +223,5 @@ class Photo(Media):
|
||||||
@returns, tuple
|
@returns, tuple
|
||||||
"""
|
"""
|
||||||
@classmethod
|
@classmethod
|
||||||
def get_valid_extensions(Photo):
|
def get_valid_extensions(cls):
|
||||||
return Photo.extensions
|
return cls.extensions
|
||||||
|
|
|
@ -6,10 +6,8 @@ Video package that handles all video operations
|
||||||
# load modules
|
# load modules
|
||||||
from distutils.spawn import find_executable
|
from distutils.spawn import find_executable
|
||||||
import tempfile
|
import tempfile
|
||||||
from sys import argv
|
|
||||||
from datetime import datetime
|
from datetime import datetime
|
||||||
|
|
||||||
import mimetypes
|
|
||||||
import os
|
import os
|
||||||
import re
|
import re
|
||||||
import shutil
|
import shutil
|
||||||
|
@ -91,7 +89,6 @@ class Video(Media):
|
||||||
# conversion in the local timezone
|
# conversion in the local timezone
|
||||||
# If the time is not found in EXIF we update EXIF
|
# If the time is not found in EXIF we update EXIF
|
||||||
seconds_since_epoch = min(os.path.getmtime(source), os.path.getctime(source)) # noqa
|
seconds_since_epoch = min(os.path.getmtime(source), os.path.getctime(source)) # noqa
|
||||||
time_found_in_exif = False
|
|
||||||
exif_data = self.get_exif()
|
exif_data = self.get_exif()
|
||||||
for key in ['Creation Date', 'Media Create Date']:
|
for key in ['Creation Date', 'Media Create Date']:
|
||||||
date = re.search('%s +: +([0-9: ]+)' % key, exif_data)
|
date = re.search('%s +: +([0-9: ]+)' % key, exif_data)
|
||||||
|
@ -106,7 +103,6 @@ class Video(Media):
|
||||||
)
|
)
|
||||||
if(exif_seconds_since_epoch < seconds_since_epoch):
|
if(exif_seconds_since_epoch < seconds_since_epoch):
|
||||||
seconds_since_epoch = exif_seconds_since_epoch
|
seconds_since_epoch = exif_seconds_since_epoch
|
||||||
time_found_in_exif = True
|
|
||||||
break
|
break
|
||||||
except:
|
except:
|
||||||
pass
|
pass
|
||||||
|
@ -279,7 +275,7 @@ class Video(Media):
|
||||||
stdout=subprocess.PIPE,
|
stdout=subprocess.PIPE,
|
||||||
shell=True
|
shell=True
|
||||||
)
|
)
|
||||||
streamdata = write_process.communicate()[0]
|
write_process.communicate()
|
||||||
if(write_process.returncode != 0):
|
if(write_process.returncode != 0):
|
||||||
if(constants.debug is True):
|
if(constants.debug is True):
|
||||||
print 'Failed to generate plist file'
|
print 'Failed to generate plist file'
|
||||||
|
@ -368,7 +364,7 @@ class Video(Media):
|
||||||
stdout=subprocess.PIPE,
|
stdout=subprocess.PIPE,
|
||||||
shell=True
|
shell=True
|
||||||
)
|
)
|
||||||
streamdata = update_process.communicate()[0]
|
update_process.communicate()
|
||||||
if(update_process.returncode != 0):
|
if(update_process.returncode != 0):
|
||||||
if(constants.debug is True):
|
if(constants.debug is True):
|
||||||
print '%s did not complete successfully' % avmetareadwrite_command # noqa
|
print '%s did not complete successfully' % avmetareadwrite_command # noqa
|
||||||
|
@ -408,8 +404,8 @@ class Video(Media):
|
||||||
@returns, tuple
|
@returns, tuple
|
||||||
"""
|
"""
|
||||||
@classmethod
|
@classmethod
|
||||||
def get_valid_extensions(Video):
|
def get_valid_extensions(cls):
|
||||||
return Video.extensions
|
return cls.extensions
|
||||||
|
|
||||||
|
|
||||||
class Transcode(object):
|
class Transcode(object):
|
||||||
|
|
|
@ -13,7 +13,7 @@ import plistlib
|
||||||
|
|
||||||
class Plist(object):
|
class Plist(object):
|
||||||
def __init__(self, source):
|
def __init__(self, source):
|
||||||
if(path.isfile(source) == False):
|
if not path.isfile(source):
|
||||||
raise IOError('Could not load plist file %s' % source)
|
raise IOError('Could not load plist file %s' % source)
|
||||||
|
|
||||||
self.source = source
|
self.source = source
|
||||||
|
|
Loading…
Reference in New Issue