]> git.parisson.com Git - timeside.git/commitdiff
rename decode and encode cores
authoryomguy <yomguy@parisson.com>
Wed, 7 Oct 2009 13:43:08 +0000 (13:43 +0000)
committeryomguy <yomguy@parisson.com>
Wed, 7 Oct 2009 13:43:08 +0000 (13:43 +0000)
14 files changed:
decode/__init__.py
decode/api.py
decode/core.py
decode/flac.py
decode/mp3.py
decode/ogg.py
decode/wav.py
encode/__init__.py
encode/api.py
encode/core.py
encode/flac.py
encode/mp3.py
encode/ogg.py
encode/wav.py

index 06cb43af605cfb32d23c9fa416d7c79485ec5016..5af60e5ac348c3991ba553c0ed90ad6d97ee63a6 100644 (file)
@@ -1,8 +1,8 @@
 # -*- coding: utf-8 -*-
 
-from timeside.export.api import *
-from timeside.export.core import *
-from timeside.export.ogg import *
-from timeside.export.flac import *
-from timeside.export.wav import *
-from timeside.export.mp3 import *
\ No newline at end of file
+from timeside.decode.api import *
+from timeside.decode.core import *
+from timeside.decode.ogg import *
+from timeside.decode.flac import *
+from timeside.decode.wav import *
+from timeside.decode.mp3 import *
\ No newline at end of file
index 7ee861c536f68712a8dda2aba274d56b82b5b888..61f5f87b508c5eae817ec6993ddac311271ac16d 100644 (file)
@@ -21,8 +21,8 @@
 
 from timeside.core import Interface, TimeSideError
 
-class IExporter(Interface):
-    """Export driver interface"""
+class IDecoder(Interface):
+    """Decoder driver interface"""
 
     # Remark: the method prototypes do not include any self or cls argument 
     # because an interface is meant to show what methods a class must expose 
@@ -30,39 +30,37 @@ class IExporter(Interface):
     # you'll obviously want to include this extra argument.
 
     def get_format():
-        """Return the export/encoding format as a short string 
+        """Return the decode/encoding format as a short string 
         Example: "MP3", "OGG", "AVI", ...
         """
    
     def get_description():
-        """Return a string describing what this export format provides, is good 
+        """Return a string describing what this decode format provides, is good 
         for, etc... The description is meant to help the end user decide what 
         format is good for him/her
         """
 
     def get_file_extension():
-        """Return the filename extension corresponding to this export format"""
+        """Return the filename extension corresponding to this decode format"""
 
     def get_mime_type():
-        """Return the mime type corresponding to this export format"""
+        """Return the mime type corresponding to this decode format"""
 
     def set_cache_dir(path):
         """Set the directory where cached files should be stored. Does nothing
-        if the exporter doesn't support caching. 
+        if the decodeer 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.
         """
 
     def process(item_id, source, metadata, options=None):
-        """Perform the exporting process and return the absolute path 
-        to the resulting file.
+        """Perform the decoding process and stream the result through a generator
 
         item_id is the media item id that uniquely identifies this audio/video
         resource
 
-        source is the audio/video source file absolute path. For audio that
-        should be a WAV file
+        source is the audio/video source file absolute path.
 
         metadata is a tuple containing tuples for each descriptor return by
         the dc.Ressource of the item, in the model order :
@@ -71,14 +69,14 @@ class IExporter(Interface):
         The returned file path is not meant to be permanent in any way, it 
         should be considered temporary/volatile by the caller.
 
