Thank you for your donation!


Cloudsmith graciously provides open-source package management and distribution for our project.


Random Album Button (I know its there, but...)
#1
Ok, I finally updated my moode BETA build to 4.3, holy cow a lot has changed, and WOW, it's great. The new library panel with the random album button is almost EXACTLY what I thought was missing.

So here's my question/suggestion. How hard would be be to add that button on my playback panel? I want a button that when you press it, it removes the current playlist, adds a random album, and starts playing.

This is a favorite feature of mine on squeezebox, and MPoD app (RIP) had it as a "shake your phone" option.

Another side note I just remembered, why can't our share name include "nas"? My music is shared on a FreeNAS server so I would love to be able to call it "FreeNAS", but it states tha's a no go.
Reply
#2
I'd have to look but IIRC the code only validates the Name field for the reserved words (NAS, RADIO, SDCARD). You should be able to have server/share contain these words.

Thats a good idea regarding the random album function right on the Playback panel :-) I'll add to the moOde 4.5 TODO list :-)
Enjoy the Music!
moodeaudio.org | Mastodon Feed | GitHub
Reply
#3
It is the share name I am talking about. I like to be able to call my music that is stored on my freenas: FreeNAS, but I had to make up a random name for it.
In the old version of Moode I would click on NAS then FreeNAS as I was allowed to use NAS in the name. Now I am not able to use FreeNAS as the name.

Obviously there is some reason for this that I don't understand.
Reply
#4
The old code did not check for an existing mount of the same name before trying to create a new one. This caused a lot of issues.

moOde 4 series added validation for certain fields entered into the NAS config screen and also some simple code to check if the mount already exists. That code is below. It grep's the output of the mount command for the value entire into the Name field.

Code:
function mountExists($mountname) {
    $result = sysCmd('mount | grep -ow ' . '"' . $mountname .'"');
    if (!empty($result)) {
        return true;
    }
    else {
        return false;
    }
}

But since mount points are in the form /mnt/NAS/<Name> the function would always return true if "NAS" were not excluded from <Name>

I'm sure it could be improved on...
Enjoy the Music!
moodeaudio.org | Mastodon Feed | GitHub
Reply
#5
I did most of a random album feature from the playback screen (was going to be a swipe of the album art rather than a button but same diff) before I remembered the library data only populated the needed array when you go to the column/album cover view. Since we load that data on startup now though it should be easy.

ETA: the reason I didn’t do it after 4.3 or whenever we started populating the arrays early was I found I don’t really want random, or at least not blindly random. It’s rare that I want to hear the first randomly selected album and will usually poke the little random thing a few times and then maybe choose something adjacent from the album list or tap the artist name to play another one of their albums. But as above it should be easy enough to ad now and it’s a nice feature for people who do want that.
Reply
#6
(12-10-2018, 09:05 PM)Tim Curtis Wrote: The old code did not check for an existing mount of the same name before trying to create a new one. This caused a lot of issues.

moOde 4 series added validation for certain fields entered into the NAS config screen and also some simple code to check if the mount already exists. That code is below. It grep's the output of the mount command for the value entire into the Name field.

Code:
function mountExists($mountname) {
    $result = sysCmd('mount | grep -ow ' . '"' . $mountname .'"');
    if (!empty($result)) {
        return true;
    }
    else {
        return false;
    }
}

But since mount points are in the form /mnt/NAS/<Name> the function would always return true if "NAS" were not excluded from <Name>

I'm sure it could be improved on...

@Tim Curtis

Am I missing something here? 

mount will output lines like

Code:
//<host>/<share> on /mnt/NAS/<mountname> type ...

Why couldn't this function grep on the string "/mnt/NAS/<mountname>"?

The syscmd line would then read


Code:
sysCmd('mount | grep -ow ' . '"' . '/mnt/NAS/' . $mountname .'"');

 
Just my 2-cents worth. I can barely read php  Tongue

Regards,
Kent
Reply
#7
Well you guys are awesome. The random function will be much appreciated. I will definitely be sending a donation your way next paycheque as I really enjoy this project, and you're clearly interested in what the users have to say.

TheOldPresbyope, that makes sense to me, but I am even worse with PHP....
Reply


Forum Jump: