merge tab fix

This commit is contained in:
j 2010-09-18 13:04:45 +00:00
commit e68aa08269

View file

@ -273,13 +273,13 @@ def api_getItem(request):
param data param data
string id string id
return item array return item array
''' '''
response = json_response({}) response = json_response({})
itemId = json.loads(request.POST['data']) itemId = json.loads(request.POST['data'])
item = get_object_or_404_json(models.Movie, movieId=itemId) item = get_object_or_404_json(models.Movie, movieId=itemId)
#FIXME: check permissions #FIXME: check permissions
response['data'] = {'item': item.get_json()} response['data'] = {'item': item.get_json()}
return render_to_json_response(response) return render_to_json_response(response)
@login_required_json @login_required_json
@ -294,8 +294,8 @@ def api_editItem(request):
item = get_object_or_404_json(models.Movie, movieId=data['id']) item = get_object_or_404_json(models.Movie, movieId=data['id'])
if item.editable(request.user): if item.editable(request.user):
response = json_response(status=501, text='not implemented') response = json_response(status=501, text='not implemented')
item.edit(data) item.edit(data)
else: else:
response = json_response(status=403, text='permissino denied') response = json_response(status=403, text='permissino denied')
return render_to_json_response(response) return render_to_json_response(response)
@ -310,9 +310,9 @@ def api_removeItem(request):
response = json_response({}) response = json_response({})
itemId = json.loads(request.POST['data']) itemId = json.loads(request.POST['data'])
item = get_object_or_404_json(models.Movie, movieId=itemId) item = get_object_or_404_json(models.Movie, movieId=itemId)
if item.editable(request.user): if item.editable(request.user):
response = json_response(status=501, text='not implemented') response = json_response(status=501, text='not implemented')
else: else:
response = json_response(status=403, text='permissino denied') response = json_response(status=403, text='permissino denied')
return render_to_json_response(response) return render_to_json_response(response)
@ -326,7 +326,7 @@ def api_info(request):
response = json_response({}) response = json_response({})
itemId = json.loads(request.POST['data']) itemId = json.loads(request.POST['data'])
item = get_object_or_404_json(models.Movie, movieId=itemId) item = get_object_or_404_json(models.Movie, movieId=itemId)
response['data'] = {'info': movie.get_stream())} response['data'] = {'info': movie.get_stream())}
return render_to_json_response(response) return render_to_json_response(response)
def api_subtitles(request): def api_subtitles(request):
@ -339,7 +339,7 @@ def api_subtitles(request):
response = json_response({}) response = json_response({})
itemId = json.loads(request.POST['data']) itemId = json.loads(request.POST['data'])
item = get_object_or_404_json(models.Movie, movieId=itemId) item = get_object_or_404_json(models.Movie, movieId=itemId)
response['data'] = {'subtitles': movie.metadata.get('subtitles', {})} response['data'] = {'subtitles': movie.metadata.get('subtitles', {})}
return render_to_json_response(response) return render_to_json_response(response)
def api_cuts(request): def api_cuts(request):
@ -352,7 +352,7 @@ def api_cuts(request):
response = json_response({}) response = json_response({})
itemId = json.loads(request.POST['data']) itemId = json.loads(request.POST['data'])
item = get_object_or_404_json(models.Movie, movieId=itemId) item = get_object_or_404_json(models.Movie, movieId=itemId)
response['data'] = {'cuts': movie.metadata.get('cuts', {})} response['data'] = {'cuts': movie.metadata.get('cuts', {})}
return render_to_json_response(response) return render_to_json_response(response)
@login_required_json @login_required_json
@ -388,10 +388,10 @@ def api_editLayer(request):
response = json_response({}) response = json_response({})
data = json.loads(request.POST['data']) data = json.loads(request.POST['data'])
layer = get_object_or_404_json(models.Layer, pk=data['id']) layer = get_object_or_404_json(models.Layer, pk=data['id'])
if layer.editable(request.user): if layer.editable(request.user):
response = json_response(status=501, text='not implemented') response = json_response(status=501, text='not implemented')
else: else:
response = json_response(status=403, text='permission denied') response = json_response(status=403, text='permission denied')
return render_to_json_response(response) return render_to_json_response(response)
response = json_response(status=501, text='not implemented') response = json_response(status=501, text='not implemented')
@ -483,7 +483,7 @@ def api_setPosterFrame(request): #parse path and return info
item.poster_frame = data['position'] item.poster_frame = data['position']
item.save() item.save()
response = json_response(status=200, text='ok') response = json_response(status=200, text='ok')
else: else:
response = json_response(status=403, text='permissino denied') response = json_response(status=403, text='permissino denied')
return render_to_json_response(response) return render_to_json_response(response)
@ -508,7 +508,7 @@ def api_setPoster(request): #parse path and return info
response['data']['poster'] = item.get_poster() response['data']['poster'] = item.get_poster()
else: else:
response = json_response(status=403, text='invalid poster url') response = json_response(status=403, text='invalid poster url')
else: else:
response = json_response(status=403, text='permission denied') response = json_response(status=403, text='permission denied')
return render_to_json_response(response) return render_to_json_response(response)
@ -523,7 +523,7 @@ def api_getImdbId(request):
if imdbId: if imdbId:
response = json_response({'imdbId': imdbId}) response = json_response({'imdbId': imdbId})
else: else:
response = json_response(status=404, text='not found') response = json_response(status=404, text='not found')
return render_to_json_response(response) return render_to_json_response(response)
def apidoc(request): def apidoc(request):