From bc2125b2915426f04192ba3fcb6a9c89870d93ca Mon Sep 17 00:00:00 2001 From: phirestalker Date: Sat, 12 Aug 2023 11:52:14 -0700 Subject: [PATCH 1/2] Ignores files with a non MusicBrainz data_source during distance check --- beetsplug/oldestdate.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/beetsplug/oldestdate.py b/beetsplug/oldestdate.py index 951e774..12a6f03 100644 --- a/beetsplug/oldestdate.py +++ b/beetsplug/oldestdate.py @@ -220,6 +220,9 @@ def _import_trackinfo(self, info): def track_distance(self, session, info): dist = hooks.Distance() + if info.data_source != 'MusicBrainz': + self._log.info('Skipping track with non MusicBrainz data source') + return dist if self.config['filter_on_import'] and not self._has_work_id(info.track_id): dist.add('work_id', 1) From 787c6b87218be9e82eba60239fd63106183c645b Mon Sep 17 00:00:00 2001 From: phirestalker Date: Wed, 23 Aug 2023 15:26:01 -0700 Subject: [PATCH 2/2] Added code to handle non-MusicBrainz releases in process_file --- beetsplug/oldestdate.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/beetsplug/oldestdate.py b/beetsplug/oldestdate.py index 12a6f03..8f86e43 100644 --- a/beetsplug/oldestdate.py +++ b/beetsplug/oldestdate.py @@ -221,7 +221,7 @@ def _import_trackinfo(self, info): def track_distance(self, session, info): dist = hooks.Distance() if info.data_source != 'MusicBrainz': - self._log.info('Skipping track with non MusicBrainz data source') + self._log.debug('Skipping track with non MusicBrainz data source {0.artist} - {0.title}', info) return dist if self.config['filter_on_import'] and not self._has_work_id(info.track_id): dist.add('work_id', 1) @@ -279,7 +279,7 @@ def _on_import(self, session, task): self._process_file(item) def _process_file(self, item): - if not item.mb_trackid: + if not item.mb_trackid or item.data_source != 'MusicBrainz': self._log.info('Skipping track with no mb_trackid: {0.artist} - {0.title}', item) return