Skip to content

Commit

Permalink
Check for Picard version and use appropriate path argument
Browse files Browse the repository at this point in the history
  • Loading branch information
rdswift authored and phw committed Jul 29, 2023
1 parent b6abe88 commit 9509b80
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions plugins/submit_isrc/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,13 +50,16 @@

import re

from picard import log
from picard import log, PICARD_VERSION
from picard.ui.itemviews import BaseAction, register_album_action
from picard.version import Version
from picard.webservice.api_helpers import MBAPIHelper, _wrap_xml_metadata
from PyQt5 import QtCore, QtWidgets

RE_VALIDATE_ISRC = re.compile(r'^[A-Z]{2}[A-Z0-9]{3}[0-9]{7}$')

NEW_MBAPIHelper = (PICARD_VERSION >= Version(2, 9, 0, 'beta', 2))

XML_HEADER = '<recording-list>'
XML_TEMPLATE = '<recording id="{0}"><isrc-list count="1"><isrc id="{1}" /></isrc-list></recording>'
XML_FOOTER = '</recording-list>'
Expand Down Expand Up @@ -226,7 +229,7 @@ def callback(self, album):
# Set up parameters for the helper
client_string = 'Picard_Plugin_{0}-v{1}'.format(PLUGIN_NAME, PLUGIN_VERSION).replace(' ', '_')
handler = self.submission_handler
path = '/recording'
path = '/recording' if NEW_MBAPIHelper else ['recording']
params = {"client": client_string}

return helper.post(path, data, handler, priority=True,
Expand Down

0 comments on commit 9509b80

Please sign in to comment.