Merge branch 'master' of github.com:LongHairedHacker/htt-daemon
This commit is contained in:
commit
2a2b8e9cc4
10
photos.py
10
photos.py
|
@ -19,10 +19,13 @@ INPUT_RES = 1440
|
|||
FONT_SIZE = 20
|
||||
TEXT_COLOR = (0, 0, 0)
|
||||
|
||||
def uniquote(stuff):
|
||||
return quote(stuff.encode('utf-8'))
|
||||
|
||||
def make_url(year, category, photographer, pid):
|
||||
year = quote(year)
|
||||
category = quote(category)
|
||||
photographer = quote(photographer)
|
||||
year = uniquote(year)
|
||||
category = uniquote(category)
|
||||
photographer = uniquote(photographer)
|
||||
pid = pid + 1
|
||||
return u"http://htt-phototeam.de/#&gid=%s/%s/%s&pid=%d" % (year, category, photographer, pid)
|
||||
|
||||
|
@ -42,6 +45,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']
|
||||
|
||||
|
|
Loading…
Reference in New Issue