-        It is highly recommended that export drivers implement some sort of
+        It is highly recommended that decode drivers implement some sort of
         cache instead of re-encoding each time process() is called.
 
         It should be possible to make subsequent calls to process() with
         different items, using the same driver instance.
         """
 
-class ExportProcessError(TimeSideError):
+class DecodeProcessError(TimeSideError):
 
     def __init__(self, message, command, subprocess):
         self.message = message
index 6f8335674675f24ef0214278aec8511189a97e15..8e6874b3d9cd3ce9bb78fe0d9fac975390a02b8f 100644 (file)
@@ -27,13 +27,13 @@ import string
 import subprocess
 import mutagen
 
-from timeside.export import *
+from timeside.decode import *
 from timeside.core import *
 import xml.dom.minidom
 import xml.dom.ext
 
-class ExporterCore(Component):
-    """Defines the main parts of the exporting tools :
+class DecoderCore(Component):
+    """Defines the main parts of the decodeing tools :
     paths, metadata parsing, data streaming thru system command"""
 
     def __init__(self):
@@ -57,7 +57,7 @@ class ExporterCore(Component):
             os.system('normalize-audio '+args+' "'+self.source+'"')
             return self.source
         except:
-            raise IOError('ExporterError: cannot normalize, path does not exist.')
+            raise IOError('DecoderError: cannot normalize, path does not exist.')
 
     def check_md5_key(self):
         """ Check if the md5 key is OK and return a boolean """
@@ -66,11 +66,11 @@ class ExporterCore(Component):
                                 '" "'+self.dest+'.md5"')
             return 'OK' in md5_log.split(':')
         except IOError:
-            raise IOError('ExporterError: cannot check the md5 key.')
+            raise IOError('DecoderError: cannot check the md5 key.')
     
     def get_file_info(self):
         """ Return the list of informations of the dest """
-        return self.export.get_file_info()
+        return self.decode.get_file_info()
 
     def get_wav_length_sec(self) :
         """ Return the length of the audio source file in seconds """
@@ -82,7 +82,7 @@ class ExporterCore(Component):
                 value = int(int(line_split[1])/(4*44100))
                 return value
         except:
-            raise IOError('ExporterError: cannot get the wav length.')
+            raise IOError('DecoderError: cannot get the wav length.')
 
     def compare_md5_key(self, source, dest):
         """ Compare source and dest files wih md5 method """
@@ -106,7 +106,7 @@ class ExporterCore(Component):
 
     def pre_process(self, item_id, source, metadata, ext,
                     cache_dir, options=None):
-        """ Pre processing : prepare the export path and return it"""
+        """ Pre processing : prepare the decode path and return it"""
         self.item_id = str(item_id)
         self.source = source
         file_name = get_file_name(self.source)
@@ -124,19 +124,19 @@ class ExporterCore(Component):
                 self.options['normalize'] == True:
                 self.normalize()
 
-        # Define the export directory
+        # Define the decode directory
         self.ext = self.get_file_extension()
-        export_dir = os.path.join(self.cache_dir,self.ext)
+        decode_dir = os.path.join(self.cache_dir,self.ext)
 
-        if not os.path.exists(export_dir):
-            export_dir_split = export_dir.split(os.sep)
-            path = os.sep + export_dir_split[0]
-            for _dir in export_dir_split[1:]:
+        if not os.path.exists(decode_dir):
+            decode_dir_split = decode_dir.split(os.sep)
+            path = os.sep + decode_dir_split[0]
+            for _dir in decode_dir_split[1:]:
                 path = os.path.join(path,_dir)
                 if not os.path.exists(path):
                     os.mkdir(path)
         else:
-            path = export_dir
+            path = decode_dir
 
         # Set the target file
         target_file = self.item_id+'.'+self.ext
@@ -212,7 +212,7 @@ def get_file_mime_type(path):
             mime = line_split[len(line_split)-1]
             return mime[:len(mime)-1]
     except:
-        raise IOError('ExporterError: path does not exist.')
+        raise IOError('DecoderError: path does not exist.')
 
 def get_file_type_desc(path):
     """ Return the type of a file given by the 'file' command """
@@ -223,7 +223,7 @@ def get_file_type_desc(path):
             description = description[1].split(', ')
             return description
     except:
-        raise IOError('ExporterError: path does not exist.')
+        raise IOError('DecoderError: path does not exist.')
 
 def iswav(path):
     """ Tell if path is a WAV """
@@ -231,7 +231,7 @@ def iswav(path):
         mime = get_file_mime_type(path)
         return mime == 'audio/x-wav'
     except:
