Fix #668: Add sample rate, bit depth, channels to track info dialog
This commit is contained in:
@@ -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
|
||||
}
|
||||
|
||||
@@ -149,6 +149,9 @@ type Track struct {
|
||||
Comment string
|
||||
BPM int
|
||||
ReplayGain ReplayGainInfo
|
||||
SampleRate int
|
||||
BitDepth int
|
||||
Channels int
|
||||
}
|
||||
|
||||
type ReplayGainInfo struct {
|
||||
|
||||
@@ -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,
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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=
|
||||
|
||||
@@ -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",
|
||||
|
||||
@@ -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))
|
||||
|
||||
|
||||
Reference in New Issue
Block a user