summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorMax Kellermann <max@musicpd.org>2018-01-26 18:48:15 +0100
committerMax Kellermann <max@musicpd.org>2018-01-26 18:48:15 +0100
commitf55b1415d4b1945b5cb064a8f08c494173e7ba68 (patch)
tree2447c52fe859cf751e9b58387875dee66bb81f2a /src
parent67693c6ad0843d5cd882204f556d00b7dcf6d0cf (diff)
input/qobuz: move code to ExtractQobuzTrackId()
Diffstat (limited to 'src')
-rw-r--r--src/input/plugins/QobuzInputPlugin.cxx24
1 files changed, 17 insertions, 7 deletions
diff --git a/src/input/plugins/QobuzInputPlugin.cxx b/src/input/plugins/QobuzInputPlugin.cxx
index bf1c89bf3..0b7ed2c03 100644
--- a/src/input/plugins/QobuzInputPlugin.cxx
+++ b/src/input/plugins/QobuzInputPlugin.cxx
@@ -163,18 +163,28 @@ FinishQobuzInput()
delete qobuz_client;
}
-static InputStreamPtr
-OpenQobuzInput(const char *uri, Mutex &mutex, Cond &cond)
+gcc_pure
+static const char *
+ExtractQobuzTrackId(const char *uri)
{
- assert(qobuz_client != nullptr);
+ // TODO: what's the standard "qobuz://" URI syntax?
+ const char *track_id = StringAfterPrefix(uri, "qobuz://track/");
+ if (track_id == nullptr)
+ return nullptr;
- const char *track_id;
+ if (*track_id == 0)
+ return nullptr;
- // TODO: what's the standard "qobuz://" URI syntax?
+ return track_id;
+}
- track_id = StringAfterPrefix(uri, "qobuz://track/");
+static InputStreamPtr
+OpenQobuzInput(const char *uri, Mutex &mutex, Cond &cond)
+{
+ assert(qobuz_client != nullptr);
- if (track_id == nullptr || *track_id == 0)
+ const char *track_id = ExtractQobuzTrackId(uri);
+ if (track_id == nullptr)
return nullptr;
// TODO: validate track_id