input/qobuz: move code to ExtractQobuzTrackId()

This commit is contained in:
Max Kellermann 2018-01-26 18:48:15 +01:00
parent 67693c6ad0
commit f55b1415d4
1 changed files with 17 additions and 7 deletions

View File

@ -163,18 +163,28 @@ FinishQobuzInput()
delete qobuz_client;
}
gcc_pure
static const char *
ExtractQobuzTrackId(const char *uri)
{
// TODO: what's the standard "qobuz://" URI syntax?
const char *track_id = StringAfterPrefix(uri, "qobuz://track/");
if (track_id == nullptr)
return nullptr;
if (*track_id == 0)
return nullptr;
return track_id;
}
static InputStreamPtr
OpenQobuzInput(const char *uri, Mutex &mutex, Cond &cond)
{
assert(qobuz_client != nullptr);
const char *track_id;
// TODO: what's the standard "qobuz://" URI syntax?
track_id = StringAfterPrefix(uri, "qobuz://track/");
if (track_id == nullptr || *track_id == 0)
const char *track_id = ExtractQobuzTrackId(uri);
if (track_id == nullptr)
return nullptr;
// TODO: validate track_id