Permalink
Browse files

formats_cleanup fixes

  • Loading branch information...
1 parent cf9346f commit 73e625aca8950d098492df27771902398f81d7fb @nmfm committed Oct 27, 2011
Showing with 6 additions and 6 deletions.
  1. +5 −5 filer/management/commands/formats_cleanup.py
  2. +1 −1 filer/models/videomodels.py
@@ -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.basename(of) for of in orig_files])
- files = set([os.path.basename(f) for f in files])
- for f in files.difference(orig_files):
- p = format_storage.path(os.path.join(subpath, f))
- os.remove(p)
+ orig_files = set([os.path.splitext(of)[0] for of in orig_files])
+ for f in files:
+ if os.path.splitext(f)[0] not in orig_files:
+ p = format_storage.path(os.path.join(subpath, f))
+ format_storage.delete(p)
@@ -92,7 +92,7 @@ def formats_html5(self):
HTML5_FORMATS = {'mp4':'video/mp4', 'ogv':'video/ogg','webm':'video/webm'}
_formats = []
for fmt, url in self.formats.items():
- if fmt in HTML5_FORMATS.keys():
+ if fmt in HTML5_FORMATS:
_formats.append({'format': fmt, 'url': url, 'mimetype': HTML5_FORMATS[format]})
return _formats

0 comments on commit 73e625a

Please sign in to comment.