1
0
mirror of https://github.com/SuperBFG7/ympd synced 2024-11-26 23:07:17 +00:00
ympd/src/mpd_client.h

66 lines
2.1 KiB
C
Raw Normal View History

#ifndef __MPD_CLIENT_H__
#define __MPD_CLIENT_H__
2013-11-04 17:18:38 +00:00
#include <libwebsockets.h>
#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)
#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"
#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"
#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
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);
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;
#endif