From 27adb77ffddce5e18ceff995bc539d5b0d3c0a1b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Luk=C3=A1=C5=A1=20Lalinsk=C3=BD?= Date: Fri, 13 Oct 2006 16:07:36 +0200 Subject: [PATCH] Encode the filename before using it. --- picard/musicdns/__init__.py | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/picard/musicdns/__init__.py b/picard/musicdns/__init__.py index d927c0f37..7c853f65e 100644 --- a/picard/musicdns/__init__.py +++ b/picard/musicdns/__init__.py @@ -17,8 +17,9 @@ # along with this program; if not, write to the Free Software # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. -from picard.musicdns import ofa - +from picard.musicdns import ofa +from picard.util import encode_filename + _decoders = [] @@ -52,13 +53,14 @@ def init(tagger): def create_fingerprint(filename): """Decode the specified file and calculate a fingerprint.""" # TODO: init/done should be called only once, but the *must* be called - # from the same thread as we call decode. + # from the same thread as we call decode. + filename = encode_filename(filename) for decoder in _decoders: - decoder.init() + decoder.init() result = decoder.decode(filename) decoder.done() if result: - buffer, samples, sample_rate, stereo, duration = result + buffer, samples, sample_rate, stereo, duration = result fingerprint = ofa.create_print(buffer, samples, sample_rate, stereo) return (fingerprint, duration) return None