mirror of
https://github.com/beetbox/beets.git
synced 2025-12-29 20:12:33 +01:00
Ensure that inc are joined with a plus
See this line in https://musicbrainz.org/doc/MusicBrainz_API#Lookups > To include more than one subquery in a single request, separate the arguments to inc= with a + (plus sign), like inc=recordings+labels.
This commit is contained in:
parent
3cbc3f0b2b
commit
001dddcf2f
1 changed files with 9 additions and 4 deletions
|
|
@ -115,7 +115,12 @@ class MusicBrainzAPI(RequestHandler):
|
|||
def create_session(self) -> LimiterTimeoutSession:
|
||||
return LimiterTimeoutSession(per_second=self.rate_limit)
|
||||
|
||||
def get_entity(self, entity: str, **kwargs) -> JSONDict:
|
||||
def get_entity(
|
||||
self, entity: str, inc_list: list[str] | None = None, **kwargs
|
||||
) -> JSONDict:
|
||||
if inc_list:
|
||||
kwargs["inc"] = "+".join(inc_list)
|
||||
|
||||
return self._group_relations(
|
||||
self.get_json(
|
||||
f"{self.api_host}/ws/2/{entity}",
|
||||
|
|
@ -124,14 +129,14 @@ class MusicBrainzAPI(RequestHandler):
|
|||
)
|
||||
|
||||
def get_release(self, id_: str) -> JSONDict:
|
||||
return self.get_entity(f"release/{id_}", inc=" ".join(RELEASE_INCLUDES))
|
||||
return self.get_entity(f"release/{id_}", inc_list=RELEASE_INCLUDES)
|
||||
|
||||
def get_recording(self, id_: str) -> JSONDict:
|
||||
return self.get_entity(f"recording/{id_}", inc=" ".join(TRACK_INCLUDES))
|
||||
return self.get_entity(f"recording/{id_}", inc_list=TRACK_INCLUDES)
|
||||
|
||||
def browse_recordings(self, **kwargs) -> list[JSONDict]:
|
||||
kwargs.setdefault("limit", BROWSE_CHUNKSIZE)
|
||||
kwargs.setdefault("inc", BROWSE_INCLUDES)
|
||||
kwargs.setdefault("inc_list", BROWSE_INCLUDES)
|
||||
return self.get_entity("recording", **kwargs)["recordings"]
|
||||
|
||||
@singledispatchmethod
|
||||
|
|
|
|||
Loading…
Reference in a new issue