From 23ea30b1d546372e81ccedeb63e3aade60004f31 Mon Sep 17 00:00:00 2001 From: Sambhav Kothari Date: Tue, 27 Feb 2018 23:40:58 +0530 Subject: [PATCH] Add an ext_to_format function --- picard/formats/__init__.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/picard/formats/__init__.py b/picard/formats/__init__.py index 8c56e9983..9258985ad 100644 --- a/picard/formats/__init__.py +++ b/picard/formats/__init__.py @@ -40,6 +40,10 @@ def supported_extensions(): return [ext for exts, name in supported_formats() for ext in exts] +def ext_to_format(ext): + return _extensions.get(ext, None) + + def guess_format(filename, options=_formats): """Select the best matching file type amongst supported formats.""" results = []