zstorok / xbmc-soundcloud-plugin

XBMC music plugin for browsing and playing content from SoundCloud.
http://zsolttorok.com
GNU General Public License v3.0
16 stars 9 forks source link

Track plays not scrobbled to Last.fm #2

Closed zstorok closed 9 years ago

zstorok commented 13 years ago

Received by email:

"Enjoying the SoundCloud plugin, but notice that it does not scrobble my “now playing” track information to Last.fm. I know there is some proof-of-concept code available for last.fm in python, do you know if this is how you would do the last.fm submission, or is there a way to hook into the XBMC internal last.fm API functions?"

zstorok commented 13 years ago

Interestingly, the Last.fm scobbler seems to work to some extent after enabling it in XBMC | System | Music | Song submission. The track doesn't show up on Last.fm, but according to the XBMC log something is going on:

13:09:01 T:2956333056 M:623087616 DEBUG: CLastfmScrobbler: Handshake succeeded! 13:09:01 T:2956333056 M:623091712 DEBUG: CLastfmScrobbler: SessionID is 6ef62bb7ddf54cdaa87b18588ab3bc62 13:09:01 T:2956333056 M:623087616 DEBUG: CLastfmScrobbler: NP URL is http://post.audioscrobbler.com:80/np_1.2 13:09:01 T:2956333056 M:623091712 DEBUG: CLastfmScrobbler: Submit URL is http://post2.audioscrobbler.com:80/protocol_1.2

zstorok commented 13 years ago

Unfortunately SoundCloud doesn't support the notion of artist for a track: you can only tell the name of the user, who uploaded the given track. See this SoundCloud Last.fm scrobbling discussion. Usernames can be both artists and labels, which makes it somewhat tricky to extract the correct information. Sometimes track names include the artist (e.g. [artist] - [title]), this scenario needs to be considered as well. To sum it up, a limited and quite rudimentary implementation of this feature might be added in the near future, with the caveats discussed above.

awesomer commented 13 years ago

Sigh, yeah. What a surprise that yet another music based startup has a complete failure of a meta information model.

I am pretty sure I would be reasonably happy with scrobbling based on uploader name, although it is somewhat insane and might not actually be worth the trouble unless I am careful to avoid DJ mixes and third party postings..

UPDATE : I looked at your code and the API request and don't understand how you are translating variable names to/from JSON, or otherwise would have taken a hack at modifying the code to use the track.user.username variable as "artist name".

zstorok commented 13 years ago

Well, I will play around with this a bit today (using track.user.username), and see how well it works for scrobbling. I guess the various possible artist extraction methods should eventually become a user preference setting, but building a dialog in XBMC looks a bit scary from what I read... Regarding the API calls: I have a blogpost series on http://zsolttorok.com on what i learned about XBMC plugin development when working on the SoundCloud plugin, the next part coming up will discuss the integration with the SoundCloud API.

zstorok commented 13 years ago

I had some success with setting the artist information, but it's still not working perfectly. Now the song I'm playing shows up on my Last.fm profile as "Listening now", but once the track is over, it just disappears. Also, the SoundCloud metadata is not really good enough for scrobbling, since people tend to include artist names in song titles, upload songs with usernames different from the actual artist name, etc. The information needs to be cleaned up before submitting to Last.fm, but anticipating and supporting so many special cases seems a bit daunting. Maybe some other music metadata webservice(s) with some kind of a fuzzy search could be used to find the proper track and artist names, but this can only work with relatively well-known tracks.

awesomer commented 13 years ago

http://www.audioscrobbler.net/development/protocol/

The submission to last.fm has two different phases. The one you are seeing is the "now playing" phase.

"The Now-Playing notification is a lightweight mechanism for notifying the Audioscrobbler server that a track has started playing. This is used for realtime display of a user's currently playing track, and does not affect a user's musical profile.

The Now-Playing notification is optional, but recommended."

It then waits for the "submission" event, which should occur under these conditions :

"The client should monitor the user's interaction with the music playing service to whatever extent the service allows. In order to qualify for submission all of the following criteria must be met:

"

"

My conjecture would be that you might not be meeting the track length criteria check within XBMC.

Note the last item with regards to "interpreting filename information", I think probably your best effort will be to submit using uploader as artist and title as track title. Maybe you want to make scrobbling to last.fm a configurable option of the soundcloud addon, in case people use it to listen to a lot of, for example, DJ mixes and don't want their last.fm polluted with incorrect info?

zstorok commented 13 years ago

I'm afraid it's all or nothing when it comes to Last.fm scrobbling in XBMC: it's a global setting and is completely out of my plugin's control. Will look into why the actual scrobbling doesn't happen; I can see in the logs that it works for local files.

zstorok commented 9 years ago

Unfortunately I don't have time to support this plugin anymore. I know a few people have forked this repository and made some updates, but I haven't followed their changes. See the repository network for these more up-to-date forks.