update timeline if part is changed
This commit is contained in:
parent
3b8dd55273
commit
843cea063d
1 changed files with 11 additions and 5 deletions
|
@ -450,8 +450,9 @@ def editMedia(request, data):
|
||||||
see: addMedia, findMedia, moveMedia, removeMedia
|
see: addMedia, findMedia, moveMedia, removeMedia
|
||||||
'''
|
'''
|
||||||
ignore = []
|
ignore = []
|
||||||
save_items = []
|
|
||||||
dont_ignore = []
|
dont_ignore = []
|
||||||
|
save_items = set()
|
||||||
|
update_timeline = set()
|
||||||
response = json_response(status=200, text='updated')
|
response = json_response(status=200, text='updated')
|
||||||
response['data']['files'] = []
|
response['data']['files'] = []
|
||||||
for info in data['files']:
|
for info in data['files']:
|
||||||
|
@ -467,7 +468,9 @@ def editMedia(request, data):
|
||||||
if key in info:
|
if key in info:
|
||||||
f.info[key] = info[key]
|
f.info[key] = info[key]
|
||||||
if key == 'language' and (f.is_video or f.is_audio):
|
if key == 'language' and (f.is_video or f.is_audio):
|
||||||
save_items.append(f.item.id)
|
save_items.add(f.item.id)
|
||||||
|
if key == 'part' and (f.is_video or f.is_audio):
|
||||||
|
update_timeline.add(f.item.id)
|
||||||
update = True
|
update = True
|
||||||
if update:
|
if update:
|
||||||
f.save()
|
f.save()
|
||||||
|
@ -496,9 +499,12 @@ def editMedia(request, data):
|
||||||
qs.update(selected=True)
|
qs.update(selected=True)
|
||||||
for id in list(set(ids)):
|
for id in list(set(ids)):
|
||||||
item.tasks.update_timeline.delay(id)
|
item.tasks.update_timeline.delay(id)
|
||||||
if save_items:
|
if save_items | update_timeline:
|
||||||
for i in Item.objects.filter(id__in=list(set(save_items))):
|
for i in Item.objects.filter(id__in=list(save_items | update_timeline)):
|
||||||
i.save()
|
if i.id in save_items:
|
||||||
|
i.save()
|
||||||
|
if i.id in update_timeline:
|
||||||
|
item.tasks.update_timeline.delay(i.public_id)
|
||||||
add_changelog(request, data, [f['id'] for f in response['data']['files']])
|
add_changelog(request, data, [f['id'] for f in response['data']['files']])
|
||||||
return render_to_json_response(response)
|
return render_to_json_response(response)
|
||||||
actions.register(editMedia, cache=False)
|
actions.register(editMedia, cache=False)
|
||||||
|
|
Loading…
Reference in a new issue