show full OpenSubsonic date where available

This commit is contained in:
Drew Weymouth
2024-12-23 17:23:26 -08:00
parent 37f678e5f3
commit ff3b1addf8
8 changed files with 108 additions and 20 deletions
+3 -4
View File
@@ -3,7 +3,6 @@ package browsing
import (
"fmt"
"log"
"strconv"
"github.com/dweymouth/supersonic/backend"
"github.com/dweymouth/supersonic/backend/mediaprovider"
@@ -370,9 +369,9 @@ func formatMiscLabelStr(a *mediaprovider.AlbumWithTracks) string {
if a.TrackCount == 1 {
tracks = lang.L("track")
}
yearStr := strconv.Itoa(a.Year)
if a.ReissueYear > a.Year {
yearStr += fmt.Sprintf(" (%s %d)", lang.L("reissued"), a.ReissueYear)
yearStr := util.FormatItemDate(a.Date)
if y := a.ReissueDate.Year; y != nil && *y > a.YearOrZero() {
yearStr += fmt.Sprintf(" (%s %d)", lang.L("reissued"), util.FormatItemDate(a.ReissueDate))
}
return fmt.Sprintf("%s · %d %s · %s%s", yearStr, a.TrackCount, tracks, discs, util.SecondsToTimeString(float64(a.Duration)))
}
+3 -3
View File
@@ -203,12 +203,12 @@ func (a *ArtistPage) getGridViewAlbumsModel() []widgets.GridViewItemModel {
return nil
}
sortFunc := func(x, y int) bool {
return a.artistInfo.Albums[x].Year < a.artistInfo.Albums[y].Year
return a.artistInfo.Albums[x].YearOrZero() < a.artistInfo.Albums[y].YearOrZero()
}
switch a.cfg.DiscographySort {
case discographySorts[1]: /*year descending*/
sortFunc = func(x, y int) bool {
return a.artistInfo.Albums[x].Year > a.artistInfo.Albums[y].Year
return a.artistInfo.Albums[x].YearOrZero() > a.artistInfo.Albums[y].YearOrZero()
}
case discographySorts[2]: /*name*/
sortFunc = func(x, y int) bool {
@@ -222,7 +222,7 @@ func (a *ArtistPage) getGridViewAlbumsModel() []widgets.GridViewItemModel {
Name: al.Name,
ID: al.ID,
CoverArtID: al.CoverArtID,
Secondary: []string{strconv.Itoa(al.Year)},
Secondary: []string{strconv.Itoa(al.YearOrZero())},
}
})
}