Skip to content

adriencyberspace/spotify-rolling-stone-500

Repository files navigation

CLI Rolling Stone Top 500 Albums Random Player

🤘 👹 🤘

This is a Command Line Interface tool to play a random album from Rolling Stone Magazine's The 500 Greatest Albums of All Time list and keep track of the albums you've already listened to. 🎵

NOTE: The Spotify app must be open AND playing for this to execute properly.

Install packages:

  1. Run npm i

Copy template files to local untracked files:

  1. Copy .env.local and rename to .env
  2. Copy rolling-stone-500-fresh.json and rename to rolling-stone-500.json (this is where your plays, likes, favorites while be saved)

Get your Spotify Credentials:

  1. Go to Spotify for Developers
  2. Create a Spotify Developer App
  3. Add a Redirect URI
    • Under Redirect URIs, add: http://127.0.0.1:8888/callback
  4. Authorize the App to Get a Code
    • Replace YOUR_CLIENT_ID in the following link and open in browser:
            https://accounts.spotify.com/authorize?client_id=YOUR_CLIENT_ID&response_type=code&redirect_uri=http://127.0.0.1:8888/callback&scope=user-read-playback-state%20user-modify-playback-state
    
  5. Run npx tsx setup/getRefreshToken.ts in your terminal and save the console logged output value in your terminal to .env SPOTIFY_REFRESH_TOKEN
    • NOTE: You only need to run this once

🪩 🪩 🪩 CONGRATS! Now you can run npm run shell to enter the interactive shell 🪩 🪩 🪩

Before you start, make sure: - You have the Spotify app open - You’re logged into Spotify - Your Spotify app is currently playing something, so an "active device" is available for playback

Then run:

npm run shell

Upon launch of the interactive command-line shell, a random album from Rolling Stone's Top 500 Greatest Albums of All Time will play. From there, you can run commands to like, score, add notes, tag, play next album, etc.

Available commands in the shell:

  • retry - ▶️ retries the current album (in case playback failed initially) (might not be working well yet)
  • next - ⏭️ loads a new random unplayed album, starts playback, and updates metadata
  • like - 💚 marks album liked: true
  • score [1–5] - ⭐ adds a rating out of 5 (i.e. 4.5)
  • note [your note] - 📝 adds a note to the album / appends note list
  • tag [tags...] - 🏷️ adds categories, comma-separated (e.g. tag dinner party, chores)
  • show - 📋 displays current album info, score, notes, and tags (from json file)
  • help - ℹ️ lists all available commands
  • exit - 🚪 saves and quits the shell

💾 💾 💾 What gets saved 💾 💾 💾

Each album is tracked in rolling-stone-500.json, with the following fields:

  • "played" - whether it’s been played (default false)
  • "liked" - whether you've liked the album (default false)
  • "score" - score (1–5) (keeping until I decide)
  • "notes" - your notes on the album (as many as you’d like, the list will be appended)
  • "tags" - categories / tags for a future feature where user can select random album from, say, "dinner party" or "chores"

Changes are automatically saved after every command

Upcoming issues:

  • Option to only play albums that are:
    • Liked
    • Selected by tag
  • Option to play any album, played or not
  • Option to Add to Liked Songs on currently playing song (Spotify API willing)
  • For albums that can't be found on Spotify with the passed in query:
    • Create an error log to store that info
    • Manually check if another search query will work for that album in Spotify
      • Use that query moving forward
      • Elegant user-friendly error-handling if not (i.e Update json if user listens another way after prompting)
  • User can run on different machines with the same saved data (easy way: remove user's json file from .gitignore so they can just pull down from and push to the same branch)
  • Option to add other collections
  • Option to queue next album before current album is over? (Spotify API willing)
  • Log history to textfile
  • Shell style updates with chalk and boxen

🤘 👹 🤘

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors