2023-04-16 05:58:51 +05:30
2023-04-16 05:58:51 +05:30
2023-04-15 08:08:02 +05:30
2023-04-16 05:20:18 +05:30
2023-04-16 05:58:51 +05:30
2023-04-13 07:47:54 +05:30
2023-04-16 05:58:51 +05:30
2023-04-16 05:58:51 +05:30
2023-01-21 00:13:49 +05:30
2023-04-15 09:01:21 +05:30

gspt


mascot
Spotify for terminal written in Go.
with builtin cover-art view and much more.
Discussion


In a very experimental stage.

Building

$ git clone https://github.com/aditya-K2/gspt.git
$ cd gspt
$ go build -v

Installing

$ sudo install -D gspt -t "/usr/bin/"

You can merge them into a one liner

git clone https://github.com/aditya-K2/gspt && cd gspt && GOFLAGS="-buildmode=pie -trimpath -mod=readonly -modcacherw" go build -v && sudo install -D gspt -t "/usr/bin/"

Please Note

  • You will need Spotify Premium to use gspt.
  • gspt uses the Web API from Spotify, which doesn't handle streaming itself. So you'll need either an official Spotify client open or a lighter weight alternative such as spotifyd.
  • Images are rendered using the Xorg child windows. Currently there is no support for Wayland.
  • Some Terminals even in Xorg don't seem to support Image rendering.
    • Following terminals have been tested with:
      • Alacritty
      • ST
      • Urxvt

Setup

How to Generate an API Key from Spotify Dashboard

If you want to use Spotify's API to create applications that interact with their music streaming service, you will need an API key. Here's how you can generate one from the Spotify Dashboard:

  1. Go to the Spotify Developer Dashboard and log in with your Spotify account credentials.

  2. Click on the "Create an App" button to create a new application.

    Create an App

  3. Give your application a name and description, and agree to the terms of service. In the Redirect URI section add http://localhost:8080/callback as a callback URL. This is necessary for the OAuth 2.0 authentication flow to work. Click on "Create" to proceed. Create an App Form

  4. On the next page, you'll see the details of your newly created application. In the Settings Look for the section labeled "Client ID" and click on the "Show Client Secret" button.

  5. You will now see your Client ID and Client Secret. You will need both of these to use the Spotify API in gspt

$ export SPOTIFY_ID= # client id
$ export SPOTIFY_SECRET= # client secret
  1. After this you can just run gspt. And follow the link that it generates, and Login.
$ gspt

Key bindings

  1. d Opens the device menu to choose a device from
  2. 1, 2, 3 Switch between the views
  3. Enter - Selects an entry
  4. ? Search
  5. v Toggle Visual Mode (Only works in some views)
  6. a Add to Playlist (Only works in some views)
  7. Ctrl-P starts playing the entry under the cursor in some views (PlaylistNavigator, Albums, etc.)

Config Options

Config file can be defined at $HOME/.config/gspt/config.yaml

Note: Configuration is live updated when you make a change

Following Options are configurable

# Following are the default values
cache_dir: $XDG_CACHE_HOME # Path to where the cached images should be stored.
redraw_interval: 500
additional_padding_x : 12
additional_padding_y : 16
image_width_extra_x : -1.5
image_width_extra_y : -3.75
colors:
    artist:
        fg: pink
        bg: ""
        bold: false
        italic: false
    album:
        fg: green
        bg: ""
        bold: false
        italic: false
    track:
        fg: blue
        bg: ""
        bold: false
        italic: false
    genre:
        fg: darkCyan
        bg: ""
        bold: true
        italic: false
    timestamp:
        fg: red
        bg: ""
        bold: false
        italic: true
    pbar_artist:
        fg: blue
        bg: ""
        bold: true
        italic: false
    pbar_track:
        fg: green
        bg: ""
        bold: true
        italic: true
    playlist_nav:
        fg: coral
        bg: ""
        bold: false
        italic: false
    nav:
        fg: papayawhip
        bg: ""
        bold: false
        italic: false
    context_menu:
        fg: turquoise
        bg: ""
        bold: true
        italic: false

Key Mappings


# Key mappings has the following API

# mappings:
#     view:
#     function: mapping

# for e.g

mappings:
    recently_played_view:
        open_entry: "ctrl-p"

# Following Views and Functions are currently available
# To see available keys please see: https://github.com/aditya-K2/gspt/blob/master/config/key.go#L13
mappings:
    album_view:
        open_entry
    albums_view:
        open_entry
        play_entry
    artist_view:
        open_entry
        play_entry
    artists_view:
        open_entry
    liked_songs_view:
        open_entry
    playlist_nav:
        open_entry
        play_entry
    playlist_view:
        open_entry
    recently_played_view:
        open_entry
    top_tracks_view:
        open_entry
        play_entry
    # These mappings are available in every view.
    global:
        focus_search
        focus_main_view
        focus_playlists
        focus_nav
        choose_device

Roadmap

  • Multiple Image rendering backends
    • Sixel
    • tview Images
    • Kitty Images
  • Rounded Corners
  • Customisable UI
  • Wayland Support for Image rendering
  • Queue Support
  • Key Mappings
Description
No description provided
Readme GPL-3.0 2.5 MiB
Languages
Go 98.9%
Makefile 1.1%