add support for /tags/:tag and other endpoints

This commit is contained in:
Laptop
2024-12-22 00:02:23 +02:00
parent bf22bbf13b
commit e4f6d7f608
6 changed files with 160 additions and 2 deletions

View File

@@ -466,3 +466,18 @@ func (t Track) DownloadImage() ([]byte, string, error) {
func (t Track) Href() string {
return "/" + t.Author.Permalink + "/" + t.Permalink
}
func RecentTracks(cid string, prefs cfg.Preferences, tag string, args string) (*Paginated[*Track], error) {
p := Paginated[*Track]{Next: "https://" + api + "/recent-tracks/" + tag + args}
err := p.Proceed(cid, true)
if err != nil {
return nil, err
}
for _, t := range p.Collection {
t.Fix(false, false)
t.Postfix(prefs, false)
}
return &p, nil
}