Implemeted sorting to make picture ids match up

This commit is contained in:
Sebastian 2016-07-17 02:40:18 +02:00
parent 39d3dba634
commit 030137904b
1 changed files with 1 additions and 0 deletions

View File

@ -44,6 +44,7 @@ def get_random_photo():
category = pick_random_key(json['photos'][year][photographer])
photos = json['photos'][year][photographer][category]
photos = sorted(photos, key = lambda photo: photo['thumb'])
pid = random.randint(0, len(photos) - 1)
photo_url = photos[pid]['images'][unicode(INPUT_RES)]['src']