Encode the filename before using it.

This commit is contained in:
Lukáš Lalinský
2006-10-13 16:07:36 +02:00
parent d560679674
commit 27adb77ffd

View File

@@ -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