Enable connecting to a custom MusicBrainz server

Under the new [musicbrainz] section in the config,
you can set a server to connect to.

Closes #172.
This commit is contained in:
Eshan Singh
2017-12-30 10:55:52 +00:00
parent 75a3d4bce1
commit e2e8676e4d
4 changed files with 16 additions and 3 deletions

View File

@@ -21,9 +21,11 @@
import ConfigParser
import codecs
import os.path
import re
import shutil
import tempfile
import urllib
from urlparse import urlparse
from whipper.common import directory
@@ -72,6 +74,13 @@ class Config:
def getboolean(self, section, option):
return self._getter('boolean', section, option)
# musicbrainz section
def get_musicbrainz_server(self):
server = self.get('musicbrainz', 'server') or 'musicbrainz.org'
server_url = server if re.match(r'^\D*//', server) else '//' + server
return urlparse(server_url).netloc
# drive sections
def setReadOffset(self, vendor, model, release, offset):