Opened 15 years ago

Last modified 12 years ago

#1424 new defect

MPlayer's -shuffle option does not shuffle the playlist

Reported by: mplayer.bugzilla@… Owned by: reimar
Priority: normal Component: core
Version: unspecified Severity: minor
Keywords: Cc: hhaamu@…
Blocked By: Blocking:
Reproduced by developer: no Analyzed by developer: no

Description

Problem:

When MPlayer is calledd with the -shuffle option, the expected result is to have the current playlist shuffled, as is done in all other apps I have used with a shuffle feature. Instead of shuffling the playlist, MPlayer seems to pick a random item from a pool of songs, dropping it out of this pool as it finishes. The result is that when a group of files are played with -shuffle, both the bindings for < and > (previous and next playlist items) behave identically -- removing the current song from the playlist and moving to the next.

Solution:

When MPlayer is passed the -shuffle option, the list of files should be shuffled (the files being reordered in a random way), then loaded as a normal playlist.

It would also be nice to have a -random option, which would pick a random file from the playlist each time a file finishes or > is used. < could be disabled when using -random, or else MPlayer could keep track of the last N songs played, thereby allowing < to be used. A -random option could be used in instances where you would like to simply keep playing randomly from a set of videos (something on display), or randomly listening to a set of songs over and over.

Attachments (1)

mplayer-shuffle.diff (4.2 KB ) - added by hhaamu@… 12 years ago.
Shuffle playtree with Fisher-Yates when entering the branch

Download all attachments as: .zip

Change History (4)

comment:1 by mplayer.bugzilla@…, 15 years ago

One follow-up about -random:

It isn't the same as -shuffle -loop (if that works, I haven't tried), because that would never be able to play the same file repeatedly, needing to go through the entire playlist before a file is available again. With -random, the same file could be picked immediately after it has finished playing.

by hhaamu@…, 12 years ago

Attachment: mplayer-shuffle.diff added

Shuffle playtree with Fisher-Yates when entering the branch

comment:2 by hhaamu@…, 12 years ago

A few open questions, though:

  • As I understand it, once a randomised playtree branch is exited, the previous code re-shuffles it. Should I try to preserve that behaviour?
  • There are a couple of constants in playtree.h that are now no longer used. Should I remove them? (Probably mutually exclusive with the previous question.)

comment:3 by hhaamu@…, 12 years ago

Cc: hhaamu@… added
Note: See TracTickets for help on using tickets.