-
Notifications
You must be signed in to change notification settings - Fork 5
/
Responder.h
60 lines (48 loc) · 1.8 KB
/
Responder.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
#ifndef RESPONDER_H
#define RESPONDER_H
#include "AIMP2_SDK.h"
#include "MultiReaderSingleWriter.hpp"
#include "CRC32.h"
#include <string>
#include <sstream>
#include <vector>
#include <map>
#include <fstream>
#include <streambuf>
enum RESPONSE_TYPE{RESPONSE_NORMAL, RESPONSE_FILENAME};
static std::map<std::string /*playlist cache key*/, std::pair<unsigned int /*time*/, std::pair<int /*crc32*/, std::string /*cached playlist*/> > > PLAYLIST_CACHE;
class CResponder
{
public:
CResponder(IAIMP2Controller *AIMP, std::map<std::string, std::string>& params);
~CResponder(void);
std::string GetResponse(void);
private:
std::wstring FromLocale(const std::string& mbstring);
std::string ToLocale(const std::wstring& widestring);
std::wstring FromUtf8(const std::string& mbstring);
std::string ToUtf8(const std::wstring& widestring);
IAIMP2Controller *ctrl;
IAIMP2PlaylistManager2 *manager2;
IAIMP2Player *player;
IAIMP2Extended *extended;
std::string pluginsPath;
std::map<std::string, std::string> requestParams;
RESPONSE_TYPE response_type;
public:
std::string DoAction(void);
void DoFilePlay(void);
std::string GetPlaylistList(void);
std::string GetPlaylistSongs(int playListID, bool ignoreCache, bool returnCRC, int offset = 0, int size = 0);
std::string GetCurrentSong();
std::string DownloadSong(int playListID, int SongNum);
void PlayTrack(int playListID, int SongNum);
void SetNewSongPosition(int playListID, int SongNum, int position);
void SortPlaylist(int playlistID, std::string sortType);
std::string GetPlayerStatus();
void SetPlayerStatus(std::string statusType, int value);
void AddFile(int playlistID, std::string fileName);
void DeleteFile(int playlistID, int fileId);
RESPONSE_TYPE GetResponseType();
};
#endif //RESPONDER_H