Closes #351: show reissue year in album page header

This commit is contained in:
Drew Weymouth
2024-03-31 08:26:54 -07:00
parent 0c03ac87a1
commit d5f0971aa2
5 changed files with 20 additions and 5 deletions
+1
View File
@@ -38,6 +38,7 @@ type Album struct {
ArtistIDs []string ArtistIDs []string
ArtistNames []string ArtistNames []string
Year int Year int
ReissueYear int
Genres []string Genres []string
TrackCount int TrackCount int
Favorite bool Favorite bool
@@ -451,13 +451,22 @@ func fillAlbum(subAlbum *subsonic.AlbumID3, album *mediaprovider.Album) {
genres = append(genres, subAlbum.Genre) genres = append(genres, subAlbum.Genre)
} }
album.Year = subAlbum.Year
if subAlbum.OriginalReleaseDate != nil &&
subAlbum.OriginalReleaseDate.Year != nil &&
*subAlbum.OriginalReleaseDate.Year < subAlbum.Year {
album.Year = *subAlbum.OriginalReleaseDate.Year
}
if subAlbum.ReleaseDate != nil && subAlbum.ReleaseDate.Year != nil {
album.ReissueYear = *subAlbum.ReleaseDate.Year
}
album.ID = subAlbum.ID album.ID = subAlbum.ID
album.CoverArtID = subAlbum.CoverArt album.CoverArtID = subAlbum.CoverArt
album.Name = subAlbum.Name album.Name = subAlbum.Name
album.Duration = subAlbum.Duration album.Duration = subAlbum.Duration
album.ArtistIDs = artistIDs album.ArtistIDs = artistIDs
album.ArtistNames = artistNames album.ArtistNames = artistNames
album.Year = subAlbum.Year
album.TrackCount = subAlbum.SongCount album.TrackCount = subAlbum.SongCount
album.Genres = genres album.Genres = genres
album.Favorite = !subAlbum.Starred.IsZero() album.Favorite = !subAlbum.Starred.IsZero()
+1 -1
View File
@@ -8,7 +8,7 @@ require (
github.com/deluan/sanitize v0.0.0-20230310221930-6e18967d9fc1 github.com/deluan/sanitize v0.0.0-20230310221930-6e18967d9fc1
github.com/dweymouth/go-jellyfin v0.0.0-20240330010648-fb02c0b3878e github.com/dweymouth/go-jellyfin v0.0.0-20240330010648-fb02c0b3878e
github.com/dweymouth/go-mpv v0.0.0-20230406003141-7f1858e503ee github.com/dweymouth/go-mpv v0.0.0-20230406003141-7f1858e503ee
github.com/dweymouth/go-subsonic v0.0.0-20240305034202-6193dca1c9de github.com/dweymouth/go-subsonic v0.0.0-20240331151503-47a6f310eb73
github.com/fsnotify/fsnotify v1.6.0 github.com/fsnotify/fsnotify v1.6.0
github.com/godbus/dbus/v5 v5.1.0 github.com/godbus/dbus/v5 v5.1.0
github.com/google/uuid v1.3.0 github.com/google/uuid v1.3.0
+2 -2
View File
@@ -75,8 +75,8 @@ github.com/dweymouth/go-jellyfin v0.0.0-20240330010648-fb02c0b3878e h1:89N7tfmGP
github.com/dweymouth/go-jellyfin v0.0.0-20240330010648-fb02c0b3878e/go.mod h1:fcUagHBaQnt06GmBAllNE0J4O/7064zXRWdqnTTtVjI= github.com/dweymouth/go-jellyfin v0.0.0-20240330010648-fb02c0b3878e/go.mod h1:fcUagHBaQnt06GmBAllNE0J4O/7064zXRWdqnTTtVjI=
github.com/dweymouth/go-mpv v0.0.0-20230406003141-7f1858e503ee h1:ZGyJ6wp7CAfT31BugypcF/TPKEy2RrGR9JFq1JOjOpY= github.com/dweymouth/go-mpv v0.0.0-20230406003141-7f1858e503ee h1:ZGyJ6wp7CAfT31BugypcF/TPKEy2RrGR9JFq1JOjOpY=
github.com/dweymouth/go-mpv v0.0.0-20230406003141-7f1858e503ee/go.mod h1:Ov0ieN90M7i+0k3OxhA/g1dozGs+UcPHDsMKqPgRDk0= github.com/dweymouth/go-mpv v0.0.0-20230406003141-7f1858e503ee/go.mod h1:Ov0ieN90M7i+0k3OxhA/g1dozGs+UcPHDsMKqPgRDk0=
github.com/dweymouth/go-subsonic v0.0.0-20240305034202-6193dca1c9de h1:RVYHvjT01YSLphWlTA/uaGtfVp2x6/4UfOIYYp9vMis= github.com/dweymouth/go-subsonic v0.0.0-20240331151503-47a6f310eb73 h1:uSy9D1HzfY7Y2Ifat14WIDSkWRhbyo57fPsqdM1XMUA=
github.com/dweymouth/go-subsonic v0.0.0-20240305034202-6193dca1c9de/go.mod h1:OWtcumdQsan8uM6wmx6PqKhldaCthH10CQ+vb+94kzo= github.com/dweymouth/go-subsonic v0.0.0-20240331151503-47a6f310eb73/go.mod h1:OWtcumdQsan8uM6wmx6PqKhldaCthH10CQ+vb+94kzo=
github.com/envoyproxy/go-control-plane v0.9.0/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4= github.com/envoyproxy/go-control-plane v0.9.0/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4=
github.com/envoyproxy/go-control-plane v0.9.1-0.20191026205805-5f8ba28d4473/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4= github.com/envoyproxy/go-control-plane v0.9.1-0.20191026205805-5f8ba28d4473/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4=
github.com/envoyproxy/go-control-plane v0.9.4/go.mod h1:6rpuAdCZL397s3pYoYcLgu1mIlRU8Am5FuJP05cCM98= github.com/envoyproxy/go-control-plane v0.9.4/go.mod h1:6rpuAdCZL397s3pYoYcLgu1mIlRU8Am5FuJP05cCM98=
+6 -1
View File
@@ -3,6 +3,7 @@ package browsing
import ( import (
"fmt" "fmt"
"log" "log"
"strconv"
"github.com/dweymouth/supersonic/backend" "github.com/dweymouth/supersonic/backend"
"github.com/dweymouth/supersonic/backend/mediaprovider" "github.com/dweymouth/supersonic/backend/mediaprovider"
@@ -362,7 +363,11 @@ func formatMiscLabelStr(a *mediaprovider.AlbumWithTracks) string {
if a.TrackCount == 1 { if a.TrackCount == 1 {
tracks = "track" tracks = "track"
} }
return fmt.Sprintf("%d · %d %s · %s%s", a.Year, a.TrackCount, tracks, discs, util.SecondsToTimeString(float64(a.Duration))) yearStr := strconv.Itoa(a.Year)
if a.ReissueYear > a.Year {
yearStr += fmt.Sprintf(" (reissued %d)", a.ReissueYear)
}
return fmt.Sprintf("%s · %d %s · %s%s", yearStr, a.TrackCount, tracks, discs, util.SecondsToTimeString(float64(a.Duration)))
} }
func (s *albumPageState) Restore() Page { func (s *albumPageState) Restore() Page {