Documentation ¶
Index ¶
- Variables
- func DoWithRetry(httpc *fasthttp.HostClient, req *fasthttp.Request, resp *fasthttp.Response) (err error)
- func DoWithRetryAll(httpc *fasthttp.Client, req *fasthttp.Request, resp *fasthttp.Response) (err error)
- func GetClientID() (string, error)
- func GetMissingTracks(cid string, missing []MissingTrack) (res []Track, next []MissingTrack, err error)
- func JoinMissingTracks(missing []MissingTrack) (st string)
- func Resolve(cid string, path string, out any) error
- func TagListParser(taglist string) (res []string)
- type Format
- type Like
- type Link
- type Media
- type MissingTrack
- type Paginated
- func GetFeaturedTracks(cid string, prefs cfg.Preferences, args string) (*Paginated[*Track], error)
- func GetSelections(cid string, prefs cfg.Preferences) (*Paginated[*Selection], error)
- func RecentTracks(cid string, prefs cfg.Preferences, args string) (*Paginated[*Track], error)
- func SearchPlaylists(cid string, prefs cfg.Preferences, args string) (*Paginated[*Playlist], error)
- func SearchTracks(cid string, prefs cfg.Preferences, args string) (*Paginated[*Track], error)
- func SearchUsers(cid string, prefs cfg.Preferences, args string) (*Paginated[*User], error)
- type Playlist
- type Protocol
- type Repost
- type RepostType
- type Selection
- type Stream
- type Track
- func GetArbitraryTrack(cid string, data string) (Track, error)
- func GetNextMissingTracks(cid string, raw string) (res []Track, next []string, err error)
- func GetTrack(cid string, permalink string) (Track, error)
- func GetTrackByID(cid string, id string) (Track, error)
- func GetTracks(cid string, ids string) ([]Track, error)
- func (t Track) DownloadImage() ([]byte, string, error)
- func (t *Track) Fix(large bool, fixAuthor bool)
- func (t Track) FormatDescription() string
- func (t *Track) GetAlbums(cid string, prefs cfg.Preferences, args string) (*Paginated[*Playlist], error)
- func (t *Track) GetPlaylists(cid string, prefs cfg.Preferences, args string) (*Paginated[*Playlist], error)
- func (t *Track) GetRelated(cid string, prefs cfg.Preferences, args string) (*Paginated[*Track], error)
- func (t Track) Href() string
- func (t *Track) Postfix(prefs cfg.Preferences, fixAuthor bool)
- type TrackPolicy
- type Transcoding
- type User
- func (u *User) Fix(large bool)
- func (u User) FormatDescription() string
- func (u User) FormatUsername() string
- func (u User) GetAlbums(cid string, prefs cfg.Preferences, args string) (*Paginated[*Playlist], error)
- func (u User) GetFollowers(cid string, prefs cfg.Preferences, args string) (*Paginated[*User], error)
- func (u User) GetFollowing(cid string, prefs cfg.Preferences, args string) (*Paginated[*User], error)
- func (u User) GetLikes(cid string, prefs cfg.Preferences, args string) (*Paginated[*Like], error)
- func (u User) GetPlaylists(cid string, prefs cfg.Preferences, args string) (*Paginated[*Playlist], error)
- func (u *User) GetRelated(cid string, prefs cfg.Preferences) ([]*User, error)
- func (u User) GetReposts(cid string, prefs cfg.Preferences, args string) (*Paginated[*Repost], error)
- func (u *User) GetTopTracks(cid string, prefs cfg.Preferences) ([]*Track, error)
- func (u User) GetTracks(cid string, prefs cfg.Preferences, args string) (*Paginated[*Track], error)
- func (u *User) GetWebProfiles(cid string) error
- func (u *User) Postfix(prefs cfg.Preferences)
Constants ¶
This section is empty.
Variables ¶
View Source
var ClientIDCache clientIdCache
View Source
var ErrIDNotFound = errors.New("clientid not found")
View Source
var ErrIncompatibleStream = errors.New("incompatible stream")
View Source
var ErrKindNotCorrect = errors.New("entity of incorrect kind")
View Source
var ErrNoURL = errors.New("no url")
View Source
var ErrScriptNotFound = errors.New("script not found")
View Source
var ErrVersionNotFound = errors.New("version not found")
View Source
var PlaylistsCache = map[string]cached[Playlist]{}
View Source
var TracksCache = map[string]cached[Track]{}
View Source
var UsersCache = map[string]cached[User]{}
Functions ¶
func DoWithRetry ¶
func DoWithRetry(httpc *fasthttp.HostClient, req *fasthttp.Request, resp *fasthttp.Response) (err error)
Since the http client is setup to always keep connections idle (great for speed, no need to open a new one everytime), those connections may be closed by soundcloud after some time of inactivity, this ensures that we retry those requests that fail due to the connection closing/timing out
func DoWithRetryAll ¶
func DoWithRetryAll(httpc *fasthttp.Client, req *fasthttp.Request, resp *fasthttp.Response) (err error)
Just retry any kind of errors, why not
func GetClientID ¶
inspired by github.com/imputnet/cobalt (mostly stolen lol)
func GetMissingTracks ¶
func GetMissingTracks(cid string, missing []MissingTrack) (res []Track, next []MissingTrack, err error)
func JoinMissingTracks ¶
func JoinMissingTracks(missing []MissingTrack) (st string)
func TagListParser ¶
Types ¶
type Media ¶
type Media struct {
Transcodings []Transcoding `json:"transcodings"`
}
func (Media) SelectCompatible ¶
func (m Media) SelectCompatible(mode string, opus bool) (*Transcoding, string)
type MissingTrack ¶
type Paginated ¶
type Paginated[T any] struct { Collection []T `json:"collection"` Total int64 `json:"total_results"` Next string `json:"next_href"` }
func GetFeaturedTracks ¶
func GetSelections ¶
func RecentTracks ¶
func SearchPlaylists ¶
func SearchTracks ¶
func SearchUsers ¶
type Playlist ¶
type Playlist struct { Artwork string `json:"artwork_url"` CreatedAt string `json:"created_at"` Description string `json:"description"` Kind string `json:"kind"` // should always be "playlist"! LastModified string `json:"last_modified"` Likes int64 `json:"likes_count"` Permalink string `json:"permalink"` //ReleaseDate string `json:"release_date"` TagList string `json:"tag_list"` Title string `json:"title"` Type string `json:"set_type"` Album bool `json:"is_album"` Author User `json:"user"` Tracks []Track `json:"tracks"` TrackCount int64 `json:"track_count"` MissingTracks string `json:"-"` }
func (Playlist) FormatDescription ¶
func (*Playlist) GetMissingTracks ¶
type Repost ¶
type Repost struct { Type RepostType Track *Track // type == track-report Playlist *Playlist // type == playlist-repost }
not worthy of its own file
func (Repost) Fix ¶
func (r Repost) Fix(prefs cfg.Preferences)
type RepostType ¶
type RepostType string
const ( TrackRepost RepostType = "track-repost" PlaylistRepost RepostType = "playlist-repost" )
type Selection ¶
type Selection struct { Title string `json:"title"` Kind string `json:"kind"` // should always be "selection"! Items Paginated[*Playlist] `json:"items"` // ?? why }
func (*Selection) Fix ¶
func (s *Selection) Fix(prefs cfg.Preferences)
type Track ¶
type Track struct { Artwork string `json:"artwork_url"` Comments int `json:"comment_count"` CreatedAt string `json:"created_at"` Description string `json:"description"` //Duration int `json:"duration"` // there are duration and full_duration fields wtf does that mean Genre string `json:"genre"` Kind string `json:"kind"` // should always be "track"! LastModified string `json:"last_modified"` License string `json:"license"` Likes int64 `json:"likes_count"` Permalink string `json:"permalink"` Played int64 `json:"playback_count"` Reposted int64 `json:"reposts_count"` TagList string `json:"tag_list"` Title string `json:"title"` ID json.Number `json:"id"` Media Media `json:"media"` Authorization string `json:"track_authorization"` Author User `json:"user"` Policy TrackPolicy `json:"policy"` }
func GetArbitraryTrack ¶
Currently supports: http/https links: - api.soundcloud.com/tracks/<id> (api-v2 subdomain also supported) - soundcloud.com/<user>/<track>
plain permalink/id: - <user>/<track> - <id>
func GetNextMissingTracks ¶
func (Track) FormatDescription ¶
func (*Track) GetPlaylists ¶
func (*Track) GetRelated ¶
type TrackPolicy ¶
type TrackPolicy string
const ( PolicyBlock TrackPolicy = "BLOCK" // not available (in your country) PolicySnip TrackPolicy = "SNIP" // 30-second snippet available PolicyAllow TrackPolicy = "ALLOW" // all good )
type Transcoding ¶
type Transcoding struct { URL string `json:"url"` Preset string `json:"preset"` Format Format `json:"format"` Quality string `json:"quality"` }
func (Transcoding) GetStream ¶
func (tr Transcoding) GetStream(cid string, prefs cfg.Preferences, authorization string) (string, error)
type User ¶
type User struct { Avatar string `json:"avatar_url"` CreatedAt string `json:"created_at"` Description string `json:"description"` Followers int64 `json:"followers_count"` Following int64 `json:"followings_count"` FullName string `json:"full_name"` Kind string `json:"kind"` // should always be "user"! LastModified string `json:"last_modified"` Liked int64 `json:"likes_count"` Permalink string `json:"permalink"` Playlists int64 `json:"playlist_count"` Tracks int64 `json:"track_count"` ID json.Number `json:"id"` Username string `json:"username"` Verified bool `json:"verified"` WebProfiles []Link }
func (User) FormatDescription ¶
func (User) FormatUsername ¶
func (User) GetFollowers ¶
func (User) GetFollowing ¶
func (User) GetPlaylists ¶
func (*User) GetRelated ¶
func (User) GetReposts ¶
func (*User) GetTopTracks ¶
func (*User) GetWebProfiles ¶
func (*User) Postfix ¶
func (u *User) Postfix(prefs cfg.Preferences)
Click to show internal directories.
Click to hide internal directories.