From c62181f4bca1ae7f74d4bd8ec15615337d23ec9a Mon Sep 17 00:00:00 2001 From: vijeth-aradhya Date: Mon, 5 Jun 2017 02:11:56 +0530 Subject: [PATCH] Add workflow method to other media ProcessingManagers Add workflow method to all the media types other than video. Calls the old celery task as it is. --- mediagoblin/media_types/ascii/processing.py | 5 +++++ mediagoblin/media_types/audio/processing.py | 5 +++++ mediagoblin/media_types/image/processing.py | 6 ++++++ mediagoblin/media_types/pdf/processing.py | 5 +++++ mediagoblin/media_types/raw_image/processing.py | 5 +++++ mediagoblin/media_types/stl/processing.py | 5 +++++ 6 files changed, 31 insertions(+) diff --git a/mediagoblin/media_types/ascii/processing.py b/mediagoblin/media_types/ascii/processing.py index 00d04e63..71ccc86e 100644 --- a/mediagoblin/media_types/ascii/processing.py +++ b/mediagoblin/media_types/ascii/processing.py @@ -273,3 +273,8 @@ class AsciiProcessingManager(ProcessingManager): super(AsciiProcessingManager, self).__init__() self.add_processor(InitialProcessor) self.add_processor(Resizer) + + def workflow(self, entry, feed_url, reprocess_action, reprocess_info=None): + ProcessMedia().apply_async( + [entry.id, feed_url, reprocess_action, reprocess_info], {}, + task_id=entry.queued_task_id) diff --git a/mediagoblin/media_types/audio/processing.py b/mediagoblin/media_types/audio/processing.py index 427309de..a83d60f7 100644 --- a/mediagoblin/media_types/audio/processing.py +++ b/mediagoblin/media_types/audio/processing.py @@ -365,3 +365,8 @@ class AudioProcessingManager(ProcessingManager): self.add_processor(InitialProcessor) self.add_processor(Resizer) self.add_processor(Transcoder) + + def workflow(self, entry, feed_url, reprocess_action, reprocess_info=None): + ProcessMedia().apply_async( + [entry.id, feed_url, reprocess_action, reprocess_info], {}, + task_id=entry.queued_task_id) diff --git a/mediagoblin/media_types/image/processing.py b/mediagoblin/media_types/image/processing.py index 14091d6e..42234eff 100644 --- a/mediagoblin/media_types/image/processing.py +++ b/mediagoblin/media_types/image/processing.py @@ -431,6 +431,12 @@ class ImageProcessingManager(ProcessingManager): self.add_processor(Resizer) self.add_processor(MetadataProcessing) + def workflow(self, entry, feed_url, reprocess_action, reprocess_info=None): + ProcessMedia().apply_async( + [entry.id, feed_url, reprocess_action, reprocess_info], {}, + task_id=entry.queued_task_id) + + if __name__ == '__main__': import sys import pprint diff --git a/mediagoblin/media_types/pdf/processing.py b/mediagoblin/media_types/pdf/processing.py index ac4bab6d..d93b19bb 100644 --- a/mediagoblin/media_types/pdf/processing.py +++ b/mediagoblin/media_types/pdf/processing.py @@ -470,3 +470,8 @@ class PdfProcessingManager(ProcessingManager): super(PdfProcessingManager, self).__init__() self.add_processor(InitialProcessor) self.add_processor(Resizer) + + def workflow(self, entry, feed_url, reprocess_action, reprocess_info=None): + ProcessMedia().apply_async( + [entry.id, feed_url, reprocess_action, reprocess_info], {}, + task_id=entry.queued_task_id) diff --git a/mediagoblin/media_types/raw_image/processing.py b/mediagoblin/media_types/raw_image/processing.py index 740ba2dd..a385d563 100644 --- a/mediagoblin/media_types/raw_image/processing.py +++ b/mediagoblin/media_types/raw_image/processing.py @@ -80,3 +80,8 @@ class RawImageProcessingManager(ProcessingManager): super(RawImageProcessingManager, self).__init__() self.add_processor(InitialRawProcessor) self.add_processor(Resizer) + + def workflow(self, entry, feed_url, reprocess_action, reprocess_info=None): + ProcessMedia().apply_async( + [entry.id, feed_url, reprocess_action, reprocess_info], {}, + task_id=entry.queued_task_id) diff --git a/mediagoblin/media_types/stl/processing.py b/mediagoblin/media_types/stl/processing.py index 55764aeb..7f2f350d 100644 --- a/mediagoblin/media_types/stl/processing.py +++ b/mediagoblin/media_types/stl/processing.py @@ -368,3 +368,8 @@ class StlProcessingManager(ProcessingManager): super(StlProcessingManager, self).__init__() self.add_processor(InitialProcessor) self.add_processor(Resizer) + + def workflow(self, entry, feed_url, reprocess_action, reprocess_info=None): + ProcessMedia().apply_async( + [entry.id, feed_url, reprocess_action, reprocess_info], {}, + task_id=entry.queued_task_id) -- 2.25.1