Code

mpdclient: removed several functions
[ncmpc.git] / src / mpdclient.h
1 #ifndef MPDCLIENT_H
2 #define MPDCLIENT_H
4 #include "playlist.h"
6 #include <mpd/client.h>
8 struct filelist;
10 struct mpdclient {
11         /* playlist */
12         struct mpdclient_playlist playlist;
14         struct mpd_connection *connection;
15         struct mpd_status *status;
16         const struct mpd_song *song;
18         int volume;
19         unsigned update_id;
21         /**
22          * A bit mask of idle events occured since the last update.
23          */
24         enum mpd_idle events;
25 };
27 /** functions ***************************************************************/
29 gint
30 mpdclient_handle_error(struct mpdclient *c);
32 struct mpdclient *
33 mpdclient_new(void);
35 void mpdclient_free(struct mpdclient *c);
37 static inline bool
38 mpdclient_is_connected(const struct mpdclient *c)
39 {
40         return c->connection != NULL;
41 }
43 static inline const struct mpd_song *
44 mpdclient_get_current_song(const struct mpdclient *c)
45 {
46         return c->song != NULL && c->status != NULL &&
47                 (mpd_status_get_state(c->status) == MPD_STATE_PLAY ||
48                  mpd_status_get_state(c->status) == MPD_STATE_PAUSE)
49                 ? c->song
50                 : NULL;
51 }
53 bool
54 mpdclient_connect(struct mpdclient *c, const gchar *host, gint port,
55                   gfloat timeout_, const gchar *password);
57 void
58 mpdclient_disconnect(struct mpdclient *c);
60 bool
61 mpdclient_update(struct mpdclient *c);
63 /**
64  * To be implemented by the application: mpdclient.c calls this to
65  * display an error message.
66  */
67 void
68 mpdclient_ui_error(const char *message);
70 /*** MPD Commands  **********************************************************/
71 gint mpdclient_cmd_play(struct mpdclient *c, gint index);
72 gint
73 mpdclient_cmd_crop(struct mpdclient *c);
74 gint mpdclient_cmd_clear(struct mpdclient *c);
75 gint mpdclient_cmd_volume(struct mpdclient *c, gint value);
76 gint mpdclient_cmd_volume_up(struct mpdclient *c);
77 gint mpdclient_cmd_volume_down(struct mpdclient *c);
78 gint mpdclient_cmd_add_path(struct mpdclient *c, const gchar *path);
80 gint mpdclient_cmd_add(struct mpdclient *c, const struct mpd_song *song);
81 gint mpdclient_cmd_delete(struct mpdclient *c, gint index);
83 gint
84 mpdclient_cmd_delete_range(struct mpdclient *c, unsigned start, unsigned end);
86 gint mpdclient_cmd_move(struct mpdclient *c, gint old_index, gint new_index);
88 /* list functions */
89 GList *mpdclient_get_artists(struct mpdclient *c);
90 GList *mpdclient_get_albums(struct mpdclient *c, const gchar *artist_utf8);
92 /*** playlist functions  **************************************************/
94 /* update the complete playlist */
95 bool
96 mpdclient_playlist_update(struct mpdclient *c);
98 /* get playlist changes */
99 bool
100 mpdclient_playlist_update_changes(struct mpdclient *c);
103 /*** filelist functions  ***************************************************/
105 struct filelist *
106 mpdclient_filelist_get(struct mpdclient *c, const gchar *path);
108 struct filelist *
109 mpdclient_filelist_search(struct mpdclient *c, int exact_match,
110                           enum mpd_tag_type tag,
111                           gchar *filter_utf8);
113 /* add all songs in filelist to the playlist */
114 int
115 mpdclient_filelist_add_all(struct mpdclient *c, struct filelist *fl);
117 /* sort by list-format */
118 gint compare_filelistentry_format(gconstpointer filelist_entry1, gconstpointer filelist_entry2);
120 #endif