]> git.parisson.com Git - telemeta.git/commitdiff
fix sox (>= 14.2) NBITS output, fix multi collection with media_import
authoryomguy <>
Tue, 7 Apr 2009 16:25:54 +0000 (16:25 +0000)
committeryomguy <>
Tue, 7 Apr 2009 16:25:54 +0000 (16:25 +0000)
INSTALL
README
telemeta/export/mp3.py
telemeta/export/ogg.py
telemeta/visualization/octave/spectrogram2img.m
tests/media_import.py

diff --git a/INSTALL b/INSTALL
index 3b531b84358093c9facc6bdf109687a32f9707c1..6a9c350dc7f8bfe8dde4ff68bf7d9015b70a0e11 100644 (file)
--- a/INSTALL
+++ b/INSTALL
@@ -9,7 +9,7 @@ Telemeta is designed to run on Linux and other UNIX based architectures.
 The following third party applications or libraries are required:
 
 python (>= 2.3.5-7), python-xml, python-mutagen, python-django (>= 1.0-1),
-python-imaging (>= 1.1.6), sox, vorbis-tools, flac, normalize-audio,
+python-imaging (>= 1.1.6), sox (>= 14.2), vorbis-tools, flac, normalize-audio,
 python-mysqldb, mysql-server, octave2.9, python-tk, libgd2-xpm,
 libsndfile1 (>= 1.0.17), python-numpy, python-ctypes (>= 1.0.1),
 python-scikits-audiolab (>= 0.7), python-setuptools (>= 0.6b3),
diff --git a/README b/README
index 880df2e9310af763835c208b9b7800458273c274..0ac7409fb7d60c9a3285a37653bc00ea66905853 100644 (file)
--- a/README
+++ b/README
@@ -37,7 +37,7 @@ but could be easily adapted/overrided to sue other data structures.
 # ============
 
 python (>= 2.3.5-7), python-xml, python-mutagen, python-django (>= 1.0-1),
-python-imaging (>= 1.1.6), sox, vorbis-tools, flac, normalize-audio,
+python-imaging (>= 1.1.6), sox (>= 14.2), vorbis-tools, flac, normalize-audio,
 python-mysqldb, mysql-server, octave2.9, python-tk, libgd2-xpm,
 libsndfile1 (>= 1.0.17), python-numpy, python-ctypes (>= 1.0.1),
 python-scikits-audiolab (>= 0.7), python-setuptools (>= 0.6b3),
index b4903c385d4bee0a9a9af6eee7e00657890e8aa6..6225e43255994fe0ddc1e21f3472d26915ce90de 100644 (file)
@@ -135,7 +135,7 @@ class Mp3Exporter(ExporterCore):
         self.args = self.get_args(options)
         self.ext = self.get_file_extension()
         self.args = ' '.join(self.args)
-        self.command = 'sox "%s" -s -q -r 44100 -t wav -c2 - | lame %s -' % (self.source, self.args)
+        self.command = 'sox "%s" -s -q -b 16 -r 44100 -t wav -c2 - | lame %s -' % (self.source, self.args)
         #self.command = 'lame %s "%s" -' % (self.args, self.source)
         
         # Pre-proccessing
index b0fef85e38251f89109a4a18b3288fd33b5dd273..f633a38003df0f1d8353074b42ac5121760df093 100644 (file)
@@ -109,7 +109,7 @@ class OggExporter(ExporterCore):
         self.args = self.get_args(options)
         self.ext = self.get_file_extension()
         self.args = ' '.join(self.args)
-        self.command = 'sox "%s" -s -q -r 44100 -t wav -c2 - | oggenc %s -' % (self.source, self.args)
+        self.command = 'sox "%s" -s -q -b 16 -r 44100 -t wav -c2 - | oggenc %s -' % (self.source, self.args)
 
         # Pre-proccessing
         self.dest = self.pre_process(self.item_id,
index 8d1d8fe4adb07bffef24b0e42ad0e93540d7ed8a..13086acf6124933625df139d255e2684a2ca0cb0 100644 (file)
@@ -40,7 +40,7 @@ if lx > lx_lim;
 end
     
 %fftn = 2^nextpow2(window); % next highest power of 2
-[S, f, t] = spectrogram(x, Fs, window, step, 4000, 'hanning', -30);
+[S, f, t] = spectrogram(x, Fs, window, step, 8000, 'hanning', -30);
 S = flipud(20*log10(S));
 %  
 %  cmap = [0:1:ncmap-1];
index c77e6d9b76b3ef16cf4d9c4863f90b59ec13a498..619ff67859c5899db30647bf0b5074e2e86d2a92 100755 (executable)
@@ -54,10 +54,9 @@ class TelemetaMediaImport:
         self.source_dir = source_dir
         self.source_files = os.listdir(self.source_dir)
         self.media_filter()
-        print self.source_files
+        #print self.source_files
         self.item_media_root_dir = settings.MEDIA_ROOT
         self.item_media_full_dir = self.item_media_root_dir + os.sep + 'items'
-        self.collection_id = self.get_collection()
 
     def media_filter(self):
         files = []
@@ -69,19 +68,13 @@ class TelemetaMediaImport:
                 files.append(media_file)
         self.source_files = files
 
-    def get_collection(self):
-        from telemeta.models import MediaItem
-        file_0 = self.source_files[0]
-        id_string = get_media_name(file_0)
-        self.item_list = MediaItem.objects.filter(id__startswith=id_string)
-        return self.item_list[0].collection_id
-
     def media_import(self):
         from telemeta.models import MediaItem
         id_list = map(get_media_name, self.source_files)
-
-        print "Working on collection_id : " + self.collection_id
+        #print id_list
+        
         for item_id in id_list:
+            item_id = item_id.strip()
             print "item_id : " + item_id
             it = MediaItem.objects.get(id=item_id)
             source_full_path = self.source_dir + os.sep + get_item_in_list(self.source_files, item_id)
@@ -89,10 +82,7 @@ class TelemetaMediaImport:
                 media = open(source_full_path, 'r')
                 f = File(media)
                 print "Adding : " + source_full_path
-                try:
-                    it.file.save(f.name, f, save=True)
-                except:
-                    raise TelemetaMediaImportError("Could not include this item: " + item_id)
+                it.file.save(f.name, f, save=True)
                 media.close()
 
     def main(self):
@@ -118,7 +108,7 @@ def print_usage():
  project_dir: the directory of the Django project which hosts Telemeta
  source_dir: the directory containing all media files to include
 
- IMPORTANT: each file name without its extension has to correspond at least to one existing item id in the database. All media files have also to correspond to only one Collection."
+ IMPORTANT: each file name without its extension has to correspond at least to one existing item id in the database."
  """ % tool_name
 
 def run():