Add version number for playlist (queue)

This is necessary to return a valid playlist id for mpd status command.
This commit is contained in:
chme 2015-05-03 10:34:49 +02:00
parent aa4a12cabe
commit 3886ec6638
3 changed files with 16 additions and 1 deletions

View File

@ -790,7 +790,7 @@ mpd_command_status(struct evbuffer *evbuf, int argc, char **argv, char **errmsg)
status.shuffle,
(status.repeat == REPEAT_SONG ? 1 : 0),
0 /* consume: not supported by forked-daapd, always return 'off' */,
status.plid,
status.plversion,
status.playlistlength,
state);
@ -1815,6 +1815,7 @@ mpd_command_playlistinfo(struct evbuffer *evbuf, int argc, char **argv, char **e
static int
mpd_command_plchanges(struct evbuffer *evbuf, int argc, char **argv, char **errmsg)
{
DPRINTF(E_WARN, L_MPD, "Ignore command %s\n", argv[0]);
return 0;
}

View File

@ -256,6 +256,7 @@ static struct player_source *shuffle_head;
static struct player_source *cur_playing;
static struct player_source *cur_streaming;
static uint32_t cur_plid;
static uint32_t cur_plversion;
static struct evbuffer *audio_buf;
/* Play history */
@ -2513,6 +2514,7 @@ get_status(struct player_command *cmd)
status->volume = master_volume;
status->plid = cur_plid;
status->plversion = cur_plversion;
switch (player_state)
{
@ -3870,6 +3872,7 @@ queue_add(struct player_command *cmd)
if (cur_plid != 0)
cur_plid = 0;
cur_plversion++;
listener_notify(LISTENER_PLAYLIST);
@ -3913,6 +3916,7 @@ queue_add_next(struct player_command *cmd)
if (cur_plid != 0)
cur_plid = 0;
cur_plversion++;
listener_notify(LISTENER_PLAYLIST);
@ -3983,6 +3987,8 @@ queue_move(struct player_command *cmd)
ps_dst->pl_next = ps_src;
}
cur_plversion++;
listener_notify(LISTENER_PLAYLIST);
return 0;
@ -4050,6 +4056,8 @@ queue_remove(struct player_command *cmd)
source_free(ps);
cur_plversion++;
listener_notify(LISTENER_PLAYLIST);
return 0;
@ -4077,6 +4085,7 @@ queue_clear(struct player_command *cmd)
}
cur_plid = 0;
cur_plversion++;
listener_notify(LISTENER_PLAYLIST);
@ -4129,6 +4138,8 @@ queue_empty(struct player_command *cmd)
source_head->shuffle_prev = source_head;
}
cur_plversion++;
listener_notify(LISTENER_PLAYLIST);
return 0;
@ -5189,6 +5200,7 @@ player_init(void)
cur_playing = NULL;
cur_streaming = NULL;
cur_plid = 0;
cur_plversion = 0;
player_state = PLAY_STOPPED;
repeat = REPEAT_OFF;

View File

@ -54,6 +54,8 @@ struct player_status {
/* Playlist id */
uint32_t plid;
/* Playlist version */
uint32_t plversion;
/* Playlist length */
uint32_t playlistlength;
/* Playing song id*/