diff --git a/backend/mediaprovider/jellyfin/jellyfinmediaprovider.go b/backend/mediaprovider/jellyfin/jellyfinmediaprovider.go index 48c091f..bf49c60 100644 --- a/backend/mediaprovider/jellyfin/jellyfinmediaprovider.go +++ b/backend/mediaprovider/jellyfin/jellyfinmediaprovider.go @@ -449,6 +449,16 @@ func toTrack(ch *jellyfin.Song) *mediaprovider.Track { t.FilePath = ch.MediaSources[0].Path t.Size = int64(ch.MediaSources[0].Size) t.BitRate = ch.MediaSources[0].Bitrate / 1000 + if strs := ch.MediaSources[0].MediaStreams; len(strs) > 0 { + t.SampleRate = strs[0].SampleRate + t.BitDepth = strs[0].BitDepth + t.Channels = strs[0].Channels + } + } + if len(ch.MediaStreams) > 0 { + t.SampleRate = max(t.SampleRate, ch.MediaStreams[0].SampleRate) + t.BitDepth = max(t.BitDepth, ch.MediaStreams[0].BitDepth) + t.Channels = max(t.Channels, ch.MediaStreams[0].Channels) } return t } diff --git a/backend/mediaprovider/model.go b/backend/mediaprovider/model.go index 626ea62..809e9ec 100644 --- a/backend/mediaprovider/model.go +++ b/backend/mediaprovider/model.go @@ -149,6 +149,9 @@ type Track struct { Comment string BPM int ReplayGain ReplayGainInfo + SampleRate int + BitDepth int + Channels int } type ReplayGainInfo struct { diff --git a/backend/mediaprovider/subsonic/subsonicmediaprovider.go b/backend/mediaprovider/subsonic/subsonicmediaprovider.go index c3bf658..478ac5a 100644 --- a/backend/mediaprovider/subsonic/subsonicmediaprovider.go +++ b/backend/mediaprovider/subsonic/subsonicmediaprovider.go @@ -573,6 +573,9 @@ func toTrack(ch *subsonic.Child) *mediaprovider.Track { Comment: ch.Comment, BPM: ch.BPM, ReplayGain: rGain, + SampleRate: ch.SamplingRate, + BitDepth: ch.BitDepth, + Channels: ch.ChannelCount, } } diff --git a/go.mod b/go.mod index f26226d..9a13fcd 100644 --- a/go.mod +++ b/go.mod @@ -10,7 +10,7 @@ require ( github.com/deluan/sanitize v0.0.0-20230310221930-6e18967d9fc1 github.com/dweymouth/fyne-advanced-list v0.0.0-20250211191927-58ea85eec72c github.com/dweymouth/fyne-tooltip v0.3.0 - github.com/dweymouth/go-jellyfin v0.0.0-20250716005557-0ea2becece1f + github.com/dweymouth/go-jellyfin v0.0.0-20250808023725-196437af15a6 github.com/go-audio/audio v1.0.0 github.com/go-audio/wav v1.1.0 github.com/godbus/dbus/v5 v5.1.0 diff --git a/go.sum b/go.sum index fbd0355..21a9689 100644 --- a/go.sum +++ b/go.sum @@ -25,6 +25,8 @@ github.com/dweymouth/fyne/v2 v2.3.0-rc1.0.20250712002006-5064d705dac4 h1:Q3r94Ac github.com/dweymouth/fyne/v2 v2.3.0-rc1.0.20250712002006-5064d705dac4/go.mod h1:YZt7SksjvrSNJCwbWFV32WON3mE1Sr7L41D29qMZ/lU= github.com/dweymouth/go-jellyfin v0.0.0-20250716005557-0ea2becece1f h1:QsKPwFpTHuYHEEuhvp4VBClkHh00bNNgQ/2Ij1bkk8M= github.com/dweymouth/go-jellyfin v0.0.0-20250716005557-0ea2becece1f/go.mod h1:fcUagHBaQnt06GmBAllNE0J4O/7064zXRWdqnTTtVjI= +github.com/dweymouth/go-jellyfin v0.0.0-20250808023725-196437af15a6 h1:IFewD1zMs7eWkqmzdGeQP9lavYboJHwGqm1oOa7wZC8= +github.com/dweymouth/go-jellyfin v0.0.0-20250808023725-196437af15a6/go.mod h1:fcUagHBaQnt06GmBAllNE0J4O/7064zXRWdqnTTtVjI= github.com/dweymouth/go-wav v0.0.0-20250719173115-e60429a83eb0 h1:mYcctuWgVArHhSLJxndlUM43C3hoE18BLDBkXKM2tl0= github.com/dweymouth/go-wav v0.0.0-20250719173115-e60429a83eb0/go.mod h1:bp2870jtp/ixAJLIOdShBfl1WpyLGDZ57jnVWMgkgIc= github.com/fatih/color v1.16.0 h1:zmkK9Ngbjj+K0yRhTVONQh1p/HknKYSlNT+vZCzyokM= diff --git a/res/translations/en.json b/res/translations/en.json index 1170cff..48865af 100644 --- a/res/translations/en.json +++ b/res/translations/en.json @@ -38,12 +38,14 @@ "Autoplay": "Autoplay", "Autoselect device": "Autoselect device", "Back": "Back", + "Bit depth": "Bit depth", "Bit rate": "Bit rate", "Bold font": "Bold font", "BPM": "BPM", "Broadcast": "Broadcast", "Cancel": "Cancel", "Cast to device": "Cast to device", + "Channels": "Channels", "Check for Updates": "Check for Updates", "Close": "Close", "Close to system tray": "Close to system tray", @@ -175,6 +177,7 @@ "ReplayGain mode": "ReplayGain mode", "ReplayGain preamp": "ReplayGain preamp", "Restart required": "Restart required", + "Sample rate": "Sample rate", "Save play queue on exit": "Save play queue on exit", "Saved at": "Saved at", "Scrobble when": "Scrobble when", diff --git a/ui/dialogs/trackinfodialog.go b/ui/dialogs/trackinfodialog.go index f4d7205..3002522 100644 --- a/ui/dialogs/trackinfodialog.go +++ b/ui/dialogs/trackinfodialog.go @@ -105,6 +105,15 @@ func (t *TrackInfoDialog) CreateRenderer() fyne.WidgetRenderer { addFormRow(c, lang.L("Content type"), t.track.ContentType) addFormRow(c, lang.L("Bit rate"), fmt.Sprintf("%d kbps", t.track.BitRate)) + if t.track.SampleRate > 0 { + addFormRow(c, lang.L("Sample rate"), fmt.Sprintf("%d Hz", t.track.SampleRate)) + } + if t.track.BitDepth > 0 { + addFormRow(c, lang.L("Bit depth"), strconv.Itoa(t.track.BitDepth)) + } + if t.track.Channels > 0 { + addFormRow(c, lang.L("Channels"), strconv.Itoa(t.track.Channels)) + } addFormRow(c, lang.L("File size"), util.BytesToSizeString(t.track.Size)) addFormRow(c, lang.L("Play count"), strconv.Itoa(t.track.PlayCount))