From 95dc427f6645158425aae8d7a6004228d80a15b6 Mon Sep 17 00:00:00 2001 From: yomguy <> Date: Sun, 4 Apr 2010 00:46:02 +0000 Subject: [PATCH] leave original samplerates through exporting --- telemeta/export/flac.py | 12 ++++++------ telemeta/export/mp3.py | 12 ++++++------ telemeta/export/ogg.py | 10 +++++----- 3 files changed, 17 insertions(+), 17 deletions(-) diff --git a/telemeta/export/flac.py b/telemeta/export/flac.py index 24f2a552..c9024abb 100644 --- a/telemeta/export/flac.py +++ b/telemeta/export/flac.py @@ -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: diff --git a/telemeta/export/mp3.py b/telemeta/export/mp3.py index 03cddc34..d6c7d167 100644 --- a/telemeta/export/mp3.py +++ b/telemeta/export/mp3.py @@ -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, diff --git a/telemeta/export/ogg.py b/telemeta/export/ogg.py index 88ce688f..3a58f6e4 100644 --- a/telemeta/export/ogg.py +++ b/telemeta/export/ogg.py @@ -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, -- 2.39.5