Documentation ¶
Index ¶
- Constants
- type AppleMusicResult
- type Client
- func (c *Client) AddStream(Url string, RadioID int, callbacks string, ...) error
- func (c *Client) DeleteStream(RadioID int, additionalParameters map[string]string) error
- func (c *Client) FindLyrics(q string, additionalParameters map[string]string) ([]LyricsResult, error)
- func (c *Client) GetCallbackUrl(additionalParameters map[string]string) (string, error)
- func (c *Client) GetStreams(additionalParameters map[string]string) ([]Stream, error)
- func (c *Client) NewLongPoll(RadioID int) LongPoll
- func (c *Client) Recognize(v interface{}, Return string, additionalParameters map[string]string) (RecognitionResult, error)
- func (c *Client) RecognizeByFile(file io.Reader, Return string, additionalParameters map[string]string) (RecognitionResult, error)
- func (c *Client) RecognizeByUrl(Url string, Return string, additionalParameters map[string]string) (RecognitionResult, error)
- func (c *Client) RecognizeHumming(file io.Reader) ([]HummingResult, error)
- func (c *Client) RecognizeHummingByUrl(Url string) ([]HummingResult, error)
- func (c *Client) RecognizeLongAudio(v interface{}, additionalParameters map[string]string) ([]RecognitionEnterpriseResult, error)
- func (c *Client) RecognizeLongAudioByFile(file io.Reader, additionalParameters map[string]string) ([]RecognitionEnterpriseResult, error)
- func (c *Client) RecognizeLongAudioByUrl(Url string, additionalParameters map[string]string) ([]RecognitionEnterpriseResult, error)
- func (c *Client) Send(parameters map[string]string) ([]byte, error)
- func (c *Client) SendFile(file io.Reader, parameters map[string]string) ([]byte, error)
- func (c *Client) SendFileRequest(file io.Reader, parameters map[string]string, v interface{}) error
- func (c *Client) SendRequest(parameters map[string]string, v interface{}) error
- func (c *Client) SendUrl(URL string, parameters map[string]string) ([]byte, error)
- func (c *Client) SendUrlRequest(url string, parameters map[string]string, v interface{}) error
- func (c *Client) SetCallbackUrl(Url string, additionalParameters map[string]string) error
- func (c *Client) SetEndpoint(APIEndpoint string)
- func (c *Client) SetStreamUrl(Url string, RadioID int, additionalParameters map[string]string) error
- func (c *Client) UseExperimentalUploading()
- type DeezerResult
- type Error
- type FindLyricsResponse
- type GetCallbackUrlResponse
- type GetStreamsResponse
- type HummingRecognitionResponse
- type HummingRecognitionResult
- type HummingResult
- type LongPoll
- type LyricsResult
- type MusicbrainzRecordings
- type NapsterResult
- type RecognitionEnterpriseResponse
- type RecognitionEnterpriseResult
- type RecognitionResponse
- type RecognitionResult
- type Response
- type SpotifyResult
- type Stream
- type StreamCallback
- type StreamNotification
- type StreamRecognitionResult
- type Warning
Constants ¶
const ( MainAPIEndpoint string = "https://api.audd.io/" EnterpriseAPIEndpoint string = "https://enterprise.audd.io/" )
API Endpoints
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AppleMusicResult ¶
type AppleMusicResult struct { Previews []struct { URL string `json:"url"` } `json:"previews"` Artwork struct { Width int `json:"width"` Height int `json:"height"` URL string `json:"url"` BgColor string `json:"bgColor"` TextColor1 string `json:"textColor1"` TextColor2 string `json:"textColor2"` TextColor3 string `json:"textColor3"` TextColor4 string `json:"textColor4"` } `json:"artwork"` ArtistName string `json:"artistName"` URL string `json:"url"` DiscNumber int `json:"discNumber"` GenreNames []string `json:"genreNames"` DurationInMillis int `json:"durationInMillis"` ReleaseDate string `json:"releaseDate"` Name string `json:"name"` ISRC string `json:"isrc"` AlbumName string `json:"albumName"` PlayParams struct { ID string `json:"id"` Kind string `json:"kind"` } `json:"playParams"` TrackNumber int `json:"trackNumber"` ComposerName string `json:"composerName"` }
type Client ¶
func (*Client) AddStream ¶
func (c *Client) AddStream(Url string, RadioID int, callbacks string, additionalParameters map[string]string) error
Adds a stream Send empty callbacks parameter for the default mode (callbacks will be sent after the song ends), send callbacks='before' for receiving callbacks when new songs just start playing on the stream
func (*Client) DeleteStream ¶
Deletes a stream
func (*Client) FindLyrics ¶
func (c *Client) FindLyrics(q string, additionalParameters map[string]string) ([]LyricsResult, error)
Finds the lyrics by the query
func (*Client) GetCallbackUrl ¶
Returns the URL the callbacks are sent to
func (*Client) GetStreams ¶
Returns all the streams
func (*Client) NewLongPoll ¶ added in v0.2.0
Opens a LongPoll connection to the AudD API and receives the callbacks via LongPoll. The callbacks will be sent to both the callback URL and all the LongPoll listeners. Won't work unless some URL is set as the URL for callbacks. More info: docs.audd.io/streams/#longpoll
func (*Client) Recognize ¶
func (c *Client) Recognize(v interface{}, Return string, additionalParameters map[string]string) (RecognitionResult, error)
Recognizes the music. Accepts files as io.Reader or []byte and file URLs as string or url.URL
func (*Client) RecognizeByFile ¶
func (c *Client) RecognizeByFile(file io.Reader, Return string, additionalParameters map[string]string) (RecognitionResult, error)
Recognizes the music in the file
func (*Client) RecognizeByUrl ¶
func (c *Client) RecognizeByUrl(Url string, Return string, additionalParameters map[string]string) (RecognitionResult, error)
Recognizes the music in the file available by the Url
func (*Client) RecognizeHumming ¶
func (c *Client) RecognizeHumming(file io.Reader) ([]HummingResult, error)
[test feature] Recognizes the music in the file by humming
func (*Client) RecognizeHummingByUrl ¶
func (c *Client) RecognizeHummingByUrl(Url string) ([]HummingResult, error)
[test feature] Recognizes the music in the file available by the Url by humming
func (*Client) RecognizeLongAudio ¶
func (c *Client) RecognizeLongAudio(v interface{}, additionalParameters map[string]string) ([]RecognitionEnterpriseResult, error)
Recognizes the music in long (even hours-long or days-long) audio files Accepts files as io.Reader or []byte and file URLs as string or url.URL
func (*Client) RecognizeLongAudioByFile ¶
func (c *Client) RecognizeLongAudioByFile(file io.Reader, additionalParameters map[string]string) ([]RecognitionEnterpriseResult, error)
Recognizes the music in long (even hours-long or days-long) audio files
func (*Client) RecognizeLongAudioByUrl ¶
func (c *Client) RecognizeLongAudioByUrl(Url string, additionalParameters map[string]string) ([]RecognitionEnterpriseResult, error)
Recognizes the music in long (even hours-long or days-long) audio files available by the Url
func (*Client) SendFileRequest ¶
Sends a request with a file and returns the result into the v
func (*Client) SendRequest ¶
Sends a request returns the result into the v
func (*Client) SendUrlRequest ¶
Sends a request with a file URL and returns the result into the v
func (*Client) SetCallbackUrl ¶
Sets the URL for callbacks. The callbacks with the information about songs recognized in your streams will be sent to the specified URL
func (*Client) SetEndpoint ¶
Sets the endpoint used
func (*Client) SetStreamUrl ¶
func (c *Client) SetStreamUrl(Url string, RadioID int, additionalParameters map[string]string) error
Sets the url of a stream
func (*Client) UseExperimentalUploading ¶
func (c *Client) UseExperimentalUploading()
Call this if you want to actually start sending files without completely loading them in the memory Can lead to unexpected issues, like if the io.Reader returns an error while uploading is in progress, it can possibly still be counted as a request
type DeezerResult ¶
type DeezerResult struct { ID int `json:"id"` Readable bool `json:"readable"` Title string `json:"title"` TitleShort string `json:"title_short"` TitleVersion string `json:"title_version"` Link string `json:"link"` Duration int `json:"duration"` Rank int `json:"rank"` ExplicitLyrics bool `json:"explicit_lyrics"` Preview string `json:"preview"` Artist struct { ID int `json:"id"` Name string `json:"name"` Link string `json:"link"` Picture string `json:"picture"` PictureSmall string `json:"picture_small"` PictureMedium string `json:"picture_medium"` PictureBig string `json:"picture_big"` PictureXl string `json:"picture_xl"` Tracklist string `json:"tracklist"` Type string `json:"type"` } `json:"artist"` Album struct { ID int `json:"id"` Title string `json:"title"` Cover string `json:"cover"` CoverSmall string `json:"cover_small"` CoverMedium string `json:"cover_medium"` CoverBig string `json:"cover_big"` CoverXl string `json:"cover_xl"` Tracklist string `json:"tracklist"` Type string `json:"type"` } `json:"album"` Type string `json:"type"` }
type FindLyricsResponse ¶
type FindLyricsResponse struct { Response Result []LyricsResult `json:"result"` }
type GetCallbackUrlResponse ¶
type GetStreamsResponse ¶
type HummingRecognitionResponse ¶
type HummingRecognitionResponse struct { Response Result HummingRecognitionResult `json:"result"` }
type HummingRecognitionResult ¶
type HummingRecognitionResult struct { Count int `json:"count"` List []HummingResult `json:"list"` }
type HummingResult ¶
type LongPoll ¶ added in v0.2.0
type LongPoll struct { ResultsChan chan StreamCallback // contains filtered or unexported fields }
type LyricsResult ¶
type LyricsResult struct { SongId int `json:"song_id,string"` ArtistId int `json:"artist_id,string"` Title string `json:"title"` TitleWithFeat string `json:"title_with_featured"` FullTitle string `json:"full_title"` Artist string `json:"artist"` Lyrics string `json:"lyrics"` Media string `json:"media"` }
type MusicbrainzRecordings ¶
type MusicbrainzRecordings struct { ID string `json:"id"` Score int `json:"score"` Title string `json:"title"` Length int `json:"length"` Disambiguation string `json:"disambiguation"` Video interface{} `json:"video"` ArtistCredit []struct { Name string `json:"name"` Artist struct { ID string `json:"id"` Name string `json:"name"` SortName string `json:"sort-name"` } `json:"artist"` } `json:"artist-credit"` Releases []struct { ID string `json:"id"` Count int `json:"count"` Title string `json:"title"` Status string `json:"status"` Disambiguation string `json:"disambiguation,omitempty"` Date string `json:"date"` Country string `json:"country"` ReleaseEvents []struct { Date string `json:"date"` Area struct { ID string `json:"id"` Name string `json:"name"` SortName string `json:"sort-name"` Iso31661Codes []string `json:"iso-3166-1-codes"` } `json:"area"` } `json:"release-events"` TrackCount int `json:"track-count"` Media []struct { Position int `json:"position"` Format string `json:"format"` Track []struct { ID string `json:"id"` Number string `json:"number"` Title string `json:"title"` Length int `json:"length"` } `json:"track"` TrackCount int `json:"track-count"` TrackOffset int `json:"track-offset"` } `json:"media"` ArtistCredit []struct { Name string `json:"name"` Artist struct { ID string `json:"id"` Name string `json:"name"` SortName string `json:"sort-name"` Disambiguation string `json:"disambiguation"` } `json:"artist"` } `json:"artist-credit,omitempty"` ReleaseGroup struct { ID string `json:"id"` TypeID string `json:"type-id"` Title string `json:"title"` PrimaryType string `json:"primary-type"` SecondaryTypes []string `json:"secondary-types"` } `json:"release-group,omitempty"` } `json:"releases"` Isrcs []string `json:"isrcs"` Tags []struct { Count int `json:"count"` Name string `json:"name"` } `json:"tags"` }
type NapsterResult ¶
type NapsterResult struct { Type string `json:"type"` ID string `json:"id"` Index int `json:"index"` Disc int `json:"disc"` Href string `json:"href"` PlaybackSeconds int `json:"playbackSeconds"` IsExplicit bool `json:"isExplicit"` IsStreamable bool `json:"isStreamable"` IsAvailableInHiRes bool `json:"isAvailableInHiRes"` Name string `json:"name"` Isrc string `json:"isrc"` Shortcut string `json:"shortcut"` Blurbs []interface{} `json:"blurbs"` ArtistID string `json:"artistId"` ArtistName string `json:"artistName"` AlbumName string `json:"albumName"` Formats []struct { Type string `json:"type"` Bitrate int `json:"bitrate"` Name string `json:"name"` SampleBits int `json:"sampleBits"` SampleRate int `json:"sampleRate"` } `json:"formats"` LosslessFormats []interface{} `json:"losslessFormats"` AlbumID string `json:"albumId"` Contributors struct { PrimaryArtist string `json:"primaryArtist"` } `json:"contributors"` Links struct { Artists struct { Ids []string `json:"ids"` Href string `json:"href"` } `json:"artists"` Albums struct { Ids []string `json:"ids"` Href string `json:"href"` } `json:"albums"` Genres struct { Ids []string `json:"ids"` Href string `json:"href"` } `json:"genres"` Tags struct { Ids []string `json:"ids"` Href string `json:"href"` } `json:"tags"` } `json:"links"` PreviewURL string `json:"previewURL"` }
type RecognitionEnterpriseResponse ¶
type RecognitionEnterpriseResponse struct { Response Result []RecognitionEnterpriseResult `json:"result"` ExecutionTime string `json:"execution_time"` }
type RecognitionEnterpriseResult ¶
type RecognitionEnterpriseResult struct { Songs []RecognitionResult `json:"songs"` Offset string `json:"offset"` }
type RecognitionResponse ¶
type RecognitionResponse struct { Response Result RecognitionResult `json:"result"` Warning *Warning `json:"warning"` }
type RecognitionResult ¶
type RecognitionResult struct { Artist string `json:"artist,omitempty"` Title string `json:"title,omitempty"` Album string `json:"album,omitempty"` ReleaseDate string `json:"release_date,omitempty"` Label string `json:"label,omitempty"` Timecode string `json:"timecode,omitempty"` SongLink string `json:"song_link,omitempty"` Lyrics *LyricsResult `json:"lyrics,omitempty"` AppleMusic *AppleMusicResult `json:"apple_music,omitempty"` Deezer *DeezerResult `json:"deezer,omitempty"` MusicBrainz []MusicbrainzRecordings `json:"musicbrainz,omitempty"` Napster *NapsterResult `json:"napster,omitempty"` Spotify *SpotifyResult `json:"spotify,omitempty"` ISRC string `json:"isrc,omitempty"` UPC string `json:"upc,omitempty"` Score int `json:"score,omitempty"` SongLength string `json:"song_length,omitempty"` AudioID int `json:"audio_id,omitempty"` StartOffset int `json:"start_offset,omitempty"` EndOffset int `json:"end_offset,omitempty"` }
type SpotifyResult ¶
type SpotifyResult struct { Album struct { AlbumType string `json:"album_type"` Artists []struct { ExternalUrls struct { Spotify string `json:"spotify"` } `json:"external_urls"` Href string `json:"href"` ID string `json:"id"` Name string `json:"name"` Type string `json:"type"` URI string `json:"uri"` } `json:"artists"` AvailableMarkets []string `json:"available_markets"` ExternalUrls struct { Spotify string `json:"spotify"` } `json:"external_urls"` Href string `json:"href"` ID string `json:"id"` Images []struct { Height int `json:"height"` URL string `json:"url"` Width int `json:"width"` } `json:"images"` Name string `json:"name"` ReleaseDate string `json:"release_date"` ReleaseDatePrecision string `json:"release_date_precision"` TotalTracks int `json:"total_tracks"` Type string `json:"type"` URI string `json:"uri"` } `json:"album"` Artists []struct { ExternalUrls struct { Spotify string `json:"spotify"` } `json:"external_urls"` Href string `json:"href"` ID string `json:"id"` Name string `json:"name"` Type string `json:"type"` URI string `json:"uri"` } `json:"artists"` AvailableMarkets []string `json:"available_markets"` DiscNumber int `json:"disc_number"` DurationMs int `json:"duration_ms"` Explicit bool `json:"explicit"` ExternalIds struct { Isrc string `json:"isrc"` } `json:"external_ids"` ExternalUrls struct { Spotify string `json:"spotify"` } `json:"external_urls"` Href string `json:"href"` ID string `json:"id"` IsLocal bool `json:"is_local"` Name string `json:"name"` Popularity int `json:"popularity"` TrackNumber int `json:"track_number"` Type string `json:"type"` URI string `json:"uri"` }
type StreamCallback ¶ added in v0.2.0
type StreamCallback struct { Status string `json:"status"` Notification *StreamNotification `json:"notification"` Result *StreamRecognitionResult `json:"result"` Time int64 `json:"time"` }
type StreamNotification ¶ added in v0.2.0
type StreamRecognitionResult ¶ added in v0.2.0
type StreamRecognitionResult struct { RadioID int `json:"radio_id"` Timestamp string `json:"timestamp"` PlayLength int `json:"play_length,omitempty"` Results []RecognitionResult `json:"results"` }