smuteczek
parent
0b334a52e2
commit
5e8e21b113
|
@ -36,6 +36,10 @@
|
||||||
Jan Paweł II wypełniał małe strony
|
Jan Paweł II wypełniał małe strony
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
<div class="alert alert-info">
|
||||||
|
beta feature: <a href={% url 'papiezator:grand_conclave' 255 200 1 %}> - ratzinger!</a>
|
||||||
|
</div>
|
||||||
<h3>How do i popes?</h3>
|
<h3>How do i popes?</h3>
|
||||||
|
|
||||||
<p> simply append width/height of the pope you need to the url.</p>
|
<p> simply append width/height of the pope you need to the url.</p>
|
||||||
|
|
|
@ -0,0 +1,43 @@
|
||||||
|
#!/usr/bin/env python
|
||||||
|
import PIL.Image
|
||||||
|
from glob import glob
|
||||||
|
from os import path
|
||||||
|
import os
|
||||||
|
|
||||||
|
|
||||||
|
exts = [".jpg", ".jpeg", ".png", ".gif"]
|
||||||
|
|
||||||
|
|
||||||
|
def remove(pope):
|
||||||
|
if os.path.isdir(pope):
|
||||||
|
return
|
||||||
|
pope_dir = path.dirname(pope)
|
||||||
|
borked_path = path.join(pope_dir, "borked")
|
||||||
|
if not path.exists(borked_path):
|
||||||
|
os.mkdir(borked_path)
|
||||||
|
|
||||||
|
file = os.path.split(pope)[1]
|
||||||
|
move_to = os.path.join(borked_path, file)
|
||||||
|
os.rename(pope, move_to)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
for pope in ["JP2", "B16"]:
|
||||||
|
print("dealing with {}".format(pope))
|
||||||
|
pope_images = glob("popes/{pope}/*".format(pope=pope))
|
||||||
|
for image in (x for x in pope_images if not path.isdir(x)):
|
||||||
|
try:
|
||||||
|
i = PIL.Image.open(image)
|
||||||
|
x, y = i.size
|
||||||
|
except:
|
||||||
|
print("{image} seems to be borked".format(image=image))
|
||||||
|
input()
|
||||||
|
if x < 300 or y < 300:
|
||||||
|
print("{image} seems to be small".format(image=image))
|
||||||
|
remove(image)
|
||||||
|
ext = path.splitext(image)[1]
|
||||||
|
if ext not in exts :
|
||||||
|
print("{image} seems to have a fucked up extension".format(image=image))
|
Loading…
Reference in New Issue