I wrote because SoundCloud removed the ability to add tracks to playlists (sets) from the mobile client. I use this extensively, so I just scripted my own workflow. TL;DR it adds anything you've liked to the playlist for this month.
Here's the logic:
- Get all playlists (sets)
- Get all favorites (likes)
- Select the playlist named as
Playlist_permalink_title
asthis_month_playlist
. Note that if multiple playlists are created with the same title, they're named as the downcase'd spaces-to-hyphens title, with things like apostrophes translated to hyphens for hte permalink. Beware. - If the playlist
Playlist_permalink_title
can't be found, create it asPlaylist_actual_title
. If you're not sure if yourPlaylist_permalink_title
andPlaylist_actual_title
line up, test it first. - generate
favs_this_month
by cherry-picking favorites (from the most-recentPage_size
ordered byPagination_order
) which are newer thanFavorites_to_add_date
(defaults:200
,created_at
,DateTime.now.utc.beginning_of_month
(SC stores all dates as UTC)) - If all of the items in
favs_this_month
exist inthis_month_playlist
, do nothing. This accounts forthis_month_playlist
having things not present infavs_this_month
- If there are tracks IDs in
favs_this_month
not present inthis_month_playlist
, combine the track IDs fromfavs_this_month
andthis_month_playlist
and updatethis_month_playlist
on SoundCloud (and locally). - Display any tracks being added, along with
favs_this_month
andthis_month_playlist
You'll need an app key and secret for this. Get that here.
Put those and your SoundCloud username / password in oauth-config.yaml
in the same directory as this script. An example for you to edit is included as oauth-config.yaml.dist
. This is the OAuth Uesr Credentials Flow if you're wondering, and yes; this could be much simpler if SoundCloud had a web UI to generate OAuth user tokens for developers.
To base64-encode your password, do something like this: echo -n 'your-password-here' |base64
To install the requirements, a bundle install
should do it. Built for Ruby 2.1.
This is quite rough right now, and there's an issue where if the thing you liked wasn't cerated in the past month, it won't be added. It looks like SoundCloud doesn't track the date of when you add something, so I'm not sure how to get around that. Please submit a PR if you have suggestions (line 50).