Summary: | Event "trackChanged" is notified twice | ||
---|---|---|---|
Product: | [Applications] amarok | Reporter: | Fabsk <fabsk> |
Component: | Notifications | Assignee: | Amarok Developers <amarok-bugs-dist> |
Status: | RESOLVED NOT A BUG | ||
Severity: | normal | CC: | kfunk |
Priority: | NOR | ||
Version: | 2.6.0 | ||
Target Milestone: | 2.7 | ||
Platform: | Ubuntu | ||
OS: | Linux | ||
Latest Commit: | Version Fixed In: | ||
Sentry Crash Report: |
Description
Fabsk
2012-05-01 16:51:17 UTC
Looks like this report slipped from our attention, sorry for that, but it was not reported for the correct component. Could you please upgrade to Amarok 2.6 and try again? Amarok 2.6 is now present in Kubuntu 12.10, and unfortunately the double-submit is still present. And this only happens when you activate that script? Then you should talk to the script author, as we are not responsible for 3rd-party add-ons. I only have this script to reproduce this issue. But this script is simple enough for me to say that this issue would bother any script that would want to be notified when the current track is changed. Here is a reduced script sample (hard to make shorter): Importer.include ( "config.js" ); function onTrackChange() { Amarok.alert("Track changed"); } Amarok.Engine.trackChanged.connect( onTrackChange ); The message "Track changed" will be displayed twice when starting the track (and only once when stopping the track). The are some work around at the script level (like ignoring one of the notifications), but it is ugly. Then it is the script to blame, as it triggers an action Amarok will already perform if you have the notifications enabled. That is redundant. I'm afraid that it is the other way around. The script asks Amarok to be notified when the song is changed, and . The script does not trigger anything and does not notify anything, it is being notified by Amarok. And Amarok send the notification twice to the script. It is no only a problem with the script «Amarok2LibreFM» in particular, it is a problem with any script wanting to be notified when a track changes. The notification system is a standard functionality of the scripting engine and is described there: http://amarok.community.kde.org/Development/Script_API#Amarok.Engine I had a look in the code and I found that we currently can't rely on the notifications for the new tracks. In "src/EngineController.cpp", there is this comment: // only update stats if we are called for something new, some phonon back-ends (at // least phonon-gstreamer-4.6.1) call slotNewTrackPlaying twice with the same source And on this blog about an Amarok statistic project: «EngineController has to deal with different phonon back-ends and this is delicate. Phonon-vlc likes to emit aboutToFinish() twice in some cases while phonon-gstreamer likes to emit currentSourceChanged() twice and metaDataChanged() even more often (witch no reason). EngineController has to be written very carefully not to explode in case of such rough handling.» http://strohel.blogspot.com/2012/07/amarok-statsyncing-gsoc-weeks-8-and-9.html That's a pity that we don't get the notifications as one would expect (in the Amarok code as shown above, and in the script). So I guess that for the time being, the solution would be what I have done for «Amarok2LibreFM», add some logic in the script to ignore the second notification :-( |