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

display randomly-selected albums on "Albums" page #298

Closed

Conversation

davebiffuk
Copy link

This is a copy of the "Random albums" feature in Subsonic. A row of randomly-selected albums is displayed on the "Albums" page, after "Recently added" and before "All albums".

The MySQL "order by rand()" is reportedly inefficient, but it takes ~0.1s to select from ~700 albums/~7000 songs on a small ARM-based system which seems acceptable.

I included the (small!) translations but I don't know if I did it right.

This change doesn't handle a SQLite backend, only MySQL.

This is a copy of the "Random albums" feature in Subsonic.
The MySQL "order by rand()" is reportedly inefficient, but
it takes ~0.1s to select from ~700 albums/~7000 songs on a
small ARM-based system.
@gs11
Copy link
Contributor

gs11 commented May 20, 2017

Just checked out this to try but I can't see the random albums row in the albums view.
screen shot 2017-05-20 at 19 26 42

@davebiffuk
Copy link
Author

Did you restart the web server after making the change? I had to restart Apache to make this show up (and when I made other changes, e.g. #170 (comment) )

Are there any messages in the web server logs?

I'm sorry I don't have any other suggestions. I can let you have an account on my server if you want to see it working.

@gs11
Copy link
Contributor

gs11 commented May 28, 2017

Not sure what I did wrong the first time but looks & works fine for me now.
I think it'd be a good idea if features were database independent, can you add the same functionality for SQLite & PostgreSQL databases?

@davebiffuk
Copy link
Author

Thanks for the feedback, I think that's a good idea and I will have a go.

@MightyCreak
Copy link
Contributor

Is it optional? Because personally I would go the other way and remove the Recently Added line.

I know what I added, it takes a precious vertical space. As for the random line, it really depends on the way you listen to your music. I often choose my music based on my mood, so I don't really need the random line (and, also, the vertical space argument)

@gs11
Copy link
Contributor

gs11 commented May 31, 2017

Could this be optional on the settings page?
A checkbox for recently added and another one for random?

@MightyCreak
Copy link
Contributor

That would be very nice. It could even be per user.

This involves a change to the database schema. In theory,
deleting the contents of sonerezh/app/tmp/cache/models
is sufficient to get that noticed; but in my experience,
setting Configure::write('debug', 2); in
sonerezh/app/Config/core.php (briefly) was necessary.
@davebiffuk
Copy link
Author

I've updated my branch to add checkboxes for "random" and "recently added" on the settings page. Thanks for the suggestion!

NB. as I wrote in the commit message:

This involves a change to the database schema. In theory,
deleting the contents of sonerezh/app/tmp/cache/models
is sufficient to get that noticed; but in my experience,
setting Configure::write('debug', 2); in
sonerezh/app/Config/core.php (briefly) was necessary.

Still only for MySQL I'm afraid, I will look at other backends next.

@davebiffuk
Copy link
Author

I've added (completely untested) support for SQLite and PostgreSQL. Any testers please?

@gs11
Copy link
Contributor

gs11 commented Jun 16, 2017

Looks good but sonerezh_pgsql.php is missing the two new columns. Once they were added it seems to be working just fine with sqlite.

@MightyCreak
Copy link
Contributor

This PR should fix #299

@lGuillaume124 lGuillaume124 added this to Issues related to the bad design in Normalize the database Aug 30, 2018
fcharlier added a commit to fcharlier/sonerezh that referenced this pull request Feb 26, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Normalize the database
  
Issues related to the bad design
Development

Successfully merging this pull request may close these issues.

None yet

4 participants