mirror of
https://git.maid.zone/stuff/soundcloak.git
synced 2025-12-10 13:49:39 +05:00
34 lines
815 B
Go
34 lines
815 B
Go
package sc
|
|
|
|
import "git.maid.zone/stuff/soundcloak/lib/cfg"
|
|
|
|
// Functions/structions related to featured/suggested content
|
|
|
|
type Selection struct {
|
|
Title string `json:"title"`
|
|
Kind string `json:"kind"` // should always be "selection"!
|
|
Items Paginated[*Playlist] `json:"items"` // ?? why
|
|
}
|
|
|
|
func GetSelections(cid string, prefs cfg.Preferences) (*Paginated[*Selection], error) {
|
|
// There is no pagination
|
|
p := Paginated[*Selection]{Next: "https://" + api + "/mixed-selections?limit=20"}
|
|
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("", false, false)
|
|
p.Postfix(prefs, false, false)
|
|
}
|
|
}
|