2014-01-08 01:23:02 +00:00
|
|
|
#ifndef __MPD_CLIENT_H__
|
|
|
|
#define __MPD_CLIENT_H__
|
|
|
|
|
2013-11-04 17:18:38 +00:00
|
|
|
#include <libwebsockets.h>
|
|
|
|
|
2014-01-08 01:23:02 +00:00
|
|
|
#define MAX_SIZE 1024 * 100
|
|
|
|
|
2013-11-04 17:18:38 +00:00
|
|
|
#define DO_SEND_STATE (1 << 0)
|
|
|
|
#define DO_SEND_PLAYLIST (1 << 1)
|
|
|
|
#define DO_SEND_TRACK_INFO (1 << 2)
|
2013-11-07 09:09:40 +00:00
|
|
|
#define DO_SEND_BROWSE (1 << 3)
|
2014-01-16 17:32:20 +00:00
|
|
|
#define DO_SEND_ERROR (1 << 4)
|
|
|
|
|
2013-11-07 09:09:40 +00:00
|
|
|
|
2013-11-04 17:18:38 +00:00
|
|
|
#define MPD_API_GET_SEEK "MPD_API_GET_SEEK"
|
|
|
|
#define MPD_API_GET_PLAYLIST "MPD_API_GET_PLAYLIST"
|
|
|
|
#define MPD_API_GET_TRACK_INFO "MPD_API_GET_TRACK_INFO"
|
2013-11-07 09:09:40 +00:00
|
|
|
#define MPD_API_GET_BROWSE "MPD_API_GET_BROWSE"
|
|
|
|
#define MPD_API_ADD_TRACK "MPD_API_ADD_TRACK"
|
2014-01-17 15:26:26 +00:00
|
|
|
#define MPD_API_ADD_PLAY_TRACK "MPD_API_ADD_PLAY_TRACK"
|
2013-11-08 11:58:18 +00:00
|
|
|
#define MPD_API_PLAY_TRACK "MPD_API_PLAY_TRACK"
|
2013-11-07 16:40:22 +00:00
|
|
|
#define MPD_API_RM_TRACK "MPD_API_RM_TRACK"
|
|
|
|
#define MPD_API_RM_ALL "MPD_API_RM_ALL"
|
2013-11-04 17:18:38 +00:00
|
|
|
#define MPD_API_SET_VOLUME "MPD_API_SET_VOLUME"
|
|
|
|
#define MPD_API_SET_PAUSE "MPD_API_SET_PAUSE"
|
|
|
|
#define MPD_API_SET_PLAY "MPD_API_SET_PLAY"
|
|
|
|
#define MPD_API_SET_STOP "MPD_API_SET_STOP"
|
|
|
|
#define MPD_API_SET_SEEK "MPD_API_SET_SEEK"
|
2013-11-04 23:17:28 +00:00
|
|
|
#define MPD_API_SET_NEXT "MPD_API_SET_PREV"
|
|
|
|
#define MPD_API_SET_PREV "MPD_API_SET_NEXT"
|
2013-11-05 13:59:12 +00:00
|
|
|
#define MPD_API_UPDATE_DB "MPD_API_UPDATE_DB"
|
2013-11-07 09:09:40 +00:00
|
|
|
#define MPD_API_TOGGLE_RANDOM "MPD_API_TOGGLE_RANDOM"
|
|
|
|
#define MPD_API_TOGGLE_CONSUME "MPD_API_TOGGLE_CONSUME"
|
|
|
|
#define MPD_API_TOGGLE_SINGLE "MPD_API_TOGGLE_SINGLE"
|
|
|
|
#define MPD_API_TOGGLE_REPEAT "MPD_API_TOGGLE_REPEAT"
|
2013-11-04 23:17:28 +00:00
|
|
|
|
2013-11-09 01:07:03 +00:00
|
|
|
struct per_session_data__ympd {
|
|
|
|
int do_send;
|
|
|
|
unsigned queue_version;
|
2014-01-17 15:26:26 +00:00
|
|
|
int current_song_id;
|
2013-11-09 01:07:03 +00:00
|
|
|
char *browse_path;
|
|
|
|
};
|
2013-11-04 17:18:38 +00:00
|
|
|
|
2013-11-09 01:07:03 +00:00
|
|
|
enum mpd_conn_states {
|
|
|
|
MPD_FAILURE,
|
|
|
|
MPD_DISCONNECTED,
|
|
|
|
MPD_CONNECTED
|
|
|
|
};
|
2013-11-04 17:18:38 +00:00
|
|
|
|
2013-12-03 20:48:49 +00:00
|
|
|
void *mpd_idle_connection(void *_data);
|
2013-11-04 17:18:38 +00:00
|
|
|
int callback_ympd(struct libwebsocket_context *context,
|
2013-11-09 01:07:03 +00:00
|
|
|
struct libwebsocket *wsi,
|
|
|
|
enum libwebsocket_callback_reasons reason,
|
|
|
|
void *user, void *in, size_t len);
|
2013-11-05 13:59:12 +00:00
|
|
|
void mpd_loop();
|
2014-01-17 15:26:26 +00:00
|
|
|
int mpd_put_state(char *buffer, int *current_song_id, unsigned *queue_version);
|
2013-11-07 09:09:40 +00:00
|
|
|
int mpd_put_current_song(char *buffer);
|
|
|
|
int mpd_put_playlist(char *buffer);
|
2013-11-09 01:07:03 +00:00
|
|
|
int mpd_put_browse(char *buffer, char *path);
|
2013-11-11 14:53:54 +00:00
|
|
|
|
|
|
|
int mpd_port;
|
|
|
|
const char *mpd_host;
|
2014-01-08 01:23:02 +00:00
|
|
|
|
|
|
|
#endif
|
|
|
|
|