Show an episode by season number and episode number

This commit is contained in:
Christine Dodrill 2015-08-09 13:20:19 -07:00
parent b8e3b0323b
commit 4b66923620
1 changed files with 8 additions and 0 deletions

View File

@ -55,6 +55,14 @@ def season(number):
return jsonify(episodes=retEpisodes)
@app.route("/season/<snumber>/episode/<epnumber>")
def show_episode(snumber, epnumber):
for episode in episodes:
if str(episode["season"]) == snumber and str(episode["episode"]) == epnumber:
return jsonify(episode=episode)
abort(404)
@app.route("/random")
def show_random_ep():
return jsonify(episode=random.choice(episodes))