Enable tidal import from MB

This commit is contained in:
Alok Saboo 2023-05-27 14:03:31 -04:00
parent 430a75d1ad
commit 0761c78b3a
3 changed files with 11 additions and 3 deletions

View file

@ -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:

View file

@ -134,6 +134,7 @@ musicbrainz:
spotify: no
deezer: no
beatport: no
tidal: no
match:
strong_rec_thresh: 0.04

View file

@ -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')