Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Album art browser in web plugin UI #5568

Draft
wants to merge 13 commits into
base: master
Choose a base branch
from
Draft

Conversation

valrus
Copy link
Contributor

@valrus valrus commented Dec 29, 2024

Description

This PR adds a "browse albums" page to the web plugin's UI, with a couple tweaks (via query params, to preserve backwards compatibility) to the API in order to enable it. This is a feature that's been requested and kind of hacked together in the past. This implementation has the following characteristics:

  1. Album covers displayed in a grid, sorta similar to CoverGrid for mpd.
  2. The grid is not interactable (at this time) — it's only for browsing.
  3. Albums will be loaded in random order. This is more fun than seeing the alphabetically first albums on every load.
  4. Album covers load as they scroll into view, to avoid making thousands of requests to the server at once for big libraries. (But I think it's still possible to send a lot of requests at once by dragging the scrollbar.)
  5. It's possible to switch between the item view and album browser and the playing track will continue to play.

It includes assorted other improvements to the web plugin as well. A list summarizing the changes:

  1. Entering a search query now shows "Loading..." in the results list while the request is in progress.
  2. The search form is now "sticky" and stays at the top of the results list when you scroll down.
  3. The player now shows the name of the playing song, if one is playing.
  4. Most CSS has been converted from floats to CSS flexbox and grid as appropriate. (This may break compatibility with some very old browsers, so I'm fine reverting it if it's important to keep that compatibility.)
  5. underscore.js and backbone.js have been updated to the most recent versions. (Ditto potential compatibility issues; I haven't checked but I will if it's important.)
  6. Non-breaking web API change: if a request to the album_art route includes the b64 query string (regardless of its value), the art data will be returned as base64 data rather than binary. This was mainly because this conversion was easier (for me) to do in Python than in JavaScript.
  7. Non-breaking web API change: if a request to the all_albums route includes the random query string (regardless of value), the albums will be returned in random order.

Here is what the browser looks like. I figured others will likely have libraries like mine where the album art situation is patchy so I tried to make the alt text look nice:
beets_browser

To Do

I haven't done any of these yet because I'm not sure this will even get merged, much less what from its current state will end up making it in. It doesn't really change any of the documented functionality of the web plugin. And there are no tests as the JS is completely untested and the API changes are not straightforward or particularly interesting to test (randomness? base-64 encoding?)

That said, I'm happy to do any of these that reviewers would like me to and I'll certainly add a changelog entry if this gets to a mergeable state.

  • Documentation.
  • Changelog.
  • Tests.

Copy link

Thank you for the PR! The changelog has not been updated, so here is a friendly reminder to check if you need to add an entry.

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