mirror of
https://git.maid.zone/stuff/soundcloak.git
synced 2026-03-22 00:28:12 +05:00
39 lines
848 B
Go
39 lines
848 B
Go
package sc
|
|
|
|
import (
|
|
"git.maid.zone/stuff/soundcloak/lib/cfg"
|
|
)
|
|
|
|
// Functions/structures related to featured/suggested content
|
|
|
|
type Selection struct {
|
|
Title string `json:"title"`
|
|
Kind string `json:"kind"` // should always be "selection"!
|
|
Items Paginated[*UserPlaylistTrack] `json:"items"` // ?? why
|
|
}
|
|
|
|
func GetSelections(cid string, prefs cfg.Preferences) (*Paginated[*Selection], error) {
|
|
uri := baseUri()
|
|
uri.SetPath("/mixed-selections")
|
|
uri.QueryArgs().Set("limit", "20")
|
|
|
|
// There is no pagination
|
|
p := Paginated[*Selection]{Next: uri}
|
|
err := p.Proceed(cid, false)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
|
|
for _, t := range p.Collection {
|
|
t.Fix(prefs)
|
|
}
|
|
|
|
return &p, nil
|
|
}
|
|
|
|
func (s *Selection) Fix(prefs cfg.Preferences) {
|
|
for _, p := range s.Items.Collection {
|
|
p.Fix(prefs)
|
|
}
|
|
}
|