Bug 207155

Summary: Some tracks have an immense negative score
Product: [Applications] amarok Reporter: optiluca <optiluca>
Component: Collections/LocalAssignee: Amarok Developers <amarok-bugs-dist>
Status: RESOLVED FIXED    
Severity: normal CC: alexey.v.sidorin, asperezhigin, grosser.meister.morti, jmcsa00, maximilian.kossick, peter, ralf-engels, valorie.zimmerman
Priority: NOR    
Version: 2.3.2   
Target Milestone: ---   
Platform: Gentoo Packages   
OS: Linux   
Latest Commit: Version Fixed In: 2.4.2
Sentry Crash Report:
Attachments: Amarok 2.2 RC1 screenshot

Description optiluca@gmail.com 2009-09-12 09:28:05 UTC
Version:           2.1.80 (using KDE 4.3.1)
OS:                Linux
Installed from:    Gentoo Packages

Hi.  I am suffering from an odd bug where some of my tracks are displaying a hugely negative score.  I have manually corrected this on most tracks, but this shouldn't occur in the first place...  All the suffering tracks are mp3 I believe.  The database was directly imported from Amarok 1.4 using the 2.2 beta 1 importer, and the database is an embedded MySQL, version 5.0.84-r1.

I realize that this is pretty vague, but I can't think of useful valid info to supply, so if you need any please ask :)
Comment 1 optiluca@gmail.com 2009-09-23 19:42:41 UTC
Created attachment 37133 [details]
Amarok 2.2 RC1 screenshot
Comment 2 optiluca@gmail.com 2009-09-23 19:45:13 UTC
Sorry was planning to comment that attachment...

