Skip to content

Commit

Permalink
rename
Browse files Browse the repository at this point in the history
  • Loading branch information
szktkfm committed Jan 16, 2024
1 parent 4b38396 commit b29c8a4
Show file tree
Hide file tree
Showing 17 changed files with 38 additions and 33 deletions.
3 changes: 2 additions & 1 deletion .goreleaser.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,8 @@ builds:
- linux
- windows
- darwin
main: ./cmd/spotui/
main: ./cmd/sptui/
binary: sptui

archives:
- format: tar.gz
Expand Down
6 changes: 3 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@ all: build

.PHONY: build
build:
go build -o test ./cmd/spotui
go build -o test ./cmd/sptui

install:
go install ./cmd/spotui
go install ./cmd/sptui

.PHONY: test
test:
Expand All @@ -15,4 +15,4 @@ test:
.PHONY: clean
clean:
rm -f test
rm ~/.config/spotui/spotify_token.json
rm ~/.config/sptui/spotify_token.json
24 changes: 12 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,49 +1,49 @@
# spotui
[![Go Report Card](https://goreportcard.com/badge/github.com/szktkfm/spotui)](https://goreportcard.com/report/github.com/szktkfm/spotui)
# sptui
[![Go Report Card](https://goreportcard.com/badge/github.com/szktkfm/sptui)](https://goreportcard.com/report/github.com/szktkfm/sptui)

<img src="assets/demo.gif" width="500">

## Overview
spotui is a Spotify TUI player, written in Go and leveraging the [charmbracelet/bubbletea](https://github.com/charmbracelet/bubbletea) library.
sptui is a Spotify TUI player, written in Go and leveraging the [charmbracelet/bubbletea](https://github.com/charmbracelet/bubbletea) library.

## Installation
Visit the [GitHub Releases](https://github.com/szktkfm/spotui/releases) page for spotui and download the appropriate binary for your operating system.
Visit the [GitHub Releases](https://github.com/szktkfm/sptui/releases) page for sptui and download the appropriate binary for your operating system.

Or, just install it with `go`:
```bash
go install github.com/szktkfm/spotui@latest
go install github.com/szktkfm/sptui@latest
```

## Usage
### Connecting to Spotify’s API
To use spotui, you need to connect it to Spotify's API. Follow these steps:
To use sptui, you need to connect it to Spotify's API. Follow these steps:

1. [Go to the Spotify Dashboard](https://developer.spotify.com/dashboard).
2. Create a new app to obtain your Client ID and Client Secret.
3. In `Edit Settings`, add `http://localhost:21112/callback` to the `Redirect URIs`. Don’t forget to save your changes.
4. Set your Client ID as an environment variable `SPOTIFY_ID`.
5. Run spotui. You will see an official Spotify URL for authentication.
5. Run sptui. You will see an official Spotify URL for authentication.

```bash
# Replace your_client_id with the actual Client ID you obtained from Spotify.
SPOTIFY_ID=your_client_id spotui
SPOTIFY_ID=your_client_id sptui
```
6. Open the provided URL in a web browser and log in to your Spotify account to grant the necessary permissions.
After granting permission, you might be redirected to a blank page. This is normal and indicates that the authentication process is complete.

Once authenticated, you are ready to use spotui!
Once authenticated, you are ready to use sptui!

### API Token Storage
Once authenticated, your Spotify API token will be stored at `${HOME}/.config/spotui/spotify_token.json`. Ensure this file is kept secure as it contains sensitive information.
Once authenticated, your Spotify API token will be stored at `${HOME}/.config/sptui/spotify_token.json`. Ensure this file is kept secure as it contains sensitive information.

### Key Bindings
Here are the key bindings for spotui:
Here are the key bindings for sptui:

| Key | Action |
|-----------|----------------------------------|
| `h` `j` `k` `l` | Navigate (left, down, up, right) |
| `esc` | Return to the previous screen |
| `q` | Quit spotui |
| `q` | Quit sptui |
| `:play` | Play current selection |
| `:pause` | Pause playback |
| `:next` | Next track |
Expand Down
2 changes: 1 addition & 1 deletion animtext.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package spotui
package sptui

import (
"strings"
Expand Down
Binary file modified assets/demo.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
10 changes: 7 additions & 3 deletions assets/spotui.tape → assets/sptui.tape
Original file line number Diff line number Diff line change
Expand Up @@ -6,18 +6,22 @@ Set TypingSpeed 200ms

Set Shell zsh
Sleep 1.5s
Type "spotui"
Type "sptui"
Enter
Sleep 1.5s
Type "ljjjjjjjjjjjjjjjjjjjjjjjjhjjjjjjk"
Type "ljjjjjjjjjjjjjjjjjjjjjjjj"
Sleep 0.5s
Type "h"
Sleep 0.5s
Type "jjjjjjk"
Enter
Type "jjjjjjjjjkk"
Sleep 500ms
Enter
Sleep 7.0s
Type ":next"
Enter
Sleep 15.0s
Sleep 7.0s
Type "q"
Sleep 1s

4 changes: 2 additions & 2 deletions auth.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package spotui
package sptui

import (
"context"
Expand Down Expand Up @@ -38,7 +38,7 @@ var (
spotifyauth.ScopeUserReadCurrentlyPlaying,
))
tokenCh = make(chan *oauth2.Token)
tokenFilePath = ".config/spotui/spotify_token.json"
tokenFilePath = ".config/sptui/spotify_token.json"
)

func generateCodeVerifier() (string, error) {
Expand Down
2 changes: 1 addition & 1 deletion bar.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package spotui
package sptui

import (
"strings"
Expand Down
4 changes: 2 additions & 2 deletions cmd/spotui/main.go → cmd/sptui/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@ import (
"os"

tea "github.com/charmbracelet/bubbletea"
"github.com/szktkfm/spotui"
"github.com/szktkfm/sptui"
)

func main() {
m := spotui.NewTabModel()
m := sptui.NewTabModel()
if _, err := tea.NewProgram(m, tea.WithoutSignalHandler()).Run(); err != nil {
fmt.Println("Error running program:", err)
os.Exit(1)
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
module github.com/szktkfm/spotui
module github.com/szktkfm/sptui

go 1.19

Expand Down
2 changes: 1 addition & 1 deletion help.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package spotui
package sptui

import (
"github.com/charmbracelet/bubbles/help"
Expand Down
2 changes: 1 addition & 1 deletion list.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package spotui
package sptui

import (
"fmt"
Expand Down
2 changes: 1 addition & 1 deletion spotify.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package spotui
package sptui

import (
"context"
Expand Down
2 changes: 1 addition & 1 deletion style.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package spotui
package sptui

import (
"github.com/charmbracelet/bubbles/list"
Expand Down
2 changes: 1 addition & 1 deletion tab.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package spotui
package sptui

import (
"fmt"
Expand Down
2 changes: 1 addition & 1 deletion textinput.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package spotui
package sptui

import (
"fmt"
Expand Down
2 changes: 1 addition & 1 deletion util.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package spotui
package sptui

import (
"fmt"
Expand Down

0 comments on commit b29c8a4

Please sign in to comment.