Skip to content

Commit

Permalink
Upd: libmympdclient 1.0.27 #1213 #1214
Browse files Browse the repository at this point in the history
  • Loading branch information
jcorporation committed Feb 15, 2024
1 parent e904bf8 commit f429263
Show file tree
Hide file tree
Showing 7 changed files with 118 additions and 37 deletions.
1 change: 0 additions & 1 deletion dist/libmympdclient/include/mpd/client.h
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@
#include "entity.h"
#include "fingerprint.h"
#include "idle.h"
#include "libmympdclient_version.h"
#include "list.h"
#include "message.h"
#include "mixer.h"
Expand Down
35 changes: 0 additions & 35 deletions dist/libmympdclient/include/mpd/libmympdclient_version.h

This file was deleted.

45 changes: 45 additions & 0 deletions dist/libmympdclient/include/mpd/playlist.h
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,22 @@ mpd_recv_playlist(struct mpd_connection *connection);
bool
mpd_send_list_playlist(struct mpd_connection *connection, const char *name);

/**
* Like mpd_send_list_playlist(), but specifies a (position) range.
* Use mpd_recv_entity() to receive the songs (#MPD_ENTITY_TYPE_SONG).
*
* @param connection the connection to MPD
* @param name the name of the playlist
* @param start the start position of the range (including)
* @param end the end position of the range (excluding); the special
* @return true on success, false on error
*
* @since libmpdclient 2.23, MPD 0.24
*/
bool
mpd_send_list_playlist_range(struct mpd_connection *connection, const char *name,
unsigned start, unsigned end);

/**
* List the content, with full metadata, of the stored playlist identified by
* name. Use mpd_recv_entity() to receive the songs (#MPD_ENTITY_TYPE_SONG).
Expand All @@ -151,6 +167,22 @@ mpd_send_list_playlist(struct mpd_connection *connection, const char *name);
bool
mpd_send_list_playlist_meta(struct mpd_connection *connection, const char *name);

/**
* Like mpd_send_list_playlist_meta(), but specifies a (position) range.
* Use mpd_recv_entity() to receive the songs (#MPD_ENTITY_TYPE_SONG).
*
* @param connection the connection to MPD
* @param name the name of the playlist
* @param start the start position of the range (including)
* @param end the end position of the range (excluding); the special
* @return true on success, false on error
*
* @since libmpdclient 2.23, MPD 0.24
*/
bool
mpd_send_list_playlist_range_meta(struct mpd_connection *connection, const char *name,
unsigned start, unsigned end);

/**
* Clear the playlist name (i.e. truncate name.m3u)
*
Expand Down Expand Up @@ -554,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
19 changes: 19 additions & 0 deletions dist/libmympdclient/include/mpd/version.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,4 +30,23 @@
((minor) == LIBMPDCLIENT_MINOR_VERSION && \
(patch) <= LIBMPDCLIENT_PATCH_VERSION))))

#define LIBMYMPDCLIENT_MAJOR_VERSION 1
#define LIBMYMPDCLIENT_MINOR_VERSION 0
#define LIBMYMPDCLIENT_PATCH_VERSION 27

/**
* Preprocessor macro which allows you to check which version of
* libmympdclient you are compiling with. It can be used in
* preprocessor directives.
*
* @return true if this libmympdclient version equals or is newer than
* the specified version number
*/
#define LIBMYMPDCLIENT_CHECK_VERSION(major, minor, patch) \
((major) < LIBMYMPDCLIENT_MAJOR_VERSION || \
((major) == LIBMYMPDCLIENT_MAJOR_VERSION && \
((minor) < LIBMYMPDCLIENT_MINOR_VERSION || \
((minor) == LIBMYMPDCLIENT_MINOR_VERSION && \
(patch) <= LIBMYMPDCLIENT_PATCH_VERSION))))

#endif
19 changes: 19 additions & 0 deletions dist/libmympdclient/include/mpd/version.h.in
Original file line number Diff line number Diff line change
Expand Up @@ -30,4 +30,23 @@
((minor) == LIBMPDCLIENT_MINOR_VERSION && \
(patch) <= LIBMPDCLIENT_PATCH_VERSION))))

#define LIBMYMPDCLIENT_MAJOR_VERSION 1
#define LIBMYMPDCLIENT_MINOR_VERSION 0
#define LIBMYMPDCLIENT_PATCH_VERSION 27

/**
* Preprocessor macro which allows you to check which version of
* libmympdclient you are compiling with. It can be used in
* preprocessor directives.
*
* @return true if this libmympdclient version equals or is newer than
* the specified version number
*/
#define LIBMYMPDCLIENT_CHECK_VERSION(major, minor, patch) \
((major) < LIBMYMPDCLIENT_MAJOR_VERSION || \
((major) == LIBMYMPDCLIENT_MAJOR_VERSION && \
((minor) < LIBMYMPDCLIENT_MINOR_VERSION || \
((minor) == LIBMYMPDCLIENT_MINOR_VERSION && \
(patch) <= LIBMYMPDCLIENT_PATCH_VERSION))))

#endif
20 changes: 20 additions & 0 deletions dist/libmympdclient/src/cplaylist.c
Original file line number Diff line number Diff line change
Expand Up @@ -29,12 +29,26 @@ mpd_send_list_playlist(struct mpd_connection *connection, const char *name)
return mpd_send_command(connection, "listplaylist", name, NULL);
}

bool
mpd_send_list_playlist_range(struct mpd_connection *connection, const char *name,
unsigned start, unsigned end)
{
return mpd_send_s_range_command(connection, "listplaylist", name, start, end);
}

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

bool
mpd_send_list_playlist_range_meta(struct mpd_connection *connection, const char *name,
unsigned start, unsigned end)
{
return mpd_send_s_range_command(connection, "listplaylistinfo", name, start, end);
}

bool
mpd_send_playlist_clear(struct mpd_connection *connection, const char *name)
{
Expand Down Expand Up @@ -299,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);
}
16 changes: 15 additions & 1 deletion dist/libmympdclient/src/search.c
Original file line number Diff line number Diff line change
Expand Up @@ -253,7 +253,21 @@ bool
mpd_search_add_window(struct mpd_connection *connection,
unsigned start, unsigned end)
{
return mpd_request_add_window(connection, start, end);
assert(connection != NULL);
assert(start <= end);

const size_t size = 64;
char *dest = mpd_request_prepare_append(connection, size);
if (dest == NULL)
return false;

if (end == UINT_MAX)
/* the special value -1 means "open end" */
snprintf(dest, size, " window %u:", start);
else
snprintf(dest, size, " window %u:%u", start, end);

return true;
}

bool
Expand Down

0 comments on commit f429263

Please sign in to comment.