Browse files

Merge branch 'feature/video' of github.com:nmfm/django-filer into fea…

…ture/video
  • Loading branch information...
2 parents 089fceb + 0238591 commit affe7522441d35d115a8ebb44571e2648687816e @pvl pvl committed Oct 31, 2011
Showing with 4 additions and 3 deletions.
  1. +3 −3 filer/management/commands/formats_cleanup.py
  2. +1 −0 filer/server/urls.py
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',),
)

0 comments on commit affe752

Please sign in to comment.