From 11c1d1bd7008f521ade990e78896d2d5b963dc61 Mon Sep 17 00:00:00 2001 From: Philipp Wolfer Date: Thu, 5 Oct 2023 18:41:30 +0200 Subject: [PATCH] Fix track metadata compare ignoring video check if there is no release --- picard/metadata.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/picard/metadata.py b/picard/metadata.py index 8fe0f7ff57..0e42f13b96 100644 --- a/picard/metadata.py +++ b/picard/metadata.py @@ -369,6 +369,12 @@ def compare_to_track(self, track, weights): score = self.length_score(a, b) parts.append((score, weights["length"])) + if 'isvideo' in weights: + metadata_is_video = self['~video'] == '1' + track_is_video = track.get('video', False) + score = 1 if metadata_is_video == track_is_video else 0 + parts.append((score, weights['isvideo'])) + if "releases" in track: releases = track['releases'] @@ -377,12 +383,6 @@ def compare_to_track(self, track, weights): sim = linear_combination_of_weights(parts) * search_score return SimMatchTrack(similarity=sim, releasegroup=None, release=None, track=track) - if 'isvideo' in weights: - metadata_is_video = self['~video'] == '1' - track_is_video = track.get('video', False) - score = 1 if metadata_is_video == track_is_video else 0 - parts.append((score, weights['isvideo'])) - result = SimMatchTrack(similarity=-1, releasegroup=None, release=None, track=None) for release in releases: release_parts = self.compare_to_release_parts(release, weights)