Refactor video processing to use FilenameMunger.
authorBrett Smith <brettcsmith@brettcsmith.org>
Sun, 25 Mar 2012 17:32:25 +0000 (13:32 -0400)
committerBrett Smith <brettcsmith@brettcsmith.org>
Sun, 25 Mar 2012 17:32:25 +0000 (13:32 -0400)
mediagoblin/media_types/video/processing.py

index 3a47980259c129ed23f697f5cd21a2ee8ca5cd95..98379d52e4e4e5e1aa8231e52f44a961252faa5f 100644 (file)
@@ -20,7 +20,7 @@ import os
 
 from mediagoblin import mg_globals as mgg
 from mediagoblin.processing import mark_entry_failed, \
-    THUMB_SIZE, MEDIUM_SIZE, create_pub_filepath
+    THUMB_SIZE, MEDIUM_SIZE, create_pub_filepath, FilenameMunger
 from . import transcoders
 
 logging.basicConfig()
@@ -49,17 +49,13 @@ def process_video(entry):
     queued_filename = workbench.localized_file(
         mgg.queue_store, queued_filepath,
         'source')
+    name_munger = FilenameMunger(queued_filename)
 
     medium_filepath = create_pub_filepath(
-        entry,
-        '{original}-640p.webm'.format(
-            original=os.path.splitext(
-                queued_filepath[-1])[0]  # Select the 
-            ))
+        entry, name_munger.munge('{basename}-640p.webm'))
 
     thumbnail_filepath = create_pub_filepath(
-        entry, 'thumbnail.jpg')
-
+        entry, name_munger.munge('{basename}.thumbnail.jpg'))
 
     # Create a temporary file for the video destination
     tmp_dst = tempfile.NamedTemporaryFile()