From 4eead8d846abe5a9d889005c623aaf8f7321c0b5 Mon Sep 17 00:00:00 2001 From: mdecker Date: Mon, 4 Apr 2011 20:52:06 +0200 Subject: [PATCH] fix divzero error in distance debug output in lastid plugin --- beetsplug/lastid.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/beetsplug/lastid.py b/beetsplug/lastid.py index 99e60c9d4..18e98980f 100644 --- a/beetsplug/lastid.py +++ b/beetsplug/lastid.py @@ -99,7 +99,7 @@ class LastIdPlugin(BeetsPlugin): dist_max += autotag.TRACK_ID_WEIGHT # log.debug('Last data: %s; distance: %f' % - # (str(last_data), dist/dist_max)) + # (str(last_data), dist/dist_max if dist_max > 0.0 else 0.0)) return dist * DISTANCE_SCALE, dist_max * DISTANCE_SCALE @@ -114,7 +114,7 @@ class LastIdPlugin(BeetsPlugin): dist_max += autotag.ARTIST_WEIGHT log.debug('Last artist (%s/%s) distance: %f' % - (last_artist, info['artist'], dist/dist_max)) + (last_artist, info['artist'], dist/dist_max if dist_max > 0.0 else 0.0)) #fixme: artist MBID currently ignored (as in vanilla tagger) return dist, dist_max