diff --git a/beets/autotag/mb.py b/beets/autotag/mb.py index cee2bdfd9..025c39d96 100644 --- a/beets/autotag/mb.py +++ b/beets/autotag/mb.py @@ -518,9 +518,9 @@ def album_info(release: Dict) -> beets.autotag.hooks.AlbumInfo: if (any(config['musicbrainz']['external_ids'].get().values()) and release.get('url-relation-list')): discogs_url, bandcamp_url, spotify_url = None, None, None - deezer_url, beatport_url = None, None + deezer_url, beatport_url, tidal_url = None, None, None fetch_discogs, fetch_bandcamp, fetch_spotify = False, False, False - fetch_deezer, fetch_beatport = False, False + fetch_deezer, fetch_beatport, fetch_tidal = False, False, False if config['musicbrainz']['external_ids']['discogs'].get(): fetch_discogs = True @@ -532,6 +532,8 @@ def album_info(release: Dict) -> beets.autotag.hooks.AlbumInfo: fetch_deezer = True if config['musicbrainz']['external_ids']['beatport'].get(): fetch_beatport = True + if config['musicbrainz']['external_ids']['tidal'].get(): + fetch_tidal = True for url in release['url-relation-list']: if fetch_discogs and url['type'] == 'discogs': @@ -549,6 +551,9 @@ def album_info(release: Dict) -> beets.autotag.hooks.AlbumInfo: if fetch_beatport and 'beatport.com' in url['target']: log.debug('Found link to Beatport release via MusicBrainz') beatport_url = url['target'] + if fetch_tidal and 'tidal.com' in url['target']: + log.debug('Found link to Tidal release via MusicBrainz') + tidal_url = url['target'] if discogs_url: info.discogs_albumid = extract_discogs_id_regex(discogs_url) @@ -563,6 +568,8 @@ def album_info(release: Dict) -> beets.autotag.hooks.AlbumInfo: if beatport_url: info.beatport_album_id = MetadataSourcePlugin._get_id( 'album', beatport_url, beatport_id_regex) + if tidal_url: + info.tidal_album_id = tidal_url.split('/')[-1] extra_albumdatas = plugins.send('mb_album_extract', data=release) for extra_albumdata in extra_albumdatas: diff --git a/beets/config_default.yaml b/beets/config_default.yaml index 6dcadccb2..97c6c8c57 100644 --- a/beets/config_default.yaml +++ b/beets/config_default.yaml @@ -134,6 +134,7 @@ musicbrainz: spotify: no deezer: no beatport: no + tidal: no match: strong_rec_thresh: 0.04 diff --git a/beets/importer.py b/beets/importer.py index 046730d72..5eaebe960 100644 --- a/beets/importer.py +++ b/beets/importer.py @@ -54,7 +54,7 @@ HISTORY_KEY = 'taghistory' REIMPORT_FRESH_FIELDS_ALBUM = ['data_source'] REIMPORT_FRESH_FIELDS_ITEM = ['data_source', 'bandcamp_album_id', 'spotify_album_id', 'deezer_album_id', - 'beatport_album_id'] + 'beatport_album_id', 'tidal_album_id'] # Global logger. log = logging.getLogger('beets') diff --git a/docs/reference/config.rst b/docs/reference/config.rst index f162c6762..beefcbbdf 100644 --- a/docs/reference/config.rst +++ b/docs/reference/config.rst @@ -859,12 +859,13 @@ to the beets library. bandcamp: yes beatport: yes deezer: yes + tidal: yes The library fields of the corresponding :ref:`autotagger_extensions` are used to save the data (``discogs_albumid``, ``bandcamp_album_id``, -``spotify_album_id``, ``beatport_album_id``, ``deezer_album_id``). On -re-imports existing data will be overwritten. +``spotify_album_id``, ``beatport_album_id``, ``deezer_album_id``, +``tidal_album_id``). On re-imports existing data will be overwritten. The default of all options is ``no``.