EHS
Loading...
Searching...
No Matches
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 {
15 };
16
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
51
54 UInt_32 Play();
55
58 UInt_32 Pause();
59
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
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
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
bool Authorize()
Definition Spotify.cpp:26
bool IsActive() const
Definition Spotify.cpp:627
UInt_32 QueueTrack(const Str_8 &id)
Definition Spotify.cpp:452
UInt_32 GetPlayingTrack(Vector< Str_8 > &artists, Str_8 &id, Str_8 &name)
Definition Spotify.cpp:330
UInt_32 SetRepeat(SpotifyState state)
Definition Spotify.cpp:190
UInt_32 AddTrack(const Str_8 &playlistId, const Str_8 &trackId, const UInt_32 pos=0)
Definition Spotify.cpp:503
Str_8 GetClientId() const
Definition Spotify.cpp:632
UInt_32 SetShuffle(bool state)
Definition Spotify.cpp:224
UInt_32 SetVolume(UInt_8 level)
Definition Spotify.cpp:132
UInt_32 Play()
Definition Spotify.cpp:152
UInt_32 Pause()
Definition Spotify.cpp:171
Spotify()
Definition Spotify.cpp:15
Str_8 GetSecret() const
Definition Spotify.cpp:637
UInt_32 Seek(UInt_32 pos)
Definition Spotify.cpp:562
static const Str_8 trackUriPrefix
Definition Spotify.h:37
UInt_32 AddTracks(const Str_8 &playlistId, const Array< Str_8 > &trackIds, const UInt_32 pos=0)
Definition Spotify.cpp:472
UInt_32 GetQueue(Array< Track > &tracks)
Definition Spotify.cpp:396
UInt_32 SearchTrack(Vector< Str_8 > &artists, Str_8 &id, Str_8 &name)
Definition Spotify.cpp:244
UInt_32 Skip()
Definition Spotify.cpp:524
bool IsVerificationForced() const
Definition Spotify.cpp:647
Str_8 GetRedURI() const
Definition Spotify.cpp:642
UInt_32 Previous()
Definition Spotify.cpp:543
Definition Vector.h:18
Definition Anchor.h:6
unsigned int UInt_32
Definition Types.h:49
unsigned char UInt_8
Definition Types.h:43
Str< Char_8, UInt_64 > Str_8
Definition Str.h:1953
SpotifyState
Definition Spotify.h:11
@ CONTEXT
Definition Spotify.h:13
@ OFF
Definition Spotify.h:14
@ TRACK
Definition Spotify.h:12
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