Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
M
mpd
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Иван Мажукин
mpd
Commits
1ecad094
Commit
1ecad094
authored
Jan 19, 2018
by
Max Kellermann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
input/tidal: add API documentation
parent
187cc573
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
37 additions
and
0 deletions
+37
-0
TidalLoginRequest.hxx
src/input/plugins/TidalLoginRequest.hxx
+8
-0
TidalSessionManager.hxx
src/input/plugins/TidalSessionManager.hxx
+21
-0
TidalTrackRequest.hxx
src/input/plugins/TidalTrackRequest.hxx
+8
-0
No files found.
src/input/plugins/TidalLoginRequest.hxx
View file @
1ecad094
...
@@ -31,12 +31,20 @@
...
@@ -31,12 +31,20 @@
class
CurlRequest
;
class
CurlRequest
;
/**
* Callback class for #TidalLoginRequest.
*
* Its methods must be thread-safe.
*/
class
TidalLoginHandler
{
class
TidalLoginHandler
{
public
:
public
:
virtual
void
OnTidalLoginSuccess
(
std
::
string
&&
session
)
noexcept
=
0
;
virtual
void
OnTidalLoginSuccess
(
std
::
string
&&
session
)
noexcept
=
0
;
virtual
void
OnTidalLoginError
(
std
::
exception_ptr
error
)
noexcept
=
0
;
virtual
void
OnTidalLoginError
(
std
::
exception_ptr
error
)
noexcept
=
0
;
};
};
/**
* An asynchronous Tidal "login/username" request.
*/
class
TidalLoginRequest
final
:
CurlResponseHandler
{
class
TidalLoginRequest
final
:
CurlResponseHandler
{
CurlSlist
request_headers
;
CurlSlist
request_headers
;
...
...
src/input/plugins/TidalSessionManager.hxx
View file @
1ecad094
...
@@ -34,10 +34,20 @@
...
@@ -34,10 +34,20 @@
class
CurlRequest
;
class
CurlRequest
;
class
TidalLoginRequest
;
class
TidalLoginRequest
;
/**
* Callback class for #TidalSessionManager.
*
* Its methods must be thread-safe.
*/
class
TidalSessionHandler
class
TidalSessionHandler
:
public
boost
::
intrusive
::
list_base_hook
<
boost
::
intrusive
::
link_mode
<
boost
::
intrusive
::
safe_link
>>
:
public
boost
::
intrusive
::
list_base_hook
<
boost
::
intrusive
::
link_mode
<
boost
::
intrusive
::
safe_link
>>
{
{
public
:
public
:
/**
* TidalSessionHandler::AddLoginHandler() has completed
* (successful or failed). This method may now call
* #TidalSessionHandler::GetSession().
*/
virtual
void
OnTidalSession
()
noexcept
=
0
;
virtual
void
OnTidalSession
()
noexcept
=
0
;
};
};
...
@@ -105,6 +115,13 @@ public:
...
@@ -105,6 +115,13 @@ public:
return
base_url
;
return
base_url
;
}
}
/**
* Ask the object to call back once the login to Tidal has
* completed. If no session exists currently, then one is
* created. Since the callback may occur in another thread,
* the it may have been completed already before this method
* returns.
*/
void
AddLoginHandler
(
TidalSessionHandler
&
h
)
noexcept
;
void
AddLoginHandler
(
TidalSessionHandler
&
h
)
noexcept
;
void
RemoveLoginHandler
(
TidalSessionHandler
&
h
)
noexcept
{
void
RemoveLoginHandler
(
TidalSessionHandler
&
h
)
noexcept
{
...
@@ -117,6 +134,10 @@ public:
...
@@ -117,6 +134,10 @@ public:
return
token
;
return
token
;
}
}
/**
* Get the Tidal session id, or rethrows an exception if an
* error has occurred while logging in.
*/
std
::
string
GetSession
()
const
{
std
::
string
GetSession
()
const
{
const
std
::
lock_guard
<
Mutex
>
protect
(
mutex
);
const
std
::
lock_guard
<
Mutex
>
protect
(
mutex
);
...
...
src/input/plugins/TidalTrackRequest.hxx
View file @
1ecad094
...
@@ -31,6 +31,11 @@
...
@@ -31,6 +31,11 @@
class
CurlRequest
;
class
CurlRequest
;
/**
* Callback class for #TidalTrackRequest.
*
* Its methods must be thread-safe.
*/
class
TidalTrackHandler
class
TidalTrackHandler
:
public
boost
::
intrusive
::
list_base_hook
<
boost
::
intrusive
::
link_mode
<
boost
::
intrusive
::
safe_link
>>
:
public
boost
::
intrusive
::
list_base_hook
<
boost
::
intrusive
::
link_mode
<
boost
::
intrusive
::
safe_link
>>
{
{
...
@@ -39,6 +44,9 @@ public:
...
@@ -39,6 +44,9 @@ public:
virtual
void
OnTidalTrackError
(
std
::
exception_ptr
error
)
noexcept
=
0
;
virtual
void
OnTidalTrackError
(
std
::
exception_ptr
error
)
noexcept
=
0
;
};
};
/**
* An asynchronous request for the streaming URL of a Tidal track.
*/
class
TidalTrackRequest
final
:
CurlResponseHandler
{
class
TidalTrackRequest
final
:
CurlResponseHandler
{
CurlSlist
request_headers
;
CurlSlist
request_headers
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment