MusicPlayerDaemon / MPD

Music Player Daemon
https://www.musicpd.org/
GNU General Public License v2.0
2.17k stars 352 forks source link

mpd skips some songs with priority #142

Closed carnager closed 6 years ago

carnager commented 6 years ago

MPD version: 0.20.11

When adding an album or multiple tracks to playlist MPD skips some of the songs, seemingly ignoring priority altogether for these.

Skipping forward and back will always skip the same songs. Instead they will be played when queue has finished all other (non-prioritized) songs.

When adding the same songs in same context the result is the same, but the songs being skipped will be different this time.

Sadly mpc does not support priorities and as far as I know neither does libmpdclient, so all I have is a perl script, but since ncmpcpp shows the priorities just fine in its playlist after adding the songs, I doubt it's the scripts fault. Also Net::MPD is a tiny module with no dependencies.

here my script: I use decreasing priorities here, but the symptoms are the same if I use "255" for every song.

#!/usr/bin/perl

use Net::MPD;

my $artist = "Alice in Chains";
my $album  = "Dirt";

$mpd //= Net::MPD->connect($ENV{MPD_HOST} // 'localhost');
my @songs = $mpd->search('Artist', $artist, "Album", $album);

my $song;
my $prio = "255";
my $pos = ($mpd->current_song->{Pos} +1);

foreach $song (@songs) {
    $mpd->prio_id($prio, $mpd->add_id($song->{uri}, $pos));
    $pos++;
    $prio--;
}
MaxKellermann commented 6 years ago

I tried reproducing this over and over, with the very little information you provided - but was unable to. MPD always played all prioritized songs before the rest. This is an exceptionally bad bug report. It contains no information at all on how to reproduce the problem. It does not even mention that you're in random mode. No log. Nothing. All I have is the version number.

carnager commented 6 years ago

relevant logs:

mpc output to see the ids of the songs:

carnager@caprica ~ > mpc playlist -f '%id% - %artist% - %title%' 
14 - Wool - SOS
20 - Alice in Chains - Rotten Apple
21 - Alice in Chains - Nutshell
22 - Alice in Chains - I Stay Away
23 - Alice in Chains - No Excuses
24 - Alice in Chains - Whale & Wasp
25 - Alice in Chains - Don't Follow
26 - Alice in Chains - Swing on This
15 - Wool - SlightlyUnder
16 - Wool - ClearMyHead
17 - Wool - Wait
18 - Wool - Medication
19 - Wool - Eff

mpd logs to see that the correct songs are prioritized and some of them are played after those that have not been:

carnager@tauron ~ > mpd --verbose --no-daemon --stdout
client: [0] process command "clear"
client: [1] process command "add "flac/Wool/1992 Budspawn EP/01-SOS.flac""
client: [1] process command "add "flac/Wool/1992 Budspawn EP/02-SlightlyUnder.flac""
client: [1] process command "add "flac/Wool/1992 Budspawn EP/03-ClearMyHead.flac""
client: [1] process command "add "flac/Wool/1992 Budspawn EP/04-Wait.flac""
client: [1] process command "add "flac/Wool/1992 Budspawn EP/05-Medication.flac""
client: [1] process command "add "flac/Wool/1992 Budspawn EP/06-Eff.flac""
client: [3] process command "random "1""
client: [4] process command "search "Artist" "Alice in Chains" "Album" "Jar of Flies""
client: [4] process command "addid "flac/Alice in Chains/1994 Jar of Flies EP/01-Rotten Apple.flac" "1""
client: [4] process command "prioid "255" "20""
client: [4] process command "addid "flac/Alice in Chains/1994 Jar of Flies EP/02-Nutshell.flac" "2""
client: [4] process command "prioid "254" "21""
client: [4] process command "addid "flac/Alice in Chains/1994 Jar of Flies EP/03-I Stay Away.flac" "3""
client: [4] process command "prioid "253" "22""
client: [4] process command "addid "flac/Alice in Chains/1994 Jar of Flies EP/04-No Excuses.flac" "4""
client: [4] process command "prioid "252" "23""
client: [4] process command "addid "flac/Alice in Chains/1994 Jar of Flies EP/05-Whale & Wasp.flac" "5""
client: [4] process command "prioid "251" "24""
client: [4] process command "addid "flac/Alice in Chains/1994 Jar of Flies EP/06-Don't Follow.flac" "6""
client: [4] process command "prioid "250" "25""
client: [4] process command "addid "flac/Alice in Chains/1994 Jar of Flies EP/07-Swing on This.flac" "7""
client: [4] process command "prioid "249" "26""
client: [0] process command "playid "14""
playlist: play 0:"flac/Wool/1992 Budspawn EP/01-SOS.flac"
playlist: queue song 1:"flac/Alice in Chains/1994 Jar of Flies EP/02-Nutshell.flac"
client: [6] process command "next"
playlist: play 1:"flac/Alice in Chains/1994 Jar of Flies EP/02-Nutshell.flac"
client: [7] process command "next"
playlist: play 2:"flac/Alice in Chains/1994 Jar of Flies EP/04-No Excuses.flac"
client: [8] process command "next"
playlist: play 3:"flac/Alice in Chains/1994 Jar of Flies EP/05-Whale & Wasp.flac"
client: [9] process command "next"
playlist: play 4:"flac/Alice in Chains/1994 Jar of Flies EP/06-Don't Follow.flac"
client: [10] process command "next"
playlist: play 5:"flac/Alice in Chains/1994 Jar of Flies EP/07-Swing on This.flac"
client: [11] process command "next"
playlist: play 6:"flac/Wool/1992 Budspawn EP/04-Wait.flac"
client: [12] process command "next"
playlist: play 7:"flac/Wool/1992 Budspawn EP/02-SlightlyUnder.flac"
client: [13] process command "next"
playlist: play 8:"flac/Wool/1992 Budspawn EP/03-ClearMyHead.flac"
client: [14] process command "next"
playlist: play 9:"flac/Wool/1992 Budspawn EP/06-Eff.flac"
client: [15] process command "next"
playlist: play 10:"flac/Wool/1992 Budspawn EP/05-Medication.flac"
client: [16] process command "next"
playlist: play 11:"flac/Alice in Chains/1994 Jar of Flies EP/03-I Stay Away.flac"
client: [17] process command "next"
playlist: play 12:"flac/Alice in Chains/1994 Jar of Flies EP/01-Rotten Apple.flac"
client: [18] process command "next"
playlist: stop

complete mpd log: https://gist.githubusercontent.com/carnager/14e3cf0b2475f026f46193201652c98c/raw/7defc0c8e156fb70c04afd3cd18185ef06fad53d/gistfile1.txt

As you can see in above log 2 of the Alice in Chains tracks are played after all other songs have been played, even though priorities have been set. Also seen in the log is that random mode was explicitly enabled.