From 5804607c427da142d463b629b026b8e31bbd1c48 Mon Sep 17 00:00:00 2001 From: abs3nt Date: Tue, 31 Jan 2023 21:37:10 -0800 Subject: [PATCH] remove debug prints. do logging later --- src/commands/commands.go | 12 ------------ src/tui/handlers.go | 7 ------- src/tui/main.go | 8 ++------ 3 files changed, 2 insertions(+), 25 deletions(-) diff --git a/src/commands/commands.go b/src/commands/commands.go index 228b594..23cbefd 100644 --- a/src/commands/commands.go +++ b/src/commands/commands.go @@ -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 { err := client.Seek(ctx, pos) if err != nil { - fmt.Println(err.Error()) return err } 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 { err := ClearRadio(ctx, client) if err != nil { - fmt.Println(err.Error()) return err } playlist, _, err := GetRadioPlaylist(ctx, client, "Saved Songs") if err != nil { - fmt.Println(err.Error()) return err } songs, err := client.CurrentUsersTracks(ctx, spotify.Limit(50), spotify.Offset(position)) if err != nil { - fmt.Println(err.Error()) return err } 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...) if err != nil { - fmt.Println(err.Error()) return err } 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 { exists, err := SongExists(db, song.ID) if err != nil { - fmt.Println(err.Error()) return err } if !exists { @@ -475,7 +469,6 @@ func RadioGivenSong(ctx *gctx.Context, client *spotify.Client, song spotify.Simp for _, song := range additional_recs.Tracks { exists, err := SongExists(db, song.ID) if err != nil { - fmt.Println(err.Error()) return err } if !exists { @@ -554,11 +547,9 @@ func RefillRadio(ctx *gctx.Context, client *spotify.Client) error { to_remove := []spotify.ID{} radioPlaylist, db, err := GetRadioPlaylist(ctx, client, "") if err != nil { - fmt.Println("ERROR AHHH", err.Error()) } if status.PlaybackContext.URI != radioPlaylist.URI { - fmt.Println(status.PlaybackContext.URI, radioPlaylist.URI) return nil } @@ -592,7 +583,6 @@ func RefillRadio(ctx *gctx.Context, client *spotify.Client) error { } trackGroups = append(trackGroups, item) if err != nil { - fmt.Println(err.Error()) return err } } @@ -697,7 +687,6 @@ func RefillRadio(ctx *gctx.Context, client *spotify.Client) error { func ClearRadio(ctx *gctx.Context, client *spotify.Client) error { radioPlaylist, db, err := GetRadioPlaylist(ctx, client, "") if err != nil { - fmt.Println(err) return err } 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 { exists, err := SongExists(db, song.ID) if err != nil { - fmt.Println(err.Error()) return err } if !exists { diff --git a/src/tui/handlers.go b/src/tui/handlers.go index 0b02d6c..2294c69 100644 --- a/src/tui/handlers.go +++ b/src/tui/handlers.go @@ -1,8 +1,6 @@ package tui import ( - "fmt" - "gospt/src/commands" "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) { err := commands.RadioFromSavedTracks(ctx, client) if err != nil { - fmt.Println(err.Error()) return } } @@ -81,7 +78,6 @@ func HandleLibraryRadio(ctx *gctx.Context, client *spotify.Client) { func HandlePlayLikedSong(ctx *gctx.Context, client *spotify.Client, position int) { err := commands.PlayLikedSongs(ctx, client, position) if err != nil { - fmt.Println(err.Error()) 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) { err := commands.QueueSong(ctx, client, track) if err != nil { - fmt.Println(err.Error()) return } err = commands.Next(ctx, client, 1) if err != nil { - fmt.Println(err.Error()) return } } @@ -103,7 +97,6 @@ func HandleSetDevice(ctx *gctx.Context, client *spotify.Client, player spotify.P var err error err = commands.SetDevice(ctx, client, player) if err != nil { - fmt.Println(err.Error()) return } } diff --git a/src/tui/main.go b/src/tui/main.go index 9b2ef8a..58a28cc 100644 --- a/src/tui/main.go +++ b/src/tui/main.go @@ -131,14 +131,12 @@ func (m *mainModel) GoBack() (tea.Cmd, error) { m.mode = Main new_items, err := MainView(m.ctx, m.client) if err != nil { - fmt.Println(err.Error()) } m.list.SetItems(new_items) case Album: m.mode = Albums new_items, err := AlbumsView(m.ctx, m.client) if err != nil { - fmt.Println(err.Error()) return nil, err } m.list.SetItems(new_items) @@ -393,7 +391,7 @@ func (m *mainModel) SelectItem() error { m.list.NewStatusMessage("Setting view to main") new_items, err := MainView(m.ctx, m.client) if err != nil { - fmt.Println(err.Error()) + return err } m.list.SetItems(new_items) } @@ -449,7 +447,6 @@ func (m *mainModel) Typing(msg tea.KeyMsg) (bool, tea.Cmd) { if msg.String() == "enter" { items, result, err := SearchView(m.ctx, m.client, m.input.Value()) if err != nil { - fmt.Println(err.Error()) return false, tea.Quit } m.searchResults = result @@ -574,7 +571,6 @@ func (m mainModel) Update(msg tea.Msg) (tea.Model, tea.Cmd) { m.mode = Devices new_items, err := DeviceView(m.ctx, m.client) if err != nil { - fmt.Println(err.Error()) return m, tea.Quit } 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" { msg, err := m.GoBack() if err != nil { - fmt.Println(err) + return m, tea.Quit } m.list.ResetSelected() return m, msg