Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
.DS_Store
.env
likes*
8 changes: 8 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,14 @@ export SPOTIFY_SECRET=xxx

## Usage

### login

To login, add `"http://localhost:8080/callback"` to your spotify app redirect URLs

### Commands

List of available commands:

```
$ ./spotifycli --help
A command line interface to manage Spotify playlists.
Expand Down Expand Up @@ -47,6 +53,7 @@ Use "spotifycli [command] --help" for more information about a command.
```

### Search

Search using query terms on top of tracks (`tr`), albums (`al`), artists (`ar`) or playlists (`pl`) by name.

```
Expand All @@ -63,6 +70,7 @@ Flags:
```

Sample search for type `tr` (track).

```
./spotifycli search --t "tr" --q "one step closer - live"
```
9 changes: 7 additions & 2 deletions cmd/auth.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,12 @@ func authorize(cmd *cobra.Command, args []string) error {
http.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) {
log.Println("Got request for: ", r.URL.String())
})
go http.ListenAndServe(":8080", nil)
go func() {
err := http.ListenAndServe(":8080", nil)
if err != nil {
log.Fatal("ListenAndServe: ", err)
}
}()

// User authentication process
fmt.Println("authorize")
Expand All @@ -67,7 +72,7 @@ func (handler *authenticationHandler) ServeHTTP(w http.ResponseWriter, r *http.R
token, err := handler.auth.Token(handler.state, r)
if err != nil {
http.Error(w, "Couldn't get token", http.StatusForbidden)
log.Fatal(err)
log.Fatal("handler.auth.Token: ", err)
}
if st := r.FormValue("state"); st != handler.state {
http.NotFound(w, r)
Expand Down
Loading