Några fixar för enklare publicering

This commit is contained in:
Thomas Lovén 2017-03-22 20:16:45 +01:00
parent f93b9659a1
commit 65b283168b
4 changed files with 13 additions and 4 deletions

3
.gitignore vendored Normal file
View File

@ -0,0 +1,3 @@
.DS_Store
slides/
thumbnails/

View File

@ -46,7 +46,7 @@ def thumbnails(category, num=0):
catdir = pages + '/' + category
thumbdir = catdir + '/thumbnails'
if not os.path.isfile('%s/%d.jpg' % (thumbdir, num)):
images = sorted([x for x in next(os.walk(catdir))[2] if x.endswith('.jpg')])
images = sorted([x for x in next(os.walk(catdir))[2] if x.endswith('.jpg')], key=lambda x: x.lower())
if not os.path.exists(thumbdir):
os.makedirs(thumbdir)
imgin = '%s/%s' % (catdir, images[num])
@ -59,7 +59,7 @@ def slides(category, num=0):
catdir = pages + '/' + category
thumbdir = catdir + '/slides'
if not os.path.isfile('%s/%d.jpg' % (thumbdir, num)):
images = sorted([x for x in next(os.walk(catdir))[2] if x.endswith('.jpg')])
images = sorted([x for x in next(os.walk(catdir))[2] if x.endswith('.jpg')], key=lambda x: x.lower())
imgin = '%s/%s' % (catdir, images[num])
imgout = '%s/%d.jpg' % (thumbdir, num)
if not os.path.exists(thumbdir):
@ -71,7 +71,7 @@ def slides(category, num=0):
@app.route('/<category>/<int:num>.jpg')
def cat_photo(category, num):
directory = pages + '/' + category
images = sorted([x for x in next(os.walk(directory))[2] if x.endswith('.jpg')])
images = sorted([x for x in next(os.walk(directory))[2] if x.endswith('.jpg')], key=lambda x: x.lower())
try:
return send_from_directory(directory, images[num]);
except IndexError:

View File

@ -9,3 +9,10 @@ arrakis:designbyloven $ workon designbyloven
* Restarting with stat
* Debugger is active!
* Debugger pin code: 111-005-251
ctrl+c för att stänga servern
g aa (add all)
g ci -m Beskrivning av ändringar (check in)
g push (publicera)

View File

@ -2,7 +2,6 @@
rm -r /Users/thomas/code/designbyloven/sidor/**/slides
rm -r /Users/thomas/code/designbyloven/sidor/**/thumbnails
rm **/.DS_Store
touch /Users/thomas/code/designbyloven/designbyloven.py
exit 0