mirror of
https://github.com/beetbox/beets.git
synced 2026-01-20 07:02:39 +01:00
Merge pull request #4698 from ghbrown/discogs_client_check
discogs_client version check
This commit is contained in:
commit
2e18f84b38
3 changed files with 18 additions and 2 deletions
|
|
@ -22,6 +22,7 @@ from beets.util.id_extractors import extract_discogs_id_regex
|
|||
from beets.autotag.hooks import AlbumInfo, TrackInfo
|
||||
from beets.plugins import MetadataSourcePlugin, BeetsPlugin, get_distance
|
||||
import confuse
|
||||
from discogs_client import __version__ as dc_string
|
||||
from discogs_client import Release, Master, Client
|
||||
from discogs_client.exceptions import DiscogsAPIError
|
||||
from requests.exceptions import ConnectionError
|
||||
|
|
@ -50,6 +51,7 @@ class DiscogsPlugin(BeetsPlugin):
|
|||
|
||||
def __init__(self):
|
||||
super().__init__()
|
||||
self.check_discogs_client()
|
||||
self.config.add({
|
||||
'apikey': API_KEY,
|
||||
'apisecret': API_SECRET,
|
||||
|
|
@ -66,6 +68,19 @@ class DiscogsPlugin(BeetsPlugin):
|
|||
self.discogs_client = None
|
||||
self.register_listener('import_begin', self.setup)
|
||||
|
||||
def check_discogs_client(self):
|
||||
"""Ensure python3-discogs-client version >= 2.3.15
|
||||
"""
|
||||
dc_min_version = [2, 3, 15]
|
||||
dc_version = [int(elem) for elem in dc_string.split('.')]
|
||||
min_len = min(len(dc_version), len(dc_min_version))
|
||||
gt_min = [(elem > elem_min) for elem, elem_min in
|
||||
zip(dc_version[:min_len],
|
||||
dc_min_version[:min_len])]
|
||||
if True not in gt_min:
|
||||
self._log.warning(('python3-discogs-client version should be '
|
||||
'>= 2.3.15'))
|
||||
|
||||
def setup(self, session=None):
|
||||
"""Create the `discogs_client` field. Authenticate if necessary.
|
||||
"""
|
||||
|
|
|
|||
|
|
@ -43,6 +43,7 @@ New features:
|
|||
:bug:`4251`
|
||||
* :doc:`/plugins/discogs`: Permit appending style to genre.
|
||||
* :doc:`plugins/discogs`: Implement item_candidates for matching singletons.
|
||||
* :doc:`plugins/discogs`: Check for compliant discogs_client module.
|
||||
* :doc:`/plugins/convert`: Add a new `auto_keep` option that automatically
|
||||
converts files but keeps the *originals* in the library.
|
||||
:bug:`1840` :bug:`4302`
|
||||
|
|
|
|||
4
setup.py
4
setup.py
|
|
@ -111,7 +111,7 @@ setup(
|
|||
'requests_oauthlib',
|
||||
'reflink',
|
||||
'rarfile',
|
||||
'python3-discogs-client',
|
||||
'python3-discogs-client>=2.3.15',
|
||||
'py7zr',
|
||||
],
|
||||
'lint': [
|
||||
|
|
@ -139,7 +139,7 @@ setup(
|
|||
'embedart': ['Pillow'],
|
||||
'embyupdate': ['requests'],
|
||||
'chroma': ['pyacoustid'],
|
||||
'discogs': ['python3-discogs-client>=2.3.10'],
|
||||
'discogs': ['python3-discogs-client>=2.3.15'],
|
||||
'beatport': ['requests-oauthlib>=0.6.1'],
|
||||
'kodiupdate': ['requests'],
|
||||
'lastgenre': ['pylast'],
|
||||
|
|
|
|||
Loading…
Reference in a new issue