Use https and http appropriately when connecting to MusicBrainz

Fixed some bugs:
- MusicBrainz submit URL always has https as protocol: hardcoded, even when
inappropriate. It's just a graphical issue.
- Whipper appears to always communicate with MusicBrainz using musicbrainzngs
over http. The musicbrainzngs.set_hostname(server).
- `musicbrainzngs.set_hostname(server)` always defaults to http. Since musicbrainzngs
version 0.7 the method `set_hostname` takes an optional argument named `use_https`
(defaults to False) which whipper never passes.

Changed behaviour of `server` option (`musicbrainz` section of whipper's configuration file).
Now it expects an URL with a valid scheme (scheme must be `http` or `http`, empty scheme isn't allowed anymore).
Only the scheme and netloc parts of the URL are taken into account.

Fixes #437.

Signed-off-by: JoeLametta <JoeLametta@users.noreply.github.com>
This commit is contained in:
JoeLametta
2020-01-16 20:44:35 +07:00
parent caa2c8b27d
commit 1206552bd2
5 changed files with 29 additions and 20 deletions

View File

@@ -351,7 +351,7 @@ class Table:
return disc.id
def getMusicBrainzSubmitURL(self):
host = config.Config().get_musicbrainz_server()
serv = config.Config().get_musicbrainz_server()
discid = self.getMusicBrainzDiscId()
values = self._getMusicBrainzValues()
@@ -363,7 +363,7 @@ class Table:
])
return urlunparse((
'https', host, '/cdtoc/attach', '', query, ''))
serv['scheme'], serv['netloc'], '/cdtoc/attach', '', query, ''))
def getFrameLength(self, data=False):
"""