diff --git a/flasky.py b/flasky.py index 024ee37..ad80cb1 100644 --- a/flasky.py +++ b/flasky.py @@ -68,14 +68,21 @@ def hello_world(): @app.route('/movies/', methods=['GET']) +@app.route('/movies//', methods=['GET']) @crossdomain(origin='*') -def movie_list(): +def movie_list(lang='en'): result = db.movies.find() movies = [] for i in result: + if 'original' in i['title']: + i['original_title'] = i['title']['original'] + i['title'] = i['title'][lang] + i['cast'] = i['cast'][lang] + i['tagline'] = i['tagline'][lang] + i['storyline'] = i['storyline'][lang] + i['director'] = i['director'][lang] movies.append(i) - if len(movies) > 10: - break + json_dict = { 'meta': { 'total_count': len(movies)