Anyway I had manually fixed all tracks and now in amarok 2.2 RC1 my negative scores are back... (also visible is bug 207153 in the form of tracks with a duration of 0:00 in the playlist)
Comment 3 Daniel Dewald 2009-11-19 03:03:34 UTC
The 0:00 duration bug is already fixed. Try do a full rescan of you collection and restart amarok. This might also fix the score problem. If not those two are unrelated.
Comment 4 Myriam Schweingruber 2009-11-19 11:48:07 UTC
Luca, you will need to upgrade, this should be solved in Amarok 2.2.1.
Once upgraded, do a full rescan of the collection, then restart Amarok, which should fix all score and track length problems.
Comment 5 optiluca@gmail.com 2009-11-20 00:37:16 UTC
I would, but I have hit a gentoo bug ( http://bugs.gentoo.org/show_bug.cgi?id=290662 ) which makes amarok crash at startup...  I will try to rescan as soon as the gentoo team get their issues sorted :)
Comment 6 optiluca@gmail.com 2009-11-20 18:01:26 UTC
Ok I have upgraded amarok, performed a full rescan of my collection and both bugs live on!!! :@  The 0:00 bug occurs in entire albums while the score bug is rather sporadic, but does tend to hit the 0:00 tracks.
Comment 7 Myriam Schweingruber 2009-11-20 19:19:35 UTC
Luca to which version of Amarok exactly did you upgrade? Also, it's not only the full rescan, you need to restart Amarok right after that.
Comment 8 optiluca@gmail.com 2009-11-20 19:26:24 UTC
Amarok 2.2.1, and I restarted.  Could it be that the scores are not being "fixed" but simply aren't being ruined anymore?  I'll try editing them all by hand and seeing if they behave.
Comment 9 Myriam Schweingruber 2009-11-20 21:28:14 UTC
(In reply to comment #8)
> Amarok 2.2.1, and I restarted.  Could it be that the scores are not being
> "fixed" but simply aren't being ruined anymore?  I'll try editing them all by
> hand and seeing if they behave.

Hm, I don't really understand what you mean with "aren't being ruined anymore".
Comment 10 optiluca@gmail.com 2009-11-21 00:56:05 UTC
Sorry.  Anyway what I meant is that tracks that had normal scores would suddenly turn into immense negative ones for no apparent reason.  I have now manually edited all scores to a normal value and I will wait and see if they turn negative again.
Comment 11 Myriam Schweingruber 2009-11-21 08:58:10 UTC
Thanks for the info.
Comment 12 optiluca@gmail.com 2009-11-28 12:47:24 UTC
Ok I can confirm that the bug is still present.  It seems to only strike tracks that have 0:00 length.  If I play a 0:00 track, and finish playing it, the score is updated normally.  If I skip the track in question (which in normal situations would slightly lower the score), the score becomes massively negative... :(
Comment 13 Mikko C. 2009-11-28 12:51:15 UTC
does it help to remove the database?
It's in $HOME/.kde4/share/apps/amarok/mysqle

Make a backup first: all the ratings will be lost.
Comment 14 optiluca@gmail.com 2009-11-28 13:19:10 UTC
It does not I am afraid.  I start Amarok, the database is scanned, I play any 0:00 length track (which are still there and are the same ones as before), skip it and voilĂ  the score goes from 0 to something hugely negative.
Comment 15 Mikko C. 2009-11-28 13:27:51 UTC
Are you sure these files are not damaged? Is the right length showed in other players? Try eyeD3 or id3info if they are MP3s.
Comment 16 Juha 2009-12-01 11:02:49 UTC
Hello,

I can also confirm this bug. Skipping a 0:00 length track causes negative score.

Seems that having a negative score in the database confuses random playing favoring higher scores. It will only play the first track in the playlist. Other random modes work fine.

This might be because of damaged file (can't confirm it anymore, deleted the file stupid me...) but anyway I think that Amarok should always check before saving insane scores to the database and random playing should not stop working because of invalid scores (different bug perhaps?).
Comment 17 optiluca@gmail.com 2009-12-11 17:09:45 UTC
I have done some testing and the 0:00 track length bug also exists in Juk, suggesting an underlying phonon issue.  The hugely negative scores must be due to some sort of misbehaviour in Amarok though.  In any case the tracks display correct length when opened in mplayer, for example.
Comment 18 Myriam Schweingruber 2010-02-07 13:50:42 UTC
Can you reproduce this with current Amarok 2.2.2 or latest git? Please all, do a full collection rescan, then restart Amarok again before testing.
Comment 19 optiluca@gmail.com 2010-02-07 15:20:31 UTC
Very much so.  Using amarok 2.2.2, after a full rescan and amarok restart, I skipped a track with duration 0:00 and surely enough said track now has a score of exactly -1073741824 :P

I just tried opening these tracks in mplayer again, and I noticed that while mplayer does provide a playtime, this playtime is most definitely wrong.  I suspect there is something wrong with my tracks, but there again that shouldn't ruin the scoring algorithm...

On a side note, any ideas as to what is wrong with these tracks??
Comment 20 Myriam Schweingruber 2010-02-07 15:32:27 UTC
No, not really, you should check those with a mass tagging software where you can make the necessary changes to the track length and see if this solves the problem.
Comment 21 Myriam Schweingruber 2010-02-14 10:06:50 UTC
*** Bug 226752 has been marked as a duplicate of this bug. ***
Comment 22 Sven Krohlas 2010-04-07 23:46:55 UTC
I have a suspicion about this:

EngineController.cpp:        m_currentTrack->finishedPlaying( double(pos)/double(length) );

if the length of the track is close to zero, then this division will become a very big number. Maybe even that big so we hit an overflow and the value gets negative.

From there we go to SqlTrack::finishedPlaying( double playedFraction ), where we hit setScore( Amarok::computeScore( score(), playCount(), playedFraction ) );

and there we end up in this:

-----
const int percentage = static_cast<int>(playedFraction * 100);
        double newScore;

        if( playCount == 0 )
            newScore = ( oldScore + percentage ) / 2;
        else
            newScore = ( ( oldScore * playCount ) + percentage ) / ( playCount + 1 );

        return newScore;
-----

Which will return a quite insane low value.

Can someone provide me with such a false zero length track?
Comment 23 optiluca@gmail.com 2010-04-08 10:52:31 UTC
I am afraid that I fixed all my b0rked tracks by running vbrfixc on them.  I believe it was all vbr tracks which were misbehaving, but no more!  Needless to say, it is all copyrighted material anyway...  Should have kept a broken one as a sample :S  Sorry.
Comment 24 sevens 2010-04-21 17:46:02 UTC
I can confirm this bug too. Occurred at least in 2.2.2, upgraded to 2.3.0 today, did a full collection rescan and Amarok restart right after the rescan (had 1 track playing during the rescan though) and nothing changed.

A false zero length track for testing (see #22) can be found at: http://archives.bassdrivearchive.com/1%20-%20Monday/The%20Cycle%20Decompression%20Sessions%20-%20Spinn/2009/Oct/%5B2009.10.02%5D_The_Cycle_-_Spinn_%5Bwith_Deep_Z%5D.mp3 (<strong>Warning: 166MB file!</strong>)

Also just about any .wav file I used in Amarok (at least in recent months with 2.2.x) has a length of 0:00, so converting a file to .wav might also work. I just did a quick test with 1 mp3 converted to wav and it also had a length of 0:00; a quick conversion can be done using 'mpg123 -w out.wav in.mp3'.
Comment 25 Valorie Zimmerman 2010-08-10 10:01:23 UTC
I just tested this with Amarok built from GIT yesterday, and the one file I found with length 0:

Length:
0:00
Bit rate:
112
Sample rate:
44100
Size:
1.1 MiB
Format:
ogg


Score:
-1610611824
Rating:
3.5
Play Count:
1
First Played:
11/10/09
Last Played:
11/10/09
Collection:
Local Collection

What I did to get the score from 50 to -1610611824, was to start it playing a couple of times, then skip ahead to something else.
Comment 26 Myriam Schweingruber 2010-10-27 12:34:05 UTC
*** Bug 255366 has been marked as a duplicate of this bug. ***
Comment 27 Myriam Schweingruber 2011-02-16 19:28:10 UTC
*** Bug 266105 has been marked as a duplicate of this bug. ***
Comment 28 Ralf Engels 2011-06-01 17:21:33 UTC
Will commit a patch against this today.