Updated some CDN urls

This commit is contained in:
Fergal Moran
2015-07-30 22:06:43 +01:00
parent 71fa592f4b
commit c636c4afa2
5 changed files with 42 additions and 12 deletions

View File

@@ -0,0 +1,22 @@
import os
from django.core.management.base import NoArgsCommand
from core.utils import cdn
from spa.models import Mix
class Command(NoArgsCommand):
def handle_noargs(self, **options):
try:
print 'Enumerating items'
items = cdn.enumerate_objects('mixes')
for item in items:
# Check if we have a corresponding mix
uid, type = os.path.splitext(item)
try:
Mix.objects.get(uid=uid)
except Mix.DoesNotExist:
# no mix found - delete the blob
cdn.delete_object('mixes', item)
print "Deleting blob: {0}".format(uid)
except Exception, ex:
print "Debug exception: %s" % ex.message