Record the original state of the media entry in the processor
This allows our processor to make some informed decisions based on the state by still having access to the original state. This commit sponsored by William Rico. Thank you!
This commit is contained in:
parent
2fa7b7f81a
commit
22479c39a0
@ -116,6 +116,7 @@ class MediaProcessor(object):
|
||||
def __init__(self, manager, media_entry):
|
||||
self.manager = manager
|
||||
self.media_entry = media_entry
|
||||
self.entry_orig_state = media_entry.state
|
||||
|
||||
# Should be initialized at time of processing, at least
|
||||
self.workbench = None
|
||||
|
@ -85,12 +85,14 @@ class ProcessMedia(task.Task):
|
||||
try:
|
||||
processor_class = manager.get_processor(reprocess_action, entry)
|
||||
|
||||
entry.state = u'processing'
|
||||
entry.save()
|
||||
|
||||
_log.debug('Processing {0}'.format(entry))
|
||||
|
||||
with processor_class(manager, entry) as processor:
|
||||
# Initial state change has to be here because
|
||||
# the entry.state gets recorded on processor_class init
|
||||
entry.state = u'processing'
|
||||
entry.save()
|
||||
|
||||
_log.debug('Processing {0}'.format(entry))
|
||||
|
||||
processor.process(**reprocess_info)
|
||||
|
||||
# We set the state to processed and save the entry here so there's
|
||||
|
Loading…
x
Reference in New Issue
Block a user