-        raise IOError('ExporterError: path does not exist.')
+        raise IOError('DecoderError: path does not exist.')
 
 def iswav16(path):
     """ Tell if path is a 16 bit WAV """
@@ -239,7 +239,7 @@ def iswav16(path):
         file_type_desc = get_file_type_desc(path)
         return iswav(path) and '16 bit' in file_type_desc
     except:
-        raise IOError('ExporterError: path does not exist.')
+        raise IOError('DecoderError: path does not exist.')
 
 def get_file_name(path):
     """ Return the file name targeted in the path """
@@ -250,11 +250,11 @@ def split_file_name(file):
     try:
         return os.path.splitext(file)
     except:
-        raise IOError('ExporterError: path does not exist.')
+        raise IOError('DecoderError: path does not exist.')
 
 def clean_word(word) :
     """ Return the word without excessive blank spaces, underscores and
-    characters causing problem to exporters"""
+    characters causing problem to decodeers"""
     word = re.sub("^[^\w]+","",word)    #trim the beginning
     word = re.sub("[^\w]+$","",word)    #trim the end
     word = re.sub("_+","_",word)        #squeeze continuous _ to one _
index 60f2f926a16272d5f01fbead21e175323babb5ef..37b956e9ae71d065e4d50152f5cacf7dfe06d2d6 100644 (file)
@@ -23,15 +23,15 @@ import os
 import string
 import subprocess
 
-from timeside.export.core import *
-from timeside.export.api import IExporter
+from timeside.decode.core import *
+from timeside.decode.api import IDecoder
 from mutagen.flac import FLAC
 from tempfile import NamedTemporaryFile
 
-class FlacExporter(ExporterCore):
-    """Defines methods to export to FLAC"""
+class FlacDecoder(DecoderCore):
+    """Defines methods to decode to FLAC"""
 
-    implements(IExporter)
+    implements(IDecoder)
     
     def __init__(self):
         self.item_id = ''
@@ -65,12 +65,12 @@ class FlacExporter(ExporterCore):
             self.info = info
             return self.info
         except:
-            raise IOError('ExporterError: metaflac is not installed or ' + \
+            raise IOError('DecoderError: metaflac is not installed or ' + \
                            'file does not exist.')
 
     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 decodeer 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.
@@ -85,7 +85,7 @@ class FlacExporter(ExporterCore):
             self.source = dest
             return dest
         except:
-            raise IOError('ExporterError: decoder is not compatible.')
+            raise IOError('DecoderError: decoder is not compatible.')
 
     def write_tags(self, file):
         media = FLAC(file)
@@ -99,7 +99,7 @@ class FlacExporter(ExporterCore):
         try:
             media.save()
         except:
-            raise IOError('ExporterError: cannot write tags.')
+            raise IOError('DecoderError: cannot write tags.')
 
     def get_args(self,options=None):
         """Get process options and return arguments for the encoder"""
index e75f15fe3b1bef9052c171896d09f854b08745da..b89a924231ece107419386d0c5e1122685bf64c4 100644 (file)
@@ -24,14 +24,14 @@ import os
 import string
 import subprocess
 
-from timeside.export.core import *
-from timeside.export.api import IExporter
+from timeside.decode.core import *
+from timeside.decode.api import IDecoder
 #from mutagen.id3 import *
 
-class Mp3Exporter(ExporterCore):
-    """Defines methods to export to MP3"""
+class Mp3Decoder(DecoderCore):
+    """Defines methods to decode to MP3"""
 
-    implements(IExporter)
+    implements(IDecoder)
     
     def __init__(self):
         self.item_id = ''
@@ -83,7 +83,7 @@ class Mp3Exporter(ExporterCore):
             self.info = info
             return self.info
         except:
-            raise IOError('ExporterError: file does not exist.')
+            raise IOError('DecoderError: file does not exist.')
 
     def decode(self):
         try:
@@ -91,7 +91,7 @@ class Mp3Exporter(ExporterCore):
                         +self.cache_dir+os.sep+self.item_id+'"')
             return self.cache_dir+os.sep+self.item_id+'.wav'
         except:
-            raise IOError('ExporterError: decoder is not compatible.')
+            raise IOError('DecoderError: decoder is not compatible.')
 
     def write_tags(self):
         """Write all ID3v2.4 tags by mapping dub2id3_dict dictionnary with the
