display randomly-selected albums on "Albums" page#298
display randomly-selected albums on "Albums" page#298davebiffuk wants to merge 6 commits intoSonerezh:developmentfrom
Conversation
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.
|
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. |
|
Not sure what I did wrong the first time but looks & works fine for me now. |
|
Thanks for the feedback, I think that's a good idea and I will have a go. |
|
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) |
|
Could this be optional on the settings page? |
|
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.
|
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: Still only for MySQL I'm afraid, I will look at other backends next. |
|
I've added (completely untested) support for SQLite and PostgreSQL. Any testers please? |
|
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. |
|
This PR should fix #299 |

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.