diff options
author | Christopher Allan Webber <cwebber@dustycloud.org> | 2013-08-12 08:57:56 -0500 |
---|---|---|
committer | Rodney Ewing <ewing.rj@gmail.com> | 2013-08-16 15:30:16 -0700 |
commit | eb372949a13c67962e7460e2411f389ff87d2661 (patch) | |
tree | 51e39a7ab33f2b3208f285bcb89e7ed86d329375 /mediagoblin/processing | |
parent | 22479c39a0fff75208309e437f5fdaf57730cf0e (diff) | |
download | mediagoblin-eb372949a13c67962e7460e2411f389ff87d2661.tar.lz mediagoblin-eb372949a13c67962e7460e2411f389ff87d2661.tar.xz mediagoblin-eb372949a13c67962e7460e2411f389ff87d2661.zip |
Factored the get_orig_filename from processing state and put it to use.
This commit sponsored by Vincent Demeester. Thank you!
Diffstat (limited to 'mediagoblin/processing')
-rw-r--r-- | mediagoblin/processing/__init__.py | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/mediagoblin/processing/__init__.py b/mediagoblin/processing/__init__.py index 47f0b84e..9466aec6 100644 --- a/mediagoblin/processing/__init__.py +++ b/mediagoblin/processing/__init__.py @@ -372,6 +372,40 @@ def mark_entry_failed(entry_id, exc): u'fail_metadata': {}}) +############################################################################### +# refactoring procstate stuff here + + +def get_orig_filename(entry, workbench): + """ + 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 by checking + some ordered list of preferred keys. + """ + if entry.queued_media_file: + orig_filepath = entry.queued_media_file + storage = mgg.queue_store + else: + orig_filepath = entry.media_files['original'] + storage = mgg.public_store + + orig_filename = workbench.localized_file( + storage, orig_filepath, + 'source') + + return orig_filename + + +# end refactoring +############################################################################### + + + class BaseProcessingFail(Exception): """ Base exception that all other processing failure messages should |