Skip to content

Conversation

@RealHypnoticOcelot
Copy link
Contributor

I'm no professional, so excuse the poor-quality code(I did my best)! I've been hoping for this endpoint for quite some time, though(#387), and so I decided I'd give it a shot myself. I tried to take advantage of as many of the existing functions Maloja had available, and I examined the ListenBrainz code to ensure as much parity as possible with the official API.

There are some limitations: primarily, this implementation only supports layout 0, or the default grid! There's a lot more complexity for non-square charts, so I didn't bother, since this should cover most use-cases anyhow. I tried to be as consistent and efficient as possible, but I'm sure there's a better way to do things, so if you see any obvious fixes, let me know!

I couldn't figure out any better way to output as .svg files, at least not without adding some complexity. I didn't want to import anything too heavy for something so basic! Anyways, merge if you think it's good, or don't if you don't. I just figured I'd throw my hat into the ring!

@RealHypnoticOcelot RealHypnoticOcelot changed the title Implement Art Endpoint from ListenBrainz Implement Art(grid-stats) Endpoint from ListenBrainz Sep 12, 2025
@RealHypnoticOcelot
Copy link
Contributor Author

One issue I have noticed is that since the resolve_image function is asynchronous, if any images are yet to be added to the cache, their respective spots will show up as blank when you request this endpoint(but they will be requested, and will show up the next time you run the command). I'm not sure what the best solution is for this at the moment, since currently the code has no awareness of whether or not the images exist yet or not.

The code also doesn't fail if there's not enough items to fill the grid completely. That's easy enough to implement, and I'm about to commit a change that returns MalformedJSONException() if that's the case!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant