|
|
@ -68,14 +68,21 @@ def hello_world(): |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@app.route('/movies/', methods=['GET']) |
|
|
|
@app.route('/movies/', methods=['GET']) |
|
|
|
|
|
|
|
@app.route('/movies/<lang>/', methods=['GET']) |
|
|
|
@crossdomain(origin='*') |
|
|
|
@crossdomain(origin='*') |
|
|
|
def movie_list(): |
|
|
|
def movie_list(lang='en'): |
|
|
|
result = db.movies.find() |
|
|
|
result = db.movies.find() |
|
|
|
movies = [] |
|
|
|
movies = [] |
|
|
|
for i in result: |
|
|
|
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) |
|
|
|
movies.append(i) |
|
|
|
if len(movies) > 10: |
|
|
|
|
|
|
|
break |
|
|
|
|
|
|
|
json_dict = { |
|
|
|
json_dict = { |
|
|
|
'meta': { |
|
|
|
'meta': { |
|
|
|
'total_count': len(movies) |
|
|
|
'total_count': len(movies) |
|
|
|