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

Store the random selection of albums for navigation in history #75

Open
pbsds opened this issue Apr 16, 2020 · 2 comments
Open

Store the random selection of albums for navigation in history #75

pbsds opened this issue Apr 16, 2020 · 2 comments

Comments

@pbsds
Copy link
Contributor

pbsds commented Apr 16, 2020

Title was: Add optional seed to /random in api, have webui use it

In the web ui, you access /#random to see a list of random albums, expanding this to /#random-{seed} would make the ui more predictably when going forward and backward in the browser history, allowing you to queue more than one of the albums from the current selection. This could perhaps be done by adding an optional seed query parmaters to the /random api endpoint.

The sqlite query however is a bit more difficult to change because you need a way to make random numbers from a seed, which sqlite does not support.

One option is demonstrated here where they use fancy sql to compute random values. It is however not very clean in my option.

An another option is to implement your own random function in rust and have sqlite use it as shown here with C. I'm not familiar with rust and diesel, but from some quick googling, i determined it should be possible, with lots of nice macros to make the code more easy to read.

@agersant
Copy link
Owner

I think this is a valid request, I've ran into this a few times myself too. Note that if you want to queue entire albums from the random view you can drag their cover into the playlist, without leaving the random page.

I don't think either of the two implementation options are very attractive. If/when I look into it, I think I would consider client-side solutions first.

@pbsds pbsds changed the title Add optional seed to /random in api, have webui use it Store the random selection of albums for navigation in history Apr 17, 2020
@pbsds
Copy link
Contributor Author

pbsds commented Apr 17, 2020

history.pushState may be an option.

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

No branches or pull requests

2 participants