Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Changed formats_cleanup command to use the format_to_original_filenam…

…e method
  • Loading branch information...
commit 023859158075ef8772890ada6ec7f8e9b4a0a060 1 parent dc6355f
@nmfm authored
View
6 filer/management/commands/formats_cleanup.py
@@ -1,7 +1,7 @@
import os
from django.core.management.base import NoArgsCommand
from filer.models.videomodels import Video
-
+from filer.utils.video import format_to_original_filename
class Command(NoArgsCommand):
help = "Deletes video formats that no longer have an original file."
@@ -21,8 +21,8 @@ def clean_up(self):
for root, dirs, files in os.walk(top, topdown=False):
subpath = os.path.relpath(root, top)
orig_dirs, orig_files = original_storage.listdir(subpath)
- orig_files = set([os.path.splitext(of)[0] for of in orig_files])
+ orig_files = set(orig_files)
for f in files:
- if os.path.splitext(f)[0] not in orig_files:
+ if format_to_original_filename(f) not in orig_files:
p = format_storage.path(os.path.join(subpath, f))
format_storage.delete(p)
View
1  filer/server/urls.py
@@ -9,6 +9,7 @@
url(r'^' + filer_settings.FILER_PRIVATEMEDIA_THUMBNAIL_STORAGE.base_url.lstrip('/') + r'(?P<path>.*)$',
'serve_protected_thumbnail',),
+
url(r'^' + filer_settings.FILER_PRIVATEMEDIA_FORMATS_STORAGE.base_url.lstrip('/') + r'(?P<path>.*)$',
'serve_protected_format',),
)
Please sign in to comment.
Something went wrong with that request. Please try again.