Skip to content

Commit

Permalink
Fix track metadata compare ignoring video check if there is no release
Browse files Browse the repository at this point in the history
  • Loading branch information
phw committed Oct 6, 2023
1 parent 7ffff43 commit 11c1d1b
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions picard/metadata.py
Original file line number Diff line number Diff line change
Expand Up @@ -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']

Expand All @@ -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)
Expand Down

0 comments on commit 11c1d1b

Please sign in to comment.