Skip to content

Commit

Permalink
Support command playlistlength
Browse files Browse the repository at this point in the history
  • Loading branch information
jcorporation committed Feb 15, 2024
1 parent 768a42e commit 30dd8d0
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 0 deletions.
1 change: 1 addition & 0 deletions NEWS
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
libmpdclient 2.23 (not yet released)
* support MPD protocol 0.24.0
- allow window for listplaylist and listplaylistinfo
- command "playlistlength"

libmpdclient 2.22 (2023/12/22)
* drop the unmaintained Vala bindings
Expand Down
13 changes: 13 additions & 0 deletions include/mpd/playlist.h
Original file line number Diff line number Diff line change
Expand Up @@ -586,6 +586,19 @@ mpd_send_rm(struct mpd_connection *connection, const char *name);
bool
mpd_run_rm(struct mpd_connection *connection, const char *name);

/**
* Count the number of songs and their total playtime (seconds) in the
* playlist.
*
* @param connection the connection to MPD
* @param name the name of the playlist file
* @return true on success, false on error
*
* @since libmpdclient 2.23, MPD 0.24
*/
bool
mpd_send_playlistlength(struct mpd_connection *connection, const char *name);

#ifdef __cplusplus
}
#endif
Expand Down
1 change: 1 addition & 0 deletions libmpdclient.ld
Original file line number Diff line number Diff line change
Expand Up @@ -270,6 +270,7 @@ global:
mpd_run_save_queue;
mpd_parse_queue_save_mode;
mpd_lookup_queue_save_mode;
mpd_send_playlistlength;

/* mpd/queue.h */
mpd_send_list_queue_meta;
Expand Down
6 changes: 6 additions & 0 deletions src/cplaylist.c
Original file line number Diff line number Diff line change
Expand Up @@ -313,3 +313,9 @@ mpd_run_rm(struct mpd_connection *connection, const char *name)
mpd_send_rm(connection, name) &&
mpd_response_finish(connection);
}

bool
mpd_send_playlistlength(struct mpd_connection *connection, const char *name)
{
return mpd_send_command(connection, "playlistlength", name, NULL);
}

0 comments on commit 30dd8d0

Please sign in to comment.