|
a/src/mpdcli.hxx |
|
b/src/mpdcli.hxx |
|
... |
|
... |
17 |
#ifndef _MPDCLI_H_X_INCLUDED_
|
17 |
#ifndef _MPDCLI_H_X_INCLUDED_
|
18 |
#define _MPDCLI_H_X_INCLUDED_
|
18 |
#define _MPDCLI_H_X_INCLUDED_
|
19 |
|
19 |
|
20 |
#include <regex.h> // for regex_t
|
20 |
#include <regex.h> // for regex_t
|
21 |
#include <string> // for string
|
21 |
#include <string> // for string
|
|
|
22 |
#include <cstdio>
|
22 |
#include <vector> // for vector
|
23 |
#include <vector> // for vector
|
|
|
24 |
#include <memory>
|
23 |
|
25 |
|
24 |
struct mpd_song;
|
26 |
struct mpd_song;
|
25 |
|
27 |
|
26 |
class UpSong {
|
28 |
class UpSong {
|
27 |
public:
|
29 |
public:
|
|
... |
|
... |
81 |
UpSong nextsong;
|
83 |
UpSong nextsong;
|
82 |
|
84 |
|
83 |
// Synthetized fields
|
85 |
// Synthetized fields
|
84 |
int trackcounter;
|
86 |
int trackcounter;
|
85 |
int detailscounter;
|
87 |
int detailscounter;
|
|
|
88 |
bool externalvolumecontrol;
|
|
|
89 |
std::string onvolumechange;
|
|
|
90 |
std::string getexternalvolume;
|
86 |
};
|
91 |
};
|
87 |
|
92 |
|
88 |
// Complete Mpd State
|
93 |
// Complete Mpd State
|
89 |
struct MpdState {
|
94 |
struct MpdState {
|
90 |
MpdStatus status;
|
95 |
MpdStatus status;
|
|
... |
|
... |
92 |
};
|
97 |
};
|
93 |
|
98 |
|
94 |
class MPDCli {
|
99 |
class MPDCli {
|
95 |
public:
|
100 |
public:
|
96 |
MPDCli(const std::string& host, int port = 6600,
|
101 |
MPDCli(const std::string& host, int port = 6600,
|
97 |
const std::string& pass="", const std::string& m_onstart="",
|
102 |
const std::string& pass="", const std::string& onstart="",
|
98 |
const std::string& m_onplay="", const std::string& m_onstop="",
|
103 |
const std::string& onplay="", const std::string& onstop="",
|
99 |
const std::string& m_onvolumechange="");
|
104 |
const std::string& onvolumechange="",
|
|
|
105 |
const std::string& getexternalvolume="",
|
|
|
106 |
bool externalvolumecontrol = false);
|
100 |
~MPDCli();
|
107 |
~MPDCli();
|
101 |
bool ok() {return m_ok && m_conn;}
|
108 |
bool ok() {return m_ok && m_conn;}
|
102 |
bool setVolume(int ivol, bool isMute = false);
|
109 |
bool setVolume(int ivol, bool isMute = false);
|
103 |
int getVolume();
|
110 |
int getVolume();
|
104 |
bool togglePause();
|
111 |
bool togglePause();
|
|
... |
|
... |
150 |
int m_port;
|
157 |
int m_port;
|
151 |
std::string m_password;
|
158 |
std::string m_password;
|
152 |
std::string m_onstart;
|
159 |
std::string m_onstart;
|
153 |
std::string m_onplay;
|
160 |
std::string m_onplay;
|
154 |
std::string m_onstop;
|
161 |
std::string m_onstop;
|
155 |
std::string m_onvolumechange;
|
|
|
156 |
regex_t m_tpuexpr;
|
162 |
regex_t m_tpuexpr;
|
157 |
// addtagid command only exists for mpd 0.19 and later.
|
163 |
// addtagid command only exists for mpd 0.19 and later.
|
158 |
bool m_have_addtagid;
|
164 |
bool m_have_addtagid;
|
159 |
// Position and id of last insertion: if the new request is to
|
165 |
// Position and id of last insertion: if the new request is to
|
160 |
// insert after this id, and the queue did not change, we compute
|
166 |
// insert after this id, and the queue did not change, we compute
|