diff --git a/picard/const.py b/picard/const.py index 322044a69..a328dfd35 100644 --- a/picard/const.py +++ b/picard/const.py @@ -40,6 +40,7 @@ USER_PLUGIN_DIR = os.path.join(USER_DIR, "plugins") # AcoustID client API key ACOUSTID_KEY = 'tPrbdkhM' ACOUSTID_HOST = 'api.acoustid.org' +ACOUSTID_PORT = 80 FPCALC_NAMES = ['fpcalc', 'pyfpcalc'] # Various Artists MBID diff --git a/picard/coverart.py b/picard/coverart.py index 684d5f888..f1f68d1b4 100644 --- a/picard/coverart.py +++ b/picard/coverart.py @@ -29,6 +29,7 @@ from functools import partial from picard import config, log from picard.metadata import Metadata, is_front_image from picard.util import mimetype, parse_amazon_url +from picard.coverartarchive import CAA_HOST, CAA_PORT from PyQt4.QtCore import QUrl, QObject # data transliterated from the perl stuff used to find cover art for the @@ -210,7 +211,7 @@ def coverart(album, metadata, release, try_list=None): % release.id) album._requests += 1 album.tagger.xmlws.download( - "coverartarchive.org", 80, "/release/%s/" % + CAA_HOST, CAA_PORT, "/release/%s/" % metadata["musicbrainz_albumid"], partial(_caa_json_downloaded, album, metadata, release, try_list), priority=True, important=True) diff --git a/picard/coverartarchive.py b/picard/coverartarchive.py index 8ad268614..2c38b1429 100644 --- a/picard/coverartarchive.py +++ b/picard/coverartarchive.py @@ -17,6 +17,9 @@ # along with this program; if not, write to the Free Software # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. +CAA_HOST = "coverartarchive.org" +CAA_PORT = 80 + # list of types from http://musicbrainz.org/doc/Cover_Art/Types # order of declaration is preserved in selection box CAA_TYPES = [ diff --git a/picard/webservice.py b/picard/webservice.py index 63f44c3f2..5ebcf51b8 100644 --- a/picard/webservice.py +++ b/picard/webservice.py @@ -33,12 +33,13 @@ from PyQt4 import QtCore, QtNetwork from PyQt4.QtGui import QDesktopServices from PyQt4.QtCore import QUrl, QXmlStreamReader from picard import PICARD_VERSION_STR, config, log -from picard.const import ACOUSTID_KEY, ACOUSTID_HOST +from picard.const import ACOUSTID_KEY, ACOUSTID_HOST, ACOUSTID_PORT +from picard.coverartarchive import CAA_HOST, CAA_PORT REQUEST_DELAY = defaultdict(lambda: 1000) -REQUEST_DELAY[(ACOUSTID_HOST, 80)] = 333 -REQUEST_DELAY[("coverartarchive.org", 80)] = 0 +REQUEST_DELAY[(ACOUSTID_HOST, ACOUSTID_PORT)] = 333 +REQUEST_DELAY[(CAA_HOST, CAA_PORT)] = 0 USER_AGENT_STRING = 'MusicBrainz%%20Picard-%s' % PICARD_VERSION_STR @@ -412,7 +413,7 @@ class XmlWebService(QtCore.QObject): return '&'.join(filters) def query_acoustid(self, handler, **args): - host, port = ACOUSTID_HOST, 80 + host, port = ACOUSTID_HOST, ACOUSTID_PORT body = self._encode_acoustid_args(args) return self.post(host, port, '/v2/lookup', body, handler, mblogin=False) @@ -424,7 +425,7 @@ class XmlWebService(QtCore.QObject): args['mbid.%d' % i] = str(submission.recordingid) if submission.puid: args['puid.%d' % i] = str(submission.puid) - host, port = ACOUSTID_HOST, 80 + host, port = ACOUSTID_HOST, ACOUSTID_PORT body = self._encode_acoustid_args(args) return self.post(host, port, '/v2/submit', body, handler, mblogin=False)