From 0761c78b3ab30c57a6e687eef0436f26dc00c576 Mon Sep 17 00:00:00 2001 From: Alok Saboo Date: Sat, 27 May 2023 14:03:31 -0400 Subject: [PATCH 1/6] Enable tidal import from MB --- beets/autotag/mb.py | 11 +++++++++-- beets/config_default.yaml | 1 + beets/importer.py | 2 +- 3 files changed, 11 insertions(+), 3 deletions(-) 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') From de2ff058a6e8d6ac12c820a24b1f51a660de8662 Mon Sep 17 00:00:00 2001 From: Alok Saboo Date: Sat, 27 May 2023 14:07:33 -0400 Subject: [PATCH 2/6] Update changelog.rst --- docs/changelog.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/changelog.rst b/docs/changelog.rst index 02c4f1762..f7a792ca9 100644 --- a/docs/changelog.rst +++ b/docs/changelog.rst @@ -10,7 +10,7 @@ With this release, beets now requires Python 3.7 or later (it removes support for Python 3.6). New features: - +* Allow importing Tidal album id from MusicBrainz release page if the information is available. * Prevent reimporting album if it is permanently removed from Spotify :bug:`4800` * Added option use `cover_art_arl` as an album art source in the `fetchart` plugin. From a5df4b95ead51c20557af4e1dd10ae0c6b22fedc Mon Sep 17 00:00:00 2001 From: Alok Saboo Date: Sat, 27 May 2023 14:11:07 -0400 Subject: [PATCH 3/6] Update MB docs --- docs/reference/config.rst | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) 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``. From e7e1498aaf15c9184c78496b155cc0d52f0987ff Mon Sep 17 00:00:00 2001 From: Alok Saboo Date: Sat, 27 May 2023 14:38:05 -0400 Subject: [PATCH 4/6] Update changelog.rst --- docs/changelog.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/changelog.rst b/docs/changelog.rst index f7a792ca9..56505215b 100644 --- a/docs/changelog.rst +++ b/docs/changelog.rst @@ -10,7 +10,7 @@ With this release, beets now requires Python 3.7 or later (it removes support for Python 3.6). New features: -* Allow importing Tidal album id from MusicBrainz release page if the information is available. +* Allow importing Tidal album id from MusicBrainz release page if the information is available. * Prevent reimporting album if it is permanently removed from Spotify :bug:`4800` * Added option use `cover_art_arl` as an album art source in the `fetchart` plugin. From b74388b23357eab143a980acfecb8b84804a726f Mon Sep 17 00:00:00 2001 From: Alok Saboo Date: Sat, 27 May 2023 15:04:50 -0400 Subject: [PATCH 5/6] Update changelog.rst --- docs/changelog.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/changelog.rst b/docs/changelog.rst index 56505215b..1e3299627 100644 --- a/docs/changelog.rst +++ b/docs/changelog.rst @@ -10,7 +10,7 @@ With this release, beets now requires Python 3.7 or later (it removes support for Python 3.6). New features: -* Allow importing Tidal album id from MusicBrainz release page if the information is available. +* Allow importing Tidal album id from MusicBrainz release page. * Prevent reimporting album if it is permanently removed from Spotify :bug:`4800` * Added option use `cover_art_arl` as an album art source in the `fetchart` plugin. From 95898a3055b42d5615896baca0a8c2a74d35b32b Mon Sep 17 00:00:00 2001 From: Alok Saboo Date: Sat, 27 May 2023 16:06:46 -0400 Subject: [PATCH 6/6] Revert changelog --- docs/changelog.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/changelog.rst b/docs/changelog.rst index 1e3299627..02c4f1762 100644 --- a/docs/changelog.rst +++ b/docs/changelog.rst @@ -10,7 +10,7 @@ With this release, beets now requires Python 3.7 or later (it removes support for Python 3.6). New features: -* Allow importing Tidal album id from MusicBrainz release page. + * Prevent reimporting album if it is permanently removed from Spotify :bug:`4800` * Added option use `cover_art_arl` as an album art source in the `fetchart` plugin.