@@ -106,11 +106,11 @@ class Mp3Exporter(ExporterCore):
                 try:
                     id3.add(frame)
                 except:
-                    raise IOError('ExporterError: cannot tag "'+tag+'"')
+                    raise IOError('DecoderError: cannot tag "'+tag+'"')
         try:
             id3.save()
         except:
-            raise IOError('ExporterError: cannot write tags')
+            raise IOError('DecoderError: cannot write tags')
 
     def get_args(self, options=None):
         """Get process options and return arguments for the encoder"""
index 270449ac8756d36ab72d771038dbef86608333ed..278e0896dd1d54fc12bc2488b55a4fb7f7d18fbc 100644 (file)
@@ -23,14 +23,14 @@ import os
 import string
 import subprocess
 
-from timeside.export.core import *
-from timeside.export.api import IExporter
+from timeside.decode.core import *
+from timeside.decode.api import IDecoder
 from mutagen.oggvorbis import OggVorbis
 
-class OggExporter(ExporterCore):
-    """Defines methods to export to OGG Vorbis"""
+class OggDecoder(DecoderCore):
+    """Defines methods to decode to OGG Vorbis"""
 
-    implements(IExporter)
+    implements(IDecoder)
     
     def __init__(self):
         self.item_id = ''
@@ -67,7 +67,7 @@ class OggExporter(ExporterCore):
             self.info = info
             return self.info
         except:
-            raise IOError('ExporterError: file does not exist.')
+            raise IOError('DecoderError: file does not exist.')
 
     def set_cache_dir(self,path):
        self.cache_dir = path
@@ -78,7 +78,7 @@ class OggExporter(ExporterCore):
                       '.wav" "'+self.source+'"')
             return self.cache_dir+os.sep+self.item_id+'.wav'
         except:
-            raise IOError('ExporterError: decoder is not compatible.')
+            raise IOError('DecoderError: decoder is not compatible.')
 
     def write_tags(self):
         media = OggVorbis(self.dest)
index c98a1720a5a04682187711d9aa9b203b02f862e9..87a64ad9f6c7acc3b483e24c1bd007c6d8ea7329 100644 (file)
 import os
 import string
 
-from timeside.export.core import *
-from timeside.export.api import IExporter
+from timeside.decode.core import *
+from timeside.decode.api import IDecoder
 
-class WavExporter(ExporterCore):
-    """Defines methods to export to WAV"""
+class WavDecoder(DecoderCore):
+    """Defines methods to decode to WAV"""
 
-    implements(IExporter)
+    implements(IDecoder)
     
     def __init__(self):
         self.item_id = ''
@@ -61,7 +61,7 @@ class WavExporter(ExporterCore):
             self.info = info
             return self.info
         except:
-            raise IOError('ExporterError: wavinfo id not installed or file does not exist.')
+            raise IOError('DecoderError: wavinfo id not installed or file does not exist.')
 
     def set_cache_dir(self,path):
         self.cache_dir = path
@@ -75,7 +75,7 @@ class WavExporter(ExporterCore):
             self.source = dest
             return dest
         except:
-            raise IOError('ExporterError: decoder is not compatible.')
+            raise IOError('DecoderError: decoder is not compatible.')
 
     def write_tags(self):
         # Create metadata XML file !
@@ -86,7 +86,7 @@ class WavExporter(ExporterCore):
         try:
             os.system('md5sum -b "'+self.dest+'" >"'+self.dest+'.md5"')
         except:
-            raise IOError('ExporterError: cannot create the md5 key.')
+            raise IOError('DecoderError: cannot create the md5 key.')
     
     def create_par_key(self):
         """ Create the par2 keys of the dest """
