From: yomguy <> Date: Tue, 7 Apr 2009 16:25:54 +0000 (+0000) Subject: fix sox (>= 14.2) NBITS output, fix multi collection with media_import X-Git-Tag: 1.1~694 X-Git-Url: https://git.parisson.com/?a=commitdiff_plain;h=63e20fd2ffe313425a39d9fd41d2f1904356cdad;p=telemeta.git fix sox (>= 14.2) NBITS output, fix multi collection with media_import --- diff --git a/INSTALL b/INSTALL index 3b531b84..6a9c350d 100644 --- 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 880df2e9..0ac7409f 100644 --- 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), diff --git a/telemeta/export/mp3.py b/telemeta/export/mp3.py index b4903c38..6225e432 100644 --- a/telemeta/export/mp3.py +++ b/telemeta/export/mp3.py @@ -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 diff --git a/telemeta/export/ogg.py b/telemeta/export/ogg.py index b0fef85e..f633a380 100644 --- a/telemeta/export/ogg.py +++ b/telemeta/export/ogg.py @@ -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, diff --git a/telemeta/visualization/octave/spectrogram2img.m b/telemeta/visualization/octave/spectrogram2img.m index 8d1d8fe4..13086acf 100644 --- a/telemeta/visualization/octave/spectrogram2img.m +++ b/telemeta/visualization/octave/spectrogram2img.m @@ -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]; diff --git a/tests/media_import.py b/tests/media_import.py index c77e6d9b..619ff678 100755 --- a/tests/media_import.py +++ b/tests/media_import.py @@ -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():