make track index weight positive

(I'm not sure why, but the weight for track index mismatches was set to 0.0.
This way, the tagger will be slightly more reluctant to frivolously reorder.)
This commit is contained in:
Adrian Sampson 2010-08-06 11:49:31 -07:00
parent c3988f7300
commit 90c4b550fb
3 changed files with 52 additions and 2 deletions

2
NEWS
View file

@ -46,6 +46,8 @@
* Fixed an occasional bug where Mutagen would complain that a tag was
already present.
* Fixed a bug with reading invalid integers from ID3 tags.
* The tagger should now be a little more reluctant to reorder tracks
that already have indices.
1.0b3
-----

View file

@ -41,10 +41,10 @@ TRACK_WEIGHT = 1.0
# the overall TRACK_WEIGHT does that).
TRACK_TITLE_WEIGHT = 3.0
# Added when the indices of tracks don't match.
TRACK_INDEX_WEIGHT = 0.0
TRACK_INDEX_WEIGHT = 1.0
# Track length weights: no penalty before GRACE, maximum (WEIGHT)
# penalty at GRACE+MAX discrepancy.
TRACK_LENGTH_GRACE = 15
TRACK_LENGTH_GRACE = 10
TRACK_LENGTH_MAX = 30
TRACK_LENGTH_WEIGHT = 2.0
# MusicBrainz track ID matches.

View file

@ -120,6 +120,54 @@ class OrderingTest(unittest.TestCase):
ordered = autotag.order_items(items, trackinfo)
self.assertEqual(ordered, None)
def test_order_corrects_when_track_names_are_entirely_wrong(self):
# A real-world test case contributed by a user.
def item(i, length):
return Item({
'artist': 'ben harper',
'album': 'burn to shine',
'title': 'ben harper - Burn to Shine ' + str(i),
'track': i,
'length': length,
'mb_trackid': '', 'mb_albumid': '', 'mb_artistid': '',
})
items = []
items.append(item(1, 241.37243007106997))
items.append(item(2, 342.27781704375036))
items.append(item(3, 245.95070222338137))
items.append(item(4, 472.87662515485437))
items.append(item(5, 279.1759535763187))
items.append(item(6, 270.33333768012))
items.append(item(7, 247.83435613222923))
items.append(item(8, 216.54504531525072))
items.append(item(9, 225.72775379800484))
items.append(item(10, 317.7643606963552))
items.append(item(11, 243.57001238834192))
items.append(item(12, 186.45916150485752))
def info(title, length):
return {
'title': title,
'length': length,
}
trackinfo = []
trackinfo.append(info('Alone', 238.893))
trackinfo.append(info('The Woman in You', 341.44))
trackinfo.append(info('Less', 245.59999999999999))
trackinfo.append(info('Two Hands of a Prayer', 470.49299999999999))
trackinfo.append(info('Please Bleed', 277.86599999999999))
trackinfo.append(info('Suzie Blue', 269.30599999999998))
trackinfo.append(info('Steal My Kisses', 245.36000000000001))
trackinfo.append(info('Burn to Shine', 214.90600000000001))
trackinfo.append(info('Show Me a Little Shame', 224.09299999999999))
trackinfo.append(info('Forgiven', 317.19999999999999))
trackinfo.append(info('Beloved One', 243.733))
trackinfo.append(info('In the Lord\'s Arms', 186.13300000000001))
ordered = autotag.order_items(items, trackinfo)
for i, item in enumerate(ordered):
self.assertEqual(i+1, item.track)
class ApplyTest(unittest.TestCase):
def setUp(self):
self.items = []