A command line application, written in Python, for interacting with Spotify.

Overview

spotify-py-cli

A command line application, written in Python, for interacting with Spotify.

The primary purpose behind developing this app was to gain experience in using Test Driven Development, and to familiarize myself with the spotify API.

NOTE: This app is still a work in progress and as such, some of the info in this doc may be subject to change.

How To Use

First, follow the steps in Setup.

Once you have an executable, or you've downloaded the source, and have a terminal open, run it! With Python:

python spotify-cli.py

Using exe with Windows:

.\spotify-cli

Linux:

./spotify-cli

Running it without any arguments will in typical command line fashion show usage help. Run any command without args to get specfic help for any given command.

Supported Functionality

Currently with this cli you can do the following:

  • Create new playlists
    • You can set the name, description, public status, and collaborative status
  • Edit any existing playlists you own, or are a collaborator on
  • Add and remove items from your user library
    • This includes followable items like artists and playlists, as well as savable items like albums, tracks, episodes and shows
    • Currently following, unfollowing, saving, and unsaving are all seperate commands
  • Show (list) items currently in your user library
    • Supports all followable/savable items

Future Functionality

Here are features that I want to add in the very close, to near future:

The biggest one in mind is playback support. I may add other smaller things, but this is the primary thing I don't have yet that I want to add. Here's a more detailed list of what I'm looking to add:

  • Playback support

    • Be able to play and pause playback of the current track
    • 'play' command will also accept a track id so you can start playback of a new track
    • Be able skip to next track
    • Be able to toggle shuffle on and off
    • Seek position in a track
    • Set volume
    • Add an item to the playback queue (passing multiple track ids to 'play' will also do this)
  • Easy-to-parse output

    • Any command that returns output, will have an option to make the output easy to parse (vs being nice to look at for a human). The idea being, if you want to pipe output from one command invocation, into another invocation, you can.
    • An example I'd like to be able to support, get a list of track ids from search command, and then pipe those into the playback command.

Design

This a very brief overview of my program design, bug me if you want me to expand this. I'll probably expand it at some point in the future.

Broadly speaking, the cli spotify-cli.py depends only on one thing, a facade. The facade spotipy_facade.py is a wrapper I wrote around spotipy which is itself a wrapper written around the Spotify API. See Figure 1.1 for a visual layout of the modules.

I wrote the facade to further simplify interaction (and seperate my cli app from) the wrapper.

The facade itself is comprised of three modules: spotify_facade.py, the main file, items.py, and user_library.py.

items.py, and user_library.py both contain item types which the facade works with, and returns to the cli based on what commands are being run. The types in those two files are the basis for all interaction with the api.

The types defined in items.py, and user_library.py implement interfaces as defined in interfaces.py.

Figure 1.1 fig1.1

Setup

First, you must get authorization.

For simplicity, and because Spotipy doesn't support Implicit Grant authorization, to use this cli, you must register an app using the Spotify Developer Dashboard so that the app can use Authorization Code flow:

  1. Log in
  2. Click the CREATE AN APP button in the top right corner
  3. Once you have created your app, on the app overview page, click EDIT SETTINGS
  4. Set the Redirect URI to http://localhost:8080 (You can change this to something else like: http://example.com, or http://127.0.0.1:9090, but it has to be the same in the app settings page and in the .env file)
  5. Note that the Client ID and Client Secret are also on the app overview page; these will be used later

Next, you have two options: Use a standalone release, or use Python.

Using a Standalone Release: COMING SOON

Note: I haven't made any standalone releases yet. If you really want one, open an issue to bug me about it.

Or, you can use pyinstaller to build a standalone app yourself; it's what I'll be doing when I get around to it.

If you don't want to install Python onto your system, you can download an existing standalone build of the app from the releases page.

  1. Download the latest release from the releases page
  2. See step 3 of Using Python

Using Python

  1. Clone the repo
  2. Install Python 3.8 or greater
    • Note: This app was built using Python 3.8 and 3.96, but it may work with older versions; I have not tested anything older than 3.8 so I can't make any guarentees for anything older than that.
  3. Create a credentials file
    1. Retrieve your Client ID and Client Secret from the app overview page
    2. Create .env file and place it into the same directory as the source code (or exe if using a standalone release)
    3. Place the following text into the .env file:
      SPOTIPY_CLIENT_ID=Your_Spotify_Client_ID
      SPOTIPY_CLIENT_SECRET=Your_Spotify_Client_Secret
      SPOTIPY_REDIRECT_URI=http://localhost:8080
      
  4. If Python is in the path, then navigate to the directory the app is in and run the app with:

    py spotify-cli.py

Credits

This project uses Spotipy for interacting with the Spotify API, and Typer for managing the CLI bits.

Owner
Drew Loukusa
UW-Bothell Alum with a bachelor's degree in Applied Computing (Computer Science Major + Math Minor).
Drew Loukusa
A simple Python CLI tool that draws routes/paths on a given map.

