Skip to content
This repository has been archived by the owner on May 21, 2022. It is now read-only.

add support for SoundCloud #144

Closed
a-r-db opened this issue Aug 27, 2014 · 62 comments
Closed

add support for SoundCloud #144

a-r-db opened this issue Aug 27, 2014 · 62 comments
Labels
app support add support for (some music app)

Comments

@a-r-db
Copy link
Contributor

a-r-db commented Aug 27, 2014

Support for SoundCloud scrobble.

@inverse
Copy link
Contributor

inverse commented Aug 27, 2014

This would be awesome! @theli-ua you seem to have quite a lot of knowledge about locating relevant intents etc. I remember you mentioning adb shell dumpsys activity broadcasts in a previous issue. How can this be used to identify anything of use?

From using this I noticed things like:

   Filter #0: BroadcastFilter{42f907a0}

      Action: "com.soundcloud.android.playback.toggleplayback"

      Action: "com.soundcloud.android.playback.playcurrent"

      Action: "com.soundcloud.android.playback.pause"

      Action: "com.soundcloud.android.playback.seek"

      Action: "com.soundcloud.android.playback.reset"

      Action: "com.soundcloud.android.playback.stop"

      Action: "com.soundcloud.android.playlistchanged"

@theli-ua
Copy link
Contributor

@inverse After you got your intents names you could build a version like this:
theli-ua@846ea82

And see logcat for the contents of the intents

@inverse
Copy link
Contributor

inverse commented Aug 28, 2014

@theli-ua thanks for the heads up. I'll be interested in trying this out. This kinda stuff should go into the Wiki 👍

@austin-1
Copy link

I was able to get SoundCloud track data from the notifications it posts by using the new notifications API introduced in Android 4.3 by pulling the extras android.title for the song and android.text for the artist. This also works with Pandora as another user reported but not iHeartRadio for some reason.

@inverse
Copy link
Contributor

inverse commented Jan 12, 2015

I've managed to figure out that the SoundCloud application actually uses

  • com.android.music.playstatechanged
  • com.android.music.metachanged
