Bug 188512 - [PATCH] Progress bar wrong when switching to Last.fm stream
Summary: [PATCH] Progress bar wrong when switching to Last.fm stream
Alias: None
Product: amarok
Classification: Applications
Component: general (show other bugs)
Version: 2.1-SVN
Platform: Ubuntu Linux
: NOR normal (vote)
Target Milestone: ---
Assignee: Amarok Developers
Depends on:
Reported: 2009-03-31 00:25 UTC by Michael Quinn
Modified: 2009-04-19 08:19 UTC (History)
1 user (show)

See Also:
Latest Commit:
Version Fixed In:

Fixes progress bar when starting last.fm stream (1.10 KB, patch)
2009-03-31 03:24 UTC, Michael Quinn

Note You need to log in before you can comment on or make changes to this bug.
Description Michael Quinn 2009-03-31 00:25:15 UTC
Version:           2.1-SVN (using KDE 4.2.1)
Compiler:          gcc 4.3.3 
OS:                Linux
Installed from:    Ubuntu Packages

While playing a track from the local collection (or while paused), switching to a last.fm station causes the first track's progress bar to act as though the track's length were the same as the track that was being played from the local collection (the text to the left and right of the bar is correct, though).  This is most evident when playing a really short track from the local collection and switching to a last.fm station.

When further tracks from the last.fm station are played, the progress bar behaves normally.

I am using Xine with PulseAudio--I have not tested anything else.
Comment 1 Michael Quinn 2009-03-31 03:24:22 UTC
Created attachment 32491 [details]
Fixes progress bar when starting last.fm stream
Comment 2 Michael Quinn 2009-03-31 03:26:04 UTC
Upon investigation, it seems that on the first track of a last.fm stream, Phonon still thinks the length of the track is the length of the previous track.  For the following tracks, it thinks it's 0 (and the code rightly ignored Phonon when it reported 0).  A signal is also triggered that sets the length to the length of the last track.

I have attached a patch that prefers the track length in Meta::Track over that reported by Phonon.  Also, when Phonon triggers trackLengthChanged(), trackLength() is called to get the correct length of the track (instead of believing what Phonon reports).
Comment 3 Dan Meltzer 2009-03-31 03:34:00 UTC
I'd much rather see this addressed in phonon than addressed in this way.  This would solve the problem, but it's one more thing to keep in mind every time we touch engine controller (and the list of things to keep in mind when touching that file is insane..)
Comment 4 Mark Kretschmann 2009-04-18 20:01:51 UTC
Well, what are we going to do about this? Reassign to Phonon? Apply Michael's patch?

We need to a reach a conclusion. Just keeping the report open for the sake of it doesn't help anyone.

Adding Leo Franchi to CC list, as he is our Last.fm expert.
Comment 5 Leo Franchi 2009-04-18 20:23:54 UTC
hmmm i agree with dan in theory, but i don't really know how to fix it in phonon. also, it doesn't really seem to be a "hack" or workaround in enginecontroller, as it just changes the functionality to prefer the Meta::Track length of the phonon-reported length if we have a valid length from Meta::Track. 

all in all i'm in favor of the patch.
Comment 6 Mark Kretschmann 2009-04-19 08:19:56 UTC
SVN commit 955976 by markey:

Fixed problem with Amarok showing wrong track length for Last.fm
streams. Patch by Michael Quinn <mike@quinnsoft.com>.

BUG: 188512

 M  +2 -0      ChangeLog  
 M  +7 -2      src/EngineController.cpp  

WebSVN link: http://websvn.kde.org/?view=rev&revision=955976