only request subtitles if a subtitles layer is defined, fixed #427

This commit is contained in:
j 2012-02-15 21:19:40 +05:30
parent b9129b10c7
commit 2cf7c56115

View file

@ -104,10 +104,14 @@ def update(request):
response['data']['data'] += [f.file.oshash for f in files.filter(file__is_audio=True, response['data']['data'] += [f.file.oshash for f in files.filter(file__is_audio=True,
file__available=False, file__available=False,
file__wanted=True)] file__wanted=True)]
response['data']['file'] = [f.file.oshash for f in files.filter(file__is_subtitle=True,
if filter(lambda l: l['id'] == 'subtitles', settings.CONFIG['layers']):
response['data']['file'] = [f.file.oshash
for f in files.filter(file__is_subtitle=True,
file__available=False, file__available=False,
path__endswith='.srt')] path__endswith='.srt')]
else:
response['data']['file'] = []
return render_to_json_response(response) return render_to_json_response(response)
actions.register(update, cache=False) actions.register(update, cache=False)