Change behavior to HTTPS by default for musicbrainz.org, but HTTP by default for custom servers

This commit is contained in:
Jelle Kaufmann 2021-05-04 16:07:08 +02:00
parent a46c975387
commit 449617050d
4 changed files with 11 additions and 7 deletions

View file

@ -97,8 +97,11 @@ def configure():
from the beets configuration. This should be called at startup.
"""
hostname = config['musicbrainz']['host'].as_str()
use_https = config['musicbrainz']['use_https'].get(bool)
musicbrainzngs.set_hostname(hostname, use_https)
https = config['musicbrainz']['https'].get(bool)
# Only call set_hostname when a custom server is configured. Since
# musicbrainz-ngs connects to musicbrainz.org with HTTPS by default
if hostname != "musicbrainz.org":
musicbrainzngs.set_hostname(hostname, https)
musicbrainzngs.set_rate_limit(
config['musicbrainz']['ratelimit_interval'].as_number(),
config['musicbrainz']['ratelimit'].get(int),

View file

@ -102,7 +102,7 @@ statefile: state.pickle
musicbrainz:
host: musicbrainz.org
use_https: yes
https: no
ratelimit: 1
ratelimit_interval: 1.0
searchlimit: 5

View file

@ -47,7 +47,7 @@ Major new features:
Other new things:
* Enable HTTPS support to Musicbrainz by default and add configuration option
`use_https`.
`https` for custom servers.
* :doc:`/plugins/mpdstats`: Add a new `strip_path` option to help build the
right local path from MPD information.
* :doc:`/plugins/convert`: Conversion can now parallelize conversion jobs on

View file

@ -691,17 +691,18 @@ MusicBrainz Options
-------------------
You can instruct beets to use `your own MusicBrainz database`_ instead of
the `main server`_. Use the ``host``, ``use_https`` and ``ratelimit`` options
the `main server`_. Use the ``host``, ``https`` and ``ratelimit`` options
under a ``musicbrainz:`` header, like so::
musicbrainz:
host: localhost:5000
use_https: no
https: no
ratelimit: 100
The ``host`` key, of course, controls the Web server hostname (and port,
optionally) that will be contacted by beets (default: musicbrainz.org).
The ``use_https`` key makes the client use https instead of http (default: yes).
The ``https`` key makes the client use https instead of http, this setting applies
only to custom servers. The official musicbrainz server always uses HTTPS (default: no).
The server must have search indices enabled (see `Building search indexes`_).
The ``ratelimit`` option, an integer, controls the number of Web service requests