Skip to main content

An awesome and easy-to-use CLI for various Spotify® utility tasks

Project description

GitHub Release GitHub Issues GitHub Pull Requests License

PyPI Version Python Versions

Quality Gate Status Security Rating Reliability Rating Maintainability Rating Vulnerabilities Technical Debt


Logo

spotify-utils

An awesome and easy-to-use CLI for various Spotify® utility tasks!
Report Bug · Request Feature

Table of Contents
  1. About The Project
  2. Getting Started
  3. Usage and examples
  4. Contributing
  5. License
  6. Acknowledgments
  7. Disclaimer

About The Project

There are many Spotify® clients out there; however, I didn't find one that really suited my needs, so I created this one. I want to create a Spotify® CLI which is easy-to-use, packed with useful functionalities and with a sophisticated documentation built-in.

Key features:

  • Interactive TUI — a terminal user interface with tabs for browsing, exporting, and scanning duplicates
  • Playlists
    • List information about playlists of the authenticated user in various output formats (Console, JSON)
    • Export playlist information in various formats (JSON, HTML)
    • Find duplicate tracks across all playlists

Of course, this CLI will not serve all needs, especially during development. I'll be adding more features in the near future. You may also suggest changes by forking this repo and creating a pull request or opening an issue.

(back to top)

Getting Started

Prerequisites

  • Python 3.10+

Installation

pip install spotify-utils

Configuration

All methods require user authorization. You will need to register your app at Spotify Developer Dashboard to get the credentials necessary to make authorized calls. Click here to go to the step-by-step guide for creating a Spotify® application.

The CLI uses the Authorization Code Flow, which the user logs into once. It provides an access token that can be refreshed.

Environment variables are being used for configuration. In order for the CLI to function properly you need to provide the following environment variables (use export instead of SET on Linux):

set SPOTIFY_UTILS_CLIENT_ID='your-spotify-client-id'
set SPOTIFY_UTILS_CLIENT_SECRET='your-spotify-client-secret'
set SPOTIFY_UTILS_REDIRECT_URI='your-app-redirect-url'

In addition, the use of an .env file is supported:

SPOTIFY_UTILS_CLIENT_ID='your-spotify-client-id'
SPOTIFY_UTILS_CLIENT_SECRET='your-spotify-client-secret'
SPOTIFY_UTILS_REDIRECT_URI='your-app-redirect-url'

(back to top)

Usage and examples

In this section you can find usage examples of the CLI

Launch the interactive TUI

spotify-utils tui

The TUI provides three tabs:

  • Playlists — browse all your playlists in a table; click a row to view its tracks
  • Duplicates — scan your owned playlists and list any duplicate tracks
  • Export — select a playlist (or all), choose JSON or HTML, and pick an output directory

Key bindings: Ctrl+L Playlists · Ctrl+D Duplicates · Ctrl+E Export · Ctrl+Q Quit

List all playlists of the current user in JSON format

spotify-utils playlists list --format json
[
  {
    "collaborative": false,
    "description": "Car Music Mix 2022 \ud83d\udd25 Best Remixes of Popular Songs 2022 EDM, Bass Boosted  by Rise Music",
    "external_urls": {
      "spotify": "https://open.spotify.com/playlist/0fM4AkfoGygOHVXjsNB7io"
    }
  }
]

Find duplicates across all playlists and display additional details:

spotify-utils playlists duplicates --verbose

Found 43 duplicate tracks across 20 playlists

Index Name Artists Playlists Track ID
0 Piercing Light League of Legends, Mako Rock, Sonos Mainstream 0163ud7I4Vb0ID5K7WBkq9
1 Edge Of The Earth Thirty Seconds To Mars Rock, Pop 0g9IOJwdElaCZEvcqGRP4b
... ... ... ... ...

Export playlists as HTML

spotify-utils playlists export --format html

HTML export

Export specific playlist as JSON

spotify-utils playlists export --format json --id {PLAYLIST_ID}

(back to top)

Contributing

Contributions are what make the open source community such an amazing place to learn, inspire, and create. Any contributions you make are greatly appreciated.

If you have a suggestion that would make this better, please fork the repo and create a pull request. You can also simply open an issue with the tag "enhancement". Don't forget to give the project a star! Thanks again!

  1. Fork the Project
  2. Create your Feature Branch (git checkout -b feature/AmazingFeature)
  3. Commit your Changes (git commit -m 'Add some AmazingFeature')
  4. Push to the Branch (git push origin feature/AmazingFeature)
  5. Open a Pull Request

(back to top)

License

Distributed under the Apache License 2.0. See LICENSE for more information.

(back to top)

Acknowledgments

(back to top)

Disclaimer

This project isn’t endorsed by Spotify AB and doesn’t reflect the views or opinions of Spotify AB or anyone officially involved in producing or managing Spotify®

(back to top)

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

spotify_utils-2.1.0.tar.gz (20.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

spotify_utils-2.1.0-py3-none-any.whl (22.2 kB view details)

Uploaded Python 3

File details

Details for the file spotify_utils-2.1.0.tar.gz.

File metadata

  • Download URL: spotify_utils-2.1.0.tar.gz
  • Upload date:
  • Size: 20.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.13

File hashes

Hashes for spotify_utils-2.1.0.tar.gz
Algorithm Hash digest
SHA256 bbcac67a4c6f4b24232112b8f06e9befb316d7e35ea34278f696e450e070a3df
MD5 7d8a031ece3ef735419ca6f1f4524785
BLAKE2b-256 825d03b6fab9848128fad5bb41320f3c59843a28cc36e7da6b00113b14cb76b5

See more details on using hashes here.

Provenance

The following attestation bundles were made for spotify_utils-2.1.0.tar.gz:

Publisher: build.yml on fabieu/spotify-utils

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file spotify_utils-2.1.0-py3-none-any.whl.

File metadata

  • Download URL: spotify_utils-2.1.0-py3-none-any.whl
  • Upload date:
  • Size: 22.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.13

File hashes

Hashes for spotify_utils-2.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 25d2f05edf5da54dd8862b7043db7974e99067884e382e29f288c2841f8699b5
MD5 b871433acb4a0c8db380963bd9ceb369
BLAKE2b-256 c27a2ee0301b31846b01e501b01fe5f519ed6b720de6eaf457595c08a11123ce

See more details on using hashes here.

Provenance

The following attestation bundles were made for spotify_utils-2.1.0-py3-none-any.whl:

Publisher: build.yml on fabieu/spotify-utils

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page