parent
0a2daa0140
commit
3a9314f8ca
12
ponyapi.nim
12
ponyapi.nim
|
@ -106,13 +106,15 @@ routes:
|
||||||
|
|
||||||
get "/last_aired":
|
get "/last_aired":
|
||||||
var
|
var
|
||||||
#now = getTime()
|
now = getTime()
|
||||||
ep: Episode
|
ep: Episode
|
||||||
|
|
||||||
for epid, episode in pairs[Episode](episodes):
|
for epid, episode in pairs[Episode](episodes):
|
||||||
# XXX HACK PLEASE FIX
|
var then = times.fromSeconds(episode.air_date)
|
||||||
if episode.season == 5 and episode.episode == 26:
|
|
||||||
ep = episode
|
if now < then:
|
||||||
|
ep = episodes[epid-1]
|
||||||
|
break
|
||||||
|
|
||||||
stats.lastAired.success.inc
|
stats.lastAired.success.inc
|
||||||
httpReply Http200, ep
|
httpReply Http200, ep
|
||||||
|
@ -144,7 +146,7 @@ routes:
|
||||||
let
|
let
|
||||||
irccmd = "/cs episode del $1 $2\n/cs episode add $1 $2 $3 $4" % [$ep.season, $ep.episode, $ep.air_date, ep.name]
|
irccmd = "/cs episode del $1 $2\n/cs episode add $1 $2 $3 $4" % [$ep.season, $ep.episode, $ep.air_date, ep.name]
|
||||||
echo irccmd
|
echo irccmd
|
||||||
|
|
||||||
if ep.air_date == 0:
|
if ep.air_date == 0:
|
||||||
stats.episodeLookup.fails.inc
|
stats.episodeLookup.fails.inc
|
||||||
httpReply Http404, "Not found"
|
httpReply Http404, "Not found"
|
||||||
|
|
Loading…
Reference in New Issue