]> git.parisson.com Git - telemeta.git/commitdiff
(re)Add sox decode before encoding
authoryomguy <>
Tue, 9 Dec 2008 09:00:59 +0000 (09:00 +0000)
committeryomguy <>
Tue, 9 Dec 2008 09:00:59 +0000 (09:00 +0000)
telemeta/export/core.py
telemeta/export/flac.py
telemeta/export/mp3.py
telemeta/export/ogg.py

index 1649c07db061493eccd35a78e832e2676a86f184..4474529d897883b1995d4d2661e48085ba6bab8a 100644 (file)
@@ -1,6 +1,6 @@
 # -*- coding: utf-8 -*-
 #
-# Copyright (C) 2007 Parisson SARL
+# Copyright (C) 2008 Parisson SARL
 # Copyright (c) 2006-2007 Guillaume Pellerin <pellerin@parisson.com>
 # All rights reserved.
 #
@@ -24,7 +24,7 @@ import xml.dom.ext
 
 class ExporterCore(Component):
     """Defines the main parts of the exporting tools :
-    paths, formats, metadata..."""
+    paths, metadata parsing, data streaming thru system command"""
 
     def __init__(self):
         self.source = ''
index 549c75a7008665585d6536ed3a356275afcdd689..efac4fd9301cded5b971103ed6f8d1b6f17ee656 100644 (file)
@@ -93,11 +93,11 @@ class FlacExporter(ExporterCore):
             if not ('verbose' in self.options and self.options['verbose'] != '0'):
                 args.append('-s')
             if 'flac_quality' in self.options:
-                args.append('-f -' + self.options['flac_quality'])
+                args.append('-f ' + self.options['flac_quality'])
             else:
-                args.append('-f -' + self.quality_default)
+                args.append('-f ' + self.quality_default)
         else:
-            args.append('-s -f -' + self.quality_default)
+            args.append('-s -f ' + self.quality_default)
 
         #for tag in self.metadata.keys():
             #value = clean_word(self.metadata[tag])
@@ -115,7 +115,7 @@ class FlacExporter(ExporterCore):
         self.args = self.get_args(options)
         self.ext = self.get_file_extension()
         self.args = ' '.join(self.args)
-        self.command = 'flac %s "%s" -c -' % (self.args, self.source)
+        self.command = 'sox "%s" -q -w -r 44100 -t wav -c2 - | flac %s -c -' % (self.source, self.args)
 
         # Pre-proccessing
         self.dest = self.pre_process(self.item_id,
index d25ac7691689356bf99224a668e529c086d2e51e..1f54672de23d00bc3762b3517c3b1229a0ec70d8 100644 (file)
@@ -44,7 +44,7 @@ class Mp3Exporter(ExporterCore):
                              #'date': 'TYER', #year
                              }
         self.dub2args_dict = {'title': 'tt', #title2
-                             'creator': 'ta', #composer
+                             'creator': 'ta', #composerS
                              'relation': 'tl', #album
                              #'type': 'tg', #genre
                              'publisher': 'tc', #comment
@@ -129,8 +129,8 @@ class Mp3Exporter(ExporterCore):
         self.args = self.get_args(options)
         self.ext = self.get_file_extension()
         self.args = ' '.join(self.args)
-        #self.command = 'sox "%s" -q -w -r 44100 -t wav -c2 - | lame %s -' \
-        self.command = 'lame %s "%s" -' % (self.args, self.source)
+        self.command = 'sox "%s" -q -w -r 44100 -t wav -c2 - | lame %s -' % (self.source, self.args)
+        #self.command = 'lame %s "%s" -' % (self.args, self.source)
         
         # Pre-proccessing
         self.dest = self.pre_process(self.item_id,
@@ -141,7 +141,7 @@ class Mp3Exporter(ExporterCore):
                                          self.options)
 
         # Processing (streaming + cache writing)
-        stream = self.core_process(self.command,self.buffer_size,self.dest)
+        stream = self.core_process(self.command, self.buffer_size, self.dest)
         for chunk in stream:
             yield chunk
     
index ad357bf384b702d0a1f5c2c5eba64ea1b11ffcc2..1189ab3032ce4d15be12fe41e2684c59920a75a8 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 = 'cat "%s" | oggenc %s -' % (self.source, self.args)
+        self.command = 'sox "%s" -q -w -r 44100 -t wav -c2 - | oggenc %s -' % (self.source, self.args)
         
         # Pre-proccessing
         self.dest = self.pre_process(self.item_id,