]> git.parisson.com Git - telemeta.git/commitdiff
leave original samplerates through exporting
authoryomguy <>
Sun, 4 Apr 2010 00:46:02 +0000 (00:46 +0000)
committeryomguy <>
Sun, 4 Apr 2010 00:46:02 +0000 (00:46 +0000)
telemeta/export/flac.py
telemeta/export/mp3.py
telemeta/export/ogg.py

index 24f2a552b411c3620fa1f19631ad7fe68c8938f7..c9024abb325d1b7c3e835e2013e520d716b5e4e1 100644 (file)
@@ -46,7 +46,7 @@ class FlacExporter(ExporterCore):
     """Defines methods to export to FLAC"""
 
     implements(IExporter)
-    
+
     def __init__(self):
         self.item_id = ''
         self.source = ''
@@ -60,7 +60,7 @@ class FlacExporter(ExporterCore):
 
     def get_format(self):
         return 'FLAC'
-    
+
     def get_file_extension(self):
         return 'flac'
 
@@ -84,8 +84,8 @@ class FlacExporter(ExporterCore):
 
     def set_cache_dir(self,path):
         """Set the directory where cached files should be stored. Does nothing
-        if the exporter doesn't support caching. 
-       
+        if the exporter doesn't support caching.
+
         The driver shouldn't assume that this method will always get called. A
         temporary directory should be used if that's not the case.
         """
@@ -145,7 +145,7 @@ class FlacExporter(ExporterCore):
         self.args = self.get_args(options)
         self.ext = self.get_file_extension()
         self.args = ' '.join(self.args)
-        self.command = 'sox "%s" -s -q -b 16 -r 44100 -t wav -c2 - | flac -c %s - ' % (self.source, self.args)
+        self.command = 'sox "%s" -s -q -b 16 -t wav -c2 - | flac -c %s - ' % (self.source, self.args)
 
         # Pre-proccessing
         self.dest = self.pre_process(self.item_id,
@@ -163,7 +163,7 @@ class FlacExporter(ExporterCore):
 
         self.write_tags(self.dest)
         file = open(self.dest,'r')
-        
+
         while True:
             chunk = file.read(self.buffer_size)
             if len(chunk) == 0:
index 03cddc34e93b70c612bee81eae1374d47380d879..d6c7d1678d0e81f250d9451c26bc1edcee04bf1e 100644 (file)
@@ -45,7 +45,7 @@ class Mp3Exporter(ExporterCore):
     """Defines methods to export to MP3"""
 
     implements(IExporter)
-    
+
     def __init__(self):
         self.item_id = ''
         self.metadata = {}
@@ -74,7 +74,7 @@ class Mp3Exporter(ExporterCore):
                              }
     def get_format(self):
         return 'MP3'
-    
+
     def get_file_extension(self):
         return 'mp3'
 
@@ -109,7 +109,7 @@ class Mp3Exporter(ExporterCore):
     def write_tags(self):
         """Write all ID3v2.4 tags by mapping dub2id3_dict dictionnary with the
             respect of mutagen classes and methods"""
-        from mutagen import id3  
+        from mutagen import id3
         id3 = id3.ID3(self.dest)
         for tag in self.metadata.keys():
             if tag in self.dub2id3_dict.keys():
@@ -128,7 +128,7 @@ class Mp3Exporter(ExporterCore):
     def get_args(self, options=None):
         """Get process options and return arguments for the encoder"""
         args = []
-        if not options is None: 
+        if not options is None:
             self.options = options
             if not ( 'verbose' in self.options and self.options['verbose'] != '0' ):
                 args.append('-S')
@@ -156,7 +156,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" -q -b 16 -r 44100 -t wav - | lame %s -' % (self.source, self.args)
+        self.command = 'sox "%s" -q -b 16 -t wav - | lame %s -' % (self.source, self.args)
         #self.command = 'lame %s "%s" -' % (self.args, self.source)
 
         # Pre-proccessing
@@ -171,7 +171,7 @@ class Mp3Exporter(ExporterCore):
         stream = self.core_process(self.command, self.buffer_size, self.dest)
         for chunk in stream:
             yield chunk
-    
+
         # Post-proccessing
         #self.post_process(self.item_id,
                          #self.source,
index 88ce688f25ea03263c9bda09ca143f50b1365eba..3a58f6e499cd8f26c5f812b881d6a610a53ad6c4 100644 (file)
@@ -44,7 +44,7 @@ class OggExporter(ExporterCore):
     """Defines methods to export to OGG Vorbis"""
 
     implements(IExporter)
-    
+
     def __init__(self):
         self.item_id = ''
         self.metadata = {}
@@ -58,10 +58,10 @@ class OggExporter(ExporterCore):
         self.dub2args_dict = {'creator': 'artist',
                              'relation': 'album'
                              }
-        
+
     def get_format(self):
         return 'OGG'
-    
+
     def get_file_extension(self):
         return 'ogg'
 
@@ -131,7 +131,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 -b 16 -r 44100 -t wav -c2 - | oggenc %s -' % (self.source, self.args)
+        self.command = 'sox "%s" -s -q -b 16 -t wav -c2 - | oggenc %s -' % (self.source, self.args)
 
         # Pre-proccessing
         self.dest = self.pre_process(self.item_id,
@@ -145,7 +145,7 @@ class OggExporter(ExporterCore):
         stream = self.core_process(self.command, self.buffer_size, self.dest)
         for chunk in stream:
             yield chunk
-    
+
         # Post-proccessing
         #self.post_process(self.item_id,
                         #self.source,