keep previous role if one existed

to clear a role use `role=''`
This commit is contained in:
blacktwin 2020-06-22 13:58:45 -04:00
parent b7a3deff9e
commit ac41da1da3

View file

@ -368,6 +368,7 @@ class Movie(Playable, Video):
thumb (str): URL to image file. thumb (str): URL to image file.
""" """
edits = {} edits = {}
actors = {actor.tag: actor for actor in self.actors}
actor = 'actor[%s]' % index actor = 'actor[%s]' % index
if name: if name:
edits['%s.tag.tag' % actor] = name edits['%s.tag.tag' % actor] = name
@ -375,6 +376,10 @@ class Movie(Playable, Video):
raise BadRequest('name keyword is required.') raise BadRequest('name keyword is required.')
if role or type(role) == str: if role or type(role) == str:
edits['%s.tagging.text' % actor] = role edits['%s.tagging.text' % actor] = role
else:
previousRole = actors.get(name)
if previousRole:
edits['%s.tagging.text' % actor] = previousRole.role
if thumb: if thumb:
edits['%s.tag.thumb' % actor] = thumb edits['%s.tag.thumb' % actor] = thumb