Commits

Sylvain Prat committed 6bafb7b

Better implementation of is_audio_file + some explanations

  • Participants
  • Parent commits 124ad39

Comments (0)

Files changed (1)

File albumart/core.py

     Metadata.Year, ...).
     """
 
-    # TODO: list all common audio files extensions
-    AUDIO_FILE_EXT = (
-        'mp3', 'ogg', 'mpc', 'wma', 'mp4', 'm4a', 'm4p', 'flac', 'ape',
-        'wav', 'aif', 'aiff'
-    )
-
     def __init__(self, albumart_prefix='albumart_', plugin_manager=None):
         """
         Creates an albumart downloader. The album art files downloaded are
         """
         Test whether this file is an audio file
         """
+        # We can't rely on the mimetypes modules: it misses some common
+        # extensions such as .ogg
+        # TODO: complete this list
+        AUDIO_FILE_EXT = set((
+            'mp3', 'ogg', 'mpc', 'wma', 'mp4', 'm4a', 'm4p', 'flac', 'ape',
+            'wav', 'aif', 'aiff', 'au',
+        ))
         ext = os.path.splitext(filename)[1][1:]  # slice to remove dot
-        return ext in self.AUDIO_FILE_EXT
+        return ext in AUDIO_FILE_EXT
 
 
 class PluginManager(object):