Random album play

Hello,
I’m very happy I found Volumio, very cool project! The only thing missing for me is random album play feature - it would be great for guys like me who like playing albums from start to end, but have huge library and would like to be surprised :wink: .

I’m a junior dev myself (work in C# though), could someone give me pointers for queue manipulation if I wanted to write some sort of plugin?

Thanks!

Take a look at ‘Guides’. Adding random tracks to queue.

Hola,

I had the same need and made a script in python for this. Now a button in my remote control plays a random album.

#/usr/bin/python

from socketIO_client import SocketIO, LoggingNamespace
import random

sock=SocketIO('localhost', 3000)

def on_browse_library(*args):
    #print(args)
    discos=args[0]['navigation']['lists'][0]['items']
    disco=discos[random.randint(0,len(discos)-1)]['uri']
    sock.emit('clearQueue')
    sock.emit('addToQueue', {'uri':disco})
    #the next lines suck, but work...
    sock.wait_for_callbacks(seconds=1)
    sock.emit('play',0)
    sock.wait_for_callbacks(seconds=1)
    sock.emit('toggle')
    
        
sock.on('pushBrowseLibrary',on_browse_library)

sock.emit("browseLibrary", {'uri': 'albums://'}, on_browse_library)
sock.wait_for_callbacks(seconds=1)

You’ll need to install the socketIO library first:
sudo pip install socketIO-client