diff options
author | Rodney Ewing <ewing.rj@gmail.com> | 2013-08-02 15:20:59 -0700 |
---|---|---|
committer | Rodney Ewing <ewing.rj@gmail.com> | 2013-08-16 15:30:14 -0700 |
commit | 45b20dce1ac5a8d9fb045faf67e796a8092f65e4 (patch) | |
tree | 632595e68d6300eabbde0914431224a0ce5244e7 /mediagoblin/processing/__init__.py | |
parent | 3e9faf85da1ee2971e9ff2fde12b192ea470d806 (diff) | |
download | mediagoblin-45b20dce1ac5a8d9fb045faf67e796a8092f65e4.tar.lz mediagoblin-45b20dce1ac5a8d9fb045faf67e796a8092f65e4.tar.xz mediagoblin-45b20dce1ac5a8d9fb045faf67e796a8092f65e4.zip |
change get_queued_filename to get_orig_filename and modified function
Diffstat (limited to 'mediagoblin/processing/__init__.py')
-rw-r--r-- | mediagoblin/processing/__init__.py | 48 |
1 files changed, 21 insertions, 27 deletions
diff --git a/mediagoblin/processing/__init__.py b/mediagoblin/processing/__init__.py index 13c677eb..60565e09 100644 --- a/mediagoblin/processing/__init__.py +++ b/mediagoblin/processing/__init__.py @@ -86,27 +86,37 @@ class ProcessingState(object): def __init__(self, entry): self.entry = entry self.workbench = None - self.queued_filename = None - self.reprocess_filename = None + self.orig_filename = None def set_workbench(self, wb): self.workbench = wb - def get_queued_filename(self): + def get_orig_filename(self): """ Get the a filename for the original, on local storage + + If the media entry has a queued_media_file, use that, otherwise + use the original. + + In the future, this will return the highest quality file available + if neither the original or queued file are available """ - if self.queued_filename is not None: - return self.queued_filename - queued_filepath = self.entry.queued_media_file - queued_filename = self.workbench.localized_file( - mgg.queue_store, queued_filepath, + if self.orig_filename is not None: + return self.orig_filename + + if self.entry.queued_media_file: + orig_filepath = self.entry.queued_media_file + else: + orig_filepath = self.entry.media_files['original'] + + orig_filename = self.workbench.localized_file( + mgg.queue_store, orig_filepath, 'source') - self.queued_filename = queued_filename - return queued_filename + self.orig_filename = orig_filename + return orig_filename def copy_original(self, target_name, keyname=u"original"): - self.store_public(keyname, self.get_queued_filename(), target_name) + self.store_public(keyname, self.get_orig_filename(), target_name) def store_public(self, keyname, local_file, target_name=None): if target_name is None: @@ -129,22 +139,6 @@ class ProcessingState(object): mgg.queue_store.delete_dir(queued_filepath[:-1]) # rm dir self.entry.queued_media_file = [] - def get_reprocess_filename(self): - """ - Get the filename to use during reprocessing - """ - # Currently only returns the original file, but eventually will return - # the highest quality file if the original doesn't exist - if self.reprocess_filename is not None: - return self.reprocess_filename - - reprocess_filepath = self.entry.media_files['original'] - reprocess_filename = self.workbench.localized_file( - mgg.public_store, reprocess_filepath, - 'source') - self.reprocess_filename = reprocess_filename - return reprocess_filename - def mark_entry_failed(entry_id, exc): """ |