@@ -99,7 +99,7 @@ class WavExporter(ExporterCore):
         try:
             os.system('par2 '+args+' "'+self.dest+'"')
         except:
-            raise IOError('ExporterError: cannot create the par2 key.')
+            raise IOError('DecoderError: cannot create the par2 key.')
 
     def process(self, item_id, source, metadata, options=None):
         self.item_id = item_id
index 06cb43af605cfb32d23c9fa416d7c79485ec5016..cfed4ed4817e6fd9f3262561a690a1d0712a8dc4 100644 (file)
@@ -1,8 +1,8 @@
 # -*- coding: utf-8 -*-
 
-from timeside.export.api import *
-from timeside.export.core import *
-from timeside.export.ogg import *
-from timeside.export.flac import *
-from timeside.export.wav import *
-from timeside.export.mp3 import *
\ No newline at end of file
+from timeside.encode.api import *
+from timeside.encode.core import *
+from timeside.encode.ogg import *
+from timeside.encode.flac import *
+from timeside.encode.wav import *
+from timeside.encode.mp3 import *
\ No newline at end of file
index 7ee861c536f68712a8dda2aba274d56b82b5b888..b97edca848bc824445025ade75c0a83719e25d9c 100644 (file)
@@ -21,8 +21,8 @@
 
 from timeside.core import Interface, TimeSideError
 
-class IExporter(Interface):
-    """Export driver interface"""
+class IEncoder(Interface):
+    """Encoder driver interface"""
 
     # Remark: the method prototypes do not include any self or cls argument 
     # because an interface is meant to show what methods a class must expose 
@@ -30,39 +30,37 @@ class IExporter(Interface):
     # you'll obviously want to include this extra argument.
 
     def get_format():
-        """Return the export/encoding format as a short string 
+        """Return the encode/encoding format as a short string 
         Example: "MP3", "OGG", "AVI", ...
         """
    
     def get_description():
-        """Return a string describing what this export format provides, is good 
+        """Return a string describing what this encode format provides, is good 
         for, etc... The description is meant to help the end user decide what 
         format is good for him/her
         """
 
     def get_file_extension():
-        """Return the filename extension corresponding to this export format"""
+        """Return the filename extension corresponding to this encode format"""
 
     def get_mime_type():
-        """Return the mime type corresponding to this export format"""
+        """Return the mime type corresponding to this encode format"""
 
     def set_cache_dir(path):
         """Set the directory where cached files should be stored. Does nothing
-        if the exporter doesn't support caching. 
+        if the encodeer 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.
         """
 
     def process(item_id, source, metadata, options=None):
-        """Perform the exporting process and return the absolute path 
-        to the resulting file.
+        """Perform the encoding process and stream the result as a generator.
 
         item_id is the media item id that uniquely identifies this audio/video
         resource
 
-        source is the audio/video source file absolute path. For audio that
-        should be a WAV file
+        source is a raw audio stream coming from the decoder.
 
         metadata is a tuple containing tuples for each descriptor return by
         the dc.Ressource of the item, in the model order :
@@ -71,7 +69,7 @@ class IExporter(Interface):
         The returned file path is not meant to be permanent in any way, it 
         should be considered temporary/volatile by the caller.
 
-        It is highly recommended that export drivers implement some sort of
+        It is highly recommended that encode drivers implement some sort of
         cache instead of re-encoding each time process() is called.
 
         It should be possible to make subsequent calls to process() with
index 6f8335674675f24ef0214278aec8511189a97e15..00f428ac96450ffbcde6b1571ef990a6bcfca332 100644 (file)
@@ -27,13 +27,13 @@ import string
 import subprocess
 import mutagen
 
-from timeside.export import *
+from timeside.encode import *
 from timeside.core import *
 import xml.dom.minidom
 import xml.dom.ext
 
