aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--mediagoblin/media_types/audio/processing.py10
-rw-r--r--mediagoblin/media_types/video/processing.py8
2 files changed, 10 insertions, 8 deletions
diff --git a/mediagoblin/media_types/audio/processing.py b/mediagoblin/media_types/audio/processing.py
index aee843d5..c4ccad49 100644
--- a/mediagoblin/media_types/audio/processing.py
+++ b/mediagoblin/media_types/audio/processing.py
@@ -15,7 +15,7 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.
import logging
-import tempfile
+from tempfile import NamedTemporaryFile
import os
from mediagoblin import mg_globals as mgg
@@ -73,7 +73,7 @@ def process_audio(entry):
transcoder = AudioTranscoder()
- with tempfile.NamedTemporaryFile() as webm_audio_tmp:
+ with NamedTemporaryFile(dir=workbench.dir) as webm_audio_tmp:
progress_callback = ProgressCallback(entry)
transcoder.transcode(
@@ -99,7 +99,7 @@ def process_audio(entry):
original=os.path.splitext(
queued_filepath[-1])[0]))
- with tempfile.NamedTemporaryFile(suffix='.ogg') as wav_tmp:
+ with NamedTemporaryFile(dir=workbench.dir, suffix='.ogg') as wav_tmp:
_log.info('Creating OGG source for spectrogram')
transcoder.transcode(
queued_filename,
@@ -109,7 +109,7 @@ def process_audio(entry):
thumbnailer = AudioThumbnailer()
- with tempfile.NamedTemporaryFile(suffix='.jpg') as spectrogram_tmp:
+ with NamedTemporaryFile(dir=workbench.dir, suffix='.jpg') as spectrogram_tmp:
thumbnailer.spectrogram(
wav_tmp.name,
spectrogram_tmp.name,
@@ -122,7 +122,7 @@ def process_audio(entry):
entry.media_files['spectrogram'] = spectrogram_filepath
- with tempfile.NamedTemporaryFile(suffix='.jpg') as thumb_tmp:
+ with NamedTemporaryFile(dir=workbench.dir, suffix='.jpg') as thumb_tmp:
thumbnailer.thumbnail_spectrogram(
spectrogram_tmp.name,
thumb_tmp.name,
diff --git a/mediagoblin/media_types/video/processing.py b/mediagoblin/media_types/video/processing.py
index aa6a25df..8d023c64 100644
--- a/mediagoblin/media_types/video/processing.py
+++ b/mediagoblin/media_types/video/processing.py
@@ -14,7 +14,7 @@
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
-import tempfile
+from tempfile import NamedTemporaryFile
import logging
from mediagoblin import mg_globals as mgg
@@ -74,7 +74,7 @@ def process_video(entry):
entry, name_builder.fill('{basename}.thumbnail.jpg'))
# Create a temporary file for the video destination
- tmp_dst = tempfile.NamedTemporaryFile()
+ tmp_dst = NamedTemporaryFile(dir=workbench.dir)
with tmp_dst:
# Transcode queued file to a VP8/vorbis file that fits in a 640x640 square
@@ -88,6 +88,7 @@ def process_video(entry):
# Push transcoded video to public storage
_log.debug('Saving medium...')
+ # TODO (#419, we read everything in RAM here!)
mgg.public_store.get_file(medium_filepath, 'wb').write(
tmp_dst.read())
_log.debug('Saved medium')
@@ -100,7 +101,7 @@ def process_video(entry):
height=transcoder.dst_data.videoheight)
# Create a temporary file for the video thumbnail
- tmp_thumb = tempfile.NamedTemporaryFile(suffix='.jpg')
+ tmp_thumb = NamedTemporaryFile(dir=workbench.dir, suffix='.jpg')
with tmp_thumb:
# Create a thumbnail.jpg that fits in a 180x180 square
@@ -129,6 +130,7 @@ def process_video(entry):
with mgg.public_store.get_file(original_filepath, 'wb') as \
original_file:
_log.debug('Saving original...')
+ # TODO (#419, we read everything in RAM here!)
original_file.write(queued_file.read())
_log.debug('Saved original')