mirror of
https://github.com/fergalmoran/picard.git
synced 2026-05-26 21:06:12 +00:00
Encode the filename before using it.
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user