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']
|
||||
),
|
||||
base_name,
|
||||
metadata['extension']
|
||||
)
|
||||
metadata['extension'])
|
||||
return file_name.lower()
|
||||
|
||||
"""
|
||||
|
@ -170,9 +169,9 @@ class FileSystem:
|
|||
if('move' in kwargs):
|
||||
move = kwargs['move']
|
||||
|
||||
allowDuplicate = False
|
||||
allow_duplicate = False
|
||||
if('allowDuplicate' in kwargs):
|
||||
allowDuplicate = kwargs['allowDuplicate']
|
||||
allow_duplicate = kwargs['allowDuplicate']
|
||||
|
||||
metadata = media.get_metadata()
|
||||
|
||||
|
@ -191,7 +190,7 @@ class FileSystem:
|
|||
|
||||
# If duplicates are not allowed and this hash exists in the db then we
|
||||
# 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):
|
||||
print '%s already exists at %s. Skipping...' % (
|
||||
_file,
|
||||
|
|
|
@ -3,9 +3,7 @@ from ConfigParser import ConfigParser
|
|||
import fractions
|
||||
import pyexiv2
|
||||
|
||||
import math
|
||||
import requests
|
||||
import sys
|
||||
import urllib
|
||||
|
||||
from elodie import constants
|
||||
|
|
|
@ -108,10 +108,10 @@ class Db(object):
|
|||
[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))
|
||||
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
|
||||
if(d <= threshold_m and d < last_d):
|
||||
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
|
||||
from datetime import datetime
|
||||
from distutils.spawn import find_executable
|
||||
from elodie import constants
|
||||
from fractions import Fraction
|
||||
from sys import argv
|
||||
|
||||
import mimetypes
|
||||
import os
|
||||
import pyexiv2
|
||||
import re
|
||||
import subprocess
|
||||
import time
|
||||
|
||||
|
||||
class Media(object):
|
||||
|
@ -241,7 +237,7 @@ class Media(object):
|
|||
stdout=subprocess.PIPE,
|
||||
shell=True
|
||||
)
|
||||
streamdata = process_output.communicate()[0]
|
||||
process_output.communicate()
|
||||
|
||||
if(process_output.returncode != 0):
|
||||
return False
|
||||
|
@ -299,7 +295,7 @@ class Media(object):
|
|||
self.metadata[key] = kwargs[key]
|
||||
|
||||
@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()
|
||||
|
||||
for i in classes:
|
||||
|
|
|
@ -3,12 +3,7 @@ Author: Jaisen Mathai <jaisen@jmathai.com>
|
|||
Photo package that handles all photo operations
|
||||
"""
|
||||
|
||||
# load modules
|
||||
from datetime import datetime
|
||||
from sys import argv
|
||||
|
||||
import imghdr
|
||||
import mimetypes
|
||||
import LatLon
|
||||
import os
|
||||
import pyexiv2
|
||||
|
@ -228,5 +223,5 @@ class Photo(Media):
|
|||
@returns, tuple
|
||||
"""
|
||||
@classmethod
|
||||
def get_valid_extensions(Photo):
|
||||
return Photo.extensions
|
||||
def get_valid_extensions(cls):
|
||||
return cls.extensions
|
||||
|
|
|
@ -6,10 +6,8 @@ Video package that handles all video operations
|
|||
# load modules
|
||||
from distutils.spawn import find_executable
|
||||
import tempfile
|
||||
from sys import argv
|
||||
from datetime import datetime
|
||||
|
||||
import mimetypes
|
||||
import os
|
||||
import re
|
||||
import shutil
|
||||
|
@ -91,7 +89,6 @@ class Video(Media):
|
|||
# conversion in the local timezone
|
||||
# If the time is not found in EXIF we update EXIF
|
||||
seconds_since_epoch = min(os.path.getmtime(source), os.path.getctime(source)) # noqa
|
||||
time_found_in_exif = False
|
||||
exif_data = self.get_exif()
|
||||
for key in ['Creation Date', 'Media Create Date']:
|
||||
date = re.search('%s +: +([0-9: ]+)' % key, exif_data)
|
||||
|
@ -106,7 +103,6 @@ class Video(Media):
|
|||
)
|
||||
if(exif_seconds_since_epoch < seconds_since_epoch):
|
||||
seconds_since_epoch = exif_seconds_since_epoch
|
||||
time_found_in_exif = True
|
||||
break
|
||||
except:
|
||||
pass
|
||||
|
@ -279,7 +275,7 @@ class Video(Media):
|
|||
stdout=subprocess.PIPE,
|
||||
shell=True
|
||||
)
|
||||
streamdata = write_process.communicate()[0]
|
||||
write_process.communicate()
|
||||
if(write_process.returncode != 0):
|
||||
if(constants.debug is True):
|
||||
print 'Failed to generate plist file'
|
||||
|
@ -368,7 +364,7 @@ class Video(Media):
|
|||
stdout=subprocess.PIPE,
|
||||
shell=True
|
||||
)
|
||||
streamdata = update_process.communicate()[0]
|
||||
update_process.communicate()
|
||||
if(update_process.returncode != 0):
|
||||
if(constants.debug is True):
|
||||
print '%s did not complete successfully' % avmetareadwrite_command # noqa
|
||||
|
@ -408,8 +404,8 @@ class Video(Media):
|
|||
@returns, tuple
|
||||
"""
|
||||
@classmethod
|
||||
def get_valid_extensions(Video):
|
||||
return Video.extensions
|
||||
def get_valid_extensions(cls):
|
||||
return cls.extensions
|
||||
|
||||
|
||||
class Transcode(object):
|
||||
|
|
|
@ -13,7 +13,7 @@ import plistlib
|
|||
|
||||
class Plist(object):
|
||||
def __init__(self, source):
|
||||
if(path.isfile(source) == False):
|
||||
if not path.isfile(source):
|
||||
raise IOError('Could not load plist file %s' % source)
|
||||
|
||||
self.source = source
|
||||
|
|
Loading…
Reference in New Issue