-class ExporterCore(Component):
-    """Defines the main parts of the exporting tools :
+class EncoderCore(Component):
+    """Defines the main parts of the encodeing tools :
     paths, metadata parsing, data streaming thru system command"""
 
     def __init__(self):
@@ -57,7 +57,7 @@ class ExporterCore(Component):
             os.system('normalize-audio '+args+' "'+self.source+'"')
             return self.source
         except:
-            raise IOError('ExporterError: cannot normalize, path does not exist.')
+            raise IOError('EncoderError: cannot normalize, path does not exist.')
 
     def check_md5_key(self):
         """ Check if the md5 key is OK and return a boolean """
@@ -66,11 +66,11 @@ class ExporterCore(Component):
                                 '" "'+self.dest+'.md5"')
             return 'OK' in md5_log.split(':')
         except IOError:
-            raise IOError('ExporterError: cannot check the md5 key.')
+            raise IOError('EncoderError: cannot check the md5 key.')
     
     def get_file_info(self):
         """ Return the list of informations of the dest """
-        return self.export.get_file_info()
+        return self.encode.get_file_info()
 
     def get_wav_length_sec(self) :
         """ Return the length of the audio source file in seconds """
@@ -82,7 +82,7 @@ class ExporterCore(Component):
                 value = int(int(line_split[1])/(4*44100))
                 return value
         except:
-            raise IOError('ExporterError: cannot get the wav length.')
+            raise IOError('EncoderError: cannot get the wav length.')
 
     def compare_md5_key(self, source, dest):
         """ Compare source and dest files wih md5 method """
@@ -106,7 +106,7 @@ class ExporterCore(Component):
 
     def pre_process(self, item_id, source, metadata, ext,
                     cache_dir, options=None):
-        """ Pre processing : prepare the export path and return it"""
+        """ Pre processing : prepare the encode path and return it"""
         self.item_id = str(item_id)
         self.source = source
         file_name = get_file_name(self.source)
@@ -124,19 +124,19 @@ class ExporterCore(Component):
                 self.options['normalize'] == True:
                 self.normalize()
 
-        # Define the export directory
+        # Define the encode directory
         self.ext = self.get_file_extension()
-        export_dir = os.path.join(self.cache_dir,self.ext)
+        encode_dir = os.path.join(self.cache_dir,self.ext)
 
-        if not os.path.exists(export_dir):
-            export_dir_split = export_dir.split(os.sep)
-            path = os.sep + export_dir_split[0]
-            for _dir in export_dir_split[1:]:
+        if not os.path.exists(encode_dir):
+            encode_dir_split = encode_dir.split(os.sep)
+            path = os.sep + encode_dir_split[0]
+            for _dir in encode_dir_split[1:]:
                 path = os.path.join(path,_dir)
                 if not os.path.exists(path):
                     os.mkdir(path)
         else:
-            path = export_dir
+            path = encode_dir
 
         # Set the target file
         target_file = self.item_id+'.'+self.ext
@@ -212,7 +212,7 @@ def get_file_mime_type(path):
             mime = line_split[len(line_split)-1]
             return mime[:len(mime)-1]
     except:
-        raise IOError('ExporterError: path does not exist.')
+        raise IOError('EncoderError: path does not exist.')
 
 def get_file_type_desc(path):
     """ Return the type of a file given by the 'file' command """
@@ -223,7 +223,7 @@ def get_file_type_desc(path):
             description = description[1].split(', ')
             return description
     except:
-        raise IOError('ExporterError: path does not exist.')
+        raise IOError('EncoderError: path does not exist.')
 
 def iswav(path):
     """ Tell if path is a WAV """
@@ -231,7 +231,7 @@ def iswav(path):
         mime = get_file_mime_type(path)
         return mime == 'audio/x-wav'
     except:
-        raise IOError('ExporterError: path does not exist.')
+        raise IOError('EncoderError: path does not exist.')
 
 def iswav16(path):
     """ Tell if path is a 16 bit WAV """
@@ -239,7 +239,7 @@ def iswav16(path):
         file_type_desc = get_file_type_desc(path)
         return iswav(path) and '16 bit' in file_type_desc
     except:
-        raise IOError('ExporterError: path does not exist.')
+        raise IOError('EncoderError: path does not exist.')
 
 def get_file_name(path):
     """ Return the file name targeted in the path """
@@ -250,11 +250,11 @@ def split_file_name(file):
     try:
         return os.path.splitext(file)
     except:
-        raise IOError('ExporterError: path does not exist.')
+        raise IOError('EncoderError: path does not exist.')
 
 def clean_word(word) :
     """ Return the word without excessive blank spaces, underscores and
