From 82ae6a76e6bf6f6dc3e5c4f26e5617083a525e2c Mon Sep 17 00:00:00 2001 From: a <a@tuxpa.in> Date: Tue, 18 Mar 2025 23:45:19 -0500 Subject: [PATCH] delete more code that was using the old recs api --- src/components/commands/radio.go | 29 ----------------------------- 1 file changed, 29 deletions(-) diff --git a/src/components/commands/radio.go b/src/components/commands/radio.go index 48e2ffb..fd450e5 100644 --- a/src/components/commands/radio.go +++ b/src/components/commands/radio.go @@ -6,7 +6,6 @@ import ( "encoding/json" "errors" "fmt" - "math/rand" "os" "path/filepath" @@ -186,33 +185,5 @@ func (c *Commander) RadioGivenList(songs []spotify.ID, name string) error { if err != nil { return err } - for i := 0; i < 4; i++ { - id := rand.Intn(len(songs)-2) + 1 - seed := spotify.Seeds{ - Tracks: []spotify.ID{songs[id]}, - } - additionalRecs, err := c.Client().GetRecommendations(c.Context, seed, &spotify.TrackAttributes{}, spotify.Limit(100)) - if err != nil { - return err - } - additionalRecsIds := []spotify.ID{} - for _, song := range additionalRecs.Tracks { - exists, err := c.SongExists(c.db, song.ID) - if err != nil { - return err - } - if !exists { - _, err = c.db.QueryContext(c.Context, fmt.Sprintf("INSERT INTO radio (id) VALUES('%s')", string(song.ID))) - if err != nil { - return err - } - additionalRecsIds = append(additionalRecsIds, song.ID) - } - } - _, err = c.Client().AddTracksToPlaylist(c.Context, radioPlaylist.ID, additionalRecsIds...) - if err != nil { - return err - } - } return nil }