]> git.parisson.com Git - telemeta.git/commitdiff
fix import command, add mp4 to video mime types
authorGuillaume Pellerin <yomguy@parisson.com>
Thu, 22 Oct 2015 15:36:54 +0000 (17:36 +0200)
committerGuillaume Pellerin <yomguy@parisson.com>
Thu, 22 Oct 2015 15:37:33 +0000 (17:37 +0200)
telemeta/locale
telemeta/management/commands/telemeta-import-collections-from-crem.py
telemeta/models/core.py
telemeta/pages

index c5786d32a14a841469db2588092390073b8d0688..4534a3d47e7909554637e87a637b1959db277941 160000 (submodule)
@@ -1 +1 @@
-Subproject commit c5786d32a14a841469db2588092390073b8d0688
+Subproject commit 4534a3d47e7909554637e87a637b1959db277941
index 510e3bb30a460e4bee00e687058063c272cbd8e0..cfec15b59175e28e78d95ff952174164cdabd4d5 100644 (file)
@@ -23,7 +23,7 @@ from optparse import make_option
 from django.conf import settings
 from django.core.management.base import BaseCommand, CommandError
 from django.contrib.auth.models import User
-from django.core.management import setup_environ
+#from django.core.management import setup_environ
 from django.core.files.base import ContentFile
 from django.contrib.auth.models import User
 from django.contrib.sites.models import Site
@@ -82,6 +82,7 @@ class Command(BaseCommand):
 
     def write_file(self, item, media):
         filename = media.split(os.sep)[-1]
+        print 'importing ' + filename
         if os.path.exists(media):
             if not item.file or self.force:
                 if not self.media_root in self.source_dir:
@@ -90,14 +91,13 @@ class Command(BaseCommand):
                     if not self.dry_run:
                         file_content = ContentFile(f.read())
                         item.file.save(filename, file_content)
-                        item.save()
                     f.close()
                 else:
                     print "file in MEDIA_ROOT, linking..."
-                    path = media[len(self.media_root)+1:]
+                    path = media[len(self.media_root):]
                     if not self.dry_run:
                         item.file = path
-                        item.save()
+                item.save()
                 if self.user:
                     item.set_revision(self.user)
             else:
index 8605fde9c498f2c51701285acab9b7fac1c907c6..8530310c378c04b3a2c52647617f5ce452177cb8 100644 (file)
@@ -65,6 +65,7 @@ PUBLIC_ACCESS_CHOICES = (('none', _('none')), ('metadata', _('metadata')),
 
 public_extra_types = {
     '.webm': 'video/webm',
+    '.mp4': 'video/mp4',
 }
 
 private_extra_types = {
index f8324093174d077b674ac2c52eb0db6eaf815ab5..ff2bfd95504603e16b17134aa774b392bf693ec0 160000 (submodule)
@@ -1 +1 @@
-Subproject commit f8324093174d077b674ac2c52eb0db6eaf815ab5
+Subproject commit ff2bfd95504603e16b17134aa774b392bf693ec0