Map Router A simple Python CLI tool that draws routes/paths on a given map. Index Installation Usage Docs Why? License Support Installation Coming soo

Pedro Morim 1 Nov 07, 2021
Custom function scheduler TUI (text-based user interface) in the console

Custom function scheduler TUI (text-based user interface) in the console

Luke 1 Oct 26, 2022
A command-line based, minimal torrent streaming client made using Python and Webtorrent-cli.

ABOUT A command-line based, minimal torrent streaming client made using Python and Webtorrent-cli. Installation pip install -r requirements.txt It use

Janardon Hazarika 17 Dec 11, 2022
The Prisma Cloud CLI is a command line interface for Prisma Cloud by Palo Alto Networks.

Prisma Cloud CLI The Prisma Cloud CLI is a command line interface for Prisma Cloud by Palo Alto Networks. Support This project has been developed by P

Palo Alto Networks 13 Oct 14, 2022
A python Ethereum utilities command-line tool.

peth-cli A python Ethereum utilities command-line tool. After wasting the all day trying to install seth and failed, I took another day to write this.

Moon 55 Nov 15, 2022
CLI tool for typescript tasks & migrations

typed CLI tool for typescript tasks & migrations Installation Usage $ typed --list Subcommands: bootstrap 🔨 Bootstrap your environment for TypeS

Lob 1 Nov 15, 2021
A CLI Password Manager made using Python and Postgresql database.

ManageMyPasswords (CLI Edition) A CLI Password Manager made using Python and Postgresql database. Quick Start Guide First Clone The Project git clone

Imira Randeniya 1 Sep 11, 2022
flora-dev-cli (fd-cli) is command line interface software to interact with flora blockchain.

Install git clone https://github.com/Flora-Network/fd-cli.git cd fd-cli python3 -m venv venv source venv/bin/activate pip install -e . --extra-index-u

14 Sep 11, 2022
Custom 64 bit shellcode encoder that evades detection and removes some common badchars (\x00\x0a\x0d\x20)

x64-shellcode-encoder Custom 64 bit shellcode encoder that evades detection and removes some common badchars (\x00\x0a\x0d\x20) Usage Using a generato

Cole Houston 2 Jan 26, 2022
Commandline Python app to Autodownload mediafire folders and files.

Commandline Python app to Autodownload mediafire folders and files.

Tharuk Renuja 3 May 12, 2022
jenkins-tui is a terminal based user interface for Jenkins.

jenkins-tui 📦 jenkins-tui is a terminal based user interface for Jenkins. 🚧 ⚠️ This app is a prototype and in very early stages of development. Ther

Craig Gumbley 22 Oct 24, 2022
commandline version of wordle game and my auto solver.

Wordle Machine (and Wordle Game) (in commandline) My implementation of the Wordle game (inspired by https://www.powerlanguage.co.uk/wordle/) and my in

Kevin Xu 11 Jan 03, 2023
A Hikari command handler for people who love ducks.

A Hikari command handler for people who love ducks.

Jeremiah 2 Oct 09, 2022
Interactive Python interpreter for executing commands within Node.js

Python Interactive Interactive Python interpreter for executing commands within Node.js. This module provides a means of using the Python interactive

Louis Lefevre 2 Sep 21, 2022
CLI tool to fix linked references for dates.

Fix Logseq dates This is a CLI tool to fix the date references following a change in date format since the current version (0.4.4) of Logseq does not

Isaac Dadzie 5 May 18, 2022
A powerful, colorful, beautiful command-line-interface for pypi.org

pypi-command-line pypi-command-line is a colorful, powerful, and beautiful command line interface for pypi.org that is actively maintained Detailed Do

Wasi Master 32 Jun 23, 2022
CLI helper to install Github releases on your system.

gh-release-install is a CLI helper to install Github releases on your system. It can be used for pretty much anything, to install a formatter in your CI, deploy some binary using an orcherstration to

Jonas L. 28 Nov 06, 2022
Todo - You could use terminal to set your todo

Python Tutorial You can learn how to build a terminal application(CLI applicatio

29 Jun 29, 2022
dotfilery, configuration, environment settings, automation, etc.

┌┬┐┌─┐┌─┐┌─┐┬ ┬┌┬┐┬ ┬┬┌─┐ │││├┤ │ ┬├─┤│ │ │ ├─┤││ :: bits & bobs, dots & things. ┴ ┴└─┘└─┘┴ ┴┴─┘┴ ┴ ┴ ┴┴└─┘ @megalithic 🚀 Instal

Seth Messer 89 Dec 25, 2022
Analyzing the most strategic words to guess on Wordle, based on letter frequency distributions

wordle-analysis Evaluating different heuristics to determine the most effective solving strategy and building an AI-powered assistant tool to help you

Sejal Dua 9 Feb 27, 2022