From a46c975387a08500af9730556d386c20a788974b Mon Sep 17 00:00:00 2001 From: Jelle Kaufmann Date: Mon, 3 May 2021 20:28:47 +0200 Subject: [PATCH 1/5] Add HTTPS support for Musicbrainz --- beets/autotag/mb.py | 3 ++- beets/config_default.yaml | 1 + docs/changelog.rst | 2 ++ docs/reference/config.rst | 6 ++++-- 4 files changed, 9 insertions(+), 3 deletions(-) diff --git a/beets/autotag/mb.py b/beets/autotag/mb.py index 3ca5463c2..53fe80a3a 100644 --- a/beets/autotag/mb.py +++ b/beets/autotag/mb.py @@ -97,7 +97,8 @@ def configure(): from the beets configuration. This should be called at startup. """ hostname = config['musicbrainz']['host'].as_str() - musicbrainzngs.set_hostname(hostname) + use_https = config['musicbrainz']['use_https'].get(bool) + musicbrainzngs.set_hostname(hostname, use_https) musicbrainzngs.set_rate_limit( config['musicbrainz']['ratelimit_interval'].as_number(), config['musicbrainz']['ratelimit'].get(int), diff --git a/beets/config_default.yaml b/beets/config_default.yaml index dd140675f..06445a687 100644 --- a/beets/config_default.yaml +++ b/beets/config_default.yaml @@ -102,6 +102,7 @@ statefile: state.pickle musicbrainz: host: musicbrainz.org + use_https: yes ratelimit: 1 ratelimit_interval: 1.0 searchlimit: 5 diff --git a/docs/changelog.rst b/docs/changelog.rst index 6caed75c6..bc7eb367e 100644 --- a/docs/changelog.rst +++ b/docs/changelog.rst @@ -46,6 +46,8 @@ Major new features: Other new things: +* Enable HTTPS support to Musicbrainz by default and add configuration option + `use_https`. * :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 diff --git a/docs/reference/config.rst b/docs/reference/config.rst index 9dd7447a4..8c4b9c373 100644 --- a/docs/reference/config.rst +++ b/docs/reference/config.rst @@ -691,15 +691,17 @@ MusicBrainz Options ------------------- You can instruct beets to use `your own MusicBrainz database`_ instead of -the `main server`_. Use the ``host`` and ``ratelimit`` options under a -``musicbrainz:`` header, like so:: +the `main server`_. Use the ``host``, ``use_https`` and ``ratelimit`` options +under a ``musicbrainz:`` header, like so:: musicbrainz: host: localhost:5000 + use_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 server must have search indices enabled (see `Building search indexes`_). The ``ratelimit`` option, an integer, controls the number of Web service requests From 449617050dddaf833fb56f92815253a75dd82aff Mon Sep 17 00:00:00 2001 From: Jelle Kaufmann Date: Tue, 4 May 2021 16:07:08 +0200 Subject: [PATCH 2/5] Change behavior to HTTPS by default for musicbrainz.org, but HTTP by default for custom servers --- beets/autotag/mb.py | 7 +++++-- beets/config_default.yaml | 2 +- docs/changelog.rst | 2 +- docs/reference/config.rst | 7 ++++--- 4 files changed, 11 insertions(+), 7 deletions(-) diff --git a/beets/autotag/mb.py b/beets/autotag/mb.py index 53fe80a3a..0334cff1e 100644 --- a/beets/autotag/mb.py +++ b/beets/autotag/mb.py @@ -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), diff --git a/beets/config_default.yaml b/beets/config_default.yaml index 06445a687..74540891e 100644 --- a/beets/config_default.yaml +++ b/beets/config_default.yaml @@ -102,7 +102,7 @@ statefile: state.pickle musicbrainz: host: musicbrainz.org - use_https: yes + https: no ratelimit: 1 ratelimit_interval: 1.0 searchlimit: 5 diff --git a/docs/changelog.rst b/docs/changelog.rst index bc7eb367e..4e3d1b374 100644 --- a/docs/changelog.rst +++ b/docs/changelog.rst @@ -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 diff --git a/docs/reference/config.rst b/docs/reference/config.rst index 8c4b9c373..92570e882 100644 --- a/docs/reference/config.rst +++ b/docs/reference/config.rst @@ -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 From 5460a81a4efa54a54156dd4107de2630db06ac34 Mon Sep 17 00:00:00 2001 From: Jelle Kaufmann <17139405+jellekaufmann@users.noreply.github.com> Date: Tue, 4 May 2021 17:01:25 +0200 Subject: [PATCH 3/5] Update docs/reference/config.rst Co-authored-by: Adrian Sampson --- docs/reference/config.rst | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/reference/config.rst b/docs/reference/config.rst index 92570e882..455639be0 100644 --- a/docs/reference/config.rst +++ b/docs/reference/config.rst @@ -701,8 +701,8 @@ under a ``musicbrainz:`` header, like so:: The ``host`` key, of course, controls the Web server hostname (and port, optionally) that will be contacted by beets (default: musicbrainz.org). -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 ``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 From 2eae5a8ecc1b151b9c94b9ccbac63ed94315177e Mon Sep 17 00:00:00 2001 From: Jelle Kaufmann <17139405+jellekaufmann@users.noreply.github.com> Date: Tue, 4 May 2021 17:01:52 +0200 Subject: [PATCH 4/5] Update docs/changelog.rst Co-authored-by: Adrian Sampson --- docs/changelog.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/changelog.rst b/docs/changelog.rst index 4e3d1b374..72a4b56d5 100644 --- a/docs/changelog.rst +++ b/docs/changelog.rst @@ -46,7 +46,7 @@ Major new features: Other new things: -* Enable HTTPS support to Musicbrainz by default and add configuration option +* Enable HTTPS for MusicBrainz by default and add configuration option `https` for custom servers. * :doc:`/plugins/mpdstats`: Add a new `strip_path` option to help build the right local path from MPD information. From a28099a35110b37dd1f65f042008b0a0e403da81 Mon Sep 17 00:00:00 2001 From: Andrew Rogl Date: Sat, 8 May 2021 19:18:11 +1000 Subject: [PATCH 5/5] Remove reference to rarfile version in link --- docs/changelog.rst | 1 + docs/reference/cli.rst | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/docs/changelog.rst b/docs/changelog.rst index 72a4b56d5..6d99dbc89 100644 --- a/docs/changelog.rst +++ b/docs/changelog.rst @@ -359,6 +359,7 @@ Fixes: :bug:`2984` * :doc:`/plugins/lyrics`: Fix crashes for Tekstowo false positives :bug:`3904` +* :doc`/reference/cli`: Remove reference to rarfile version in link For plugin developers: diff --git a/docs/reference/cli.rst b/docs/reference/cli.rst index 5d2b834b7..d450b299a 100644 --- a/docs/reference/cli.rst +++ b/docs/reference/cli.rst @@ -151,7 +151,7 @@ Optional command flags: beet import --set genre="Alternative Rock" --set mood="emotional" -.. _rarfile: https://pypi.python.org/pypi/rarfile/2.2 +.. _rarfile: https://pypi.python.org/pypi/rarfile/ .. only:: html