mirror of
https://github.com/fergalmoran/picard.git
synced 2026-02-27 01:54:06 +00:00
Merge pull request #171 from phw/caa_host_constant
Add constants for cover art archive host and port.
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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 = [
|
||||
|
||||
@@ -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)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user