Skip to content

Curate Spotify playlists from /r/listentothis top threads

Notifications You must be signed in to change notification settings

asobti/listentothis

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

18 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

listentothis

A python script to update Spotify playlists with top threads from /r/listentothis

Playlists

/r/listentothis Weekly Top Tracks
/r/listentothis Monthly Top Tracks

Setup

# Clone the repo
git clone [email protected]:asobti/listentothis.git
cd listentothis

# Create a [virtualenv](https://virtualenv.pypa.io/en/stable/)
virtualenv env
source env/bin/activate

# install requirements
pip install -r requirements.txt

Usage

usage: listentothis.py [-h] --subreddit SUBREDDIT --period {week,all,year,day,month}
               [--limit LIMIT] --playlist-id PLAYLIST_ID --spotify-client-id
               SPOTIFY_CLIENT_ID --spotify-client-secret SPOTIFY_CLIENT_SECRET
               --refresh-token-file REFRESH_TOKEN_FILE
               [--search-threshold SEARCH_THRESHOLD] [--dry-run]

Add subreddit top tracks to a Spotify playlist

optional arguments:
  -h, --help            show this help message and exit
  --subreddit SUBREDDIT
                        The subreddit to query
  --period {week,all,year,day,month}
                        The time period for top reddit threads
  --limit LIMIT         Number of threads to retreive
  --playlist-id PLAYLIST_ID
                        ID of Spotify Playlist to add tracks to
  --spotify-client-id SPOTIFY_CLIENT_ID
                        Spotify application client ID
  --spotify-client-secret SPOTIFY_CLIENT_SECRET
                        Spotify application client secret
  --refresh-token-file REFRESH_TOKEN_FILE
                        Path to file with refresh token
  --search-threshold SEARCH_THRESHOLD
                        Fraction of reddit threads that must convert to
                        Spotify tracks in order to proceed
  --dry-run             Do a dry run - Spotify playlists are not modified

Example command to update a playlist with top Weekly tracks:

./listentothis.py \
  # /r/listentothis subreddit
  --subreddit listentothis \
  # weekly top threads
  --period week \
  # limit search results to top 50 threads
  --limit 50 \
  # Spotify playlist id
  --playlist-id 2f1Ioxhg8evQ6TGVVVPT6j \
  # Spotify app Client ID
  --spotify-client-id your-client-id \
  # Spotify app Client Secret
  --spotify-client-secret your-client-secret \
  # Path to file containing the refresh token
  --refresh-token-file refresh_token \
  # At least 50% of reddit threads should conver to Spotify tracks
  --search-threshold 0.5

Spotify Intructions

To get a Spotify client id, client secret and refresh token, follow instructions at Spotify Web API Tutorial

About

Curate Spotify playlists from /r/listentothis top threads

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages