Bug 305576

Summary: Last.FM "Ban" & "Skip" buttons don't show up for Last.fm streams recreated on startup
Product: [Applications] amarok Reporter: alex
Component: Services/Last.fmAssignee: Amarok Developers <amarok-bugs-dist>
Status: RESOLVED FIXED    
Severity: normal CC: matej, sam
Priority: NOR    
Version: 2.6.0   
Target Milestone: 2.7   
Platform: Arch Linux   
OS: Linux   
Latest Commit: Version Fixed In: 2.7
Bug Depends on: 311733    
Bug Blocks:    

Description alex 2012-08-22 08:07:03 UTC
Since I've upgraded to Amarok 2.6.0, the Last.FM "Ban" and "Skip" buttons have lost their functionality ... clicking them simply does nothing. The third "Love" button, however, does still function as expected.

I've started Amarok via `amarok --debug` and this is what I get when I hit "Love":

amarok: BEGIN: void LastFmService::love() 
amarok:   BEGIN: void ScrobblerAdapter::loveTrack(Meta::TrackPtr) 
amarok:     BEGIN: void ScrobblerAdapter::copyTrackMetadata(lastfm::MutableTrack&, Meta::TrackPtr) 
amarok:       [lastfm] scrobbleComposer:  false 
amarok:     END__: void ScrobblerAdapter::copyTrackMetadata(lastfm::MutableTrack&, Meta::TrackPtr) [Took: 0s] 
amarok:   END__: void ScrobblerAdapter::loveTrack(Meta::TrackPtr) [Took: 0s] 
amarok: END__: void LastFmService::love() [Took: 0s] 

However when I hit "Ban" or "Skip" there is 100% nothing added to the console.

Reproducible: Always

Steps to Reproduce:
1. Play a Last.FM tag
2. Click the "Skip" button
3.
Actual Results:  
100% nothing happens

Expected Results:  
It should skip to the next song that Last.FM will provide
Comment 1 Matěj Laitl 2012-08-24 21:27:08 UTC
(In reply to comment #0)
> Since I've upgraded to Amarok 2.6.0, the Last.FM "Ban" and "Skip" buttons
> have lost their functionality ... clicking them simply does nothing. The
> third "Love" button, however, does still function as expected.

What "third"? Please describe precisely what buttons work and what do not.

> I've started Amarok via `amarok --debug` and this is what I get when I hit
> "Love":
> 
> amarok: BEGIN: void LastFmService::love() 
> amarok:   BEGIN: void ScrobblerAdapter::loveTrack(Meta::TrackPtr) 
> amarok:     BEGIN: void
> ScrobblerAdapter::copyTrackMetadata(lastfm::MutableTrack&, Meta::TrackPtr) 
> amarok:       [lastfm] scrobbleComposer:  false 
> amarok:     END__: void
> ScrobblerAdapter::copyTrackMetadata(lastfm::MutableTrack&, Meta::TrackPtr)
> [Took: 0s] 
> amarok:   END__: void ScrobblerAdapter::loveTrack(Meta::TrackPtr) [Took: 0s] 
> amarok: END__: void LastFmService::love() [Took: 0s] 
> 
> However when I hit "Ban" or "Skip" there is 100% nothing added to the
> console.

Alex, just because the methods don't emit debugging information doesn't mean they do nothing. Banning a track using Ctrl+B works for me, although there's no feedback, but the track shows up in my list of banned tracks (not visible in Last.fm page AFAICS, but can be seen in http://ws.audioscrobbler.com/2.0/?method=user.getbannedtracks&user=YOUR_LAST_FM_USERNAME&api_key=b25b959554ed76058ac220b7b2e0a026 )

The situation with the "Skip" action is a bit worse, because Last.fm removed the method from the API and further restricted the radio API - you cannot for example play the tracks in different order or even re-start listening a to track (making pause impossible), see [1].

[1] http://www.last.fm/api/radio

So, I'll fix this by removing the "Skip" button. Additionally, the Ban action will have user feedback - the code is already there in my statsyncing GSoC branch.
Comment 2 alex 2012-08-25 07:14:39 UTC
(In reply to comment #1)
> What "third"? Please describe precisely what buttons work and what do not.

I'm not too sure why I said "third", simply meant the "Love" button on the main toolbar. The only button that works for me is "Love".

> Alex, just because the methods don't emit debugging information doesn't mean
> they do nothing. Banning a track using Ctrl+B works for me, although there's
> no feedback, but the track shows up in my list of banned tracks (not visible
> in Last.fm page AFAICS, but can be seen in
> http://ws.audioscrobbler.com/2.0/?method=user.
> getbannedtracks&user=YOUR_LAST_FM_USERNAME&api_key=b25b959554ed76058ac220b7b2
> e0a026 )

I've just tried to confirm if clicking "Ban" updates that XML file (for my username), however unless that feed does not get updated often then the "Ban" button has also lost its functionality. You can also view your banned tracks via http://www.last.fm/user/USERNAME/library/banned, it's not linked from anywhere though.

> The situation with the "Skip" action is a bit worse, because Last.fm removed
> the method from the API and further restricted the radio API - you cannot
> for example play the tracks in different order or even re-start listening a
> to track (making pause impossible), see [1].
> 
> [1] http://www.last.fm/api/radio

That would explain it then! Also when clicking on "Ban" it used to "Ban" it and then skip to the next track too, sounds like they've removed some useful functionality from their API here ... looks like I'll be changing service.
Comment 3 Matěj Laitl 2012-08-25 14:13:23 UTC
Git commit d11827eaa102743e72f05138f22acfb78898d0fb by Matěj Laitl.
Committed on 25/08/2012 at 15:17.
Pushed by laitl into branch 'master'.

Remove Last.fm Skip button for streams

Last.fm API no longer supports it, don't confuse users.
FIXED-IN: 2.7

M  +1    -0    ChangeLog
M  +0    -5    src/MainWindow.cpp
M  +0    -1    src/MainWindow.h
M  +0    -13   src/services/lastfm/LastFmService.cpp
M  +0    -1    src/services/lastfm/LastFmService.h
M  +0    -11   src/services/lastfm/ScrobblerAdapter.cpp
M  +0    -1    src/services/lastfm/ScrobblerAdapter.h
M  +0    -16   src/services/lastfm/meta/LastFmMeta.cpp
M  +0    -3    src/services/lastfm/meta/LastFmMeta.h
M  +0    -11   src/services/lastfm/meta/MultiPlayableCapabilityImpl_p.h

http://commits.kde.org/amarok/d11827eaa102743e72f05138f22acfb78898d0fb
Comment 4 alex 2012-08-25 14:28:45 UTC
Is there any way that you could fake the "Skip" button? For example, right now if I don't like a track I can "Skip" it by double-clicking on the Last.FM tag that I have added to my playlist, which I'm assuming just stops and then plays the tag again - resulting in a new song.

Maybe that's against their ToS, though.
Comment 5 alex 2012-09-17 15:03:30 UTC
Matěj, I've just re-added a few Last.FM tags that I had in my playlist, and to my surprise the Last.FM "Skip" buttons are now working. Are you able to confirm this original behaviour? If so, may need to revert that commit!
Comment 6 Matěj Laitl 2012-09-17 15:26:29 UTC
(In reply to comment #5)
> Matěj, I've just re-added a few Last.FM tags that I had in my playlist, and
> to my surprise the Last.FM "Skip" buttons are now working. Are you able to
> confirm this original behaviour? If so, may need to revert that commit!

Hmm, so they work sometimes and sometimes not? See [1], it is not clear whether advancing to the next track is valid or not.

[1] http://www.last.fm/api/radio
Comment 7 alex 2012-09-17 15:34:14 UTC
The tags that I have in my playlist, which have been in there for months, do not allow me to skip track. However, the newer tags that I've just added do let me skip. 

I've also just added a duplicate tag, e.g. "acoustic", just to see if it was an issue with that certain tag, but that now works as well.

I don't know much about the Last.FM API, however after looking at their example response I would assume it is perfectly valid, you just advance to the next track in the order and it should allow it.

If there is any config file that I can provide you which may give you some clues as to why my older tags in the playlist do not work, let me know.
Comment 8 alex 2012-09-17 15:43:56 UTC
A ha, ok I have found out how to replicate this 100% now.

1) Add a new Last.FM tag, e.g. "acoustic"
2) Start playing the acoustic tag from the playlist
3) Click the "Skip" button
4) Track will skip to the next one
5) Close and reopen Amarok
6) Repeat steps 2 & 3
7) Track will *not* skip
Comment 9 Matěj Laitl 2012-09-17 15:47:59 UTC
(In reply to comment #8)
> A ha, ok I have found out how to replicate this 100% now.
> 
> 1) Add a new Last.FM tag, e.g. "acoustic"
> 2) Start playing the acoustic tag from the playlist
> 3) Click the "Skip" button
> 4) Track will skip to the next one
> 5) Close and reopen Amarok
> 6) Repeat steps 2 & 3
> 7) Track will *not* skip

Okay, it boils down to Last.fm tracks not being properly recreated at startup..
Comment 10 Matěj Laitl 2012-12-17 18:48:40 UTC
Git commit 143c96f6782f2206a9b47736bd4cfed214d0483c by Matěj Laitl.
Committed on 17/12/2012 at 19:46.
Pushed by laitl into branch 'master'.

LastFmService: fix track recreation on startup

...and add a warning to ServiceBase so that we know quicker next time.

BUGFIXES:
 * Fix Last.fm streams not being correctly recreated on startup.
FIXED-IN: 2.7

M  +1    -0    ChangeLog
M  +7    -3    src/services/ServiceBase.cpp
M  +5    -3    src/services/lastfm/LastFmService.cpp
M  +0    -1    src/services/lastfm/meta/LastFmMeta.cpp

http://commits.kde.org/amarok/143c96f6782f2206a9b47736bd4cfed214d0483c
Comment 11 Matěj Laitl 2012-12-17 19:29:02 UTC
Oh, I've fixed the re-creation, but the buttons don't show up for re-created tracks. Let's see.
Comment 12 Matěj Laitl 2012-12-17 21:20:08 UTC
Git commit 40c45b77418a92b7b5489dfbb8941cfe73655a42 by Matěj Laitl.
Committed on 17/12/2012 at 22:11.
Pushed by laitl into branch 'master'.

MetaProxy, LastFmMeta: finally fix Last.fm track recreation

QObjects and threads don't go well together, hopefully I'll win.
FIXED-IN: 2.7

M  +22   -9    src/core-impl/meta/proxy/MetaProxy.cpp
M  +21   -28   src/core-impl/meta/proxy/MetaProxyWorker.cpp
M  +34   -24   src/core-impl/meta/proxy/MetaProxyWorker.h
M  +24   -6    src/services/lastfm/meta/LastFmMeta.cpp

http://commits.kde.org/amarok/40c45b77418a92b7b5489dfbb8941cfe73655a42