Documentation
¶
Index ¶
Constants ¶
const ( // DefaultBaseURL is redundantly the base URL of the chipmusic.org DefaultBaseURL = "https://chipmusic.org" DefaultWorkers = 40 // AudioFileTypeMP3 is the expected extension for an MP3 audio file AudioFileTypeMP3 AudioFileType = "mp3" // TrackFilterNone does not filter for any particular track; instead, it returns the most recently posted tracks TrackFilterLatest = "latest" // TrackFilterRandom filters for random tracks TrackFilterRandom = "random" // TrackFilterFeatured filters for featured tracks TrackFilterFeatured = "featured" // TrackFilterFeatured filters for tracks with high ratings TrackFilterHighRatings = "popular" )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AudioFileType ¶
type AudioFileType string
AudioFileType is an enumeration of possible audio file types
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client is a struct capable of interacting with chipmusic.org
func (*Client) GetTrack ¶
GetTrack takes a URL to a track page for chipmusic.org and returns a Track. The returned struct contains metadata about the track and a reader which can be used to download the track itself for playback. Use FileType in the Track to determine how to use the the content returned from the reader
func (*Client) Search ¶
Search performs a search against chipmusic.org, returning a list of URLs to tracks which match. If a search returns more tracks than can be returned in a single call, you can use the page parameter to paginate through the additional tracks. To iterate through all tracks for a particular search, start with page = 1 and increment it for subsequent calls. The order of the tracks returned is undefined. If no tracks are found or there are no other tracks, an empty slice is returned
type Option ¶
Option is an alias for a function that modifies a Client. An Option is used to override the default values of Client
func WithBaseURL ¶
WithBaseURL allows overriding the base URL for chipmusic.org
func WithHTTPClient ¶
WithHTTPClient allows overriding the default HTTP client used to make requests
func WithWorkers ¶
WithWorkers allows overriding the default number fo workers used to download a file
type ReadSeekCloser ¶
type ReadSeekCloser interface {
io.ReadSeeker
io.Closer
}
ReadSeekCloser is an interface combining the capabilities of ReaderSeeker and Closer. The beep library
type ReadSeekNopCloser ¶
type ReadSeekNopCloser struct {
Reader io.ReadSeeker
}
ReadSeekNopCloser is an implementation of ReadSeekCloser which is able to read and seek but closing the reader doesn't actually do anything
func (*ReadSeekNopCloser) Close ¶
func (r *ReadSeekNopCloser) Close() error
type Track ¶
type Track struct {
// Title is the name of the track
Title string
// Artist is the name of the author who composed the track
Artist string
// Reader reads the body of the track. It is also able to seek to any point within the track
Reader ReadSeekCloser
// FileType represents the type of audio file for this track. This should be used to determine how to interpret and
// play the content returned from Reader
FileType AudioFileType
}
Track is song from chipmusic.org. It contains metadata related to the song along with a reader of the track itself