]> git.parisson.com Git - telemeta.git/commitdiff
fix various lam needs lam
authorGuillaume Pellerin <yomguy@parisson.com>
Thu, 7 May 2015 14:33:45 +0000 (16:33 +0200)
committerGuillaume Pellerin <yomguy@parisson.com>
Thu, 7 May 2015 14:33:45 +0000 (16:33 +0200)
telemeta/management/commands/telemeta-import-items-without-copy-lam.py [deleted file]
telemeta/templates/telemeta/collection_detail.html
telemeta/views/item.py

diff --git a/telemeta/management/commands/telemeta-import-items-without-copy-lam.py b/telemeta/management/commands/telemeta-import-items-without-copy-lam.py
deleted file mode 100644 (file)
index 38e4836..0000000
+++ /dev/null
@@ -1,59 +0,0 @@
-from optparse import make_option
-from django.conf import settings
-from django.core.management.base import BaseCommand, CommandError
-from django.core.files.base import ContentFile
-from telemeta.models import *
-from telemeta.util.unaccent import unaccent
-import os, sys
-
-try:
-    from django.utils.text import slugify
-except ImportError:
-    def slugify(string):
-        killed_chars = re.sub('[\(\),]', '', string)
-        return re.sub(' ', '_', killed_chars)
-
-def beautify(string):
-    return os.path.splitext(string)[0].replace('_',' ')
-
-
-class Command(BaseCommand):
-    help = "import media files from a directory in the media directory into a collection (no file copy)"
-    args = "media_dir"
-
-    def handle(self, *args, **options):
-        import_dir = os.path.abspath(args[-1])
-        media_dir = os.path.normpath(settings.MEDIA_ROOT)
-        if not media_dir in import_dir:
-            sys.exit('This directory is not in the MEDIA_ROOT directory')     
-
-        for root, dirs, files in os.walk(import_dir):
-            for filename in files:
-                path = root + os.sep + filename
-                path = path[len(media_dir)+1:]
-        filename_pre, ext = os.path.splitext(filename)
-        if ext == '.wav':
-            collection_code = '_'.join(filename_pre.split('_')[:4])
-                #filename_pre = slugify(collection_code + '_' + filename_pre)
-            collections = MediaCollection.objects.filter(code=collection_code)
-            if not collections:
-                collection = MediaCollection(code=collection_code, title=collection_code)
-                collection.public_access = 'full'
-                collection.save()
-                print 'collection created: ' + collection_code
-            else:
-                collection = collections[0]
-                print 'using collection: ' + collection.code
-                
-            items = MediaItem.objects.filter(code=filename_pre)
-            if not items:
-                item = MediaItem(collection=collection, code=filename_pre)
-                print 'item created: ' + item.code
-            else:
-                item = item[0]
-                print 'item already exists: ' + items.code
-            
-            item.title = filename_pre
-            item.file = path
-            item.public_access = 'full'
-            item.save()
index c75dc366c373ae4e9a71a0960c3f9e0c886788ca..1be61b9dd75413ef2b29a34b963df1fdeaa222d5 100644 (file)
@@ -90,6 +90,8 @@
                 {% dl_field collection "title"  %}
                 {% dl_field collection "alt_title" %}
                 {% dl_field collection "creator" placeholder %}
+                <dt>{% trans "Comments" %}</dt>
+                <dd>{{ collection.comment|html_line_break|safe }}</dd>
                 {% dl_field collection "recording_context" %}
                 <dt>{% trans "Recording period" %}</dt>
                     <dd>{% if collection.recorded_from_year %}{{ collection.recorded_from_year }}{% endif %}{% if collection.recorded_from_year and collection.recorded_to_year %} - {% endif %}{% if  collection.recorded_to_year %}{{ collection.recorded_to_year}}{% endif %}</dd>
                         <dd>{{ collection.booklet_description|html_line_break|safe }}</dd>
                         {% dl_field collection "publishing_status" %}
                         {% dl_field collection "alt_ids" %}
-                        <dt>{% trans "Comments" %}</dt>
-                        <dd>{{ collection.comment|html_line_break|safe }}</dd>
                         {% dl_field collection "metadata_writer" %}
                         {% dl_field collection "travail" %}
                         {% dl_field collection "items_done" %}
index 018d3a24d05399694e4da7ca3334ecb810ab7784..4f8e30a0d9575dba346906e0a27b2f469b962594 100644 (file)
@@ -533,7 +533,7 @@ class ItemView(object):
                 # source > encoder > stream
                 decoder = self.decoders[0](audio)
                 decoder.setup()
-                proc = encoder(media, streaming=True)
+                proc = encoder(media, streaming=True, overwrite=True)
                 proc.setup(channels=decoder.channels(), samplerate=decoder.samplerate())
                 if extension in mapping.unavailable_extensions:
                     metadata=None