104 lines
1.6 KiB
Go
104 lines
1.6 KiB
Go
package metadata
|
|
|
|
import (
|
|
"git.gammaspectra.live/S.O.N.G/METANOIA/utilities"
|
|
"time"
|
|
)
|
|
|
|
type Album struct {
|
|
License License
|
|
SourceUniqueIdentifier string
|
|
Name NameSlice
|
|
Roles RoleSlice
|
|
Art NameSlice
|
|
Identifiers NameSlice
|
|
Tags NameSlice
|
|
Links []Link
|
|
Discs []Disc
|
|
ReleaseDate time.Time
|
|
}
|
|
|
|
func (n *Album) Normalize() {
|
|
n.Name.Normalize()
|
|
n.Identifiers.Normalize()
|
|
n.Roles.Normalize()
|
|
n.Art.Normalize()
|
|
n.Tags.Normalize()
|
|
for i := range n.Discs {
|
|
n.Discs[i].Normalize()
|
|
}
|
|
}
|
|
|
|
type Disc struct {
|
|
Name NameSlice
|
|
Identifiers NameSlice
|
|
Links []Link
|
|
Tracks []Track
|
|
}
|
|
|
|
func (n *Disc) Normalize() {
|
|
n.Name.Normalize()
|
|
n.Identifiers.Normalize()
|
|
for i := range n.Tracks {
|
|
n.Tracks[i].Normalize()
|
|
}
|
|
}
|
|
|
|
type Track struct {
|
|
Name NameSlice
|
|
Roles RoleSlice
|
|
Links []Link
|
|
Duration time.Duration
|
|
Lyrics LyricGetter
|
|
}
|
|
|
|
func (n *Track) Normalize() {
|
|
n.Name.Normalize()
|
|
n.Roles.Normalize()
|
|
}
|
|
|
|
type RoleSlice []Role
|
|
|
|
func (s RoleSlice) Normalize() {
|
|
for i := range s {
|
|
s[i].Normalize()
|
|
}
|
|
}
|
|
|
|
type Role struct {
|
|
Kind string
|
|
Name NameSlice
|
|
Group string
|
|
}
|
|
|
|
func (n *Role) Normalize() {
|
|
n.Name.Normalize()
|
|
n.Group = utilities.NormalizeUnicode(n.Group)
|
|
}
|
|
|
|
type Link struct {
|
|
Kind string
|
|
Name NameSlice
|
|
}
|
|
|
|
func (n *Link) Normalize() {
|
|
n.Name.Normalize()
|
|
}
|
|
|
|
type NameSlice []Name
|
|
|
|
func (s NameSlice) Normalize() {
|
|
for i := range s {
|
|
s[i].Normalize()
|
|
}
|
|
}
|
|
|
|
type Name struct {
|
|
Kind string
|
|
Name string
|
|
}
|
|
|
|
func (n *Name) Normalize() {
|
|
n.Name = utilities.NormalizeUnicode(n.Name)
|
|
}
|