-    characters causing problem to exporters"""
+    characters causing problem to encodeers"""
     word = re.sub("^[^\w]+","",word)    #trim the beginning
     word = re.sub("[^\w]+$","",word)    #trim the end
     word = re.sub("_+","_",word)        #squeeze continuous _ to one _
index 60f2f926a16272d5f01fbead21e175323babb5ef..e6553907ea6c4efe10b6e8864e4c1edd1bb82d2c 100644 (file)
@@ -23,15 +23,15 @@ import os
 import string
 import subprocess
 
-from timeside.export.core import *
-from timeside.export.api import IExporter
+from timeside.encode.core import *
+from timeside.encode.api import IEncoder
 from mutagen.flac import FLAC
 from tempfile import NamedTemporaryFile
 
-class FlacExporter(ExporterCore):
-    """Defines methods to export to FLAC"""
+class FlacEncoder(EncoderCore):
+    """Defines methods to encode to FLAC"""
 
-    implements(IExporter)
+    implements(IEncoder)
     
     def __init__(self):
         self.item_id = ''
@@ -65,12 +65,12 @@ class FlacExporter(ExporterCore):
             self.info = info
             return self.info
         except:
-            raise IOError('ExporterError: metaflac is not installed or ' + \
+            raise IOError('EncoderError: metaflac is not installed or ' + \
                            'file does not exist.')
 
     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 encodeer 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.
@@ -85,7 +85,7 @@ class FlacExporter(ExporterCore):
             self.source = dest
             return dest
         except:
-            raise IOError('ExporterError: decoder is not compatible.')
+            raise IOError('EncoderError: decoder is not compatible.')
 
     def write_tags(self, file):
         media = FLAC(file)
@@ -99,7 +99,7 @@ class FlacExporter(ExporterCore):
         try:
             media.save()
         except:
-            raise IOError('ExporterError: cannot write tags.')
+            raise IOError('EncoderError: cannot write tags.')
 
     def get_args(self,options=None):
         """Get process options and return arguments for the encoder"""
index e75f15fe3b1bef9052c171896d09f854b08745da..0b4fa3813c532bb4698aaddb5cc024c4ceee1aea 100644 (file)
@@ -24,14 +24,14 @@ import os
 import string
 import subprocess
 
-from timeside.export.core import *
-from timeside.export.api import IExporter
+from timeside.encode.core import *
+from timeside.encode.api import IEncoder
 #from mutagen.id3 import *
 
-class Mp3Exporter(ExporterCore):
-    """Defines methods to export to MP3"""
+class Mp3Encoder(EencoderCore):
+    """Defines methods to encode to MP3"""
 
-    implements(IExporter)
+    implements(IEncoder)
     
     def __init__(self):
         self.item_id = ''
@@ -83,7 +83,7 @@ class Mp3Exporter(ExporterCore):
             self.info = info
             return self.info
         except:
-            raise IOError('ExporterError: file does not exist.')
+            raise IOError('EncoderError: file does not exist.')
 
     def decode(self):
         try:
@@ -91,7 +91,7 @@ class Mp3Exporter(ExporterCore):
                         +self.cache_dir+os.sep+self.item_id+'"')
             return self.cache_dir+os.sep+self.item_id+'.wav'
         except:
