mpv-playlistmanager icon indicating copy to clipboard operation
mpv-playlistmanager copied to clipboard

[Feature Request]: Toggleable Shuffle

Open NaiveInvestigator opened this issue 2 years ago • 3 comments

What this feature does is that, it shuffles the playlist if on but if turned off it will return to its original playlist.

Sorry bother you if this was already implemented but I can't figure out how to do it using this script. As you know using cycle shuffle doesn't actually work in runtime so I thought of using this script to do exactly that.

NaiveInvestigator avatar Sep 21 '22 06:09 NaiveInvestigator

Add this in input.conf KEY script-message playlistmanager shuffle to suffle at runtime. Although there is no function to reverse it. What use case do you have to return to original?

jonniek avatar Sep 21 '22 08:09 jonniek

I need it cause sometimes i press shuffle by mistake, un-shuffling it would help in that case. mostly. And sometimes tho it is rare, while listening to songs I listen to some album songs in order that is why. But mostly it the first scenario that happens to me frequently and is annoying lol.

NaiveInvestigator avatar Sep 21 '22 10:09 NaiveInvestigator

nvm I think i found a way to do it.

Using this js script:

var state = 0

var commands = [
    'playlist-shuffle',
    'playlist-unshuffle'
]

function perform_action() {
    mp.command(commands[state])
    state = (state + 1) % commands.length
}

mp.add_key_binding('i','toggle-shuffle', perform_action)

Thank you for the help! Feel free to close this issue.

NaiveInvestigator avatar Sep 21 '22 13:09 NaiveInvestigator

playlist-unshuffle cool I didn't know about this :+1:

I feel like it's a bit waste to re-implement that for this script. I think maybe this script shouldn't include a shuffle anyway nowadays. Not sure if anyone actually uses it over the native shuffle.

jonniek avatar Sep 25 '22 12:09 jonniek