Closed weisslj closed 12 years ago
To be clear, are you interested in an alternative to parse_lookup_result() that just gets the score and the internal Acoustid track ID? (Or did you mean the MusicBrainz recording ID?)
Yes, score and "internal" Acoustid track id (it is not really that internal, as it is written to tags by Picard, and also visible on the MusicBrainz page). Initially I wanted to modify parse_lookup_result(), but it would be bad to make the output dependent on the parameter of "meta", wouldn't it?
Sounds good. I was thinking of changing the "parse" parameter to "match" so that, instead of a boolean, it takes a function. It defaults to parse_lookup_result, but can be this hypothetical new parser that just pulls out the score and ID. (It can also be None, which causes the raw response to be returned.) Does that make sense?
Well, but that is not any different from just passing False to "parse" and calling a function (what I'm doing now). I think I don't get "parse_lookup_result" at all: Why does it return all results (even with low score), but not all recordings (only the first, even from a result with high score)?
Yep, not that different from writing your own "parser" to extract the results you want. Is there an API style you think would be better?
The idea behind the existing function is to make it easy to get a snapshot of the most relevant/useful information. It's a compromise between completeness and straightforwardness of the API, the idea being that if you want arbitrary information, you can process the parsed JSON object yourself. I'd be open to more flexible built in processing, though, because it can be kind of tricky to get the response-walking right.
Hmm, I thought about it, but to be honest I can't come up with a better API... I thought of renaming "parse_lookup_result" to "get_recordings" (and introduce new "get_track_ids" etc.), but it doesn't make much sense either. The output of "match()" (the parsed JSON response) is actually good enough already, it doesn't really need to be parsed much further (besides maybe strip the status code).
So I will close the issue request, sorry for all the fuss :-).
it should be simpler to just get the result of an API request without or empty "meta" parameter