<?xml version="1.0" encoding="UTF-8"?>
<commit>
  <added type="array"/>
  <modified type="array">
    <modified>
      <diff>@@ -47,7 +47,7 @@ class AiffAudio(AudioFile):
     @classmethod
     def is_type(cls, file):
         header = file.read(12)
-        
+
         return ((header[0:4] == 'FORM') and
                 (header[8:12] == 'AIFF'))
 </diff>
      <filename>audiotools/__aiff__.py</filename>
    </modified>
    <modified>
      <diff>@@ -82,7 +82,7 @@ class ApeTag(MetaData,dict):
     #make sure to update the corresponding dict pair
     def __setattr__(self, key, value):
         self.__dict__[key] = value
-        
+
         if (self.ATTRIBUTE_MAP.has_key(key)):
             if (key != 'track_number'):
                 self[self.ATTRIBUTE_MAP[key]] = value
@@ -93,7 +93,7 @@ class ApeTag(MetaData,dict):
     #make sure to update the corresponding attribute
     def __setitem__(self, key, value):
         dict.__setitem__(self, key, value)
-        
+
         if (self.ITEM_MAP.has_key(key)):
             if (key != 'Track'):
                 self.__dict__[self.ITEM_MAP[key]] = value
@@ -110,7 +110,7 @@ class ApeTag(MetaData,dict):
                 field = unicode(getattr(metadata,field))
                 if (field != u''):
                     tags[key] = field
-                
+
             return ApeTag(tags)
 
     def __comment_name__(self):
@@ -128,7 +128,7 @@ class ApeTag(MetaData,dict):
                    &quot;Artist&quot;:5,
                    &quot;Copyright&quot;:7,
                    &quot;Year&quot;:6}
-        
+
         return cmp((KEY_MAP.get(pair1[0],8),pair1[0],pair1[1]),
                    (KEY_MAP.get(pair2[0],8),pair2[0],pair2[1]))
 
@@ -143,11 +143,11 @@ class ApeTag(MetaData,dict):
                     items.append((key,value.encode('hex')))
                 else:
                     items.append((key,value.encode('hex')[0:39].upper() + u&quot;\u2026&quot;))
-        
+
         return sorted(items,ApeTag.__by_pair__)
-        
 
-    #Takes a file object of a Monkey's Audio file 
+
+    #Takes a file object of a Monkey's Audio file
     #and returns a tuple.
     #That tuple contains the dict of its APE tag info
     #and the total tag size.
@@ -163,7 +163,7 @@ class ApeTag(MetaData,dict):
 
         apev2tag = {}
 
-        for tag in Con.StrictRepeater(footer.item_count, 
+        for tag in Con.StrictRepeater(footer.item_count,
                                       cls.APEv2_TAG).parse(apefile.read()):
             if (tag.encoding == 0):
                 apev2tag[tag.key] = tag.value.rstrip(&quot;\0&quot;).decode('utf-8',
@@ -184,7 +184,7 @@ class ApeTag(MetaData,dict):
         header.version_number = 0x07D0
         header.tag_size = 0
         header.item_count = len(self.keys())
-        
+
         header.undefined1 = header.undefined2 = header.undefined3 = 0
         header.read_only = False
         header.encoding = 0
@@ -212,13 +212,13 @@ class ApeTag(MetaData,dict):
         tags = []
         for (key,value) in self.items():
             tag = Con.Container()
-            
+
             if (isinstance(value,unicode)):
                 value = value.encode('utf-8')
                 tag.encoding = 0
             else:
                 tag.encoding = 1
-                
+
             tag.length = len(value)
             tag.key = key
             tag.value = value
@@ -257,9 +257,9 @@ class ApeTaggedAudio:
 
     def set_metadata(self, metadata):
         apetag = ApeTag.converted(metadata)
-        
+
         if (apetag is None): return
-        
+
         current_metadata = self.get_metadata()
         if (current_metadata != None):  #there's existing tags to delete
             f = file(self.filename,&quot;rb&quot;)
@@ -320,7 +320,7 @@ class ApeAudio(ApeTaggedAudio,AudioFile):
 
     def __init__(self, filename):
         AudioFile.__init__(self, filename)
-        
+
         (self.__samplespersec__,
          self.__channels__,
          self.__bitspersample__,
@@ -348,7 +348,7 @@ class ApeAudio(ApeTaggedAudio,AudioFile):
 
     def sample_rate(self):
         return self.__samplespersec__
-    
+
 
     @classmethod
     def __ape_info__(cls, filename):
@@ -394,7 +394,7 @@ class ApeAudio(ApeTaggedAudio,AudioFile):
                         ((header.total_frames - 1) * \
                          blocks_per_frame) + \
                          header.final_frame_blocks)
-                
+
         finally:
             f.close()
 </diff>
      <filename>audiotools/__ape__.py</filename>
    </modified>
    <modified>
      <diff>@@ -35,7 +35,7 @@ class AuReader(PCMReader):
             __capped_stream_reader__(au_file,data_size),
             bits_per_sample / 8,
             True, False)
-        
+
         PCMReader.__init__(self,self.stream,
                            sample_rate,channels,bits_per_sample)
 
@@ -43,7 +43,7 @@ class AuReader(PCMReader):
     def read(self, bytes):
         return audiotools.pcmstream.pcm_to_string(
             self.stream.read(bytes),self.bits_per_sample / 8,False)
-        
+
 
 class AuAudio(AudioFile):
     SUFFIX = &quot;au&quot;
@@ -117,7 +117,7 @@ class AuAudio(AudioFile):
 
         converter = audiotools.pcmstream.PCMStreamReader(
             pcmreader,bytes_per_sample,False,False)
-        
+
         header = Con.Container(magic_number='.snd',
                                data_offset=0,
                                data_size=0,
@@ -139,7 +139,7 @@ class AuAudio(AudioFile):
                                                        bytes_per_sample,
                                                        True)
                 f.write(s)
-                
+
                 header.data_size += len(s)
                 d = converter.read(BUFFER_SIZE)
 </diff>
      <filename>audiotools/__au__.py</filename>
    </modified>
    <modified>
      <diff>@@ -56,12 +56,12 @@ class FlacMetaData(MetaData):
 
         #Don't use an external SEEKTABLE, either.
         self.__dict__['seektable'] = None
-        
+
         self.__dict__['vorbis_comment'] = None
         self.__dict__['cuesheet'] = None
         image_blocks = []
         self.__dict__['extra_blocks'] = []
-        
+
         for block in blocks:
             if ((block.type == 0) and (self.streaminfo is None)):
                 #only one STREAMINFO allowed
@@ -71,7 +71,7 @@ class FlacMetaData(MetaData):
                 comments = {}
 
                 comment_container = FlacVorbisComment.VORBIS_COMMENT.parse(block.data)
-                
+
                 for comment in comment_container.value:
                     try:
                         key = comment[0:comment.index(&quot;=&quot;)].upper()
@@ -79,10 +79,10 @@ class FlacMetaData(MetaData):
                         comments.setdefault(key,[]).append(value)
                     except ValueError:
                         pass
-                
+
                 self.__dict__['vorbis_comment'] = FlacVorbisComment(
                     comments,comment_container.vendor_string)
-                
+
             elif ((block.type == 5) and (self.cuesheet is None)):
                 #only one CUESHEET allowed
                 self.__dict__['cuesheet'] = block
@@ -92,7 +92,7 @@ class FlacMetaData(MetaData):
             elif (block.type == 6):
                 #multiple PICTURE blocks are ok
                 image = FlacAudio.PICTURE_COMMENT.parse(block.data)
-                
+
                 image_blocks.append(FlacPictureComment(
                     type=image.type,
                     mime_type=image.mime_type.decode('ascii','replace'),
@@ -153,10 +153,10 @@ class FlacMetaData(MetaData):
     def metadata_blocks(self):
         yield self.streaminfo
         yield self.vorbis_comment
-        
+
         if (self.seektable is not None):
             yield self.seektable
-        
+
         if (self.cuesheet is not None):
             yield self.cuesheet
 
@@ -176,7 +176,7 @@ class FlacMetaData(MetaData):
     @classmethod
     def supports_images(cls):
         return True
-            
+
 
 
 #a slight variation of VorbisComment without the framing bit
@@ -189,7 +189,7 @@ class FlacVorbisComment(VorbisComment):
         length_field=Con.ULInt32(&quot;length&quot;),
         subcon=Con.PascalString(&quot;value&quot;,
                                 length_field=Con.ULInt32(&quot;length&quot;))))
-    
+
     def build_block(self, last=0):
         block = self.build()
         return FlacAudio.METADATA_BLOCK_HEADER.build(
@@ -213,7 +213,7 @@ class FlacVorbisComment(VorbisComment):
                         [unicode(getattr(metadata,key))]
 
             return FlacVorbisComment(values)
-  
+
 
 #this is a container for FLAC's PICTURE metadata blocks
 #type, width, height, color_depth and color_count are ints
@@ -301,13 +301,13 @@ class FlacAudio(AudioFile):
     DEFAULT_COMPRESSION = &quot;8&quot;
     COMPRESSION_MODES = tuple(map(str,range(0,9)))
     BINARIES = (&quot;flac&quot;,&quot;metaflac&quot;)
-    
-    
+
+
     METADATA_BLOCK_HEADER = Con.BitStruct(&quot;metadata_block_header&quot;,
                                           Con.Bit(&quot;last_block&quot;),
                                           Con.Bits(&quot;block_type&quot;,7),
                                           Con.Bits(&quot;block_length&quot;,24))
-    
+
     STREAMINFO = Con.Struct(&quot;flac_streaminfo&quot;,
                                  Con.UBInt16(&quot;minimum_blocksize&quot;),
                                  Con.UBInt16(&quot;maximum_blocksize&quot;),
@@ -359,7 +359,7 @@ class FlacAudio(AudioFile):
           Con.StrictRepeater(3,Con.Byte(&quot;reserved&quot;)))
             ))
          ))
-    
+
     def __init__(self, filename):
         AudioFile.__init__(self, filename)
         self.__samplerate__ = 0
@@ -378,7 +378,7 @@ class FlacAudio(AudioFile):
             #Though the official flac binaries grudgingly accept these,
             #such tags are unnecessary and outside the specification
             #so I will encourage people to remove them.
-            
+
             file.seek(-4,1)
             ID3v2Comment.skip(file)
             if (file.read(4) == 'fLaC'):
@@ -410,7 +410,7 @@ class FlacAudio(AudioFile):
         try:
             if (f.read(4) != 'fLaC'):
                 raise FlacException('invalid FLAC file')
-            
+
             blocks = []
 
             while (True):
@@ -427,9 +427,9 @@ class FlacAudio(AudioFile):
 
     def set_metadata(self, metadata):
         import tempfile
-        
+
         metadata = FlacMetaData.converted(metadata)
-        
+
         if (metadata == None): return
 
         #port over the old STREAMINFO and SEEKTABLE blocks
@@ -448,7 +448,7 @@ class FlacAudio(AudioFile):
 
         if (stream.read(4) != 'fLaC'):
             raise FlacException('invalid FLAC file')
-        
+
         block = FlacAudio.METADATA_BLOCK_HEADER.parse_stream(stream)
         while (block.last_block == 0):
             stream.seek(block.block_length,1)
@@ -471,7 +471,7 @@ class FlacAudio(AudioFile):
     def __read_flac_header__(cls, flacfile):
         p = FlacAudio.METADATA_BLOCK_HEADER.parse(flacfile.read(4))
         return (p.last_block, p.block_type, p.block_length)
