Git Product home page Git Product logo

spotify-cmd's Introduction

๐Ÿ“ป spotify-cmd v0.1.4

spotify-cmd is a Spotify client that allows controlling the playback of albums and playlists from a user's library (based on names or Spotify URIs) and individual tracks (based solely on Spotify URIs). The application is intended for use with spotifyd, but it works with any Spotify-enabled device.

Installation

Ensure you have Python 3 installed. Package is available on PyPi: https://pypi.org/project/spotify-cmd/. Install it using pip3:

pip3 install spotify-cmd

Configuration

The application configuration should be located in ~/.config/spotify-cmd/config.ini. Below is a detailed guide on each configuration option:

[SPOTIFY]
client_id = your_client_id
client_secret = your_client_secret
device_name = your_device_name
redirect_uri = http://localhost:8888/callback

[SPOTIFY_CMD_DAEMON]
socket_path = /tmp/spotify-cmd-daemon.sock
socket_buffer_size = 1024
  • client_id, client_secret are required. Obtain these by creating an app at the Spotify Developer Dashboard.
  • device_name is required. spotify-cmd-daemon will force to use it even if other is currently active.
  • redirect_uri is used for Spotify authentication. If not set, it defaults to 'http://localhost:8888/callback'.
  • socket_path specifies the Unix socket path for the daemon. Defaults to '/tmp/spotify-cmd-daemon.sock'.
  • socket_buffer_size defines the buffer size for socket communication. Defaults to 1024.

Commands

spotify-cmd offers the following commands:

  • get playlists: Lists the user's playlists.
  • get albums: Lists the user's albums.
  • play playlist <name>, play album <name>, play uri <spotify_uri>: Plays a specific playlist, album, or resource by Spotify URI.
  • play, pause, next, previous: Controls playback.
  • set shuffle <on|off>: Toggles shuffle mode.
  • set volume <0-100>: Sets the volume level.
  • find <search_type> <query>: Searches for items on Spotify. Acceptable search types are album, artist, playlist, track, episode, and show.

Output Format

Select output format using the --format flag:

  • --format text: Plain text output (default).
  • --format json: Output in JSON format.
  • --format verbose: Verbose text information.

Usage Examples

spotify-cmd get albums
spotify-cmd get playlists
spotify-cmd play album "Listening Tree"
spotify-cmd play playlist "Discover Weekly"
spotify-cmd play uri spotify:album:5zKTfU3vyuZfLgtYRfJyza
spotify-cmd find artist "Nils Frahm"

For Developers

Developers can create interfaces for spotify-cmd-daemon using /tmp/spotify-cmd-daemon.sock. Socket handling and data format details are in the ./src/common directory (there is no documentation).

Planned Features and Upcoming Development

  • Displaying tracks from specific albums or playlists.
  • MPRIS D-Bus interface support to reduce server queries.
  • spotify-cmd-ui: A ncurses-based UI for track display and control, working with the same daemon.
  • Search functionality. [Done in 0.1.4]
  • Support for other resource types like artists.
  • Config instructions after installation / creation of default config.

License

This project is licensed under the terms of the GNU General Public License. Detailed information can be found in the LICENSE.md file.

Author

Project created by Maciej Ciemborowicz.

spotify-cmd's People

Contributors

ciembor avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar  avatar

spotify-cmd's Issues

basic usage

Hey, first of all - sorry for opening such a stupid issue.

I have a problem understanding how I am supposed to use this. I have spotifyd installed on my RPi 0 W and it works flawlessly. I've then installed this tool through pip (tried with and without root), created the config file with all the credentials:

  • client_id and secret is pretty straightforward,
  • then the device_name, I suppose it's the one I set in spotifyd, but I'm not sure,
  • redirect_uri, left as it is,
  • and the real problem - socket_path. I initially left it as it was by default, but when I tried issuing any command to the spotify-cmd it just errored out. The error was that it couldn't find the .sock file, so I created a dummy file in /tmp named exactly as it is in the default config. After that I was met with another error, but different this time, it just was a connection error with the daemon.

What am I doing wrong here? I feel like I missed an important step, but I really can't figure it out. I suppose the tool should have a daemon itself, but I'm not really sure. Any help would be appreciated and of course I can supply logs if it's needed.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.