[Pkg-mpd-maintainers] Bug#700219: mpc: Playlist numbering is off-by-one

Steve Kemp steve at steve.org.uk
Sun Feb 10 00:50:12 UTC 2013


Package: mpc
Version: 0.19-2
Severity: normal

*** Please type your report below this line ***

I regularly use (via a local emacs mode) the formatting optiona
available in the playlist-display to choose my next song.

This example will make it clear:

    * I'm trying to dump all songs in the playlist, along with
      their numbers.

precious ~ $ mpc --format='%id% - %file%' playlist  | head -n 10
0 - Abba/Abba - Dancing Queen.mp3
1 - AC-DC/Back In Black/Hells Bells - AC-DC - Back In Black - 01.mp3
2 - AC-DC/Back In Black/Shoot To Thrill - AC-DC - Back In Black - 02.mp3
3 - AC-DC/Back In Black/What Do You Do For Money Honey- - AC-DC - Back In Black - 03.mp3
4 - AC-DC/Back In Black/Givin The Dog A Bone - AC-DC - Back In Black - 04.mp3
5 - AC-DC/Back In Black/Let Me Put My Love Into You - AC-DC - Back In Black - 05.mp3
6 - AC-DC/Back In Black/Back In Black - AC-DC - Back In Black - 06.mp3
7 - AC-DC/Back In Black/Have A Drink On Me - AC-DC - Back In Black - 08.mp3
8 - AC-DC/Back In Black/Shake A Leg - AC-DC - Back In Black - 09.mp3
9 - AC-DC/Back In Black/Rock And Roll Ain't Noise Pollution - AC-DC - Back In Black - 10.mp3


So now I have the ID of each song, and the name.

Let us pretend that song 10 is currently playing.  Let us play song 0:

precious ~ $ mpc play 0
AC-DC - Rock And Roll Ain't Noise Poll
[playing] #10/10246   0:04/4:26 (1%)
volume: n/a   repeat: on    random: on    single: off   consume: off

Here you see there is "magic behaviour".  Attempting to play song 0
will show the details for the currently-playing song.  It will not
play song zero.

If I wish to play Abba, the first song in the list above, I must choose
track 1:

precious ~ $ mpc play 1
Abba - Dancing Queen
[playing] #1/10246   0:00/6:33 (0%)
volume: n/a   repeat: on    random: on    single: off   consume: off

The conclusion?  The playlist-formatting should start the ID at 1, not
0.

Patch attached:

--- util.c  2013-02-10 00:43:30.000000000 +0000
+++ util.c~ 2013-02-10 00:43:22.000000000 +0000
@@ -245,7 +245,7 @@
        snprintf(buffer, sizeof(buffer), "%d", pos+1);
        value = buffer;
    } else if (strcmp(name, "id") == 0) {
-       snprintf(buffer, sizeof(buffer), "%u", mpd_song_get_id(song)+1);
+       snprintf(buffer, sizeof(buffer), "%u", mpd_song_get_id(song));
        value = buffer;
    } else {
        enum mpd_tag_type tag_type = mpd_tag_name_iparse(name);

-- System Information:
Debian Release: 6.0.6
  APT prefers stable-updates
  APT policy: (500, 'stable-updates'), (500, 'stable')
Architecture: amd64 (x86_64)

Kernel: Linux 2.6.32-5-amd64 (SMP w/2 CPU cores)
Locale: LANG=en_GB.UTF-8, LC_CTYPE=en_GB.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash

Versions of packages mpc depends on:
ii  libc6                         2.11.3-4   Embedded GNU C Library: Shared lib
ii  libmpdclient2                 2.3-1      client library for the Music Playe

mpc recommends no packages.

Versions of packages mpc suggests:
ii  mpd                           0.16.7-2   Music Player Daemon

-- no debconf information



More information about the Pkg-mpd-maintainers mailing list