feat(subsonic): expose album isCompilation and releaseTypes
This commit is contained in:
No files matched your search
@@ -5,6 +5,7 @@ import (
|
||||
"regexp"
|
||||
"strings"
|
||||
"time"
|
||||
"unicode"
|
||||
|
||||
"go.senan.xyz/gonic"
|
||||
"go.senan.xyz/gonic/server/ctrlsubsonic/specid"
|
||||
@@ -150,6 +151,9 @@ type Album struct {
|
||||
Year int `xml:"year,attr,omitempty" json:"year,omitempty"`
|
||||
Tracks []*TrackChild `xml:"song,omitempty" json:"song,omitempty"`
|
||||
|
||||
IsCompilation bool `xml:"isCompilation" json:"isCompilation"`
|
||||
ReleaseTypes []string `xml:"releaseTypes" json:"releaseTypes"`
|
||||
|
||||
// star / rating
|
||||
Starred *time.Time `xml:"starred,attr,omitempty" json:"starred,omitempty"`
|
||||
UserRating int `xml:"userRating,attr,omitempty" json:"userRating,omitempty"`
|
||||
@@ -488,6 +492,25 @@ func formatExt(ext string) string {
|
||||
return strings.TrimPrefix(ext, ".")
|
||||
}
|
||||
|
||||
func formatReleaseTypes(types string) []string {
|
||||
parts := strings.Split(types, ",")
|
||||
if len(parts) == 0 {
|
||||
return []string{}
|
||||
}
|
||||
for i, part := range parts {
|
||||
part = strings.TrimSpace(part)
|
||||
if len(part) == 0 {
|
||||
continue
|
||||
}
|
||||
part = string(unicode.ToUpper([]rune(part)[0])) + string([]rune(part)[1:])
|
||||
if part == "Ep" {
|
||||
part = "EP"
|
||||
}
|
||||
parts[i] = part
|
||||
}
|
||||
return parts
|
||||
}
|
||||
|
||||
var doublePuncExpr = regexp.MustCompile(`\.\s+\.\s+`)
|
||||
var licenceExpr = regexp.MustCompile(`(?i)\buser-contributed text.*`)
|
||||
var readMoreExpr = regexp.MustCompile(`(?i)\bread more on.*`)
|
||||
|
||||
Reference in New Issue
Block a user