remove debug prints. do logging later
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful

This commit is contained in:
abs3nt 2023-01-31 21:37:10 -08:00
parent 148b93f0f8
commit 5804607c42
3 changed files with 2 additions and 25 deletions

View File

@ -27,7 +27,6 @@ func SetVolume(ctx *gctx.Context, client *spotify.Client, vol int) error {
func SetPosition(ctx *gctx.Context, client *spotify.Client, pos int) error { func SetPosition(ctx *gctx.Context, client *spotify.Client, pos int) error {
err := client.Seek(ctx, pos) err := client.Seek(ctx, pos)
if err != nil { if err != nil {
fmt.Println(err.Error())
return err return err
} }
return nil return nil
@ -244,17 +243,14 @@ func PlaySongInPlaylist(ctx *gctx.Context, client *spotify.Client, context *spot
func PlayLikedSongs(ctx *gctx.Context, client *spotify.Client, position int) error { func PlayLikedSongs(ctx *gctx.Context, client *spotify.Client, position int) error {
err := ClearRadio(ctx, client) err := ClearRadio(ctx, client)
if err != nil { if err != nil {
fmt.Println(err.Error())
return err return err
} }
playlist, _, err := GetRadioPlaylist(ctx, client, "Saved Songs") playlist, _, err := GetRadioPlaylist(ctx, client, "Saved Songs")
if err != nil { if err != nil {
fmt.Println(err.Error())
return err return err
} }
songs, err := client.CurrentUsersTracks(ctx, spotify.Limit(50), spotify.Offset(position)) songs, err := client.CurrentUsersTracks(ctx, spotify.Limit(50), spotify.Offset(position))
if err != nil { if err != nil {
fmt.Println(err.Error())
return err return err
} }
to_add := []spotify.ID{} to_add := []spotify.ID{}
@ -263,7 +259,6 @@ func PlayLikedSongs(ctx *gctx.Context, client *spotify.Client, position int) err
} }
_, err = client.AddTracksToPlaylist(ctx, playlist.ID, to_add...) _, err = client.AddTracksToPlaylist(ctx, playlist.ID, to_add...)
if err != nil { if err != nil {
fmt.Println(err.Error())
return err return err
} }
err = client.PlayOpt(ctx, &spotify.PlayOptions{ err = client.PlayOpt(ctx, &spotify.PlayOptions{
@ -366,7 +361,6 @@ func RadioGivenArtist(ctx *gctx.Context, client *spotify.Client, artist spotify.
for _, song := range additional_recs.Tracks { for _, song := range additional_recs.Tracks {
exists, err := SongExists(db, song.ID) exists, err := SongExists(db, song.ID)
if err != nil { if err != nil {
fmt.Println(err.Error())
return err return err
} }
if !exists { if !exists {
@ -475,7 +469,6 @@ func RadioGivenSong(ctx *gctx.Context, client *spotify.Client, song spotify.Simp
for _, song := range additional_recs.Tracks { for _, song := range additional_recs.Tracks {
exists, err := SongExists(db, song.ID) exists, err := SongExists(db, song.ID)
if err != nil { if err != nil {
fmt.Println(err.Error())
return err return err
} }
if !exists { if !exists {
@ -554,11 +547,9 @@ func RefillRadio(ctx *gctx.Context, client *spotify.Client) error {
to_remove := []spotify.ID{} to_remove := []spotify.ID{}
radioPlaylist, db, err := GetRadioPlaylist(ctx, client, "") radioPlaylist, db, err := GetRadioPlaylist(ctx, client, "")
if err != nil { if err != nil {
fmt.Println("ERROR AHHH", err.Error())
} }
if status.PlaybackContext.URI != radioPlaylist.URI { if status.PlaybackContext.URI != radioPlaylist.URI {
fmt.Println(status.PlaybackContext.URI, radioPlaylist.URI)
return nil return nil
} }
@ -592,7 +583,6 @@ func RefillRadio(ctx *gctx.Context, client *spotify.Client) error {
} }
trackGroups = append(trackGroups, item) trackGroups = append(trackGroups, item)
if err != nil { if err != nil {
fmt.Println(err.Error())
return err return err
} }
} }
@ -697,7 +687,6 @@ func RefillRadio(ctx *gctx.Context, client *spotify.Client) error {
func ClearRadio(ctx *gctx.Context, client *spotify.Client) error { func ClearRadio(ctx *gctx.Context, client *spotify.Client) error {
radioPlaylist, db, err := GetRadioPlaylist(ctx, client, "") radioPlaylist, db, err := GetRadioPlaylist(ctx, client, "")
if err != nil { if err != nil {
fmt.Println(err)
return err return err
} }
err = client.UnfollowPlaylist(ctx, radioPlaylist.ID) err = client.UnfollowPlaylist(ctx, radioPlaylist.ID)
@ -1158,7 +1147,6 @@ func RadioGivenList(ctx *gctx.Context, client *spotify.Client, song_ids []spotif
for _, song := range additional_recs.Tracks { for _, song := range additional_recs.Tracks {
exists, err := SongExists(db, song.ID) exists, err := SongExists(db, song.ID)
if err != nil { if err != nil {
fmt.Println(err.Error())
return err return err
} }
if !exists { if !exists {

View File

@ -1,8 +1,6 @@
package tui package tui
import ( import (
"fmt"
"gospt/src/commands" "gospt/src/commands"
"gospt/src/gctx" "gospt/src/gctx"
@ -73,7 +71,6 @@ func HandlePlaylistRadio(ctx *gctx.Context, client *spotify.Client, playlist spo
func HandleLibraryRadio(ctx *gctx.Context, client *spotify.Client) { func HandleLibraryRadio(ctx *gctx.Context, client *spotify.Client) {
err := commands.RadioFromSavedTracks(ctx, client) err := commands.RadioFromSavedTracks(ctx, client)
if err != nil { if err != nil {
fmt.Println(err.Error())
return return
} }
} }
@ -81,7 +78,6 @@ func HandleLibraryRadio(ctx *gctx.Context, client *spotify.Client) {
func HandlePlayLikedSong(ctx *gctx.Context, client *spotify.Client, position int) { func HandlePlayLikedSong(ctx *gctx.Context, client *spotify.Client, position int) {
err := commands.PlayLikedSongs(ctx, client, position) err := commands.PlayLikedSongs(ctx, client, position)
if err != nil { if err != nil {
fmt.Println(err.Error())
return return
} }
} }
@ -89,12 +85,10 @@ func HandlePlayLikedSong(ctx *gctx.Context, client *spotify.Client, position int
func HandlePlayTrack(ctx *gctx.Context, client *spotify.Client, track spotify.ID) { func HandlePlayTrack(ctx *gctx.Context, client *spotify.Client, track spotify.ID) {
err := commands.QueueSong(ctx, client, track) err := commands.QueueSong(ctx, client, track)
if err != nil { if err != nil {
fmt.Println(err.Error())
return return
} }
err = commands.Next(ctx, client, 1) err = commands.Next(ctx, client, 1)
if err != nil { if err != nil {
fmt.Println(err.Error())
return return
} }
} }
@ -103,7 +97,6 @@ func HandleSetDevice(ctx *gctx.Context, client *spotify.Client, player spotify.P
var err error var err error
err = commands.SetDevice(ctx, client, player) err = commands.SetDevice(ctx, client, player)
if err != nil { if err != nil {
fmt.Println(err.Error())
return return
} }
} }

View File

@ -131,14 +131,12 @@ func (m *mainModel) GoBack() (tea.Cmd, error) {
m.mode = Main m.mode = Main
new_items, err := MainView(m.ctx, m.client) new_items, err := MainView(m.ctx, m.client)
if err != nil { if err != nil {
fmt.Println(err.Error())
} }
m.list.SetItems(new_items) m.list.SetItems(new_items)
case Album: case Album:
m.mode = Albums m.mode = Albums
new_items, err := AlbumsView(m.ctx, m.client) new_items, err := AlbumsView(m.ctx, m.client)
if err != nil { if err != nil {
fmt.Println(err.Error())
return nil, err return nil, err
} }
m.list.SetItems(new_items) m.list.SetItems(new_items)
@ -393,7 +391,7 @@ func (m *mainModel) SelectItem() error {
m.list.NewStatusMessage("Setting view to main") m.list.NewStatusMessage("Setting view to main")
new_items, err := MainView(m.ctx, m.client) new_items, err := MainView(m.ctx, m.client)
if err != nil { if err != nil {
fmt.Println(err.Error()) return err
} }
m.list.SetItems(new_items) m.list.SetItems(new_items)
} }
@ -449,7 +447,6 @@ func (m *mainModel) Typing(msg tea.KeyMsg) (bool, tea.Cmd) {
if msg.String() == "enter" { if msg.String() == "enter" {
items, result, err := SearchView(m.ctx, m.client, m.input.Value()) items, result, err := SearchView(m.ctx, m.client, m.input.Value())
if err != nil { if err != nil {
fmt.Println(err.Error())
return false, tea.Quit return false, tea.Quit
} }
m.searchResults = result m.searchResults = result
@ -574,7 +571,6 @@ func (m mainModel) Update(msg tea.Msg) (tea.Model, tea.Cmd) {
m.mode = Devices m.mode = Devices
new_items, err := DeviceView(m.ctx, m.client) new_items, err := DeviceView(m.ctx, m.client)
if err != nil { if err != nil {
fmt.Println(err.Error())
return m, tea.Quit return m, tea.Quit
} }
m.list.SetItems(new_items) m.list.SetItems(new_items)
@ -585,7 +581,7 @@ func (m mainModel) Update(msg tea.Msg) (tea.Model, tea.Cmd) {
if msg.String() == "backspace" || msg.String() == "esc" || msg.String() == "q" { if msg.String() == "backspace" || msg.String() == "esc" || msg.String() == "q" {
msg, err := m.GoBack() msg, err := m.GoBack()
if err != nil { if err != nil {
fmt.Println(err) return m, tea.Quit
} }
m.list.ResetSelected() m.list.ResetSelected()
return m, msg return m, msg