input/qobuz: add setting "format_id"
This commit is contained in:
parent
fce061b544
commit
67693c6ad0
14
doc/user.xml
14
doc/user.xml
|
@ -2429,6 +2429,20 @@ run</programlisting>
|
|||
The Qobuz password.
|
||||
</entry>
|
||||
</row>
|
||||
|
||||
<row>
|
||||
<entry>
|
||||
<varname>format_id</varname>
|
||||
<parameter>N</parameter>
|
||||
</entry>
|
||||
<entry>
|
||||
The <ulink
|
||||
url="https://github.com/Qobuz/api-documentation/blob/master/endpoints/track/getFileUrl.md#parameters">Qobuz
|
||||
format identifier</ulink>, i.e. a number which
|
||||
chooses the format and quality to be requested from
|
||||
Qobuz. The default is "5" (320 kbit/s MP3).
|
||||
</entry>
|
||||
</row>
|
||||
</tbody>
|
||||
</tgroup>
|
||||
</informaltable>
|
||||
|
|
|
@ -52,10 +52,12 @@ QobuzClient::QobuzClient(EventLoop &event_loop,
|
|||
const char *_app_id, const char *_app_secret,
|
||||
const char *_device_manufacturer_id,
|
||||
const char *_username, const char *_email,
|
||||
const char *_password)
|
||||
const char *_password,
|
||||
const char *_format_id)
|
||||
:base_url(_base_url), app_id(_app_id), app_secret(_app_secret),
|
||||
device_manufacturer_id(_device_manufacturer_id),
|
||||
username(_username), email(_email), password(_password),
|
||||
format_id(_format_id),
|
||||
curl(event_loop),
|
||||
defer_invoke_handlers(event_loop, BIND_THIS_METHOD(InvokeHandlers))
|
||||
{
|
||||
|
|
|
@ -45,6 +45,7 @@ class QobuzClient final : QobuzLoginHandler {
|
|||
const char *const app_id, *const app_secret;
|
||||
const char *const device_manufacturer_id;
|
||||
const char *const username, *const email, *const password;
|
||||
const char *const format_id;
|
||||
|
||||
CurlInit curl;
|
||||
|
||||
|
@ -72,7 +73,12 @@ public:
|
|||
const char *_app_id, const char *_app_secret,
|
||||
const char *_device_manufacturer_id,
|
||||
const char *_username, const char *_email,
|
||||
const char *_password);
|
||||
const char *_password,
|
||||
const char *_format_id);
|
||||
|
||||
const char *GetFormatId() const noexcept {
|
||||
return format_id;
|
||||
}
|
||||
|
||||
gcc_pure
|
||||
CurlGlobal &GetCurl() noexcept;
|
||||
|
|
|
@ -148,10 +148,13 @@ InitQobuzInput(EventLoop &event_loop, const ConfigBlock &block)
|
|||
if (password == nullptr)
|
||||
throw PluginUnavailable("No Qobuz password configured");
|
||||
|
||||
const char *format_id = block.GetBlockValue("format_id", "5");
|
||||
|
||||
qobuz_client = new QobuzClient(event_loop, base_url,
|
||||
app_id, app_secret,
|
||||
device_manufacturer_id,
|
||||
username, email, password);
|
||||
username, email, password,
|
||||
format_id);
|
||||
}
|
||||
|
||||
static void
|
||||
|
|
|
@ -70,7 +70,7 @@ MakeTrackUrl(QobuzClient &client, const char *track_id)
|
|||
return client.MakeSignedUrl("track", "getFileUrl",
|
||||
{
|
||||
{"track_id", track_id},
|
||||
{"format_id", "5"},
|
||||
{"format_id", client.GetFormatId()},
|
||||
});
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue