make extension lower case

This commit is contained in:
j 2016-02-13 15:58:06 +05:30
parent 44515eb031
commit 209ebeaab8
2 changed files with 3 additions and 3 deletions

View file

@ -88,7 +88,7 @@ def run_scan():
if f.startswith('.'): if f.startswith('.'):
continue continue
f = os.path.join(root, f) f = os.path.join(root, f)
ext = f.split('.')[-1] ext = f.split('.')[-1].lower()
if ext == 'kepub': if ext == 'kepub':
ext = 'epub' ext = 'epub'
if ext in extensions: if ext in extensions:
@ -166,7 +166,7 @@ def run_import(options=None):
if f.startswith('.'): if f.startswith('.'):
continue continue
f = os.path.join(root, f) f = os.path.join(root, f)
ext = f.split('.')[-1] ext = f.split('.')[-1].lower()
if ext in extensions: if ext in extensions:
books.append(f) books.append(f)
count += 1 count += 1

View file

@ -28,7 +28,7 @@ def get_id(f=None, data=None):
return base64.b32encode(codecs.decode(ox.sha1sum(f, cached=True), 'hex')).decode() return base64.b32encode(codecs.decode(ox.sha1sum(f, cached=True), 'hex')).decode()
def metadata(f, from_=None): def metadata(f, from_=None):
ext = f.split('.')[-1] ext = f.split('.')[-1].lower()
data = {} data = {}
data['extension'] = ext data['extension'] = ext
data['size'] = os.stat(f).st_size data['size'] = os.stat(f).st_size