-            raise IOError('ExporterError: decoder is not compatible.')
+            raise IOError('EncoderError: decoder is not compatible.')
 
     def write_tags(self):
         """Write all ID3v2.4 tags by mapping dub2id3_dict dictionnary with the
@@ -106,11 +106,11 @@ class Mp3Exporter(ExporterCore):
                 try:
                     id3.add(frame)
                 except:
-                    raise IOError('ExporterError: cannot tag "'+tag+'"')
+                    raise IOError('EncoderError: cannot tag "'+tag+'"')
         try:
             id3.save()
         except:
-            raise IOError('ExporterError: cannot write tags')
+            raise IOError('EncoderError: cannot write tags')
 
     def get_args(self, options=None):
         """Get process options and return arguments for the encoder"""
index 270449ac8756d36ab72d771038dbef86608333ed..7437ac75e62fdc1a69e529b3446198f10cef1810 100644 (file)
@@ -23,14 +23,14 @@ import os
 import string
 import subprocess
 
-from timeside.export.core import *
-from timeside.export.api import IExporter
+from timeside.encode.core import *
+from timeside.encode.api import IEncoder
 from mutagen.oggvorbis import OggVorbis
 
-class OggExporter(ExporterCore):
-    """Defines methods to export to OGG Vorbis"""
+class OggEncoder(EncoderCore):
+    """Defines methods to encode to OGG Vorbis"""
 
-    implements(IExporter)
+    implements(IEncoder)
     
     def __init__(self):
         self.item_id = ''
@@ -67,7 +67,7 @@ class OggExporter(ExporterCore):
             self.info = info
             return self.info
         except:
-            raise IOError('ExporterError: file does not exist.')
+            raise IOError('EncoderError: file does not exist.')
 
     def set_cache_dir(self,path):
        self.cache_dir = path
@@ -78,7 +78,7 @@ class OggExporter(ExporterCore):
                       '.wav" "'+self.source+'"')
             return self.cache_dir+os.sep+self.item_id+'.wav'
         except:
-            raise IOError('ExporterError: decoder is not compatible.')
+            raise IOError('EncoderError: decoder is not compatible.')
 
     def write_tags(self):
         media = OggVorbis(self.dest)
index c98a1720a5a04682187711d9aa9b203b02f862e9..b1e822cacf0b37b3bc5e18765d63c4b3b961ae2a 100644 (file)
 import os
 import string
 
-from timeside.export.core import *
-from timeside.export.api import IExporter
+from timeside.encode.core import *
+from timeside.encode.api import IEncoder
 
-class WavExporter(ExporterCore):
-    """Defines methods to export to WAV"""
+class WavEncoder(EncoderCore):
+    """Defines methods to encode to WAV"""
 
-    implements(IExporter)
+    implements(IEncoder)
     
     def __init__(self):
         self.item_id = ''
@@ -61,7 +61,7 @@ class WavExporter(ExporterCore):
             self.info = info
             return self.info
         except:
-            raise IOError('ExporterError: wavinfo id not installed or file does not exist.')
+            raise IOError('EncoderError: wavinfo id not installed or file does not exist.')
 
     def set_cache_dir(self,path):
         self.cache_dir = path
@@ -75,7 +75,7 @@ class WavExporter(ExporterCore):
             self.source = dest
             return dest
         except:
-            raise IOError('ExporterError: decoder is not compatible.')
+            raise IOError('EncoderError: decoder is not compatible.')
 
     def write_tags(self):
         # Create metadata XML file !
@@ -86,7 +86,7 @@ class WavExporter(ExporterCore):
         try:
             os.system('md5sum -b "'+self.dest+'" >"'+self.dest+'.md5"')
         except:
-            raise IOError('ExporterError: cannot create the md5 key.')
+            raise IOError('EncoderError: cannot create the md5 key.')
     
     def create_par_key(self):
         """ Create the par2 keys of the dest """
@@ -99,7 +99,7 @@ class WavExporter(ExporterCore):
         try:
             os.system('par2 '+args+' "'+self.dest+'"')
         except:
-            raise IOError('ExporterError: cannot create the par2 key.')
+            raise IOError('EncoderError: cannot create the par2 key.')
 
     def process(self, item_id, source, metadata, options=None):
         self.item_id = item_id