Documentation ¶
Index ¶
- Variables
- func CalculateMatchRatio(radio string, spotify *ImmutableSpotifyTrack) int
- type Cache
- type ImmutableSpotifyTrack
- type PlaylistItem
- type PlaylistResponse
- type SearchResponse
- type SearchResponseBody
- type Spotify
- func (s *Spotify) AddToPlaylist(ctx context.Context, playlistId string, track *ImmutableSpotifyTrack) error
- func (s *Spotify) FindTracks(ctx context.Context, query string) ([]*ImmutableSpotifyTrack, error)
- func (s *Spotify) ListLiked(ctx context.Context) ([]*ImmutableSpotifyTrack, error)
- func (s *Spotify) ListPlaylist(ctx context.Context, playlistId string) ([]*ImmutableSpotifyTrack, error)
- func (s *Spotify) ListPlaylistWithFilter(ctx context.Context, playlistId string, filter func(SpotifyTrack) bool) ([]*ImmutableSpotifyTrack, error)
- func (s *Spotify) RemoveFromPlaylist(ctx context.Context, playlistId string, track *ImmutableSpotifyTrack) error
- type SpotifyAlbum
- type SpotifyArtist
- type SpotifyTrack
Constants ¶
This section is empty.
Variables ¶
View Source
var TerribleSongNames = []string{
"acapella",
"acappella",
"as made famous",
"in the style of",
"in style of",
"karaoke",
"made famous by",
"originally performed by",
"reprise",
"tribute",
}
Functions ¶
func CalculateMatchRatio ¶
func CalculateMatchRatio(radio string, spotify *ImmutableSpotifyTrack) int
Calculates match ratio between song name stored in a string from radio (e.g. "Artist - Some song") and a given SpotifyTrack. Returns match ratio from 0 to 100, anything below 75 is bad quality, while 50 and less is probably worthless.
Types ¶
type Cache ¶
type Cache interface { // Playlist cache methods Add(playlistId string, track *ImmutableSpotifyTrack) error ReplaceAll(playlistId string, tracks []*ImmutableSpotifyTrack) error Remove(playlistId string, track *ImmutableSpotifyTrack) error Get(playlistId string) []*ImmutableSpotifyTrack IsCached(playlistId string) bool }
type ImmutableSpotifyTrack ¶
type ImmutableSpotifyTrack struct {
// contains filtered or unexported fields
}
func (*ImmutableSpotifyTrack) Artist ¶
func (t *ImmutableSpotifyTrack) Artist() string
func (*ImmutableSpotifyTrack) Id ¶
func (t *ImmutableSpotifyTrack) Id() string
func (*ImmutableSpotifyTrack) String ¶
func (t *ImmutableSpotifyTrack) String() string
func (*ImmutableSpotifyTrack) Title ¶
func (t *ImmutableSpotifyTrack) Title() string
type PlaylistItem ¶
type PlaylistItem struct {
Track SpotifyTrack
}
type PlaylistResponse ¶
type PlaylistResponse struct { Items []PlaylistItem Total int Next string }
type SearchResponse ¶
type SearchResponse struct {
Tracks SearchResponseBody
}
type SearchResponseBody ¶
type SearchResponseBody struct {
Items []SpotifyTrack
}
type Spotify ¶
type Spotify struct {
// contains filtered or unexported fields
}
func (*Spotify) AddToPlaylist ¶
func (*Spotify) FindTracks ¶
func (*Spotify) ListLiked ¶
func (s *Spotify) ListLiked(ctx context.Context) ([]*ImmutableSpotifyTrack, error)
func (*Spotify) ListPlaylist ¶
func (*Spotify) ListPlaylistWithFilter ¶
func (s *Spotify) ListPlaylistWithFilter(ctx context.Context, playlistId string, filter func(SpotifyTrack) bool) ([]*ImmutableSpotifyTrack, error)
func (*Spotify) RemoveFromPlaylist ¶
type SpotifyAlbum ¶
type SpotifyAlbum struct { Id string Name string Artists []SpotifyArtist }
type SpotifyArtist ¶
type SpotifyTrack ¶
type SpotifyTrack struct { Id string Name string DurationMs int64 `json:"duration_ms"` Popularity int Artists []SpotifyArtist Album SpotifyAlbum AvailableMarkets []string `json:"available_markets"` }
func (SpotifyTrack) ArtistAsString ¶
func (t SpotifyTrack) ArtistAsString() string
func (SpotifyTrack) String ¶
func (t SpotifyTrack) String() string
Click to show internal directories.
Click to hide internal directories.