|
a/upmpd/mpdcli.hxx |
|
b/upmpd/mpdcli.hxx |
|
... |
|
... |
18 |
#define _MPDCLI_H_X_INCLUDED_
|
18 |
#define _MPDCLI_H_X_INCLUDED_
|
19 |
|
19 |
|
20 |
#include <unordered_map>
|
20 |
#include <unordered_map>
|
21 |
#include <string>
|
21 |
#include <string>
|
22 |
#include <map>
|
22 |
#include <map>
|
|
|
23 |
#include <vector>
|
23 |
|
24 |
|
24 |
class MpdStatus {
|
25 |
class MpdStatus {
|
25 |
public:
|
26 |
public:
|
26 |
MpdStatus()
|
27 |
MpdStatus()
|
27 |
: trackcounter(0), detailscounter(0)
|
28 |
: trackcounter(0), detailscounter(0)
|
|
... |
|
... |
55 |
// Synthetized fields
|
56 |
// Synthetized fields
|
56 |
int trackcounter;
|
57 |
int trackcounter;
|
57 |
int detailscounter;
|
58 |
int detailscounter;
|
58 |
};
|
59 |
};
|
59 |
|
60 |
|
|
|
61 |
struct mpd_song;
|
|
|
62 |
|
60 |
class MPDCli {
|
63 |
class MPDCli {
|
61 |
public:
|
64 |
public:
|
62 |
MPDCli(const std::string& host, int port = 6600,
|
65 |
MPDCli(const std::string& host, int port = 6600,
|
63 |
const std::string& pass="");
|
66 |
const std::string& pass="");
|
64 |
~MPDCli();
|
67 |
~MPDCli();
|
65 |
bool ok() {return m_ok && m_conn;}
|
68 |
bool ok() {return m_ok && m_conn;}
|
66 |
bool setVolume(int ivol, bool isMute = false);
|
69 |
bool setVolume(int ivol, bool isMute = false);
|
67 |
int getVolume();
|
70 |
int getVolume();
|
68 |
bool togglePause();
|
71 |
bool togglePause();
|
|
|
72 |
bool pause(bool onoff);
|
69 |
bool play(int pos = -1);
|
73 |
bool play(int pos = -1);
|
|
|
74 |
bool playId(int pos = -1);
|
70 |
bool stop();
|
75 |
bool stop();
|
71 |
bool next();
|
76 |
bool next();
|
72 |
bool previous();
|
77 |
bool previous();
|
73 |
bool repeat(bool on);
|
78 |
bool repeat(bool on);
|
74 |
bool random(bool on);
|
79 |
bool random(bool on);
|
|
... |
|
... |
77 |
bool clearQueue();
|
82 |
bool clearQueue();
|
78 |
int insert(const std::string& uri, int pos);
|
83 |
int insert(const std::string& uri, int pos);
|
79 |
bool deleteId(int id);
|
84 |
bool deleteId(int id);
|
80 |
bool statId(int id);
|
85 |
bool statId(int id);
|
81 |
int curpos();
|
86 |
int curpos();
|
|
|
87 |
bool getQueueSongs(std::vector<mpd_song*>& songs);
|
|
|
88 |
void freeSongs(std::vector<mpd_song*>& songs);
|
|
|
89 |
bool statSong(std::unordered_map<std::string, std::string>& status,
|
|
|
90 |
int pos = -1, bool isId = false);
|
|
|
91 |
|
82 |
const MpdStatus& getStatus()
|
92 |
const MpdStatus& getStatus()
|
83 |
{
|
93 |
{
|
84 |
updStatus();
|
94 |
updStatus();
|
85 |
return m_stat;
|
95 |
return m_stat;
|
86 |
}
|
96 |
}
|
|
... |
|
... |
98 |
int m_port;
|
108 |
int m_port;
|
99 |
std::string m_password;
|
109 |
std::string m_password;
|
100 |
|
110 |
|
101 |
bool openconn();
|
111 |
bool openconn();
|
102 |
bool updStatus();
|
112 |
bool updStatus();
|
103 |
bool updSong(std::unordered_map<std::string, std::string>& status,
|
|
|
104 |
int pos = -1);
|
|
|
105 |
bool showError(const std::string& who);
|
113 |
bool showError(const std::string& who);
|
106 |
};
|
114 |
};
|
107 |
|
115 |
|
108 |
|
116 |
|
109 |
#endif /* _MPDCLI_H_X_INCLUDED_ */
|
117 |
#endif /* _MPDCLI_H_X_INCLUDED_ */
|