Switch to unified view

a/upmpd/mpdcli.hxx b/upmpd/mpdcli.hxx
...
...
20
#include <unordered_map>
20
#include <unordered_map>
21
#include <string>
21
#include <string>
22
#include <map>
22
#include <map>
23
#include <vector>
23
#include <vector>
24
24
25
class UpSong {
26
public:
27
    UpSong() : duration_secs(0), mpdid(0) {}
28
    void clear() {
29
        uri.clear(); 
30
        artist.clear(); 
31
        album.clear();
32
        title.clear();
33
        tracknum.clear();
34
        genre.clear();
35
        duration_secs = mpdid = 0;
36
    }
37
    std::string uri;
38
    std::string artist;
39
    std::string album;
40
    std::string title;
41
    std::string tracknum;
42
    std::string genre;
43
    unsigned int duration_secs;
44
    unsigned int mpdid;
45
};
46
25
class MpdStatus {
47
class MpdStatus {
26
public:
48
public:
27
    MpdStatus()
28
        : trackcounter(0), detailscounter(0)
49
    MpdStatus() : trackcounter(0), detailscounter(0) {}
29
        {}
50
30
    enum State {MPDS_UNK, MPDS_STOP, MPDS_PLAY, MPDS_PAUSE};
51
    enum State {MPDS_UNK, MPDS_STOP, MPDS_PLAY, MPDS_PAUSE};
52
31
    int volume;
53
    int volume;
32
    bool rept;
54
    bool rept;
33
    bool random;
55
    bool random;
34
    bool single;
56
    bool single;
35
    bool consume;
57
    bool consume;
...
...
46
    unsigned int kbrate;
68
    unsigned int kbrate;
47
    unsigned int sample_rate;
69
    unsigned int sample_rate;
48
    unsigned int bitdepth;
70
    unsigned int bitdepth;
49
    unsigned int channels;
71
    unsigned int channels;
50
    std::string errormessage;
72
    std::string errormessage;
51
    // Current song info. The keys are didl-lite names (which can be
73
    UpSong currentsong;
52
    // attribute or element names
74
    UpSong nextsong;
53
    std::unordered_map<std::string, std::string> currentsong;
54
    std::unordered_map<std::string, std::string> nextsong;
55
75
56
    // Synthetized fields
76
    // Synthetized fields
57
    int trackcounter;
77
    int trackcounter;
58
    int detailscounter;
78
    int detailscounter;
59
};
79
};
...
...
79
    bool random(bool on);
99
    bool random(bool on);
80
    bool single(bool on);
100
    bool single(bool on);
81
    bool seek(int seconds);
101
    bool seek(int seconds);
82
    bool clearQueue();
102
    bool clearQueue();
83
    int insert(const std::string& uri, int pos);
103
    int insert(const std::string& uri, int pos);
104
    // Insert after given id
105
    bool insertAfterId(const std::string& uri, int id);
84
    bool deleteId(int id);
106
    bool deleteId(int id);
85
    bool statId(int id);
107
    bool statId(int id);
86
    int curpos();
108
    int curpos();
87
    bool getQueueSongs(std::vector<mpd_song*>& songs);
109
    bool getQueueIds(std::vector<unsigned int>& vids);
88
    void freeSongs(std::vector<mpd_song*>& songs);
110
    bool statSong(UpSong& usong, int pos = -1, bool isId = false);
89
    bool statSong(std::unordered_map<std::string, std::string>& status, 
111
    bool mapSong(UpSong& usong, struct mpd_song *song);
90
                  int pos = -1, bool isId = false);
112
    
91
92
    const MpdStatus& getStatus()
113
    const MpdStatus& getStatus()
93
    {
114
    {
94
        updStatus();
115
        updStatus();
95
        return m_stat;
116
        return m_stat;
96
    }
117
    }
...
...
108
    int m_port;
129
    int m_port;
109
    std::string m_password;
130
    std::string m_password;
110
131
111
    bool openconn();
132
    bool openconn();
112
    bool updStatus();
133
    bool updStatus();
134
    bool getQueueSongs(std::vector<mpd_song*>& songs);
135
    void freeSongs(std::vector<mpd_song*>& songs);
113
    bool showError(const std::string& who);
136
    bool showError(const std::string& who);
114
};
137
};
115
138
116
139
117
#endif /* _MPDCLI_H_X_INCLUDED_ */
140
#endif /* _MPDCLI_H_X_INCLUDED_ */