mirror of
https://github.com/fergalmoran/picard.git
synced 2026-02-26 17:43:59 +00:00
Address bitmap comments
Add MUSICBRAINZ_SERVERS constant and use this in options/general and to decide SSL for mblogin webservice.
This commit is contained in:
@@ -861,3 +861,9 @@ ALIAS_LOCALES = {
|
||||
u'zu': 'Zulu',
|
||||
u'zu_ZA': 'Zulu (South Africa)',
|
||||
}
|
||||
|
||||
# List of official musicbrainz servers - must support SSL for mblogin requests (such as collections).
|
||||
MUSICBRAINZ_SERVERS = [
|
||||
'musicbrainz.org',
|
||||
'beta.musicbrainz.org',
|
||||
]
|
||||
|
||||
@@ -21,6 +21,7 @@ from picard import config
|
||||
from picard.ui.options import OptionsPage, register_options_page
|
||||
from picard.ui.ui_options_general import Ui_GeneralOptionsPage
|
||||
from picard.util import rot13
|
||||
from picard.const import MUSICBRAINZ_SERVERS
|
||||
|
||||
|
||||
class GeneralOptionsPage(OptionsPage):
|
||||
@@ -32,7 +33,7 @@ class GeneralOptionsPage(OptionsPage):
|
||||
ACTIVE = True
|
||||
|
||||
options = [
|
||||
config.TextOption("setting", "server_host", "musicbrainz.org"),
|
||||
config.TextOption("setting", "server_host", MUSICBRAINZ_SERVERS[0]),
|
||||
config.IntOption("setting", "server_port", 80),
|
||||
config.TextOption("setting", "username", ""),
|
||||
config.PasswordOption("setting", "password", ""),
|
||||
@@ -44,10 +45,7 @@ class GeneralOptionsPage(OptionsPage):
|
||||
super(GeneralOptionsPage, self).__init__(parent)
|
||||
self.ui = Ui_GeneralOptionsPage()
|
||||
self.ui.setupUi(self)
|
||||
mirror_servers = [
|
||||
"musicbrainz.org",
|
||||
]
|
||||
self.ui.server_host.addItems(sorted(mirror_servers))
|
||||
self.ui.server_host.addItems(MUSICBRAINZ_SERVERS)
|
||||
|
||||
def load(self):
|
||||
self.ui.server_host.setEditText(config.setting["server_host"])
|
||||
|
||||
@@ -37,7 +37,8 @@ from picard.const import (ACOUSTID_KEY,
|
||||
ACOUSTID_HOST,
|
||||
ACOUSTID_PORT,
|
||||
CAA_HOST,
|
||||
CAA_PORT)
|
||||
CAA_PORT,
|
||||
MUSICBRAINZ_SERVERS)
|
||||
|
||||
|
||||
REQUEST_DELAY = defaultdict(lambda: 1000)
|
||||
@@ -169,7 +170,7 @@ class XmlWebService(QtCore.QObject):
|
||||
|
||||
def _start_request(self, method, host, port, path, data, handler, xml,
|
||||
mblogin=False, cacheloadcontrol=None):
|
||||
if mblogin and host=='musicbrainz.org' and port==80:
|
||||
if mblogin and host in MUSICBRAINZ_SERVERS and port==80:
|
||||
urlstring = "https://%s%s" % (host, path)
|
||||
else:
|
||||
urlstring = "http://%s:%d%s" % (host, port, path)
|
||||
|
||||
Reference in New Issue
Block a user