Repository: rabitt/pysox

Issue:
This install of SoX cannot process .MP3 files.
Hi - I am on Ubuntu 18.04. When I try to interact via Python bindings with SoX, I get a warning saying `This install of SoX cannot process .MP3 files.` And then the file is processed just fine. After looking into this issue, I have found that the root cause is in capitalization of file extension that I have on my files.

What do you think about PR to ignore letter size when checking for valid formats? 

Discussion:

Patch:
diff --git a/sox/file_info.py b/sox/file_info.py
index 9cb83f8..2998ff0 100644
--- a/sox/file_info.py
+++ b/sox/file_info.py
@@ -326,7 +326,7 @@ def file_extension(filepath):
     extension : str
         The file's extension
     '''
-    return os.path.splitext(filepath)[1][1:]
+    return os.path.splitext(filepath)[1][1:].lower()
 
 
 def info(filepath):


Test patch:
diff --git a/tests/test_file_info.py b/tests/test_file_info.py
index d960434..f1ea875 100644
--- a/tests/test_file_info.py
+++ b/tests/test_file_info.py
@@ -12,6 +12,7 @@ def relpath(f):
 SPACEY_FILE = relpath("data/annoying filename (derp).wav")
 INPUT_FILE = relpath('data/input.wav')
 INPUT_FILE2 = relpath('data/input.aiff')
+INPUT_FILE3 = relpath('data/input.WAV')
 EMPTY_FILE = relpath('data/empty.wav')
 INPUT_FILE_INVALID = relpath('data/input.xyz')
 OUTPUT_FILE = relpath('data/output.wav')
@@ -33,6 +34,7 @@ class TestBitrate(unittest.TestCase):
     def test_empty(self):
         actual = file_info.bitrate(EMPTY_FILE)
         expected = None
+        self.assertEqual(expected, actual)
 
 class TestBitdepth(unittest.TestCase):
 
@@ -233,6 +235,11 @@ class TestFileExtension(unittest.TestCase):
         expected = 'x23zya'
         self.assertEqual(expected, actual)
 
+    def test_ext6(self):
+        actual = file_info.file_extension('simplefile.MP3')
+        expected = 'mp3'
+        self.assertEqual(expected, actual)
+
 
 class TestInfo(unittest.TestCase):