01-12 23:08:38.877: E/SoundCloud(2026): Dumping: com.android.music.metachanged
01-12 23:08:58.969: E/SoundCloud(2026): Dumping Intent start
01-12 23:08:58.970: E/SoundCloud(2026): [duration=582531]
01-12 23:08:58.970: E/SoundCloud(2026): [artist=Erotus]
01-12 23:08:58.970: E/SoundCloud(2026): [id=184688169]
01-12 23:08:58.970: E/SoundCloud(2026): [track=Blamstrain - Nightcruiser (For All The D]
01-12 23:08:58.970: E/SoundCloud(2026): Dumping Intent end
01-12 23:08:59.019: E/SoundCloud(2026): Dumping: com.android.music.playstatechanged
01-12 23:09:49.713: E/SoundCloud(2026): Dumping: com.android.music.metachanged
01-12 23:09:49.713: E/SoundCloud(2026): Dumping Intent start
01-12 23:09:49.713: E/SoundCloud(2026): [duration=352215]
01-12 23:09:49.713: E/SoundCloud(2026): [artist=Endless Plains Records ❑]
01-12 23:09:49.713: E/SoundCloud(2026): [id=185328848]
01-12 23:09:49.713: E/SoundCloud(2026): [track=Kadahn - S i g n a l s LP [ENDPRLP01] Pr]
01-12 23:09:49.713: E/SoundCloud(2026): Dumping Intent end

@vedit
Copy link

vedit commented Jan 13, 2015

Is there any ongoing development here? I'd like to pitch in if nobody built something so far.

@inverse
Copy link
Contributor

inverse commented Jan 13, 2015

I started working a little bit on a branch (see https://github.com/inverse/sls/tree/soundcloud).

  • Need to figure out the correct parsing of the track/artist since often the track contains the artist as well. This is also apparent with reposts where the artist bundle key is the reposter, and not the actual artist. I can see this causing quite a lot of invalid submissions.
  • Also there may be another intent that I missing (com.android.music.playbackcomplete) which needs to be investigated
  • Finally working out if there is any further information in the playstate change intent.

I'm really unsure as to if anything will ever get merged here @tgwizard has been pretty absent this past year. Although looking back that sounds a bit harsh which it's not meant to be.

@inverse
Copy link
Contributor

inverse commented Jan 15, 2015

@vedit feel free to contribute or take the work what I've done to bring SC integration into the app:)

@vedit
Copy link

vedit commented Jan 17, 2015

@inverse thanks, I'll take a look at it today

@jeffshieldsdev
Copy link

Any update on Soundcloud support? Thank you.

@vedit
Copy link

vedit commented Apr 9, 2015

Sorry for lack of an update. I took a stab at it and turns out correct names are the main problem with soundcloud. Couldn't reliably find and use track names for lastfm submissions, especially from record label pages.

@austin-1
Copy link

There is no way you will ever be able to automatically correct every single song on Soundcloud. It's better to just scrobble is as-is because then everybody will be scrobbling the same thing, even if it's technically "wrong." If 3000 people scrobble a song with incorrect info, last.fm will be much more likely to file a correction than 20 scrobbles on a "fixed" track title from this specific app.

@inverse
Copy link
Contributor

inverse commented Apr 11, 2015

Perhaps looking at how the web-scrobbler handles Soundcloud for some ideas of how the track scrobbling could be done.

@a-r-db
Copy link
Contributor Author

a-r-db commented Apr 17, 2015

@inverse I found another resource for you on parsing.
https://addons.mozilla.org/en-US/firefox/files/browse/304994/file/chrome/content/foxyscrobbler/soundcloud.js
Java isn't my strong suit, but I understand these web-scrobblers and can understand most common programming languages. I hope this helps you with your sls/soundcloud fork.

@inverse
Copy link
Contributor

inverse commented Apr 17, 2015

@HumbleBeeBumbleBee Thanks for the heads up. I think It'll be good to look at how these other web-scrobblers handle such cases because It's not going to be an absolute solution but def an improvement over not scrobbling.

Also we could add some validation against last.fm to only scrobble known tracks. But I am not sure what people's take on that would be.

@austin-1
Copy link

I've already said my take on the issue, but just to reiterate...I think we
should only worry about scrobbling the track info as-is. So Artist Name -
Name of Track. Then let the last.FM community decide what things need to be
corrected to.

Everybody that uses soundcloud knows how weird some of the track names can
be, especially when you have one artist posting something where the primary
artist is actually in the track title. So you end up with Artist A - Artist
B - Track Name. Big deal and so what? If that's how they want it to show up
then just let it be and stop worrying about trying to make a panacea for
every situation.
On Apr 17, 2015 3:02 PM, "Malachi Soord" [email protected] wrote:

@HumbleBeeBumbleBee https://github.com/HumbleBeeBumbleBee Thanks for
the heads up. I think It'll be good to look at how these other
web-scrobblers handle such cases because It's not going to be an absolute
solution but def an improvement over not scrobbling.

Also we could add some validation against last.fm to only scrobble known
tracks. But I am not sure what people's take on that would be.


Reply to this email directly or view it on GitHub
#144 (comment).

@a-r-db a-r-db mentioned this issue Apr 26, 2015
@a-r-db a-r-db added the app support add support for (some music app) label May 1, 2015
@a-r-db
Copy link
Contributor Author

a-r-db commented May 3, 2015

I have a working prototype of SoundCloud running on my phone now.
No parsing to the data.
I second the motion from @bhb192 about letting last.fm and libre.fm to decide what to do with the songs.
It scrobbles just fine, except I have found that it cuts of Track names that exceed a certain size.
Mr. Little Jeans - The Suburbs (Crywolf
Soundcloud hands over a shortened track name according to my logs.

    Line 705447: E/SoundCloud(27592): 411 <- track length in seconds for @ 50% scrobble
    Line 705449: E/SoundCloud(27592): Dumping Intent start
    Line 705451: E/SoundCloud(27592): [duration=411689]
    Line 705453: E/SoundCloud(27592): [artist=Crywolf]
    Line 705455: E/SoundCloud(27592): [id=27701972]
    Line 705457: E/SoundCloud(27592): [track=Mr. Little Jeans - The Suburbs (Crywolf ]

I don't think this is an SLS problem but a SoundCloud problem.

@austin-1
Copy link

austin-1 commented May 3, 2015

Thanks for all of your work on that, I'm happy to see it finally
scrobbling! What is the data source of the track name?
On May 2, 2015 10:38 PM, "HumbleBeeBumbleBee" [email protected]
wrote:

I have a working prototype of SoundCloud running on my phone now.
No parsing to the data.
I second the motion from @bhb192 https://github.com/bhb192 about
letting last.fm and libre.fm to decide what to do with the songs.
It scrobbles just fine, except I have found that it cuts of Track names
that exceed a certain size.
Mr. Little Jeans - The Suburbs (Crywolf
Soundcloud hands over a shortened track name according to my logs.

Line 705447: E/SoundCloud(27592): 411 <- track length in seconds for @ 50% scrobble
Line 705449: E/SoundCloud(27592): Dumping Intent start
Line 705451: E/SoundCloud(27592): [duration=411689]
Line 705453: E/SoundCloud(27592): [artist=Crywolf]
Line 705455: E/SoundCloud(27592): [id=27701972]
Line 705457: E/SoundCloud(27592): [track=Mr. Little Jeans - The Suburbs (Crywolf ]

I don't think this is an SLS probably but a SoundCloud problem.


Reply to this email directly or view it on GitHub
#144 (comment).

@a-r-db
Copy link
Contributor Author

a-r-db commented May 3, 2015

I second the motion because SoundCloud doesn't send the full track information anyways.
Mr. Little Jeans - The Suburbs (Crywolf <- only about 40 characters
It would be different if full information was in the track title.
If that were so we could split the title into track name - artist and maybe have a Spotify style comma separated artist and track information.

@a-r-db
Copy link
Contributor Author

a-r-db commented May 3, 2015

@bhb192 The data source of the track is com.android.music.metachanged
I go that from @inverse
I didn't check for other broadcasts.... hmmm...

@austin-1
Copy link

austin-1 commented May 3, 2015 via email

@a-r-db
Copy link
Contributor Author

a-r-db commented May 3, 2015

@bhb192 I fired out and email to [email protected]
I'll let you know if there are any custom broadcasts I can grab full track information from. :)

@a-r-db
Copy link
Contributor Author

a-r-db commented May 3, 2015

If there isn't going to be any parsing involved I guess we can at least try to get all the information to last.fm or libre.fm so they can fix track information.

@a-r-db
Copy link
Contributor Author

a-r-db commented May 3, 2015

https://github.com/tgwizard/sls/blob/SoundCloud/src/com/adam/aslfms/receiver/SoundCloud.java
Ok, it's all done. The scrobble output is messy, but we have moderate SoundCloud support now.
All credit goes to @inverse
I really think we should look into the scrobble after 4 minutes rule/feature for long songs on SoundCloud.

@inverse
Copy link
Contributor

inverse commented May 3, 2015

The cut of in intent track info seems a little strange. Let us know what SoundCloud say :)

Is it worth porting some of the logic from web-scrobbler to clean up the track information? I guess that could be useful to have built into the core and enabled on a per-player basis. Perhaps for now just bundling it with SoundCloud would be sufficient for now. Opinions?

Why do you say scrobbler after 4 minutes?

@a-r-db
Copy link
Contributor Author

a-r-db commented May 3, 2015

I don't think we can port the logic of the webscrobbler, if our track information is not full.

A track should only be scrobbled when the following conditions have been met:

  • The track must be longer than 30 seconds.
  • And the track has been played for at least half its duration, or for 4 minutes (whichever occurs earlier.)

http://www.last.fm/api/scrobbling

Some SoundCloud tracks are a couple hours long.

@inverse
Copy link
Contributor

inverse commented May 3, 2015

Makes sens 👍 I'd say it'll be worth raising a separate issue to discuss how this should be handled.

@austin-1
Copy link

austin-1 commented May 3, 2015 via email

@writepython
Copy link

@bhb192 - If you're saying that 8tracks and others indiscriminately scrobble soundcloud username as artist name, that does complicate things. I see evidence of that here: http://www.last.fm/music/TriAngleRecords In that case, it might be better to split the track name first on "-" and see if last.fm's api's artist autocorrection feature returns an artist name for either side of that split. And look at souncloud username second.

@austin-1
Copy link

austin-1 commented May 5, 2015

Most of the time making the SoundCloud username second priority will work,
but then there are times when the artist has a dash in the name. Also a
dash isn't always the delineator. I mentioned it in a previous post, but
look at http://last.fm/music/octobersveryown. And that is the official
account!
On May 5, 2015 5:30 PM, "Ryan McCormack" [email protected] wrote:

@bhb192 https://github.com/bhb192 - If you're saying that 8tracks and
others indiscriminately scrobble soundcloud username as artist name, that
does complicate things. I see evidence of that here:
http://www.last.fm/music/TriAngleRecords In that case, it might be better
to split the track name first on "-" and see if last.fm's api's artist
autocorrection feature returns an artist name for either side of that
split. And look at souncloud username second.


Reply to this email directly or view it on GitHub
#144 (comment).

@writepython
Copy link

Right. The splitting could be a bit more robust. Search the string for: whitespace + some assortment of delimeters + whitespace.

@a-r-db
Copy link
Contributor Author

a-r-db commented May 6, 2015

Their email support told me to try StackExchange.

You reached the SoundCloud community team, and we're unable to deal with technical requests of this nature unfortunately! I'd suggest heading to https://developers.soundcloud.com/support and also looking to Stack Overflow for any help. Our developers try to keep an eye on posts tagged with "soundcloud", so you might get in touch with one of them this way.

https://stackoverflow.com/questions/30083644/what-causes-soundcloud-track-strings-character-limits

@a-r-db
Copy link
Contributor Author

a-r-db commented May 12, 2015

I have a new issue with SoundCloud becoming the default receiver instead of the built in music player. I think this could be the problem affecting 8tracks and VLC and my stock player not scrobbling properly.
I might have to drop SoundCloud support until this is fixed, but I want to make sure it's the cause of the problem.
I disabled SoundCloud in the apps section and now 8tracks and VLC and the Stock player seem to scrobble correctly via "Android Music Player" instead of "SoundCloud".
Can anybody else verify this problem?

@a-r-db a-r-db reopened this May 12, 2015
@a-r-db
Copy link
Contributor Author

a-r-db commented May 15, 2015

It's 100% caused by SoundCloudReceiver.java

When "SoundCloud" is enabled in "Enabled Apps" VLC, Stock Samsung Music Player & 8tracks (& I assume others) DO NOT scrobble to last.fm, they only scrobble to libre.fm.

When "SoundCloud" is disabled in "Enabled Apps" everything works normally.

I believe the conflict is here with
https://github.com/tgwizard/sls/blob/master/app/src/main/AndroidManifest.xml#L263-L271
overriding/interfering
https://github.com/tgwizard/sls/blob/master/app/src/main/AndroidManifest.xml#L67-L76

I think this is going to require asking SoundCloud Android developers to make their application Scrobbler compatible.

Also, since SoundCloud does not even provide full track information (~40 character limit) I think it's a good idea to ask SoundCloud to make their app Scrobbler compatible and pull SoundCloud support until they make their app compatible.

@austin-1
Copy link

Not a solution to the problem, but 8tracks will scrobble server-side. I
wish SoundCloud would just give an actual statement regarding scrobbling
other than "we don't support it, but sharing to Facebook is similar."
On May 15, 2015 5:45 PM, "HumbleBeeBumbleBee" [email protected]
wrote:

It's 100% caused by SoundCloudReceiver.java
https://github.com/tgwizard/sls/blob/master/app/src/main/java/com/adam/aslfms/receiver/SoundCloudReceiver.java

When "SoundCloud" is enabled in "Enabled Apps" VLC
https://www.videolan.org/vlc/download-android.html, Stock Samsung Music
Player and 8tracks https://8tracks.com/ DO NOT scrobble to last.fm,
they only scrobble to libre.fm.

When "SoundCloud" is disabled in "Enabled Apps" everything works normally.

I believe the conflict is here with

https://github.com/tgwizard/sls/blob/master/app/src/main/AndroidManifest.xml#L263-L271
overriding/interfering

https://github.com/tgwizard/sls/blob/master/app/src/main/AndroidManifest.xml#L67-L76

I am going to try switching the places of the above code, but I still
think they will conflict.

I think this is going to require asking SoundCloud Android developers to
make their application Scrobbler compatible.


Reply to this email directly or view it on GitHub
#144 (comment).

@inverse
Copy link
Contributor

inverse commented May 17, 2015

@HumbleBeeBumbleBee It's been a while since I've worked with Android and my phone's USB is dodgy. But just discovered this though: https://play.google.com/store/apps/details?id=com.ttxapps.wifiadb&hl=en

Had a play around and we need a way to distinguish which application sent the intent so we can filter this out in each.Getting the Soundcloud application to provide unique actions would solve this. However is there a way to get the application sending the intent from the onRecieve method?

Could this be used to limit? https://chris.orr.me.uk/android-ssp-data-intent-filter/ Although only API 19+ supported.

@a-r-db
Copy link
Contributor Author

a-r-db commented May 31, 2015

I left a branch OldSC with the current SoundCloud support as it is for people who want to build their own and manually enable/disable SoundCloud as they need it, but it seems like there are too many issues.

  • 40 character limit
  • default android intent interference
  • patch that limits our device support to KitKat (API 19+) Version Graph

I can't cut off (potentially) half our user base for bad SoundCloud support.
If somebody wants to try and patch this on OldSC please do, but I want to keep the support as it's shown on Google Play

  • Requires Android 2.1 and up

We should just have a bunch of people demanding Scrobble support [email protected]
For now I will put SoundCloud in the PBR category.

@austin-1
Copy link

austin-1 commented May 31, 2015 via email

@a-r-db
Copy link
Contributor Author

a-r-db commented May 31, 2015

@bhb192 Great!!!

@inverse
Copy link
Contributor

inverse commented May 31, 2015

The 40 character limit could be over come by using their API since we have the track ID. But the other issues will cause a problem. Having this on the backlog is a good idea in the mean time though :)

@a-r-db
Copy link
Contributor Author

a-r-db commented May 31, 2015

@a-r-db
Copy link
Contributor Author

a-r-db commented Jun 1, 2015

@inverse Any idea how we could implement some code to grab detailed track information from the SoundCloud API?

@a-r-db
Copy link
Contributor Author

a-r-db commented Jun 4, 2015

Thanks for getting in touch! We've received a lot of requests for this feature and our developers are currently looking into the infrastructure to make this possible, but they haven't provided me with a definitive answer as to when this might become available. Keep up with our status blog (status.soundcloud.com) to see any new updates and releases.

I've forwarded your request to our developers to review for future updates and to emphasize the growing desire for this feature.

Hope this helps! Let me know if you have any other questions.

That seems promising!

@austin-1
Copy link

austin-1 commented Jun 4, 2015 via email

@a-r-db
Copy link
Contributor Author

a-r-db commented Jun 4, 2015

@bhb192 not sure what could be causing that. Maybe it's SoundCloud. I have the same problem with Chrome and Google Play Music opening sometimes.

@a-r-db a-r-db changed the title SoundCloud add support for SoundCloud Jun 7, 2015
@a-r-db
Copy link
Contributor Author

a-r-db commented Jul 12, 2016

SLS accepts broadcasts for SoundCloud now.

@a-r-db a-r-db closed this as completed Jul 12, 2016
@fishstik
Copy link

fishstik commented Aug 22, 2016

Why is this closed? I don't see SC on the apps list. I noticed the official Last.fm scrobbles SC now...though it looks like they're also restricted by the char limit. I've switched over to the official app just for this reason.

I support parsing of differently-formatted titles...provided we can work around the char limit. The way web-scrobbler parses SC titles works really well almost all the time. It really sucks to scrobble something like [Artist:{"Elysian Records"}, Title:{"Artist - Title"}].

@a-r-db a-r-db reopened this Aug 22, 2016
@a-r-db
Copy link
Contributor Author

a-r-db commented Aug 27, 2019

For android devices running 21 aka Lollipop or higher this should resolve any app issues.
#478

@a-r-db a-r-db closed this as completed Aug 27, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
app support add support for (some music app)
Projects
None yet
Development

No branches or pull requests

8 participants