added stuff, broke some other stuff, made admin auth!

Signed-off-by: ari melody <ari@arimelody.me>
This commit is contained in:
ari melody 2024-07-31 04:09:22 +01:00
parent 0d1e694b59
commit 5631c4bd87
26 changed files with 1615 additions and 1401 deletions

View file

@ -1,33 +1,37 @@
package music
import (
"fmt"
"time"
"errors"
"fmt"
"time"
)
var Releases []*MusicRelease;
var Artists []*Artist;
func make_date_work(date string) time.Time {
res, err := time.Parse("2-Jan-2006", date)
if err != nil {
fmt.Printf("somehow we failed to parse %s! falling back to epoch :]\n", date)
return time.Unix(0, 0)
res, err := time.Parse("2-Jan-2006", date)
if err != nil {
fmt.Printf("somehow we failed to parse %s! falling back to epoch :]\n", date)
return time.Unix(0, 0)
}
return res
}
func GetRelease(id string) (*MusicRelease, error) {
for _, release := range Releases {
if release.Id == id {
return release, nil
}
return res
}
return nil, errors.New(fmt.Sprintf("Release %s not found", id))
}
func GetRelease(id string) (MusicRelease, bool) {
for _, album := range placeholders {
if album.Id == id {
return album, true
}
func GetArtist(id string) (*Artist, error) {
for _, artist := range Artists {
if artist.Id == id {
return artist, nil
}
return MusicRelease{}, false
}
return nil, errors.New(fmt.Sprintf("Artist %s not found", id))
}
func QueryAllMusic() ([]MusicRelease) {
return placeholders
}
func QueryAllArtists() ([]Artist) {
return []Artist{ ari, mellodoot, zaire, mae, loudar, red }
}