mirror of
https://github.com/tanrax/guetzli-recursively.git
synced 2024-12-22 20:25:35 +01:00
fixbug type file
This commit is contained in:
parent
c70ed2bbf5
commit
7b2c882f66
@ -1,16 +1,16 @@
|
|||||||
#!/usr/bin/env python
|
#!/usr/bin/env python
|
||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
from os import path, walk, remove, rename
|
from os import path, walk, remove, rename
|
||||||
|
from imghdr import what
|
||||||
from subprocess import call
|
from subprocess import call
|
||||||
from sys import argv
|
from sys import argv
|
||||||
top_dir = argv[1]
|
top_dir = argv[1]
|
||||||
TEMP_FILE = 'temp.jpg'
|
TEMP_FILE = 'temp.jpg'
|
||||||
extensions = ('jpeg', 'jpg')
|
TYPES = ('jpeg',)
|
||||||
|
|
||||||
for dirpath, dirnames, files in walk(top_dir):
|
for dirpath, dirnames, files in walk(top_dir):
|
||||||
for name in files:
|
for name in files:
|
||||||
for extension in extensions:
|
if what(path.join(dirpath, name)) in TYPES:
|
||||||
if name.lower().endswith(extension):
|
|
||||||
# Get urls
|
# Get urls
|
||||||
url = path.join(dirpath, name)
|
url = path.join(dirpath, name)
|
||||||
print(url)
|
print(url)
|
||||||
|
Loading…
Reference in New Issue
Block a user