-
Notifications
You must be signed in to change notification settings - Fork 0
/
pianohelper.cpp
48 lines (33 loc) · 884 Bytes
/
pianohelper.cpp
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
#include "pianohelper.h"
PianoHelper::PianoHelper()
{
//DO NOTHING
}
//Code from pianobar
char* PianoHelper::PianoJsonStrdup(json_object* json, const char* key)
{
return strdup(json_object_get_string(json_object_object_get(json, key)));
}
std::vector< PandoraStation > PianoHelper::parseStations(PianoStation_t* stations)
{
std::vector<PandoraStation> ret;
while(stations != NULL){
PandoraStation station (*stations);
ret.push_back(station);
//Weird way of iterrating
stations = stations->next;
}
free(stations);
return ret;
}
std::vector< PandoraSong > PianoHelper::parsePlaylist(PianoSong_t* playlist)
{
std::vector<PandoraSong> ret;
while(playlist != NULL){
PandoraSong song (*playlist);
ret.push_back(song);
playlist = playlist->next;
}
free(playlist);//Destroy the old playlist object
return ret;
}