EHS
Spotify.h
Go to the documentation of this file.
1#pragma once
2
3#include "ehs/EHS.h"
4#include "ehs/Str.h"
5#include "ehs/Array.h"
6#include "ehs/io/socket/SSL.h"
7
8namespace ehs
9{
10 enum class SpotifyState
11 {
12 TRACK,
13 CONTEXT,
14 OFF
15 };
16
17 struct Track
18 {
22 };
23
24 class EHS_LIB_IO Spotify final
25 {
26 private:
27 SSL client;
28 Str_8 clientId;
29 Str_8 secret;
30 Str_8 redURI;
31 Array<Str_8> scopes;
32 bool forceVerify;
33 Str_8 token;
34 Str_8 rToken;
35
36 public:
37 static const Str_8 trackUriPrefix;
38
39 virtual ~Spotify();
40
41 Spotify();
42
43 Spotify(Str_8 clientId, Str_8 secret, Str_8 redURI, Array<Str_8> scopes, bool forceVerify);
44
45 bool Authorize();
46
50 UInt_32 SetVolume(UInt_8 level);
51
54 UInt_32 Play();
55
58 UInt_32 Pause();
59
63 UInt_32 SetRepeat(SpotifyState state);
64
68 UInt_32 SetShuffle(bool state);
69
70 UInt_32 SearchTrack(Vector<Str_8>& artists, Str_8& id, Str_8& name);
71
72 UInt_32 GetPlayingTrack(Vector<Str_8>& artists, Str_8& id, Str_8& name);
73
74 UInt_32 GetQueue(Array<Track>& tracks);
75
79 UInt_32 QueueTrack(const Str_8& id);
80
81 UInt_32 AddTracks(const Str_8& playlistId, const Array<Str_8>& trackIds, const UInt_32 pos = 0);
82
83 UInt_32 AddTrack(const Str_8& playlistId, const Str_8& trackId, const UInt_32 pos = 0);
84
87 UInt_32 Skip();
88
91 UInt_32 Previous();
92
96 UInt_32 Seek(UInt_32 pos);
97
98 Str_8 GetClientId() const;
99
100 Str_8 GetSecret() const;
101
102 Str_8 GetRedURI() const;
103
104 bool IsVerificationForced() const;
105
106 bool IsActive() const;
107
108 private:
109 void StartConnection();
110
111 bool ReAuthorize();
112 };
113}
Definition: Array.h:16
A class for handling the HTTP(S) TCP socket layer.
Definition: SSL.h:16
Definition: Spotify.h:25
static const Str_8 trackUriPrefix
Definition: Spotify.h:37
Definition: Vector.h:18
Definition: Anchor.h:6
unsigned int UInt_32
Definition: Types.h:49
unsigned char UInt_8
Definition: Types.h:43
SpotifyState
Definition: Spotify.h:11
Definition: Spotify.h:18
Str_8 id
Definition: Spotify.h:21
Array< Str_8 > artists
Definition: Spotify.h:19
Str_8 name
Definition: Spotify.h:20