This commit is contained in:
j 2011-06-04 18:15:38 +02:00
parent 1db636d8c1
commit 9f6be94ea8

View file

@ -464,6 +464,36 @@ def setPoster(request): #parse path and return info
return render_to_json_response(response) return render_to_json_response(response)
actions.register(setPoster, cache=False) actions.register(setPoster, cache=False)
def lookup(request):
'''
param data {
title: string,
director: [string],
year: string,
id: string
}
return {
status: {'code': int, 'text': string},
data: {
title: string,
director: [string],
year: string,
id: string
}
}
'''
data = json.loads(request.POST['data'])
if 'id' in data:
i = models.Item.objects.get(itemId=data['id'])
r = {'id': i.itemId}
for key in ('title', 'director', 'year'):
r[key] = i.get(key)
response = json_response(r)
else:
response = json_response(status=404, text='not found')
return render_to_json_response(response)
actions.register(lookup)
def getImdbId(request): def getImdbId(request):
''' '''
param data { param data {