-    
+
     def to_pcm(self):
         sub = subprocess.Popen([BIN['flac'],&quot;-s&quot;,&quot;-d&quot;,&quot;-c&quot;,
                                 &quot;--force-raw-format&quot;,
@@ -540,7 +540,7 @@ class FlacAudio(AudioFile):
             foreign_metadata = []
 
         devnull = file(os.devnull,'ab')
-        
+
         sub = subprocess.Popen([BIN['flac'],&quot;-s&quot;,&quot;-f&quot;] + \
                                foreign_metadata + \
                                [&quot;-d&quot;,&quot;-o&quot;,wave_filename,
@@ -596,7 +596,7 @@ class FlacAudio(AudioFile):
         (stop,header_type,length) = FlacAudio.__read_flac_header__(f)
         if (header_type != 0):
             raise FlacException(&quot;STREAMINFO not first metadata block&quot;)
-    
+
         p = FlacAudio.STREAMINFO.parse(f.read(length))
 
         md5sum = &quot;&quot;.join([&quot;%.2X&quot; % (x) for x in p.md5]).lower()
@@ -617,7 +617,7 @@ class FlacAudio(AudioFile):
                         (track.bits_per_sample() == 16) and
                         ((track.sample_rate() == 44100) or
                          (track.sample_rate() == 48000)))]
-        
+
         if ((len(track_names) &gt; 0) and (BIN.can_execute(BIN['metaflac']))):
             subprocess.call([BIN['metaflac'],'--add-replay-gain'] + \
                             track_names)
@@ -629,7 +629,7 @@ class FlacAudio(AudioFile):
     def replay_gain(self):
         vorbis_metadata = self.get_metadata().vorbis_comment
 
-        if (set(['REPLAYGAIN_TRACK_PEAK', 'REPLAYGAIN_TRACK_GAIN', 
+        if (set(['REPLAYGAIN_TRACK_PEAK', 'REPLAYGAIN_TRACK_GAIN',
                  'REPLAYGAIN_ALBUM_PEAK', 'REPLAYGAIN_ALBUM_GAIN']).issubset(
                 vorbis_metadata.keys())):  #we have ReplayGain data
             try:
@@ -648,7 +648,7 @@ class FlacAudio(AudioFile):
             return self.__md5__ == audiofile.__md5__
         elif (isinstance(audiofile,AudioFile)):
             import md5
-            
+
             p = audiofile.to_pcm()
             m = md5.new()
             s = p.read(BUFFER_SIZE)
@@ -659,7 +659,7 @@ class FlacAudio(AudioFile):
             return m.digest() == self.__md5__
         else:
             return False
-    
+
     #returns a list of (track_number,&quot;start.x-stop.y&quot;) tuples
     #for use by the --cue FLAC decoding option
     #track_number starts from 0, for consistency
@@ -745,7 +745,7 @@ class OggFlacAudio(FlacAudio):
         FlacAudio.METADATA_BLOCK_HEADER),
                                     Con.Embed(
         FlacAudio.STREAMINFO))
-    
+
     @classmethod
     def is_type(cls, file):
         header = file.read(0x23)
@@ -757,7 +757,7 @@ class OggFlacAudio(FlacAudio):
         stream = OggStreamReader(file(self.filename,&quot;rb&quot;))
         try:
             packets = stream.packets()
-            
+
             blocks = [FlacMetaDataBlock(
                 type=0,
                 data=FlacAudio.STREAMINFO.build(
@@ -773,14 +773,14 @@ class OggFlacAudio(FlacAudio):
                       data=block[FlacAudio.METADATA_BLOCK_HEADER.sizeof():]))
                 if (header.last_block == 1):
                     break
-                
+
             return FlacMetaData(blocks)
         finally:
             stream.close()
 
     def set_metadata(self, metadata):
         import tempfile
-        
+
         comment = FlacMetaData.converted(metadata)
 
         #port over the old STREAMINFO and SEEKTABLE blocks
@@ -858,7 +858,7 @@ class OggFlacAudio(FlacAudio):
             writer.write_page(page_header,page_data)
             sequence_number += 1
 
-            
+
         #now write the rest of the old pages to the new file,
         #re-sequenced and re-checksummed
         for (page,data) in reader.pages(from_beginning=False):
@@ -876,7 +876,7 @@ class OggFlacAudio(FlacAudio):
         new_file.close()
         f.close()
         writer.close()
-        
+
 
     def __read_streaminfo__(self):
         stream = OggStreamReader(file(self.filename,&quot;rb&quot;))
@@ -894,7 +894,7 @@ class OggFlacAudio(FlacAudio):
             self.__header_packets__ = header.header_packets
 
             self.__md5__ = &quot;&quot;.join([chr(c) for c in header.md5])
-            
+
             del(packets)
         finally:
             stream.close()
@@ -994,7 +994,7 @@ class OggFlacAudio(FlacAudio):
 
         return OggFlacAudio(filename)
 
-        
+
     @classmethod
     def add_replay_gain(cls, filenames):
         pass</diff>
      <filename>audiotools/__flac__.py</filename>
    </modified>
    <modified>
      <diff>@@ -19,7 +19,7 @@
 
 
 from audiotools import VERSION,Con,cStringIO,sys,re,MetaData,AlbumMetaData,__most_numerous__,DummyAudioFile
-        
+
 #######################
 #XMCD
 #######################
@@ -90,9 +90,9 @@ def parse_xmcd_file(filename):
                                  performer_name=u'',
                                  copyright=u'',
                                  year=entries.get('DYEAR',u'')))
-            
+
             return AlbumMetaData(metadata)
-            
+
     finally:
         file.close()
 
@@ -101,7 +101,7 @@ def parse_xmcd_file(filename):
 #returns an XMCD file as a string
 def build_xmcd_file(audiofiles, discid=None):
     import StringIO
-    
+
     #stream is a file-like object
     #key is a string
     #value is a unicode string
@@ -133,8 +133,8 @@ def build_xmcd_file(audiofiles, discid=None):
             finally:
                 line.close()
                 to_encode.close()
-                
-    
+
+
     audiofiles = sorted(audiofiles,
                         lambda x,y: cmp(x.track_number(),
                                         y.track_number()))
@@ -167,7 +167,7 @@ def build_xmcd_file(audiofiles, discid=None):
     album_list = [file.get_metadata().album_name
                   for file in audiofiles if
                   file.get_metadata() != None]
-    
+
     artist_list = [file.get_metadata().artist_name
                    for file in audiofiles if
                    file.get_metadata() != None]
@@ -184,7 +184,7 @@ def build_xmcd_file(audiofiles, discid=None):
 
     build_key_pair(xmcd,&quot;DTITLE&quot;,u&quot;%s / %s&quot; % (artist,album))
     build_key_pair(xmcd,&quot;DYEAR&quot;,u&quot;&quot;)
-    
+
     for (i,track) in enumerate(audiofiles):
         metadata = track.get_metadata()
         if (metadata != None):
@@ -195,15 +195,15 @@ def build_xmcd_file(audiofiles, discid=None):
             else:
                 build_key_pair(xmcd,&quot;TTITLE%d&quot; % (i),
                                metadata.track_name)
-                
+
     build_key_pair(xmcd,&quot;EXTDD&quot;,u&quot;&quot;)
     for (i,track) in enumerate(audiofiles):
         build_key_pair(xmcd,&quot;EXTT%d&quot; % (i),u&quot;&quot;)
 
     build_key_pair(xmcd,&quot;PLAYORDER&quot;,u&quot;&quot;)
-    
+
     return xmcd.getvalue()
-    
+
 
 
 #######################
@@ -233,10 +233,10 @@ class DiscID:
     def offsets(self):
         if (self.__offsets__ == None):
             offsets = [150]
-            
+
             for track in self.tracks[0:-1]:
                 offsets.append(track + offsets[-1])
-                
+
             return offsets
         else:
             return self.__offsets__
@@ -251,7 +251,7 @@ class DiscID:
         return str(len(self.tracks)) + &quot; &quot; + \
                &quot; &quot;.join([str(offset) for offset in self.offsets()]) + \
                &quot; &quot; + str((self.length() + self.__lead_in__) / 75)
-    
+
     def __str__(self):
         def __count_digits__(i):
             if (i == 0):
@@ -260,14 +260,14 @@ class DiscID:
                 return (i % 10) + __count_digits__(i / 10)
 
         disc_id = Con.Container()
-        
+
         disc_id.track_count = len(self.tracks)
         disc_id.length = self.length() / 75
-        disc_id.digit_sum = sum([__count_digits__(o / 75) 
+        disc_id.digit_sum = sum([__count_digits__(o / 75)
                                  for o in self.offsets()]) % 0xFF
 
         return DiscID.DISCID.build(disc_id).encode('hex')
-        
+
     def freedb_id(self):
         return str(self) + &quot; &quot; + self.idsuffix()
 
@@ -280,7 +280,7 @@ class FreeDBException(Exception): pass
 
 class FreeDB:
     LINE = re.compile(r'\d\d\d\s.+')
-    
+
     def __init__(self, server, port):
         self.server = server
         self.port = port
@@ -290,15 +290,15 @@ class FreeDB:
 
     def connect(self):
         import socket
-        
+
         try:
             print &gt;&gt;sys.stderr,&quot;* Connecting to \&quot;%s\&quot;&quot; % (self.server)
             self.socket = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
             self.socket.connect((self.server,self.port))
-            
+
             self.r = self.socket.makefile(&quot;rb&quot;)
             self.w = self.socket.makefile(&quot;wb&quot;)
-            
+
             (code,msg) = self.read()  #the welcome message
             if (code == 201):
                 print &gt;&gt;sys.stderr,&quot;* Connected ... attempting to login&quot;
@@ -307,7 +307,7 @@ class FreeDB:
                 self.w.close()
                 self.socket.close()
                 raise FreeDBException(&quot;Invalid Hello Message&quot;)
-            
+
             self.write(&quot;cddb hello user %s %s %s&quot; % \
                        (socket.getfqdn(),&quot;audiotools&quot;,VERSION))
 
@@ -317,25 +317,25 @@ class FreeDB:
                 self.w.close()
                 self.socket.close()
                 raise FreeDBException(&quot;Handshake unsuccessful&quot;)
-            
+
             self.write(&quot;proto 6&quot;)
-            
+
             (code,msg) = self.read()  #the protocol successful message
             if ((code != 200) and (code != 201)):
                 self.r.close()
                 self.w.close()
                 self.socket.close()
                 raise FreeDBException(&quot;Protocol change unsuccessful&quot;)
-            
+
         except socket.error,err:
             raise FreeDBException(err[1])
 
     def close(self):
         print &gt;&gt;sys.stderr,&quot;* Closing connection&quot;
-        
+
         self.write(&quot;quit&quot;)
         (code,msg) = self.read()  #the quit successful message
-        
+
         self.r.close()
         self.w.close()
         self.socket.close()
@@ -357,7 +357,7 @@ class FreeDB:
         matches = []
 
         print &gt;&gt;sys.stderr,&quot;* Sending ID to server&quot;
-        
+
         self.write(&quot;cddb query &quot; + disc_id.freedb_id())
         (code,msg) = self.read()
         if (code == 200):
@@ -398,16 +398,16 @@ class FreeDBWeb(FreeDB):
 
     def connect(self):
         import httplib
-        
+
         self.connection = httplib.HTTPConnection(self.server,self.port)
-        
+
     def close(self):
         if (self.connection != None):
             self.connection.close()
 
     def write(self, line):
         import urllib,socket
-        
+
         u = urllib.urlencode({&quot;hello&quot;:&quot;user %s %s %s&quot; % \
                                       (socket.getfqdn(),
                                        &quot;audiotools&quot;,
@@ -417,9 +417,9 @@ class FreeDBWeb(FreeDB):
 
         try:
             self.connection.request(
-                &quot;POST&quot;, 
-                &quot;/~cddb/cddb.cgi&quot;, 
-                u, 
+                &quot;POST&quot;,
+                &quot;/~cddb/cddb.cgi&quot;,
+                u,
                 {&quot;Content-type&quot;:&quot;application/x-www-form-urlencoded&quot;,
                  &quot;Accept&quot;: &quot;text/plain&quot;})
         except socket.error,msg:
@@ -434,12 +434,12 @@ class FreeDBWeb(FreeDB):
             return (int(line[0:3]),line[4:].rstrip(&quot;\r\n&quot;))
         else:
             return (None,line.rstrip(&quot;\r\n&quot;))
-            
+
     def query(self, disc_id):
         matches = []
 
         print &gt;&gt;sys.stderr,&quot;* Sending ID to server&quot;
-        
+
         self.write(&quot;cddb query &quot; + disc_id.freedb_id())
         data =  cStringIO.StringIO(self.read())
         (code,msg) = self.__parse_line__(data.readline())
@@ -457,7 +457,7 @@ class FreeDBWeb(FreeDB):
             print &gt;&gt;sys.stderr,&quot;* %s matches found&quot; % (len(matches))
 
         return map(lambda m: m.split(&quot; &quot;,2), matches)
-        
+
     #category and id are raw strings, as returned by query()
     #output is a file handle the output will be written to
     def read_data(self, category, id, output):
@@ -471,7 +471,7 @@ class FreeDBWeb(FreeDB):
                 line = data.readline()
         else:
             print &gt;&gt;sys.stderr,(code,msg)
-    
+
 
 #matches is a list of (category,disc_id,title) tuples returned from
 #FreeDB.query().  If the length of that list is 1, return the first
@@ -521,7 +521,7 @@ def get_xmcd(disc_id, output, freedb_server, freedb_server_port,
         #freedb will auto-close its sockets
         output.close()
         raise IOError(str(msg))
-        
+
     try:
         matches = freedb.query(disc_id)
         #HANDLE MULTIPLE MATCHES, or NO MATCHES
@@ -531,16 +531,16 @@ def get_xmcd(disc_id, output, freedb_server, freedb_server_port,
             else:
                 (category,idstring,title) = __select_default_match__(
                     matches,default_selection)
-                
+
             freedb.read_data(category,idstring,output)
         else:
             disc_id.toxmcd(output)
-        
+
         freedb.close()
     except FreeDBException,msg:
         #otherwise, close the sockets manually
         freedb.close()
         raise IOError(str(msg))
-        
+
     output.close()
     print &gt;&gt;sys.stderr,&quot;* %s written&quot; % (output.name)</diff>
      <filename>audiotools/__freedb__.py</filename>
    </modified>
    <modified>
      <diff>@@ -53,7 +53,7 @@ class ID3v2Comment(MetaData,dict):
                                 Con.StrictRepeater(8,
                                                    Con.Flag(&quot;flag&quot;)))),
                               Syncsafe32(&quot;length&quot;))
-  
+
     FRAME_HEADER = Con.Struct(&quot;id3v24_frame&quot;,
                               Con.Bytes(&quot;frame_id&quot;,4),
                               Syncsafe32(&quot;frame_size&quot;),
@@ -78,15 +78,15 @@ class ID3v2Comment(MetaData,dict):
                      'artist_name':'TPE1',
                      'performer_name':'TPE2',
                      'year':'TDRC'}
-    
+
     ITEM_MAP = dict(map(reversed,ATTRIBUTE_MAP.items()))
-    
+
     #takes a filename
     #returns an ID3v2Comment-based object
     @classmethod
-    def read_id3v2_comment(cls, filename):        
+    def read_id3v2_comment(cls, filename):
         f = file(filename,&quot;rb&quot;)
-        
+
         try:
              frames = {}
 
@@ -115,7 +115,7 @@ class ID3v2Comment(MetaData,dict):
 
         finally:
             f.close()
-    
+
     #takes a stream of ID3v2 data
     #returns a (frame id,frame data) tuple
     #raises EndOfID3v2Stream if we've reached the end of valid frames
@@ -196,7 +196,7 @@ class ID3v2Comment(MetaData,dict):
                                         metadata.get(&quot;TRK&quot;,[u&quot;0&quot;]))[0])
         except ValueError:
             tracknum = 0
-        
+
 
         images = []
         if (metadata.has_key('APIC')):
@@ -225,31 +225,31 @@ class ID3v2Comment(MetaData,dict):
                     pic = PICImage.PIC_FRAME.parse(pic_frame)
                 except Con.RangeError:
                     continue
-                
+
                 images.append(PICImage(data=pic.data,
                                        format=pic.format.decode('ascii'),
                                        description=pic.description.decode(
                     ('ascii','utf-16')[pic.text_encoding]),
                                        pic_type=pic.picture_type))
-                            
+
         MetaData.__init__(self,
                           track_name=metadata.get(&quot;TIT2&quot;,
                                                   metadata.get(&quot;TT2&quot;,[u&quot;&quot;]))[0],
-                          
+
                           track_number=tracknum,
-                          
+
                           album_name=metadata.get(&quot;TALB&quot;,
                                                   metadata.get(&quot;TAL&quot;,[u&quot;&quot;]))[0],
-                          
+
                           artist_name=metadata.get(&quot;TPE1&quot;,
                                        metadata.get(&quot;TP1&quot;,
                                         metadata.get(&quot;TOPE&quot;,
                                          metadata.get(&quot;TCOM&quot;,
                                           metadata.get(&quot;TOLY&quot;,
-                                           metadata.get(&quot;TEXT&quot;,               
+                                           metadata.get(&quot;TEXT&quot;,
                                             metadata.get(&quot;TOA&quot;,
                                              metadata.get(&quot;TCM&quot;,[u&quot;&quot;]))))))))[0],
-                                                   
+
                           performer_name=metadata.get(&quot;TPE2&quot;,
                                            metadata.get(&quot;TPE3&quot;,
                                             metadata.get(&quot;TPE4&quot;,
@@ -281,7 +281,7 @@ class ID3v2Comment(MetaData,dict):
     #make sure to update the corresponding attribute
     def __setitem__(self, key, value):
         dict.__setitem__(self, key, value)
-        
+
         if (self.ITEM_MAP.has_key(key)):
             if (key != 'TRCK'):
                 self.__dict__[self.ITEM_MAP[key]] = value[0]
@@ -418,7 +418,7 @@ class ID3v2_3Comment(ID3v2Comment):
                      'artist_name':'TPE1',
                      'performer_name':'TPE2',
                      'year':'TDRC'}
-    
+
     ITEM_MAP = dict(map(reversed,ATTRIBUTE_MAP.items()))
 
     #takes a stream of ID3v2 data
@@ -499,7 +499,7 @@ class ID3v2_3Comment(ID3v2Comment):
             tag.frame_size = len(t_s)
 
             tags.append(cls.FRAME_HEADER.build(tag) + t_s)
-        
+
         header = Con.Container()
         header.experimental = False
         header.extended_header = False
@@ -528,7 +528,7 @@ class ID3v2_2Comment(ID3v2Comment):
                      'artist_name':'TP1',
                      'performer_name':'TP2',
                      'year':'TYE'}
-    
+
     ITEM_MAP = dict(map(reversed,ATTRIBUTE_MAP.items()))
 
     @classmethod
@@ -630,7 +630,7 @@ class ID3v2_2Comment(ID3v2Comment):
             tag.frame_size = len(t_s)
 
             tags.append(cls.FRAME_HEADER.build(tag) + t_s)
-        
+
         header = Con.Container()
         header.experimental = False
         header.extended_header = False
@@ -709,7 +709,7 @@ class APICImage(Image):
                 repr(self.color_depth),repr(self.color_count))
 
     @classmethod
-    def converted(cls, image):  
+    def converted(cls, image):
         return APICImage(data=image.data,
                          mime_type=image.mime_type,
                          description=image.description,
@@ -722,7 +722,7 @@ class APICImage(Image):
         except UnicodeEncodeError:
             description = self.description.encode('utf-8')
             text_encoding = 3
-        
+
         return self.APIC_FRAME.build(
             Con.Container(text_encoding=text_encoding,
                           mime_type=self.mime_type.encode('ascii','replace'),
@@ -744,7 +744,7 @@ class PICImage(Image):
     #data is a string
     def __init__(self, data, format, description, pic_type):
         img = Image.new(data,u'',0)
-        
+
         self.pic_type = pic_type
         self.format = format
         Image.__init__(self,
@@ -786,7 +786,7 @@ class PICImage(Image):
                 repr(self.pic_type))
 
     @classmethod
-    def converted(cls, image):  
+    def converted(cls, image):
         return PICImage(data=image.data,
                         format={u&quot;image/png&quot;:u&quot;PNG&quot;,
                                 u&quot;image/jpeg&quot;:u&quot;JPG&quot;,
@@ -805,7 +805,7 @@ class PICImage(Image):
         except UnicodeEncodeError:
             description = self.description.encode('utf-16')
             text_encoding = 1
-        
+
         return self.PIC_FRAME.build(
             Con.Container(text_encoding=text_encoding,
                           format=self.format.encode('ascii'),
@@ -825,7 +825,7 @@ class ID3v1Comment(MetaData,list):
       Con.Padding(1),
       Con.Byte(&quot;track_number&quot;),
       Con.Byte(&quot;genre&quot;))
-  
+
     ID3v1_NO_TRACKNUMBER = Con.Struct(&quot;id3v1_notracknumber&quot;,
       Con.Const(Con.String(&quot;identifier&quot;,3),'TAG'),
       Con.String(&quot;song_title&quot;,30),
@@ -841,7 +841,7 @@ class ID3v1Comment(MetaData,list):
                   'year',
                   'comment',
                   'track_number']
-    
+
     #takes an open mp3 file object
     #returns a (song title, artist, album, year, comment, track number) tuple
     #if no ID3v1 tag is present, returns a tuple with those fields blank
@@ -866,7 +866,7 @@ class ID3v1Comment(MetaData,list):
                           id3v1.album,
                           id3v1.year,
                           id3v1.comment)
-            
+
             return tuple(map(lambda t:
                              t.rstrip('\x00').decode('ascii','replace'),
                              field_list) + [id3v1.track_number])
@@ -914,7 +914,7 @@ class ID3v1Comment(MetaData,list):
     #make sure to update the corresponding list item
     def __setattr__(self, key, value):
         self.__dict__[key] = value
-        
+
         if (key in self.ATTRIBUTES):
             if (key != 'track_number'):
                 self[self.ATTRIBUTES.index(key)] = value
@@ -925,7 +925,7 @@ class ID3v1Comment(MetaData,list):
     #make sure to update the corresponding attribute
     def __setitem__(self, key, value):
         list.__setitem__(self, key, value)
-        
+
         if (key &lt; len(self.ATTRIBUTES)):
             if (key != 5):
                 self.__dict__[self.ATTRIBUTES[key]] = value
@@ -986,12 +986,12 @@ class ID3CommentPair(MetaData):
 
     def __setattr__(self, key, value):
         self.__dict__[key] = value
-        
+
         if (self.id3v2 is not None):
             setattr(self.id3v2,key,value)
         if (self.id3v1 is not None):
             setattr(self.id3v1,key,value)
-        
+
     @classmethod
     def converted(cls, metadata):
         if ((metadata is None) or (isinstance(metadata,ID3CommentPair))):
@@ -1004,7 +1004,7 @@ class ID3CommentPair(MetaData):
             return ID3CommentPair(
                 ID3v2_3Comment.converted(metadata),
                 ID3v1Comment.converted(metadata))
-            
+
 
     def __unicode__(self):
         if ((self.id3v2 != None) and (self.id3v1 != None)):
@@ -1027,7 +1027,7 @@ class ID3CommentPair(MetaData):
             return self.id3v2.images()
         else:
             return []
-    
+
     def add_image(self, image):
         if (self.id3v2 is not None):
             self.id3v2.add_image(image)</diff>
      <filename>audiotools/__id3__.py</filename>
    </modified>
    <modified>
      <diff>@@ -125,7 +125,7 @@ class __JPEG__(ImageMetrics):
                         file.read(segment.length - 2))
                     frame0 = cls.SOF.parse_stream(segment_data)
                     segment_data.close()
-                    
+
                     return __JPEG__(width = frame0.image_width,
                                     height = frame0.image_height,
                                     bits_per_pixel = (frame0.data_precision * \
@@ -211,7 +211,7 @@ class __PNG__(ImageMetrics):
             return __PNG__(ihdr.width,ihdr.height,bits_per_pixel,color_count)
         except Con.ConstError:
             raise InvalidPNG('invalid PNG')
-        
+
 #######################
 #BMP
 #######################
@@ -242,7 +242,7 @@ class __BMP__(ImageMetrics):
     def __init__(self, width, height, bits_per_pixel, color_count):
         ImageMetrics.__init__(self, width, height, bits_per_pixel, color_count,
                               u'image/x-ms-bmp')
-        
+
     @classmethod
     def parse(cls, file):
         try:
@@ -252,7 +252,7 @@ class __BMP__(ImageMetrics):
             return __BMP__(information.width, information.height,
                            information.bits_per_pixel,
                            information.colors_used)
-        
+
         except Con.ConstError:
             raise InvalidBMP('invalid BMP')
 
@@ -348,7 +348,7 @@ class __TIFF__(ImageMetrics):
                                 Con.UBInt32(&quot;high&quot;),
                                 Con.UBInt32(&quot;low&quot;))}[tag.type]
 
-        
+
         data = Con.StrictRepeater(tag.count,
                                   subtype)
         if ((tag.type != 2) and (data.sizeof() &lt;= 4)):
@@ -367,7 +367,7 @@ class __TIFF__(ImageMetrics):
                                 Con.ULInt32(&quot;high&quot;),
                                 Con.ULInt32(&quot;low&quot;))}[tag.type]
 
-        
+
         data = Con.StrictRepeater(tag.count,
                                   subtype)
         if ((tag.type != 2) and (data.sizeof() &lt;= 4)):
@@ -382,7 +382,7 @@ class __TIFF__(ImageMetrics):
         height = 0
         bits_per_sample = 0
         color_count = 0
-        
+
         try:
             header = cls.HEADER.parse_stream(file)
             if (header.byte_order == 'II'):</diff>
      <filename>audiotools/__image__.py</filename>
    </modified>
    <modified>
      <diff>@@ -42,7 +42,7 @@ except ImportError:
         print &gt;&gt;sys.stderr,&quot;&quot;&quot;To remedy this: \&quot;make construct_install\&quot;
 from the audiotools source directory to install the Construct module.&quot;&quot;&quot;
         sys.exit(1)
-    
+
 
 class RawConfigParser(ConfigParser.RawConfigParser):
     def get_default(self, section, option, default):
@@ -125,7 +125,7 @@ class UnsupportedFile(Exception): pass
 #raised if an audio file cannot be initialized correctly
 class InvalidFile(Exception): pass
 
-#raised if an audio file cannot be created correctly from from_pcm() 
+#raised if an audio file cannot be created correctly from from_pcm()
 class InvalidFormat(Exception): pass
 
 #takes a filename string
@@ -143,7 +143,7 @@ def open(filename):
                     return audioclass(filename)
             else:
                 raise UnsupportedFile(filename)
-        
+
         finally:
             f.close()
     except IOError:
@@ -192,10 +192,10 @@ class PCMReader:
 
     def close(self):
         self.file.close()
-        
+
         if (self.process != None):
             self.process.wait()
-        
+
 
 
 #sends BUFFER_SIZE strings from from_function to to_function
@@ -235,13 +235,13 @@ def threaded_transfer_data(from_function, to_function):
 #takes a wave-compatible object with a readframes() method
 #maps it to something PCMReader compatible
 class FrameReader(PCMReader):
-    def __init__(self, framefile, 
+    def __init__(self, framefile,
                  sample_rate, channels, bits_per_sample,
                  process=None):
         PCMReader.__init__(self,
                            file=framefile,
-                           sample_rate=sample_rate, 
-                           channels=channels, 
+                           sample_rate=sample_rate,
+                           channels=channels,
                            bits_per_sample=bits_per_sample,
                            process=process)
         self.framefile = framefile
@@ -291,7 +291,7 @@ def pcm_cmp(pcmreader1, pcmreader2):
         else:
             s1 = reader1.read(BUFFER_SIZE)
             s2 = reader2.read(BUFFER_SIZE)
-    
+
     return True
 
 #returns True if the PCM data in pcmreader1 equals pcmreader2
@@ -306,7 +306,7 @@ def stripped_pcm_cmp(pcmreader1, pcmreader2):
     import sha
 
     data = cStringIO.StringIO()
-    
+
     d = pcmreader1.read(BUFFER_SIZE)
     while (len(d) &gt; 0):
         data.write(d)
@@ -315,12 +315,12 @@ def stripped_pcm_cmp(pcmreader1, pcmreader2):
     sum1 = sha.new(data.getvalue().strip(chr(0x00)))
 
     data = cStringIO.StringIO()
-    
+
     d = pcmreader2.read(BUFFER_SIZE)
     while (len(d) &gt; 0):
         data.write(d)
         d = pcmreader2.read(BUFFER_SIZE)
-    
+
     sum2 = sha.new(data.getvalue().strip(chr(0x00)))
 
     del(data)
@@ -333,7 +333,7 @@ class PCMCat(PCMReader):
     #returns their data concatted together
     def __init__(self, pcmreaders):
         self.reader_queue = pcmreaders
-        
+
         try:
             self.first = self.reader_queue.next()
         except StopIteration:
@@ -342,7 +342,7 @@ class PCMCat(PCMReader):
         self.sample_rate = self.first.sample_rate
         self.channels = self.first.channels
         self.bits_per_sample = self.first.bits_per_sample
-    
+
     def read(self, bytes):
         try:
             s = self.first.read(bytes)
@@ -377,7 +377,7 @@ class __buffer__:
 
     def pop(self):
         return self.buffer.pop(0)
-            
+
     def unpop(self, s):
         self.buffer.insert(0,s)
 
@@ -414,8 +414,8 @@ class BufferedPCMReader(PCMReader):
                 self.buffer.push(s)
             else:
                 self.reader_finished = True
-            
-            
+
+
 
 #takes a PCMReader and a list of reader lengths (in PCM samples)
 #returns an iterator of PCMReader-compatible objects, each limited
@@ -473,20 +473,20 @@ class PCMConverter(PCMReader):
             self.input.sample_rate != self.sample_rate)
 
         self.bytes_per_sample = self.bits_per_sample / 8
-        
+
         self.leftover_samples = []
 
 
         self.conversions = []
         if (self.input.channels != self.channels):
             self.conversions.append(self.convert_channels)
-            
+
         if (self.input.sample_rate != self.sample_rate):
             self.resampler = pcmstream.Resampler(
                 self.channels,
                 float(self.sample_rate) / float(self.input.sample_rate),
                 0)
-            
+
             self.unresampled = []
 
             #if we're converting sample rate and bits-per-sample
@@ -496,20 +496,20 @@ class PCMConverter(PCMReader):
                 self.conversions.append(self.convert_sample_rate_and_bits_per_sample)
             else:
                 self.conversions.append(self.convert_sample_rate)
-        
+
         else:
             if (self.input.bits_per_sample != self.bits_per_sample):
                 self.conversions.append(self.convert_bits_per_sample)
-        
-        
+
+
     def read(self, bytes):
         (frame_list,self.leftover_samples) = FrameList.from_samples(
             self.leftover_samples + self.reader.read(bytes),
             self.input.channels)
-        
+
         for converter in self.conversions:
             frame_list = converter(frame_list)
-            
+
         return pcmstream.pcm_to_string(frame_list,self.bytes_per_sample,False)
 
     def close(self):
@@ -522,9 +522,9 @@ class PCMConverter(PCMReader):
         #anyway, this should speed up the conversion without
         #damaging anything.
         #Just be careful when using this routine elsewhere.
-        
+
         difference = self.bits_per_sample - self.input.bits_per_sample
-        
+
         if (difference &lt; 0):   #removing bits per sample
             bits_difference = -difference
 
@@ -536,7 +536,7 @@ class PCMConverter(PCMReader):
                                for i in xrange(len(frame_list))]
             else:
                 white_noise = [0] * len(frame_list)
-                
+
 
             return [(s &gt;&gt; bits_difference) ^ w for (s,w) in izip(frame_list,
                                                                  white_noise)]
@@ -555,7 +555,7 @@ class PCMConverter(PCMReader):
             channels = []
             for i in xrange(self.channels):
                 channels.append(frame_list.channel(i))
-            
+
             return FrameList.from_channels(channels)
         else:                #adding new channels
             channels = list(frame_list.channels())
@@ -566,7 +566,7 @@ class PCMConverter(PCMReader):
 
     def convert_sample_rate(self, frame_list):
         multiplier = 1 &lt;&lt; (self.bits_per_sample - 1)
-        
+
         #FIXME - The floating-point output from resampler.process()
         #should be normalized rather than just chopping off
         #excessively high or low samples (above 1.0 or below -1.0)
@@ -577,7 +577,7 @@ class PCMConverter(PCMReader):
         (output,self.unresampled) = self.resampler.process(
             self.unresampled + frame_list,
             (len(frame_list) == 0) and (len(self.unresampled) == 0))
-        
+
         return [int(round(s * multiplier)) for s in output]
 
 
@@ -603,7 +603,7 @@ class PCMConverter(PCMReader):
                                for i in xrange(len(frame_list))]
             else:
                 white_noise = [0] * len(frame_list)
-            
+
             return [int(round(s * multiplier)) ^ w
                     for (s,w) in izip(frame_list,white_noise)]
 
@@ -625,7 +625,7 @@ class ReplayGainReader(PCMReader):
         self.reader = pcmstream.PCMStreamReader(pcmreader,
                                                 pcmreader.bits_per_sample / 8,
                                                 False, False)
-        
+
         PCMReader.__init__(self, None,
                            pcmreader.sample_rate,
                            pcmreader.channels,
@@ -654,7 +654,7 @@ class ReplayGainReader(PCMReader):
             white_noise = [0] * len(samples)
 
         return pcmstream.pcm_to_string(
-            [(int(round(s * multiplier)) ^ w) for (s,w) in 
+            [(int(round(s * multiplier)) ^ w) for (s,w) in
              izip(samples,white_noise)],
             self.bytes_per_sample,
             False)
@@ -669,17 +669,17 @@ class ReplayGainReader(PCMReader):
 class InterruptableReader(PCMReader):
     def __init__(self, pcmreader):
         import threading,Queue,signal
-        
+
         PCMReader.__init__(self, pcmreader,
                            sample_rate=pcmreader.sample_rate,
                            channels=pcmreader.channels,
                            bits_per_sample=pcmreader.bits_per_sample)
-        
+
         self.stop_reading = False
         self.data_queue = Queue.Queue()
 
         self.old_sigint = signal.signal(signal.SIGINT,self.stop)
-        
+
         thread = threading.Thread(target=self.send_data)
         thread.setDaemon(True)
         thread.start()
@@ -696,7 +696,7 @@ class InterruptableReader(PCMReader):
         #try to use a half second long buffer
         BUFFER_SIZE = self.sample_rate * (self.bits_per_sample / 8) * \
                       self.channels / 2
-        
+
         s = self.file.read(BUFFER_SIZE)
         while ((len(s) &gt; 0) and (not self.stop_reading)):
             self.data_queue.put(s)
@@ -729,7 +729,7 @@ class FrameList(list):
         l_repr = list.__repr__(self)
         if (len(l_repr) &gt; 20):
             l_repr = l_repr[0:17] + &quot;...&quot;
-        
+
         return &quot;FrameList(%s,%s)&quot; % (l_repr,
                                      repr(self.total_channels))
 
@@ -779,9 +779,9 @@ class FrameList(list):
 
         for (i,c) in enumerate(channels):
             data[i::len(channels)] = c
-            
+
         return FrameList(data,len(channels))
-        
+
 
     #takes a list of frame lists,
     #each containing one PCM sample per channel
@@ -836,7 +836,7 @@ class MetaData:
             self.__dict__['__images__'] = list(images)
         else:
             self.__dict__['__images__'] = list()
-            
+
 
     def __repr__(self):
         return &quot;MetaData(%s,%s,%s,%s,%s,%s,%s)&quot; % \
@@ -887,7 +887,7 @@ class MetaData:
 
     def __eq__(self, metadata):
         import operator
-        
+
         if (metadata is not None):
             return reduce(operator.and_,
                           [(getattr(self,attr) == getattr(metadata,attr))
@@ -1229,7 +1229,7 @@ class DummyAudioFile(AudioFile):
     def __init__(self, length, metadata):
         self.__length__ = length
         self.__metadata__ = metadata
-        
+
         AudioFile.__init__(self,&quot;&quot;)
 
     def get_metadata(self):
@@ -1249,12 +1249,12 @@ from __flac__ import *
 from __ape__ import *
 from __id3__ import *
 from __mp3__ import *
-from __vorbis__ import *        
+from __vorbis__ import *
 from __m4a__ import *
 from __wavpack__ import *
 from __musepack__ import *
 from __speex__ import *
-    
+
 #######################
 #CD data
 #######################
@@ -1308,7 +1308,7 @@ class CDTrackLog(dict):
     #log format is similar to cdda2wav's
     def __str__(self):
         return &quot;, &quot;.join([&quot;%%(%s)d %s&quot; % (field,field)
-                          for field in 
+                          for field in
                           (&quot;rderr&quot;,&quot;skip&quot;,&quot;atom&quot;,&quot;edge&quot;,
                            &quot;drop&quot;,&quot;dup&quot;,&quot;drift&quot;)]) % \
                            {&quot;edge&quot;:self.get(2,0),
@@ -1376,7 +1376,7 @@ class CDTrackReader(PCMReader):
         #(divisible by 2352 bytes, basically)
         #or at least 1 sector's worth, if &quot;bytes&quot; is too small
         return self.__read_sectors__(max(bytes / 2352,1))
-            
+
 
     def close(self):
         pass
@@ -1403,7 +1403,7 @@ class ExecQueue:
 
     def execute(self, function, args, kwargs=None):
         self.todo.append((function,args,kwargs))
- 
+
     def __run__(self, function, args, kwargs):
         pid = os.fork()
         if (pid &gt; 0):  #parent
@@ -1425,7 +1425,7 @@ class ExecQueue:
             (function,args,kwargs) = self.todo.pop(0)
             process_pool.add(self.__run__(function,args,kwargs))
             #print &quot;Filling %s&quot; % (repr(process_pool))
-         
+
         #as processes end, keep adding new ones to the pool
         #until we run out of queued jobs
 
@@ -1458,6 +1458,6 @@ AVAILABLE_TYPES = (FlacAudio,OggFlacAudio,
                    VorbisAudio,SpeexAudio,MusepackAudio,
                    AiffAudio,AuAudio,M4AAudio,WavPackAudio)
 
-TYPE_MAP = dict([(track_type.SUFFIX,track_type) 
+TYPE_MAP = dict([(track_type.SUFFIX,track_type)
                  for track_type in AVAILABLE_TYPES
                  if track_type.has_binaries(BIN)]); del(track_type)</diff>
      <filename>audiotools/__init__.py</filename>
    </modified>
    <modified>
      <diff>@@ -28,7 +28,7 @@ from audiotools import AudioFile,InvalidFile,PCMReader,PCMConverter,Con,transfer
 #some of those Atoms are containers for sub-Atoms
 class __Qt_Atom__:
     CONTAINERS = frozenset(
-        ['dinf', 'edts', 'imag', 'imap', 'mdia', 'mdra', 'minf', 
+        ['dinf', 'edts', 'imag', 'imap', 'mdia', 'mdra', 'minf',
          'moov', 'rmra', 'stbl', 'trak', 'tref', 'udta', 'vnrp'])
 
     STRUCT = Con.Struct(&quot;qt_atom&quot;,
@@ -118,7 +118,7 @@ class __Qt_Atom_Stream__(__Qt_Atom__):
     def __init__(self, stream):
         self.stream = stream
         self.atom_class = __Qt_Atom__
-        
+
         __Qt_Atom__.__init__(self,None,None)
 
     def is_container(self):
@@ -150,7 +150,7 @@ def __build_qt_atom__(atom_type, atom_data):
     con.type = atom_type
     con.size = len(atom_data) + __Qt_Atom__.STRUCT.sizeof()
     return __Qt_Atom__.STRUCT.build(con) + atom_data
-    
+
 
 #takes an existing __Qt_Atom__ object (possibly a container)
 #and a __Qt_Atom__ to replace
@@ -225,7 +225,7 @@ class M4AAudio(AudioFile):
     @classmethod
     def is_type(cls, file):
         header = file.read(12)
-        
+
         return ((header[4:8] == 'ftyp') and
                 (header[8:12] in ('mp41','mp42','M4A ','M4B ')))
 
@@ -265,7 +265,7 @@ class M4AAudio(AudioFile):
     def set_metadata(self, metadata):
         metadata = M4AMetaData.converted(metadata)
         if (metadata is None): return
-        
+
         new_file = __replace_qt_atom__(self.qt_stream,
                                        metadata.to_atom())
         f = file(self.filename,&quot;wb&quot;)
@@ -274,7 +274,7 @@ class M4AAudio(AudioFile):
 
         f = file(self.filename,&quot;rb&quot;)
         self.qt_stream = __Qt_Atom_Stream__(f)
-        
+
 
     def to_pcm(self):
         devnull = file(os.devnull,&quot;ab&quot;)
@@ -292,7 +292,7 @@ class M4AAudio(AudioFile):
     @classmethod
     def from_pcm(cls, filename, pcmreader,
                  compression=&quot;100&quot;):
-        
+
 
         if (compression not in cls.COMPRESSION_MODES):
             compression = cls.DEFAULT_COMPRESSION
@@ -328,7 +328,7 @@ class M4AAudio(AudioFile):
                                preexec_fn=ignore_sigint)
         #Note: faac handles SIGINT on its own,
         #so trying to ignore it doesn't work like on most other encoders.
-        
+
         transfer_data(pcmreader.read,sub.stdin.write)
         pcmreader.close()
         sub.stdin.close()
@@ -386,7 +386,7 @@ class M4AMetaData(MetaData,dict):
     #make sure to update the corresponding dict pair
     def __setattr__(self, key, value):
         self.__dict__[key] = value
-        
+
         if (self.ATTRIBUTE_MAP.has_key(key)):
             if (key != 'track_number'):
                 self[self.ATTRIBUTE_MAP[key]] = [value]
@@ -394,14 +394,14 @@ class M4AMetaData(MetaData,dict):
                 trkn = [__Qt_Meta_Atom__.TRKN.build(Con.Container(
                     track_number=int(value),
                     total_tracks=0))]
-                
+
                 self[self.ATTRIBUTE_MAP[key]] = trkn
 
     #if a dict pair is updated (e.g. self['\xa9nam'])
     #make sure to update the corresponding attribute
     def __setitem__(self, key, value):
         dict.__setitem__(self, key, value)
-        
+
         if (self.ITEM_MAP.has_key(key)):
             if (key != 'trkn'):
                 self.__dict__[self.ITEM_MAP[key]] = value[0]
@@ -422,7 +422,7 @@ class M4AMetaData(MetaData,dict):
     def converted(cls, metadata):
         if ((metadata is None) or (isinstance(metadata,M4AMetaData))):
             return metadata
-        
+
         tags = {}
 
         for (key,field) in cls.ITEM_MAP.items():
@@ -437,7 +437,7 @@ class M4AMetaData(MetaData,dict):
 
         if (len(metadata.front_covers()) &gt; 0):
             tags['covr'] = [i.data for i in metadata.front_covers()]
-        
+
         return M4AMetaData(tags)
 
     #returns the contents of this M4AMetaData as a 'meta' atom string
@@ -445,7 +445,7 @@ class M4AMetaData(MetaData,dict):
         hdlr = __build_qt_atom__(
             'hdlr',
             (chr(0) * 8) + 'mdirappl' + (chr(0) * 10))
-        
+
         ilst = []
         for (key,values) in self.items():
             for value in values:
@@ -469,7 +469,7 @@ class M4AMetaData(MetaData,dict):
                            hdlr + \
                            __build_qt_atom__('ilst',&quot;&quot;.join(ilst)) + \
                            __build_qt_atom__('free',chr(0) * 2040))
-                           
+
 
 
     def __comment_name__(self):
@@ -499,7 +499,7 @@ class M4AMetaData(MetaData,dict):
                     pairs.append((key.replace('\xa9',' '),value))
                 elif (key == 'trkn'):
                     tracknumber = __Qt_Meta_Atom__.TRKN.parse(value)
-                    
+
                     pairs.append((key,&quot;%s/%s&quot; % (tracknumber.track_number,
                                                  tracknumber.total_tracks)))
                 else:
@@ -521,7 +521,7 @@ class M4ACovr(Image):
         self.image_data = image_data
 
         img = Image.new(image_data,u'',0)
- 
+
         Image.__init__(self,
                        data=image_data,
                        mime_type=img.mime_type,</diff>
      <filename>audiotools/__m4a__.py</filename>
    </modified>
    <modified>
      <diff>@@ -32,7 +32,7 @@ class MP3Audio(AudioFile):
     DEFAULT_COMPRESSION = &quot;standard&quot;
     COMPRESSION_MODES = (&quot;medium&quot;,&quot;standard&quot;,&quot;extreme&quot;,&quot;insane&quot;)
     BINARIES = (&quot;lame&quot;,)
-    
+
     #MPEG1, Layer 1
     #MPEG1, Layer 2,
     #MPEG1, Layer 3,
@@ -74,7 +74,7 @@ class MP3Audio(AudioFile):
                                   Con.Bits(&quot;copyright&quot;,1),
                                   Con.Bits(&quot;original&quot;,1),
                                   Con.Bits(&quot;emphasis&quot;,2))
-  
+
     XING_HEADER = Con.Struct(&quot;xing_header&quot;,
                              Con.Bytes(&quot;header_id&quot;,4),
                              Con.Bytes(&quot;flags&quot;,4),
@@ -82,7 +82,7 @@ class MP3Audio(AudioFile):
                              Con.UBInt32(&quot;bytes&quot;),
                              Con.StrictRepeater(100,Con.Byte(&quot;toc_entries&quot;)),
                              Con.UBInt32(&quot;quality&quot;))
-    
+
     def __init__(self, filename):
         AudioFile.__init__(self, filename)
 
@@ -95,11 +95,11 @@ class MP3Audio(AudioFile):
             self.__framelength__ = self.__length__()
         finally:
             mp3file.close()
-            
+
     @classmethod
     def is_type(cls, file):
         ID3v2Comment.skip(file)
-        
+
         try:
             frame = cls.MP3_FRAME_HEADER.parse_stream(file)
             return ((frame.sync == 0x07FF) and
@@ -110,7 +110,7 @@ class MP3Audio(AudioFile):
 
     def lossless(self):
         return False
-            
+
     def to_pcm(self):
         if (BIG_ENDIAN):
             endian = ['-x']
@@ -131,7 +131,7 @@ class MP3Audio(AudioFile):
     def from_pcm(cls, filename, pcmreader,
                  compression=&quot;standard&quot;):
         import decimal,bisect
-        
+
         if (compression not in cls.COMPRESSION_MODES):
             compression = cls.DEFAULT_COMPRESSION
 
@@ -143,13 +143,13 @@ class MP3Audio(AudioFile):
                         [32000,44100,48000],pcmreader.sample_rate)],
                 channels=min(pcmreader.channels,2),
                 bits_per_sample=16)
-                        
+
 
         if (pcmreader.channels &gt; 1):
             mode = &quot;j&quot;
         else:
             mode = &quot;m&quot;
-        
+
         sub = subprocess.Popen([BIN['lame'],&quot;--quiet&quot;,
                                 &quot;-r&quot;,&quot;-x&quot;,
                                 &quot;-s&quot;,str(
@@ -166,7 +166,7 @@ class MP3Audio(AudioFile):
         pcmreader.close()
         sub.stdin.close()
         sub.wait()
-        
+
         return MP3Audio(filename)
 
     def bits_per_sample(self):
@@ -202,7 +202,7 @@ class MP3Audio(AudioFile):
 
     def set_metadata(self, metadata):
         metadata = ID3CommentPair.converted(metadata)
-        
+
         if (metadata == None): return
 
         #get the original MP3 data
@@ -237,7 +237,7 @@ class MP3Audio(AudioFile):
                ((ord(b2) &amp; 0xE0) != 0xE0)):
             (b1,b2) = mp3file.read(2)
         mp3file.seek(-2,1)
-    
+
     #places mp3file at the position of the last MP3 frame's end
     #(either the last byte in the file or just before the ID3v1 tag)
     #this may not be strictly accurate if ReplayGain data is present,
@@ -252,7 +252,7 @@ class MP3Audio(AudioFile):
         else:
             mp3file.seek(0,2)
         return
-            
+
     #header is a Construct parsed from 4 bytes sent to MP3_FRAME_HEADER
     #returns the total length of the frame, including the header
     #(subtract 4 when doing a seek or read to the next one)
@@ -262,7 +262,7 @@ class MP3Audio(AudioFile):
 
         bit_rate = MP3Audio.__get_mp3_frame_bitrate__(header)
         if (bit_rate == None): raise MP3Exception(&quot;invalid bit rate&quot;)
-        
+
         sample_rate = MP3Audio.__get_mp3_frame_sample_rate__(header)
 
         #print layer,sample_rate,bit_rate
@@ -319,7 +319,7 @@ class MP3Audio(AudioFile):
     #raises MP3Exception if any portion of the frame is invalid
     def __length__(self):
         mp3file = file(self.filename,&quot;rb&quot;)
-    
+
         try:
             MP3Audio.__find_next_mp3_frame__(mp3file)
 
@@ -392,7 +392,7 @@ class MP2Audio(MP3Audio):
     @classmethod
     def is_type(cls, file):
         ID3v2Comment.skip(file)
-        
+
         try:
             frame = cls.MP3_FRAME_HEADER.parse_stream(file)
 
@@ -409,7 +409,7 @@ class MP2Audio(MP3Audio):
 
         if (compression not in cls.COMPRESSION_MODES):
             compression = cls.DEFAULT_COMPRESSION
-            
+
 
         if ((pcmreader.channels &gt; 2) or
             (pcmreader.sample_rate not in (32000,48000,44100))):
@@ -419,8 +419,8 @@ class MP2Audio(MP3Audio):
                         [32000,44100,48000],pcmreader.sample_rate)],
                 channels=min(pcmreader.channels,2),
                 bits_per_sample=16)
-        
-        
+
+
         sub = subprocess.Popen([BIN['twolame'],&quot;--quiet&quot;,
                                 &quot;-r&quot;,
                                 &quot;-s&quot;,str(pcmreader.sample_rate),
@@ -437,5 +437,5 @@ class MP2Audio(MP3Audio):
         pcmreader.close()
         sub.stdin.close()
         sub.wait()
-        
+
         return MP2Audio(filename)</diff>
      <filename>audiotools/__mp3__.py</filename>
    </modified>
    <modified>
      <diff>@@ -54,25 +54,25 @@ class Musepack8StreamReader:
     NUT_HEADER = Con.Struct('nut_header',
                             Con.String('key',2),
                             NutValue('length'))
-    
+
     def __init__(self, stream):
         self.stream = stream
 
     #iterates over a bunch of (key,data) tuples
     def packets(self):
         import string
-        
+
         UPPERCASE = frozenset(string.ascii_uppercase)
-        
+
         while (True):
             try:
                 frame_header = self.NUT_HEADER.parse_stream(self.stream)
             except Con.core.FieldError:
                 break
-         
+
             if (not frozenset(frame_header.key).issubset(UPPERCASE)):
                 break
-         
+
             yield (frame_header.key,
                    self.stream.read(frame_header.length -
                                     len(self.NUT_HEADER.build(frame_header))))
@@ -85,7 +85,7 @@ class MusepackAudio(ApeTaggedAudio,AudioFile):
 
     ###Musepack SV7###
     BINARIES = ('mppdec','mppenc')
-    
+
     ###Musepack SV8###
     #BINARIES = ('mpcdec','mpcenc')
 
@@ -101,7 +101,7 @@ class MusepackAudio(ApeTaggedAudio,AudioFile):
         Con.Bits('channel_count',4),
         Con.Flag('mid_side_used'),
         Con.Bits('audio_block_frames',3))))
-        
+
 
     #not sure about some of the flag locations
     #Musepack 7's header is very unusual
@@ -154,7 +154,7 @@ class MusepackAudio(ApeTaggedAudio,AudioFile):
 
             else:                     #a Musepack 7 stream
                 f.seek(0,0)
-                
+
                 try:
                     header = MusepackAudio.MUSEPACK7_HEADER.parse_stream(f)
                 except Con.ConstError:
@@ -231,7 +231,7 @@ class MusepackAudio(ApeTaggedAudio,AudioFile):
                                stderr=devnull)
         sub.wait()
         devnull.close()
-        
+
     @classmethod
     def __from_wave__(cls, filename, wave_filename, compression=None):
         if (str(compression) not in cls.COMPRESSION_MODES):
@@ -262,7 +262,7 @@ class MusepackAudio(ApeTaggedAudio,AudioFile):
         #                        &quot;--%s&quot; % (compression),
         #                        wave_filename,
         #                        filename])
-        
+
         sub.wait()
 
         if (tempfile is not None):</diff>
      <filename>audiotools/__musepack__.py</filename>
    </modified>
    <modified>
      <diff>@@ -64,7 +64,7 @@ class SpeexAudio(VorbisAudio):
     @classmethod
     def is_type(cls, file):
         header = file.read(0x23)
-        
+
         return (header.startswith('OggS') and
                 header[0x1C:0x23] == 'Speex  ')
 
@@ -100,7 +100,7 @@ class SpeexAudio(VorbisAudio):
     @classmethod
     def from_pcm(cls, filename, pcmreader, compression=None):
         import bisect
-        
+
         if (compression not in cls.COMPRESSION_MODES):
             compression = cls.DEFAULT_COMPRESSION
 
@@ -143,7 +143,7 @@ class SpeexAudio(VorbisAudio):
 
     def set_metadata(self, metadata):
         comment = VorbisComment.converted(metadata)
-        
+
         if (comment == None): return
 
         reader = OggStreamReader(file(self.filename,'rb'))</diff>
      <filename>audiotools/__speex__.py</filename>
    </modified>
    <modified>
      <diff>@@ -45,13 +45,13 @@ class OggStreamReader:
     def packets(self, from_beginning=True):
         if (from_beginning):
             self.stream.seek(0,0)
-            
+
         segment = cStringIO.StringIO()
 
         while (True):
             try:
                 page = OggStreamReader.OGGS.parse_stream(self.stream)
-            
+
                 for length in page.segment_lengths:
                     if (length == 255):
                         segment.write(self.stream.read(length))
@@ -72,7 +72,7 @@ class OggStreamReader:
     def pages(self, from_beginning=True):
         if (from_beginning):
             self.stream.seek(0,0)
-            
+
         while (True):
             try:
                 page = OggStreamReader.OGGS.parse_stream(self.stream)
@@ -81,7 +81,7 @@ class OggStreamReader:
                 break
             except Con.ConstError:
                 break
-        
+
 
     #takes a page iterator (such as pages(), above)
     #returns a list of (Container,data string) tuples
@@ -92,7 +92,7 @@ class OggStreamReader:
         while (packet[-1][0].segment_lengths[-1] == 255):
             packet.append(pages_iter.next())
         return packet
-    
+
 
     CRC_LOOKUP = (0x00000000,0x04c11db7,0x09823b6e,0x0d4326d9,
                   0x130476dc,0x17c56b6b,0x1a864db2,0x1e475005,
@@ -198,10 +198,10 @@ class OggStreamWriter:
     #returns a list of (page_header,page_data) tuples containing
     #all of the Ogg pages necessary to contain the packet
     @classmethod
-    def build_pages(cls, granule_position, serial_number, 
+    def build_pages(cls, granule_position, serial_number,
                     starting_sequence_number, packet_data,
                     header_type=0):
-        
+
         page = Con.Container()
         page.magic_number = 'OggS'
         page.version = 0
@@ -210,7 +210,7 @@ class OggStreamWriter:
         page.bitstream_serial_number = serial_number
         page.page_sequence_number = starting_sequence_number
         page.checksum = 0
-        
+
         if (len(packet_data) == 0):
             #an empty Ogg page, but possibly a continuation
 
@@ -257,7 +257,7 @@ class OggStreamWriter:
             page.segment_lengths = [255] * (len(packet_data) / 255)
             if ((len(packet_data) % 255) &gt; 0):
                 page.segment_lengths += [len(packet_data) % 255]
-            
+
             page.checksum = OggStreamReader.calculate_ogg_checksum(
                 page,packet_data)
             return [(page,packet_data)]
@@ -272,7 +272,7 @@ class VorbisAudio(AudioFile):
     DEFAULT_COMPRESSION = &quot;3&quot;
     COMPRESSION_MODES = tuple([str(i) for i in range(0,11)])
     BINARIES = (&quot;oggenc&quot;,&quot;oggdec&quot;,&quot;vorbiscomment&quot;)
-    
+
     OGG_IDENTIFICATION = Con.Struct(
         &quot;ogg_id&quot;,
         Con.ULInt32(&quot;vorbis_version&quot;),
@@ -300,7 +300,7 @@ class VorbisAudio(AudioFile):
     @classmethod
     def is_type(cls, file):
         header = file.read(0x23)
-        
+
         return (header.startswith('OggS') and
                 header[0x1C:0x23] == '\x01vorbis')
 
@@ -324,7 +324,7 @@ class VorbisAudio(AudioFile):
                 self.__channels__ = identification.channels
             else:
                 raise InvalidFile('first packet is not vorbis')
-            
+
             #the Comment packet comes next
             comment_packet = packets.next()
             header = VorbisAudio.COMMENT_HEADER.parse(
@@ -415,13 +415,13 @@ class VorbisAudio(AudioFile):
 
     def set_metadata(self, metadata):
         metadata = VorbisComment.converted(metadata)
-        
+
         if (metadata == None): return
 
         sub = subprocess.Popen([BIN['vorbiscomment'],
                                 &quot;-R&quot;,&quot;-w&quot;,self.filename],
                                stdin=subprocess.PIPE)
-        
+
         for (tag,values) in metadata.items():
             for value in values:
                 print &gt;&gt;sub.stdin,&quot;%(tag)s=%(value)s&quot; % \
@@ -446,7 +446,7 @@ class VorbisAudio(AudioFile):
     def add_replay_gain(cls, filenames):
         track_names = [track.filename for track in
                        open_files(filenames) if
-                       isinstance(track,cls)]     
+                       isinstance(track,cls)]
 
         if ((len(track_names) &gt; 0) and
             BIN.can_execute(BIN['vorbisgain'])):
@@ -466,7 +466,7 @@ class VorbisAudio(AudioFile):
     def replay_gain(self):
         vorbis_metadata = self.get_metadata()
 
-        if (set(['REPLAYGAIN_TRACK_PEAK', 'REPLAYGAIN_TRACK_GAIN', 
+        if (set(['REPLAYGAIN_TRACK_PEAK', 'REPLAYGAIN_TRACK_GAIN',
                  'REPLAYGAIN_ALBUM_PEAK', 'REPLAYGAIN_ALBUM_GAIN']).issubset(
                 vorbis_metadata.keys())):  #we have ReplayGain data
             try:</diff>
      <filename>audiotools/__vorbis__.py</filename>
    </modified>
    <modified>
      <diff>@@ -52,7 +52,7 @@ class VorbisComment(MetaData,dict):
             performer_name = vorbis_data.get('PERFORMER',[u''])[0],
             copyright = vorbis_data.get('COPYRIGHT',[u''])[0],
             year = vorbis_data.get('YEAR',[u''])[0])
-                          
+
         dict.__init__(self,vorbis_data)
         self.vendor_string = vendor_string
 
@@ -60,7 +60,7 @@ class VorbisComment(MetaData,dict):
     #make sure to update the corresponding dict pair
     def __setattr__(self, key, value):
         self.__dict__[key] = value
-        
+
         if (self.ATTRIBUTE_MAP.has_key(key)):
             if (key != 'track_number'):
                 self[self.ATTRIBUTE_MAP[key]] = [value]
@@ -71,13 +71,13 @@ class VorbisComment(MetaData,dict):
     #make sure to update the corresponding attribute
     def __setitem__(self, key, value):
         dict.__setitem__(self, key, value)
-        
+
         if (self.ITEM_MAP.has_key(key)):
             if (key != 'TRACKNUMBER'):
                 self.__dict__[self.ITEM_MAP[key]] = value[0]
             else:
                 self.__dict__[self.ITEM_MAP[key]] = int(value[0])
-        
+
 
     @classmethod
     def converted(cls, metadata):</diff>
      <filename>audiotools/__vorbiscomment__.py</filename>
    </modified>
    <modified>
      <diff>@@ -83,7 +83,7 @@ class WavException(InvalidFile): pass
 
 def __blank_channel_mask__():
     c = Con.Container(undefined=0,undefined2=0)
-    
+
     for attr in ('front_right_of_center',
                  'front_left_of_center',
                  'rear_right',
@@ -103,7 +103,7 @@ def __blank_channel_mask__():
                  'top_back_right',
                  'top_back_center'):
         setattr(c,attr,False)
-        
+
     return c
 
 def __channel_mask__(total_channels):
@@ -119,7 +119,7 @@ def __channel_mask__(total_channels):
     c = __blank_channel_mask__()
     for channel in mask[total_channels]:
         setattr(c,channel,True)
-    return c                      
+    return c
 
 class WaveAudio(AudioFile):
     SUFFIX = &quot;wav&quot;
@@ -132,7 +132,7 @@ class WaveAudio(AudioFile):
     CHUNK_HEADER = Con.Struct(&quot;chunk_header&quot;,
                               Con.Bytes(&quot;chunk_id&quot;,4),
                               Con.ULInt32(&quot;chunk_length&quot;))
- 
+
     FMT_CHUNK = Con.Struct(&quot;fmt_chunk&quot;,
                            Con.ULInt16(&quot;compression&quot;),
                            Con.ULInt16(&quot;channels&quot;),
@@ -165,7 +165,7 @@ class WaveAudio(AudioFile):
                                          Con.Flag('side_right'),
                                          Con.Flag('side_left'),
                                          Con.Flag('rear_center'),
-                                         
+
                                          #byte 3
                                          Con.Bits('undefined',6),
                                          Con.Flag('top_back_right'),
@@ -177,7 +177,7 @@ class WaveAudio(AudioFile):
                                   )
                            )
 
-    
+
     def __init__(self, filename):
         AudioFile.__init__(self, filename)
 
@@ -238,7 +238,7 @@ class WaveAudio(AudioFile):
                 fmt.compression = 1
             else:
                 fmt.compression = 0xFFFE
-                
+
             fmt.channels = pcmreader.channels
             fmt.sample_rate = pcmreader.sample_rate
             fmt.bytes_per_second = \
@@ -255,7 +255,7 @@ class WaveAudio(AudioFile):
             fmt.valid_bits_per_sample = pcmreader.bits_per_sample
             fmt.sub_format = &quot;0100000000001000800000aa00389b71&quot;.decode('hex')
             fmt.channel_mask = __channel_mask__(pcmreader.channels)
-            
+
 
             data_header = Con.Container()
             data_header.chunk_id = 'data'
@@ -287,7 +287,7 @@ class WaveAudio(AudioFile):
                 fmt_header.chunk_length + \
                 WaveAudio.CHUNK_HEADER.sizeof() + \
                 data_header.chunk_length
-            
+
             f.write(WaveAudio.WAVE_HEADER.build(header))
             f.write(WaveAudio.CHUNK_HEADER.build(fmt_header))
             f.write(WaveAudio.FMT_CHUNK.build(fmt))
@@ -295,7 +295,7 @@ class WaveAudio(AudioFile):
 
         finally:
             f.close()
-        
+
         return WaveAudio(filename)
 
     def to_wave(self, wave_filename):
@@ -349,11 +349,11 @@ class WaveAudio(AudioFile):
         while (totalsize &gt; 0):
             (chunk_format,chunk_size) = self.__read_chunk_header__(wave_file)
             self.__chunk_ids__.append(chunk_format)
-            
+
             __chunklist__.append(chunk_format)
             #Fix odd-sized chunk sizes to be even
             if ((chunk_size &amp; 1) == 1): chunk_size += 1
-            
+
             if (chunk_format == &quot;fmt &quot;):
                 self.__read_format_chunk__(wave_file, chunk_size)
             elif (chunk_format == &quot;data&quot;):
@@ -367,7 +367,7 @@ class WaveAudio(AudioFile):
             header = WaveAudio.WAVE_HEADER.parse(wave_file.read(12))
         except Con.ConstError:
             raise WavException(&quot;not a RIFF WAVE file&quot;)
-        
+
         return header.wave_size
 
     def __read_chunk_header__(self, wave_file):
@@ -379,7 +379,7 @@ class WaveAudio(AudioFile):
             raise WavException(&quot;fmt chunk is too short&quot;)
 
         fmt = WaveAudio.FMT_CHUNK.parse(wave_file.read(chunk_size))
-        
+
         self.__wavtype__ = fmt.compression
         self.__channels__ = fmt.channels
         self.__samplespersec__ = fmt.sample_rate
@@ -408,7 +408,7 @@ class WaveAudio(AudioFile):
 
             #Fix odd-sized chunks to have 16-bit boundaries
             if ((chunk_size &amp; 1) == 1): chunk_size += 1
-            
+
             yield (chunk_id,wave_file.read(chunk_size))
 
             total_size -= (chunk_size + 8)
@@ -428,7 +428,7 @@ class WaveAudio(AudioFile):
 
         #write an unfinished header with an invalid size (for now)
         f.write(cls.WAVE_HEADER.build(header))
-        
+
         for (chunk_id,chunk_data) in chunk_iter:
 
             #fix odd-sized chunks to fall on 16-bit boundaries
@@ -448,5 +448,5 @@ class WaveAudio(AudioFile):
         f.write(cls.WAVE_HEADER.build(header))
         f.close()
 
-            
-            
+
+</diff>
      <filename>audiotools/__wav__.py</filename>
    </modified>
    <modified>
      <diff>@@ -72,9 +72,9 @@ class WavPackAudio(ApeTaggedAudio,AudioFile):
                         Con.ULInt32(&quot;crc&quot;))
 
     BITS_PER_SAMPLE = (8,16,24,32)
-    SAMPLING_RATE = (6000,  8000,  9600,   11025, 
+    SAMPLING_RATE = (6000,  8000,  9600,   11025,
                      12000, 16000, 22050,  24000,
-                     32000, 44100, 48000,  64000, 
+                     32000, 44100, 48000,  64000,
                      88200, 96000, 192000, 0)
 
 
@@ -106,7 +106,7 @@ class WavPackAudio(ApeTaggedAudio,AudioFile):
                     WavPackAudio.HEADER.sizeof()))
             except Con.ConstError:
                 raise InvalidFile('wavpack header ID invalid')
-        
+
             self.__samplerate__ = WavPackAudio.SAMPLING_RATE[
                 (header.sampling_rate_high &lt;&lt; 1) |
                 header.sampling_rate_low]
@@ -145,14 +145,14 @@ class WavPackAudio(ApeTaggedAudio,AudioFile):
 
     def sample_rate(self):
         return self.__samplerate__
-    
+
     @classmethod
     def from_pcm(cls, filename, pcmreader, compression=None):
         import tempfile
 
         f = tempfile.NamedTemporaryFile(suffix=&quot;.wav&quot;)
         w = WaveAudio.from_pcm(f.name, pcmreader)
-        
+
         try:
             return cls.from_wave(filename,w.filename,compression)
         finally:
@@ -207,7 +207,7 @@ class WavPackAudio(ApeTaggedAudio,AudioFile):
             self.to_wave(f.name)
             f.seek(0,0)
             return TempWaveReader(f)
-        
+
     @classmethod
     def from_wave(cls, filename, wave_filename, compression=None):
         if (str(compression) not in cls.COMPRESSION_MODES):
@@ -227,7 +227,7 @@ class WavPackAudio(ApeTaggedAudio,AudioFile):
             filename = tempfile.name
         else:
             actual_filename = tempfile = None
-    
+
         sub = subprocess.Popen([BIN['wavpack'],
                                 wave_filename] + \
                                compression_param[compression] + \
@@ -251,7 +251,7 @@ class WavPackAudio(ApeTaggedAudio,AudioFile):
     def add_replay_gain(cls, filenames):
         track_names = [track.filename for track in
                        open_files(filenames) if
-                       isinstance(track,cls)]        
+                       isinstance(track,cls)]
 
         if ((len(track_names) &gt; 0) and
             BIN.can_execute(BIN['wvgain'])):
@@ -270,8 +270,8 @@ class WavPackAudio(ApeTaggedAudio,AudioFile):
 
     def replay_gain(self):
         metadata = self.get_metadata()
-        
-        if (set(['replaygain_track_gain', 'replaygain_track_peak', 
+
+        if (set(['replaygain_track_gain', 'replaygain_track_peak',
                  'replaygain_album_gain', 'replaygain_album_peak']).issubset(
                 metadata.keys())):  #we have ReplayGain data
             try:</diff>
      <filename>audiotools/__wavpack__.py</filename>
    </modified>
    <modified>
      <diff>@@ -25,7 +25,7 @@ import re
 
 #This method of cuesheet reading involves a tokenizer and parser,
 #analagous to lexx/yacc.
-#It might be easier to use a line-by-line ad-hoc method for parsing, 
+#It might be easier to use a line-by-line ad-hoc method for parsing,
 #but this brute-force approach should be a bit more thorough.
 
 SPACE = 0x0
@@ -82,7 +82,7 @@ def tokens(cuedata):
                 break
         else:
             break
-                
+
     if (len(cuedata) &gt; 0):
         raise CueException(&quot;invalid token at char %d&quot; % \
                                (full_length - len(cuedata)))
@@ -125,7 +125,7 @@ def parse(tokens):
                 elif (token == 'TRACK'):
                     if (track is not None):
                         cuesheet.tracks[track.number] = track
-                    
+
                     track = Track(get_value(tokens,NUMBER,
                                             &quot;invalid track number&quot;),
                                   get_value(tokens,TAG | STRING,
@@ -143,14 +143,14 @@ def parse(tokens):
                             tokens,
                             STRING | TAG | NUMBER | ISRC,
                             &quot;missing value&quot;)
-                        
+
                         get_value(tokens,EOL,&quot;excess data&quot;)
 
                     elif (token == 'FILE'):
                         filename = get_value(tokens,STRING,&quot;missing filename&quot;)
                         filetype = get_value(tokens,STRING | TAG,
                                              &quot;missing file type&quot;)
-                        
+
                         cuesheet.attribs[token] = (filename,filetype)
 
                         get_value(tokens,EOL,&quot;excess data&quot;)
@@ -190,7 +190,7 @@ def parse(tokens):
                         index_timestamp = get_value(tokens,TIMESTAMP,
                                                     &quot;invalid timestamp&quot;)
                         track.indexes[index_number] = index_timestamp
-                        
+
                         get_value(tokens,EOL,&quot;excess data&quot;)
 
                     elif (token in ('FILE',)):
@@ -199,7 +199,7 @@ def parse(tokens):
                     else:
                         raise CueException(&quot;invalid tag %s at line %d&quot; % \
                                                (token,line_number))
-                    
+
             else:
                 raise CueException(&quot;missing tag at line %d&quot; % (line_number))
     except StopIteration:
@@ -228,7 +228,7 @@ class Cuesheet:
                     previous = index
         else:
             return True
-        
+
 
     #returns an iterator of index lists
     def indexes(self):</diff>
      <filename>audiotools/cue.py</filename>
    </modified>
    <modified>
      <diff>@@ -37,12 +37,12 @@ class UTF8(Con.Struct):
     @classmethod
     def __calculate_utf8_value__(cls, ctx):
         import operator
-    
+
         return Con.lib.bin_to_int(ctx.header[ctx.header.index('\x00') + 1:] + \
                                   reduce(operator.concat,
                                          [s[2:] for s in ctx['sub_byte']],
                                          ''))
-    
+
     def __init__(self, name):
         Con.Struct.__init__(
             self,name,
@@ -94,16 +94,16 @@ class FlacReader:
         lambda ctx1: ctx1['channel_assignment'] &lt;= 7,
         Con.Value('c',lambda ctx2: ctx2['channel_assignment'] + 1),
         Con.Value('c',lambda ctx3: 2)),
-                              
+
                               UTF8('frame_number'),
-                              
+
                               Con.IfThenElse(
         'extended_block_size',
         lambda ctx1: ctx1['block_size'] == 6,
         Con.Bits('b',8),
         Con.If(lambda ctx2: ctx2['block_size'] == 7,
                Con.Bits('b',16))),
-                              
+
                               Con.IfThenElse(
         'extended_sample_rate',
         lambda ctx1: ctx1['sample_rate'] == 12,
@@ -249,7 +249,7 @@ class FlacReader:
             self.bitstream.close()
         else:
             self.stream.close()
-        
+
 
     def read_stream_marker(self):
         if (self.stream.read(4) != 'fLaC'):
@@ -262,19 +262,19 @@ class FlacReader:
                 self.streaminfo = audiotools.FlacAudio.STREAMINFO.parse_stream(self.stream)
             else:
                 self.stream.seek(block.block_length,1)
-                
+
             block = audiotools.FlacAudio.METADATA_BLOCK_HEADER.parse_stream(self.stream)
         self.stream.seek(block.block_length,1)
 
     def begin_bitstream(self):
         import bitstream
-        
+
         #self.bitstream = Con.BitStreamReader(self.stream)
         self.bitstream = bitstream.BitStreamReader(self.stream)
 
     def read_frame(self):
         self.stream.reset_buffer()
-        
+
         try:
             header = FlacReader.FRAME_HEADER.parse_stream(self.bitstream)
         except Con.core.FieldError:
@@ -291,7 +291,7 @@ class FlacReader:
         block_size = FlacReader.BLOCK_SIZE[header.block_size]
         if (block_size == self.GET_BLOCKSIZE_FROM_STREAMINFO):
             block_size = self.streaminfo.maximum_blocksize
-            
+
         elif ((block_size == self.GET_8BIT_BLOCKSIZE_FROM_END_OF_HEADER) or
               (block_size == self.GET_16BIT_BLOCKSIZE_FROM_END_OF_HEADER)):
             block_size = header.extended_block_size + 1
@@ -305,8 +305,8 @@ class FlacReader:
                 self.read_subframe(header, block_size, channel_number))
 
         crc16sum = crc16(self.stream.getvalue())
-        
-            
+
+
         #try to byte-align the stream
         if (len(self.bitstream.buffer) &gt; 0):
             self.bitstream.read(len(self.bitstream.buffer))
@@ -314,8 +314,8 @@ class FlacReader:
 
         if (crc16sum != Con.Bits('crc16',16).parse_stream(self.bitstream)):
             raise FlacStreamException('crc16 checksum failed')
-        
-        
+
+
         #convert our list of subframe data arrays into
         #a string of sample data
         if (FlacReader.SAMPLE_SIZE[header.bits_per_sample] == 16):
@@ -327,22 +327,22 @@ class FlacReader:
                 merged_frames.byteswap()
 
             return merged_frames.tostring()
-        
+
         elif (FlacReader.SAMPLE_SIZE[header.bits_per_sample] == 8):
             merged_frames = array.array('b',
                                         FlacReader.CHANNEL_FUNCTIONS[
                 header.channel_assignment](subframe_data))
 
             return merged_frames.tostring()
-        
+
         else:
             if (FlacReader.SAMPLE_SIZE[header.bits_per_sample] == \
                 self.GET_SAMPLE_SIZE_FROM_STREAMINFO):
                 bits_per_sample = self.streaminfo.bits_per_sample + 1
-                
+
             elif (FlacReader.SAMPLE_SIZE[header.bits_per_sample] == None):
                 raise FlacStreamException('invalid bits per sample')
-            
+
             else:
                 bits_per_sample = FlacReader.SAMPLE_SIZE[header.bits_per_sample]
 
@@ -355,7 +355,7 @@ class FlacReader:
                 [Con.Container(value=v) for v in
                  FlacReader.CHANNEL_FUNCTIONS[header.channel_assignment](
                     subframe_data)])
-            
+
 
 
     def read_subframe(self, frame_header, block_size, channel_number):
@@ -369,21 +369,21 @@ class FlacReader:
             #and this is the difference, add 1 bit
             bits_per_sample = FlacReader.SAMPLE_SIZE[
                 frame_header.bits_per_sample] + 1
-            
+
         elif ((frame_header.channel_assignment == 9) and
               (channel_number == 0)):
             #if channel is stored as difference+right
             #and this is the difference, add 1 bit
             bits_per_sample = FlacReader.SAMPLE_SIZE[
                 frame_header.bits_per_sample] + 1
-            
+
         elif ((frame_header.channel_assignment == 10) and
               (channel_number == 1)):
             #if channel is stored as average+difference
             #and this is the difference, add 1 bit
             bits_per_sample = FlacReader.SAMPLE_SIZE[
                 frame_header.bits_per_sample] + 1
-            
+
         else:
             #otherwise, use the number from the frame header
             bits_per_sample = FlacReader.SAMPLE_SIZE[
@@ -392,25 +392,25 @@ class FlacReader:
 
         if (subframe_header.has_wasted_bits_per_sample):
             bits_per_sample -= subframe_header.wasted_bits_per_sample
-        
+
         if (subframe_header.subframe_type == 0):
             subframe = self.read_subframe_constant(block_size, bits_per_sample)
-            
+
         elif (subframe_header.subframe_type == 1):
             subframe = self.read_subframe_verbatim(block_size, bits_per_sample)
-            
+
         elif ((subframe_header.subframe_type &amp; 0x38) == 0x08):
             subframe = self.read_subframe_fixed(
                 subframe_header.subframe_type &amp; 0x07,
                 block_size,
                 bits_per_sample)
-            
+
         elif ((subframe_header.subframe_type &amp; 0x20) == 0x20):
             subframe = self.read_subframe_lpc(
                 (subframe_header.subframe_type &amp; 0x1F) + 1,
                 block_size,
                 bits_per_sample)
-            
+
         else:
             raise FlacStreamException('invalid subframe type')
 
@@ -425,11 +425,11 @@ class FlacReader:
     def read_subframe_constant(self, block_size, bits_per_sample):
         sample = Con.Bits('b',bits_per_sample).parse_stream(
             self.bitstream)
-        
+
         subframe = array.array('i',[sample] * block_size)
 
         return subframe
-    
+
 
     def read_subframe_verbatim(self, block_size, bits_per_sample):
         return array.array('i',
@@ -446,21 +446,21 @@ class FlacReader:
             Con.Bits(&quot;warm_up_samples&quot;,
                      bits_per_sample,
                      signed=True))
-        
+
         subframe = array.array('i',
                                samples.parse_stream(self.bitstream))
 
         residual = self.read_residual(block_size,order)
 
         fixed_func = self.FIXED_FUNCTIONS[order]
- 
+
         for i in xrange(len(subframe),block_size):
             fixed_func(subframe,residual,i)
-            
+
         return subframe
 
 
-    def read_subframe_lpc(self, order, block_size, bits_per_sample):       
+    def read_subframe_lpc(self, order, block_size, bits_per_sample):
         samples = Con.StrictRepeater(
             order,
             Con.Bits(&quot;warm_up_samples&quot;,
@@ -482,7 +482,7 @@ class FlacReader:
             Con.Bits('coefficients',
                      lpc_precision,
                      signed=True)).parse_stream(self.bitstream))
-        
+
         residual = self.read_residual(block_size, order)
 
         for i in xrange(len(subframe),block_size):
@@ -510,7 +510,7 @@ class FlacReader:
             rice2 = True
         else:
             raise FlacStreamException('invalid residual coding method')
-        
+
         partition_order = Con.Bits('partition_order',4).parse_stream(
             self.bitstream)
 
@@ -518,10 +518,10 @@ class FlacReader:
             total_samples = ((block_size / 2 ** partition_order) -
                              predictor_order)
             rice.extend(self.read_encoded_rice(total_samples,rice2))
-            
+
             for i in xrange(1,2 ** partition_order):
                 total_samples = (block_size / 2 ** partition_order)
-                
+
                 rice.extend(self.read_encoded_rice(total_samples,rice2))
         else:
             rice.extend(self.read_encoded_rice(block_size - predictor_order,
@@ -532,7 +532,7 @@ class FlacReader:
 
     def read_encoded_rice(self, total_samples, rice2=False):
         bin_to_int = Con.lib.binary.bin_to_int
-        
+
         samples = array.array('i')
 
         if (not rice2):
@@ -548,7 +548,7 @@ class FlacReader:
 
                 #count the number of 0 bits before the next 1 bit
                 #(unary encoding)
-                #to find our most significant bits            
+                #to find our most significant bits
                 msb = 0
                 s = self.bitstream.read(1)
                 while (s != '\x01'):
@@ -712,4 +712,4 @@ class FlacPCMReader(audiotools.PCMReader):
 
     def close(self):
         self.flacreader.close()
-        
+</diff>
      <filename>audiotools/flac.py</filename>
    </modified>
    <modified>
      <diff>@@ -90,7 +90,7 @@ class Filter:
         self.input_kernel = input_kernel
         self.output_kernel = output_kernel
 
-        self.unfiltered_samples = [0.0] * len(self.input_kernel)        
+        self.unfiltered_samples = [0.0] * len(self.input_kernel)
         self.filtered_samples = [0.0] * len(self.output_kernel)
 
     #takes a list of floating point samples
@@ -113,13 +113,13 @@ class Filter:
 
             self.filtered_samples.append(filtered)
             toreturn.append(filtered)
-                
+
 
         #if we have more filtered and unfiltered samples than we'll need,
         #chop off the excess at the beginning
         if (len(self.unfiltered_samples) &gt; (len(self.input_kernel))):
             self.unfiltered_samples = self.unfiltered_samples[-len(self.input_kernel):]
-            
+
         if (len(self.filtered_samples) &gt; (len(self.output_kernel))):
             self.filtered_samples = self.filtered_samples[-len(self.output_kernel):]
 
@@ -134,7 +134,7 @@ class EqualLoudnessFilter(audiotools.PCMReader):
             raise ValueError(&quot;channels must equal 2&quot;)
         if (pcmreader.sample_rate not in SAMPLE_RATE_MAP.keys()):
             raise ValueError(&quot;unsupported sample rate&quot;)
-        
+
         self.stream = audiotools.pcmstream.PCMStreamReader(
             pcmreader,
             pcmreader.bits_per_sample / 8,
@@ -156,7 +156,7 @@ class EqualLoudnessFilter(audiotools.PCMReader):
         self.yule_filter_r = Filter(
             BYule[SAMPLE_RATE_MAP[self.sample_rate]],
             AYule[SAMPLE_RATE_MAP[self.sample_rate]])
-        
+
         self.butter_filter_l = Filter(
             BButter[SAMPLE_RATE_MAP[self.sample_rate]],
             AButter[SAMPLE_RATE_MAP[self.sample_rate]])
@@ -178,7 +178,7 @@ class EqualLoudnessFilter(audiotools.PCMReader):
         #run our channel lists through the Yule and Butter filters
         l_channel = self.butter_filter_l.filter(
             self.yule_filter_l.filter(l_channel))
-        
+
         r_channel = self.butter_filter_r.filter(
             self.yule_filter_r.filter(r_channel))
 
@@ -199,11 +199,11 @@ class EqualLoudnessFilter(audiotools.PCMReader):
 def replay_gain_blocks(pcmreader):
     unhandled_samples = []        #partial PCM frames
     frame_pool = audiotools.FrameList([],pcmreader.channels)
-    
+
     reader = audiotools.pcmstream.PCMStreamReader(pcmreader,
                                                   pcmreader.bits_per_sample / 8,
                                                   False,False)
-    
+
     (framelist,unhandled_samples) = audiotools.FrameList.from_samples(
         unhandled_samples + reader.read(audiotools.BUFFER_SIZE),
         pcmreader.channels)
@@ -227,26 +227,26 @@ def replay_gain_blocks(pcmreader):
     reader.close()
     #this drops the last block that's not 50ms long
     #that's probably the right thing to do
-    
+
 
 #takes a PCMReader-compatible object with 2 channels and a
 #supported sample rate
 #returns the stream's ReplayGain value in dB
 def calculate_replay_gain(pcmstream):
     import math
-    
+
     def __mean__(l):
         return sum(l) / len(l)
 
     pcmstream = EqualLoudnessFilter(pcmstream)
-    
+
     db_blocks = []
-    
+
     for block in replay_gain_blocks(pcmstream):
         left = __mean__([s ** 2 for s in block.channel(0)])
         right = __mean__([s ** 2 for s in block.channel(1)])
         db_blocks.append((left + right) / 2)
- 
+
     db_blocks = [10 * math.log10(b + 10 ** -10) for b in db_blocks]
     db_blocks.sort()
     replay_gain = db_blocks[int(round(len(db_blocks) * 0.95))]</diff>
      <filename>audiotools/replaygain.py</filename>
    </modified>
    <modified>
      <diff>@@ -67,7 +67,7 @@ if (__name__ == '__main__'):
     #get the AudioFile class we are converted to
     AudioType = audiotools.TYPE_MAP[options.type]
 
-    
+
     #ensure the selected compression is compatible with that class
     if (options.quality == 'help'):
         if (len(AudioType.COMPRESSION_MODES) &gt; 1):
@@ -87,7 +87,7 @@ if (__name__ == '__main__'):
               (AudioType.SUFFIX)
         sys.exit(1)
 
-    
+
     #if we're using an XMCD file, use that file for MetaData
     if (options.xmcd != None):
         try:
@@ -152,7 +152,7 @@ if (__name__ == '__main__'):
                                          None))
 
                 audiotools.make_dirs(filename)
-                
+
                 track = AudioType.from_pcm(
                     filename,
                     cd_track,</diff>
      <filename>cd2track</filename>
    </modified>
    <modified>
      <diff>@@ -44,7 +44,7 @@ if (__name__ == '__main__'):
     parser.add_option('-D','--default',
                       action='store_const',const=1,default=None,
                       help='when multiple choices are available, select the first one automatically')
-       
+
     (options,args) = parser.parse_args()
 
     try:
@@ -62,7 +62,7 @@ if (__name__ == '__main__'):
         if (len(cdda) == 255):
              print &gt;&gt;sys.stderr,&quot;*** No CD in drive&quot;
              sys.exit(1)
-        
+
         tracks = list(cdda)
 
         id = audiotools.DiscID([t.length() for t in tracks],
@@ -79,7 +79,7 @@ if (__name__ == '__main__'):
         else:
             print id.freedb_id()
 
-            
+
     except IOError,msg:
         print &gt;&gt;sys.stderr,&quot;* Error: %s&quot; % (msg)
         sys.exit(1)</diff>
      <filename>cd2xmcd</filename>
    </modified>
    <modified>
      <diff>@@ -65,7 +65,7 @@ def get_pixbuf(imagedata,width,height):
         l.write(s)
         s = imagedata.read(0x1000)
     l.close()
-    
+
     pb = l.get_pixbuf()
     (width,height) = image_size((width,height),pb)
     pb = pb.scale_simple(width,height,gtk.gdk.INTERP_BILINEAR)
@@ -75,7 +75,7 @@ def get_raw_pixbuf(imagedata):
     l = gtk.gdk.PixbufLoader()
     l.write(imagedata)
     l.close()
-    
+
     return l.get_pixbuf()
 
 class ImageList:
@@ -97,7 +97,7 @@ class ImageList:
 
         self.set_images(picture_list)
 
-        
+
 
     #picture_list is a list of (filepath,Image) tuples
     def set_images(self, picture_list):
@@ -198,8 +198,8 @@ if (__name__ == '__main__'):
     for audiofile in audiotools.open_files(args):
         try:
             metadata = audiofile.get_metadata()
-            
-            if ((metadata != None) and 
+
+            if ((metadata != None) and
                 (len(metadata.images()) &gt; 0)):
                 for image in metadata.images():
                     cover_list.append((audiofile.filename,image))</diff>
      <filename>coverview</filename>
    </modified>
    <modified>
      <diff>@@ -46,7 +46,7 @@ class OSSReader(audiotools.PCMReader):
     @classmethod
     def available(cls):
         return True
-        
+
 class PulseAudioReader(audiotools.PCMReader):
     NAME = &quot;pulse&quot;
 </diff>
      <filename>record2track</filename>
    </modified>
    <modified>
      <diff>@@ -36,7 +36,7 @@ def convert_to_wave(audiofile,wave_filename):
         pcm = audiotools.PCMConverter(audiofile.to_pcm(),44100,2,16)
         audiotools.WaveAudio.from_pcm(wave_filename,pcm)
         pcm.close()
-        
+
     print (u&quot;* %s&quot; % (audiofile.filename.decode(audiotools.FS_ENCODING))
            ).encode(audiotools.IO_ENCODING,'replace')
 
@@ -107,7 +107,7 @@ if (__name__ == '__main__'):
                           (audiofile,f[1]))
 
     queue.run(max_processes)
-    
+
     exec_args += wave_files
     subprocess.call(exec_args)
 </diff>
      <filename>track2cd</filename>
    </modified>
    <modified>
      <diff>@@ -58,8 +58,8 @@ def convert_file(destination_class, destination_filename,
                     temp_wave.name,
                     compression)
             finally:
-                temp_wave.close()    
-                
+                temp_wave.close()
+
         else:
             #otherwise, route the data through PCM
             destination_audiofile = destination_class.from_pcm(
@@ -81,7 +81,7 @@ if (__name__ == '__main__'):
         '[-d directory] [-q quality] ' + \
         '&lt;track 1&gt; [track 2] ...',
         version=&quot;Python Audio Tools %s&quot; % (audiotools.VERSION))
-    
+
     parser.add_option('-x','--xmcd',
                       action='store',
                       type='string',
@@ -119,7 +119,7 @@ if (__name__ == '__main__'):
                       action='store',
                       dest='output',
                       help='output filename to use, overriding default and -d')
-    
+
     parser.add_option('--no-replay-gain',
                       action='store_false',
                       dest='add_replay_gain',
@@ -198,7 +198,7 @@ if (__name__ == '__main__'):
                                                      xmcd[track_number]))
 
                     audiotools.make_dirs(filename)
-                    
+
                     queue.execute(convert_file,
                                   (AudioType,
                                    filename,
@@ -213,7 +213,7 @@ if (__name__ == '__main__'):
                                                      audiofile.get_metadata()))
 
                     audiotools.make_dirs(filename)
-                    
+
                     queue.execute(convert_file,
                                   (AudioType,
                                    filename,
@@ -223,7 +223,7 @@ if (__name__ == '__main__'):
                 encoded_filenames.append(filename)
             except KeyError:
                 continue
-        
+
         queue.run(max_processes)
 
         if (options.add_replay_gain and AudioType.can_add_replay_gain()):</diff>
      <filename>track2track</filename>
    </modified>
    <modified>
      <diff>@@ -36,7 +36,7 @@ if (__name__ == '__main__'):
                       default=audiotools.FREEDB_PORT)
     parser.add_option('-m','--metadata',action='store_true',
                       dest='metadata',default=False)
-    
+
     parser.add_option('-i','--id',dest='discid',
                       action='store_true',default=False,
                       help='display disc ID rather than fetch XMCD data')</diff>
      <filename>track2xmcd</filename>
    </modified>
    <modified>
      <diff>@@ -49,7 +49,7 @@ if (__name__ == '__main__'):
     parser.add_option('-o','--outfile',dest='filename',
                       metavar='FILE',
                       help='the output file')
-    
+
     (options,args) = parser.parse_args()
 
     if (options.filename == None):
@@ -85,7 +85,7 @@ if (__name__ == '__main__'):
         sys.exit(1)
 
     quality = options.quality
-    
+
     pcmdata = audiotools.PCMCat(iter([af.to_pcm() for af in audiofiles]))
 
     try:</diff>
      <filename>trackcat</filename>
    </modified>
    <modified>
      <diff>@@ -70,7 +70,7 @@ if (__name__ == '__main__'):
         files2 = audiotools.open_files(
             [os.path.join(args[1],f) for f in os.listdir(args[1])
              if os.path.isfile(os.path.join(args[1],f))])
-             
+
         files1_map = dict([(f.track_number(),f) for f in files1])
         files2_map = dict([(f.track_number(),f) for f in files2])
 </diff>
      <filename>trackcmp</filename>
    </modified>
    <modified>
      <diff>@@ -30,9 +30,9 @@ if (__name__ == '__main__'):
                       default=False)
     parser.add_option(&quot;-b&quot;,&quot;--bitrate&quot;,
                       action=&quot;store_true&quot;,dest=&quot;show_bitrate&quot;)
-                      
+
     (options,args) = parser.parse_args()
-    
+
     show_metadata = not options.no_metadata
     show_bitrate = options.show_bitrate
 </diff>
      <filename>trackinfo</filename>
    </modified>
    <modified>
      <diff>@@ -41,7 +41,7 @@ PULSEAUDIO_CHANNEL_MAP = \
 
 class OSSPlayer:
     NAME = 'oss'
-    
+
     def __init__(self):
         self.dev = ossaudiodev.open(&quot;w&quot;)
 
@@ -80,7 +80,7 @@ class __FloatConverter__:
     def read(self, bytes):
         data = self.floatstream.read(bytes)
         return struct.pack(&quot;&lt;%df&quot; % (len(data)),*data)
-        
+
 
 class PulsePlayer:
     NAME = 'pulse'
@@ -124,7 +124,7 @@ class PulsePlayer:
         else:
             channel_map = []
 
-        
+
         dev = subprocess.Popen([audiotools.BIN[&quot;pacat&quot;],
                                 &quot;-p&quot;,&quot;-n&quot;,&quot;trackplay&quot;,
                                 &quot;--stream-name=%s&quot; % (stream_name),
@@ -169,7 +169,7 @@ if (__name__ == '__main__'):
                       dest='album_replaygain',
                       help='apply album ReplayGain during playback, if present')
 
-    
+
     players = [p for p in [OSSPlayer,PulsePlayer] if p.available()]
     players_map = dict([(p.NAME,p) for p in players])
 
@@ -179,9 +179,9 @@ if (__name__ == '__main__'):
                       choices=players_map.keys(),
                       default=players[-1].NAME,
                       help=&quot;the method to play audio (choose from: %s)&quot; % \
-                          &quot;, &quot;.join([&quot;\&quot;%s\&quot;&quot; % (k) for k in 
+                          &quot;, &quot;.join([&quot;\&quot;%s\&quot;&quot; % (k) for k in
                                      players_map.keys()]))
-                                   
+
     (options,args) = parser.parse_args()
 
     player = players_map[options.output]()
@@ -196,11 +196,11 @@ if (__name__ == '__main__'):
                     #around the given PCMReader
                     if (options.track_replaygain or options.album_replaygain):
                         replaygain = audiofile.replay_gain()
-                        if ((replaygain is not None) and 
+                        if ((replaygain is not None) and
                             options.album_replaygain):
                             pcm = audiotools.ReplayGainReader(
                                 pcm,replaygain.album_gain,replaygain.album_peak)
-                        elif ((replaygain is not None) and 
+                        elif ((replaygain is not None) and
                               options.track_replaygain):
                             pcm = audiotools.ReplayGainReader(
                                 pcm,replaygain.track_gain,replaygain.track_peak)</diff>
      <filename>trackplay</filename>
    </modified>
    <modified>
      <diff>@@ -58,7 +58,7 @@ if (__name__ == '__main__'):
                                                   metadata[track_number])
             if (filename != preferred_filename):
                 audiotools.make_dirs(os.path.join(path,preferred_filename))
-                
+
                 subprocess.call([audiotools.BIN['mv'],
                                  &quot;-iv&quot;,
                                  track.filename,
@@ -69,13 +69,13 @@ if (__name__ == '__main__'):
         #try to set the track name from the track's metadata
         for (track_number,track) in [(audiofile.track_number(),
                                       audiofile) for audiofile in audiofiles]:
-            
+
             (path,filename) = os.path.split(track.filename)
             preferred_filename = track.track_name(track_number,
                                                   track.get_metadata())
             if (filename != preferred_filename):
                 audiotools.make_dirs(os.path.join(path,preferred_filename))
-                
+
                 subprocess.call([audiotools.BIN['mv'],
                                  &quot;-iv&quot;,
                                  track.filename,</diff>
      <filename>trackrename</filename>
    </modified>
    <modified>
      <diff>@@ -29,12 +29,12 @@ def extract_part(input_filename, input_pcm, output_filename, quality, metadata):
                (input_filename.decode(audiotools.FS_ENCODING),
                 output_filename.decode(audiotools.FS_ENCODING))).encode(
         audiotools.IO_ENCODING)
-        
+
     destination_audiofile = AudioType.from_pcm(
         output_filename,
         input_pcm,
         quality)
-    
+
     encoded_filenames.append(filename)
 
     if (metadata is not None):
@@ -47,7 +47,7 @@ def has_embedded_cuesheet(audiofile):
     #the FLAC actually contains a cuesheet with the necessary sub-tracks
     return (hasattr(audiofile,&quot;sub_pcm_tracks&quot;) and
             hasattr(audiofile.get_metadata(),&quot;cuesheet&quot;))
-        
+
 
 if (__name__ == '__main__'):
     parser = optparse.OptionParser(
@@ -61,7 +61,7 @@ if (__name__ == '__main__'):
                       type='string',
                       dest='cuesheet',
                       help='the cuesheet to use for splitting track')
-    
+
     parser.add_option('-x','--xmcd',
                       action='store',
                       type='string',
@@ -146,7 +146,7 @@ if (__name__ == '__main__'):
         except audiotools.XMCDException:
             print &gt;&gt;sys.stderr,&quot;*** Invalid XMCD file&quot;
             sys.exit(1)
-    else: 
+    else:
         #if we're not using an XMCD file, no MetaData
         #(I could theoretically pull some from the base track
         # but there usually isn't any and it's not very practical)
@@ -183,7 +183,7 @@ if (__name__ == '__main__'):
         #but the only way we'll be able to wait() correctly
         for p in split_pcm:
             p.process = None
-        
+
 
     for (i,pcmreader) in enumerate(split_pcm):
         track_number = i + 1
@@ -199,17 +199,17 @@ if (__name__ == '__main__'):
                 base_directory,
                 AudioType.track_name(track_number,
                                      None))
-            
+
             metadata = None
 
         audiotools.make_dirs(filename)
         encoded_filenames.append(filename)
-        
+
         queue.execute(extract_part,
-                      (audiofile.filename, 
-                       pcmreader, 
+                      (audiofile.filename,
+                       pcmreader,
                        filename,
-                       options.quality, 
+                       options.quality,
                        metadata))
 
     queue.run(options.max_processes)</diff>
      <filename>tracksplit</filename>
    </modified>
    <modified>
      <diff>@@ -59,11 +59,11 @@ def get_image(filename, type):
         f = open(filename,'rb')
         data = f.read()
         f.close()
-        
+
         return audiotools.Image.new(data,u'',type)
     except IOError:
         raise audiotools.InvalidImage(&quot;error opening file: \&quot;%s\&quot;&quot; % (filename))
-    
+
 
 if (__name__ == '__main__'):
     parser = optparse.OptionParser(
@@ -81,7 +81,7 @@ if (__name__ == '__main__'):
                       type='int',
                       dest='track_number',
                       help=&quot;the number of the track in the album&quot;)
-    
+
     parser.add_option('--album',
                       action='store',
                       type='string',
@@ -173,7 +173,7 @@ if (__name__ == '__main__'):
                       help='add ReplayGain metadata to track(s)')
 
     (options,args) = parser.parse_args()
-    
+
     audiofiles = audiotools.open_files(args)
 
     if (options.xmcd != None):
@@ -196,7 +196,7 @@ if (__name__ == '__main__'):
             metadata_function = track_metadata
         else:
             metadata_function = xmcd_track_metadata
-            
+
 
     for file in audiofiles:
         metadata = metadata_function(file, xmcd)
@@ -212,7 +212,7 @@ if (__name__ == '__main__'):
                             attr = attr.decode(audiotools.IO_ENCODING)
                         setattr(metadata,field,attr)
 
-                    
+
                 if (metadata.supports_images()):
                     if (options.remove_images):
                         for i in metadata.images():
@@ -242,7 +242,7 @@ if (__name__ == '__main__'):
             except audiotools.InvalidImage,msg:
                 print &gt;&gt;sys.stderr,&quot;* %s: %s&quot; % (file.filename,msg)
                 sys.exit(1)
-    
+
     #we're assuming all tracks are the same type
     if (options.add_replay_gain and
         (len(audiofiles) &gt; 0) and</diff>
      <filename>tracktag</filename>
    </modified>
  </modified>
  <removed type="array"/>
  <parents type="array">
    <parent>
      <id>d3810f0df4de1844f25943af612314a48e237a2b</id>
    </parent>
  </parents>
  <author>
    <name>Brian Langenberger</name>
    <email>bjl@usa.net</email>
  </author>
  <url>http://github.com/tuffy/python-audio-tools/commit/0ea93ebae03469cbc89d02fc8d995dc50219f98b</url>
  <id>0ea93ebae03469cbc89d02fc8d995dc50219f98b</id>
  <committed-date>2008-02-26T07:52:52-08:00</committed-date>
  <authored-date>2008-02-26T07:52:52-08:00</authored-date>
  <message>Removed lots of trailing whiespace.</message>
  <tree>dfcb991fffd59c1aad753401044afb3504717f00</tree>
  <committer>
    <name>Brian Langenberger</name>
    <email>bjl@usa.net</email>
  </committer>
</commit>
