No files matched your search
@@ -20,7 +20,7 @@ func NewAlbumByFolder(f *db.Album) *Album {
|
|||||||
TrackCount: f.ChildCount,
|
TrackCount: f.ChildCount,
|
||||||
Duration: f.Duration,
|
Duration: f.Duration,
|
||||||
Created: f.CreatedAt,
|
Created: f.CreatedAt,
|
||||||
AverageRating: formatRating(f.AverageRating),
|
AverageRating: f.AverageRating,
|
||||||
ReleaseTypes: []string{},
|
ReleaseTypes: []string{},
|
||||||
}
|
}
|
||||||
if f.AlbumStar != nil {
|
if f.AlbumStar != nil {
|
||||||
@@ -44,7 +44,7 @@ func NewTCAlbumByFolder(f *db.Album) *TrackChild {
|
|||||||
Title: f.RightPath,
|
Title: f.RightPath,
|
||||||
ParentID: f.ParentSID(),
|
ParentID: f.ParentSID(),
|
||||||
CreatedAt: f.CreatedAt,
|
CreatedAt: f.CreatedAt,
|
||||||
AverageRating: formatRating(f.AverageRating),
|
AverageRating: f.AverageRating,
|
||||||
Year: f.TagYear,
|
Year: f.TagYear,
|
||||||
}
|
}
|
||||||
if f.AlbumStar != nil {
|
if f.AlbumStar != nil {
|
||||||
@@ -84,7 +84,7 @@ func NewTCTrackByFolder(t *db.Track, parent *db.Album) *TrackChild {
|
|||||||
Type: "music",
|
Type: "music",
|
||||||
MusicBrainzID: t.TagBrainzID,
|
MusicBrainzID: t.TagBrainzID,
|
||||||
CreatedAt: t.CreatedAt,
|
CreatedAt: t.CreatedAt,
|
||||||
AverageRating: formatRating(t.AverageRating),
|
AverageRating: t.AverageRating,
|
||||||
Year: t.TagYear,
|
Year: t.TagYear,
|
||||||
}
|
}
|
||||||
if trCh.Title == "" {
|
if trCh.Title == "" {
|
||||||
@@ -170,7 +170,7 @@ func NewArtistByFolder(f *db.Album) *Artist {
|
|||||||
ID: f.SID(),
|
ID: f.SID(),
|
||||||
Name: f.RightPath,
|
Name: f.RightPath,
|
||||||
AlbumCount: f.ChildCount,
|
AlbumCount: f.ChildCount,
|
||||||
AverageRating: formatRating(f.AverageRating),
|
AverageRating: f.AverageRating,
|
||||||
}
|
}
|
||||||
if f.AlbumStar != nil {
|
if f.AlbumStar != nil {
|
||||||
a.Starred = &f.AlbumStar.StarDate
|
a.Starred = &f.AlbumStar.StarDate
|
||||||
@@ -192,7 +192,7 @@ func NewDirectoryByFolder(f *db.Album, children []*TrackChild) *Directory {
|
|||||||
Name: f.RightPath,
|
Name: f.RightPath,
|
||||||
Children: children,
|
Children: children,
|
||||||
ParentID: f.ParentSID(),
|
ParentID: f.ParentSID(),
|
||||||
AverageRating: formatRating(f.AverageRating),
|
AverageRating: f.AverageRating,
|
||||||
}
|
}
|
||||||
if f.AlbumStar != nil {
|
if f.AlbumStar != nil {
|
||||||
d.Starred = &f.AlbumStar.StarDate
|
d.Starred = &f.AlbumStar.StarDate
|
||||||
|
|||||||
@@ -22,7 +22,7 @@ func NewAlbumByTags(a *db.Album, artists []*db.Artist) *Album {
|
|||||||
Genres: []*GenreRef{},
|
Genres: []*GenreRef{},
|
||||||
Year: a.TagYear,
|
Year: a.TagYear,
|
||||||
Tracks: []*TrackChild{},
|
Tracks: []*TrackChild{},
|
||||||
AverageRating: formatRating(a.AverageRating),
|
AverageRating: a.AverageRating,
|
||||||
IsCompilation: a.TagCompilation,
|
IsCompilation: a.TagCompilation,
|
||||||
ReleaseTypes: formatReleaseTypes(a.TagReleaseType),
|
ReleaseTypes: formatReleaseTypes(a.TagReleaseType),
|
||||||
DiscTitles: []*DiscTitle{},
|
DiscTitles: []*DiscTitle{},
|
||||||
@@ -97,7 +97,7 @@ func NewTrackByTags(t *db.Track, album *db.Album) *TrackChild {
|
|||||||
DiscNumber: t.TagDiscNumber,
|
DiscNumber: t.TagDiscNumber,
|
||||||
Type: "music",
|
Type: "music",
|
||||||
MusicBrainzID: t.TagBrainzID,
|
MusicBrainzID: t.TagBrainzID,
|
||||||
AverageRating: formatRating(t.AverageRating),
|
AverageRating: t.AverageRating,
|
||||||
TranscodeMeta: TranscodeMeta{},
|
TranscodeMeta: TranscodeMeta{},
|
||||||
Year: t.TagYear,
|
Year: t.TagYear,
|
||||||
}
|
}
|
||||||
@@ -162,7 +162,7 @@ func NewArtistByTags(a *db.Artist) *Artist {
|
|||||||
Name: a.Name,
|
Name: a.Name,
|
||||||
AlbumCount: a.AlbumCount,
|
AlbumCount: a.AlbumCount,
|
||||||
Albums: []*Album{},
|
Albums: []*Album{},
|
||||||
AverageRating: formatRating(a.AverageRating),
|
AverageRating: a.AverageRating,
|
||||||
}
|
}
|
||||||
if a.Info != nil && a.Info.ImageURL != "" {
|
if a.Info != nil && a.Info.ImageURL != "" {
|
||||||
r.CoverID = a.SID()
|
r.CoverID = a.SID()
|
||||||
|
|||||||
@@ -165,7 +165,7 @@ type Album struct {
|
|||||||
// star / rating
|
// star / rating
|
||||||
Starred *time.Time `xml:"starred,attr,omitempty" json:"starred,omitempty"`
|
Starred *time.Time `xml:"starred,attr,omitempty" json:"starred,omitempty"`
|
||||||
UserRating int `xml:"userRating,attr,omitempty" json:"userRating,omitempty"`
|
UserRating int `xml:"userRating,attr,omitempty" json:"userRating,omitempty"`
|
||||||
AverageRating string `xml:"averageRating,attr,omitempty" json:"averageRating,omitempty"`
|
AverageRating float64 `xml:"averageRating,attr,omitempty" json:"averageRating,omitempty"`
|
||||||
}
|
}
|
||||||
|
|
||||||
type RandomTracks struct {
|
type RandomTracks struct {
|
||||||
@@ -228,7 +228,7 @@ type TrackChild struct {
|
|||||||
// star / rating
|
// star / rating
|
||||||
Starred *time.Time `xml:"starred,attr,omitempty" json:"starred,omitempty"`
|
Starred *time.Time `xml:"starred,attr,omitempty" json:"starred,omitempty"`
|
||||||
UserRating int `xml:"userRating,attr,omitempty" json:"userRating,omitempty"`
|
UserRating int `xml:"userRating,attr,omitempty" json:"userRating,omitempty"`
|
||||||
AverageRating string `xml:"averageRating,attr,omitempty" json:"averageRating,omitempty"`
|
AverageRating float64 `xml:"averageRating,attr,omitempty" json:"averageRating,omitempty"`
|
||||||
|
|
||||||
ReplayGain *ReplayGain `xml:"replayGain" json:"replayGain"`
|
ReplayGain *ReplayGain `xml:"replayGain" json:"replayGain"`
|
||||||
|
|
||||||
@@ -249,7 +249,7 @@ type Artist struct {
|
|||||||
// star / rating
|
// star / rating
|
||||||
Starred *time.Time `xml:"starred,attr,omitempty" json:"starred,omitempty"`
|
Starred *time.Time `xml:"starred,attr,omitempty" json:"starred,omitempty"`
|
||||||
UserRating int `xml:"userRating,attr,omitempty" json:"userRating,omitempty"`
|
UserRating int `xml:"userRating,attr,omitempty" json:"userRating,omitempty"`
|
||||||
AverageRating string `xml:"averageRating,attr,omitempty" json:"averageRating,omitempty"`
|
AverageRating float64 `xml:"averageRating,attr,omitempty" json:"averageRating,omitempty"`
|
||||||
}
|
}
|
||||||
|
|
||||||
type Indexes struct {
|
type Indexes struct {
|
||||||
@@ -269,7 +269,7 @@ type Directory struct {
|
|||||||
Name string `xml:"name,attr,omitempty" json:"name"`
|
Name string `xml:"name,attr,omitempty" json:"name"`
|
||||||
Starred *time.Time `xml:"starred,attr,omitempty" json:"starred,omitempty"`
|
Starred *time.Time `xml:"starred,attr,omitempty" json:"starred,omitempty"`
|
||||||
UserRating int `xml:"userRating,attr,omitempty" json:"userRating,omitempty"`
|
UserRating int `xml:"userRating,attr,omitempty" json:"userRating,omitempty"`
|
||||||
AverageRating string `xml:"averageRating,attr,omitempty" json:"averageRating,omitempty"`
|
AverageRating float64 `xml:"averageRating,attr,omitempty" json:"averageRating,omitempty"`
|
||||||
Children []*TrackChild `xml:"child,omitempty" json:"child,omitempty"`
|
Children []*TrackChild `xml:"child,omitempty" json:"child,omitempty"`
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -507,13 +507,6 @@ type OpenSubsonicExtension struct {
|
|||||||
|
|
||||||
type OpenSubsonicExtensions []OpenSubsonicExtension
|
type OpenSubsonicExtensions []OpenSubsonicExtension
|
||||||
|
|
||||||
func formatRating(rating float64) string {
|
|
||||||
if rating == 0 {
|
|
||||||
return ""
|
|
||||||
}
|
|
||||||
return fmt.Sprintf("%.2f", rating)
|
|
||||||
}
|
|
||||||
|
|
||||||
func formatExt(ext string) string {
|
func formatExt(ext string) string {
|
||||||
return strings.TrimPrefix(ext, ".")
|
return strings.TrimPrefix(ext, ".")
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user