pyacoustid icon indicating copy to clipboard operation
pyacoustid copied to clipboard

Fingerprint result with force fpcalc is other than with default settings

Open garlontas opened this issue 4 years ago • 4 comments

Hello! I'm developing an application using your library and I had the problem that I didn't get any result with the default fingerprinting. (acoustid.match(self.__API_KEY, self.__file)) :disappointed: Then I used acoustid.match(self.__API_KEY, self.__file, force_fpcalc=True) and I received the data I needed. :+1: Maybe you could take a look at this problem. A possible solution would be setting fpcalc as the default finger printer.

PS: It also occurs using your aidmatch.py script

garlontas avatar Oct 14 '21 13:10 garlontas

Is there a way you can describe to reproduce the problem?

sampsyo avatar Oct 14 '21 13:10 sampsyo

So first I had this code:

        try:
            results = acoustid.match(self.__API_KEY, self.__file)
        except acoustid.NoBackendError:
            raise error.ChromaprintNotFoundException(
                "Chromaprint library/tool not found")
        except acoustid.FingerprintGenerationError:
            raise error.FingerprintGenerationError(
                "Fingerprint could not be calculated")
        except acoustid.WebServiceError as exc:
            raise error.WebServiceError("Web service request failed:", exc.message)
        try:
            result = next(results)
        except StopIteration as exc:
            raise error.FingerprintGenerationError(
                "Fingerprint could not be calculated") from exc
        self.__id = result[1]
        return self.__id

When I run that code, your pyacoustid calculates the fingerprint with the default calculator, and it fails with the StopIteration error because the generator is empty.

Afterwards I changed the code and wrote this:

        try:
            results = acoustid.match(self.__API_KEY, self.__file, force_fpcalc=True)
        except acoustid.NoBackendError:
            raise error.ChromaprintNotFoundException(
                "Chromaprint library/tool not found")
        except acoustid.FingerprintGenerationError:
            raise error.FingerprintGenerationError(
                "Fingerprint could not be calculated")
        except acoustid.WebServiceError as exc:
            raise error.WebServiceError("Web service request failed:", exc.message)
        try:
            result = next(results)
        except StopIteration as exc:
            raise error.FingerprintGenerationError(
                "Fingerprint could not be calculated") from exc
        self.__id = result[1]
        return self.__id

Now everything worked, and I got no errors (fpcalc version 1.4.3)

The file I tested with has the fpcalc result: result.txt

garlontas avatar Oct 14 '21 14:10 garlontas

I can confirm this issue, I have the exact same problem.

OS: elementaryOS 6 (Ubuntu 20.04) chromaprint: 1.4.3 (distribution provided)

swanux avatar Oct 27 '21 18:10 swanux