Thank you for your donation!


Random subsample of playlist
#1
Hi,

I have a playlist consisting of all my rock/pop/jazz etc, totalling about 13k tracks. This number makes the Playback tab very unresponsive, with frequent freezing, especially on a phone. I'd like to be able to create a random subsample of this playlist, enough tracks to last for a day (maybe specified by hours of music?); I can't see any way to do this manually within the existing software.

I realise that I could use the Shuffle mode, but this would also pick from other stuff on the SSD - I don't really want to have Beethoven symphonies, brewing blogs or episodes of "I'm Sorry I Haven't a Clue" interrupting my music. In fact I use this mode on my second Moode install, which has only the rock music loaded, and it works well.

Great software, by the way! Finally got to retire my NSLU2/Roku system.

Thanks,
Andy
Reply
#2
Auto-shuffle does support excluding things by tag or shuffling over a subset of files but I haven't experimented with any of these options. The dev gives examples of how to use the options in the Git repo. https://github.com/joshkunz/ashuffle

You could try turning it off in moOde UI and then running it from cmd line with something like --e genre classical

Code:
usage: ashuffle -h -n [-e PATTERN ...] [-o NUMBER] [-f FILENAME]

Optional Arguments:
  -e,--exclude  Specify things to remove from shuffle (think blacklist).
  -o,--only     Instead of continuously adding songs, just add 'NUMBER'
                songs and then exit.
  -h,-?,--help  Display this help message.
  -f,--file     Use MPD URI's found in 'file' instead of using the entire MPD
                library. You can supply `-` instead of a filename to retrive
                URI's from standard in. This can be used to pipe song URI's
                from another program into ashuffle.
  -n,--nocheck  When reading URIs from a file, don't check to ensure that
                the URIs match the given exclude rules. This option is most
                helpful when shuffling songs with -f, that aren't in the
                MPD library.
See included `readme.md` file for PATTERN syntax.

-Tim
Enjoy the Music!
moodeaudio.org | Twitter Feed | Git Repo
Reply
#3
OK, thanks, I'll play with those options.

Cheers,
A.
Reply
#4
Post your results. Maybe its something that can be added as a setting.
Enjoy the Music!
moodeaudio.org | Twitter Feed | Git Repo
Reply
#5
The first step will be to find an id3 tag editor that I can use over ssh. Then it should be straightforward I think. I've already used ashuffle when I had a problem using autoshuffle inside moode.

One question - if I set ashuffle to start on boot, should I include a delay so that Moode is up and running, or run ashuffle first?

Andy
Reply
#6
I did find an alternative to ashuffle's exclude (-e) option, which was to use the -f (--file) option to receive piped tracks names from an mpd search or from an mpd playlist, e.g.:

~$ cat /var/lib/mpd/playlists/BeerSmith.m3u | ashuffle -f -
Picking random songs out of a pool of 166

This works fine in combination with the Consume toggle in Moode, but it takes a very long time to parse a playlist of 13000 tracks, so I may also explore the exclude option, once I've checked and edited the id3 tags.

Cheers
Andy
Reply
#7
I think I have a good solution to the problem of shuffling large playlists: using shuf -n to randomly select a number of songs from a folder or playlist and piping to ashuffle, e.g.

mpc search filename USB/ssd/MyAudio/MyMusic | shuf -n 10 | ashuffle -f - & [from a folder]
or
shuf -n 100 "/var/lib/mpd/playlists/CDs.m3u" | ashuffle -f - & [from a playlist]

You need to manually select Consume mode or the tracks accumulate in the Moode playlist. Also, I haven't yet tried to start this on boot, or worked out how to stop it without killing the ashuffle process.

Cheers,
Andy
Reply
#8
Update: I've added a script to /etc/rc.local that tests whether mpd is running and then pipes a random selection of tracks from a playlist into ashuffle. On boot, this initiates shuffling a subset of tracks from your playlist into Moode without overloading the browser memory, which seemed to be an issue with Chrome on both my tablet and phone. For my purposes , it's better than the shuffle option within Moode as it doesn't pick from the whole library, but a playlist or folder (see previous post).

(/etc/rc.local)
while !(pgrep -x "mpd" > /dev/null)
do
sleep 10
done
shuf -n 200 "/var/lib/mpd/playlists/CDs.m3u" | ashuffle -f -

This seems to work OK - so far: this isn't my specialist subject, so happy to receive comments.

Cheers,
Andy
Reply
#9
Hi,

I quickly realized that my "solution" to the problem of unresponsive large playlists didn't work well: creating a subset of (say) 200 tracks at boot and then using ashuffle to feed tracks to Moode meant that, inevitably, some tracks were played more than once over the course of a day (ashuffle doesn't have a Consume mode).

Instead, I now get the pi to create a new playlist containing 200 randomly selected tracks from a larger playlist. I added this to /etc/rc.local so that it runs on boot and refreshes the playlist daily (my Moode pi is set to shutdown at night):

           sudo sh -c 'shuf -n 200 "/var/lib/mpd/playlists/The CDs.m3u" > "var/lib/mpd/playlists/Random.m3u"'

This "Random" playlist appears in Moode's Browse tab and will also start automatically on boot if set up that way.

Cheers,
Andy
Reply
#10
(05-26-2018, 09:09 AM)Hillsidebeer Wrote: Hi,

I quickly realized that my "solution" to the problem of unresponsive large playlists didn't work well: creating a subset of (say) 200 tracks at boot and then using ashuffle to feed tracks to Moode meant that, inevitably, some tracks were played more than once over the course of a day (ashuffle doesn't have a Consume mode).

Instead, I now get the pi to create a new playlist containing 200 randomly selected tracks from a larger playlist. I added this to /etc/rc.local so that it runs on boot and refreshes the playlist daily (my Moode pi is set to shutdown at night):

           sudo sh -c 'shuf -n 200 "/var/lib/mpd/playlists/The CDs.m3u" > "var/lib/mpd/playlists/Random.m3u"'

This "Random" playlist appears in Moode's Browse tab and will also start automatically on boot if set up that way.

Cheers,
Andy

Clever solution, Andy, that is very much in the spirit of Major Charles Emerson Winchester III (a character in the long-running TV show M*A*S*H): "I do one thing at a time. I do it very well. And then I move on."  Smile

Regards,
Kent
Reply


Forum Jump: