add scrobbling for Jellyfin

This commit is contained in:
Drew Weymouth
2023-11-14 18:08:55 -08:00
parent b7f54054d8
commit 2ffcac9b88
6 changed files with 73 additions and 25 deletions
+1 -1
View File
@@ -461,7 +461,7 @@ func (c *Controller) ShowSettingsDialog(themeUpdateCallbk func(), themeFiles map
}
bands := c.App.Player.Equalizer().BandFrequencies()
dlg := dialogs.NewSettingsDialog(c.App.Config, devs, themeFiles, bands, c.MainWindow)
dlg := dialogs.NewSettingsDialog(c.App.Config, devs, themeFiles, bands, c.App.ServerManager.Server.ClientDecidesScrobble(), c.MainWindow)
dlg.OnReplayGainSettingsChanged = func() {
c.App.PlaybackManager.SetReplayGainOptions(c.App.Config.ReplayGain)
}
+16 -5
View File
@@ -43,6 +43,8 @@ type SettingsDialog struct {
themeFiles map[string]string // filename -> displayName
promptText *widget.RichText
clientDecidesScrobble bool
content fyne.CanvasObject
}
@@ -52,9 +54,10 @@ func NewSettingsDialog(
audioDeviceList []player.AudioDevice,
themeFileList map[string]string,
equalizerBands []string,
clientDecidesScrobble bool,
window fyne.Window,
) *SettingsDialog {
s := &SettingsDialog{config: config, audioDevices: audioDeviceList, themeFiles: themeFileList}
s := &SettingsDialog{config: config, audioDevices: audioDeviceList, themeFiles: themeFileList, clientDecidesScrobble: clientDecidesScrobble}
s.ExtendBaseWidget(s)
tabs := container.NewAppTabs(
@@ -188,7 +191,9 @@ func (s *SettingsDialog) createGeneralTab() *container.TabItem {
durationEntry.Disable()
} else {
durationEntry.Text = lastScrobbleText
durationEntry.Enable()
if s.clientDecidesScrobble {
durationEntry.Enable()
}
durationEntry.Refresh()
durationEntry.OnChanged(durationEntry.Text)
}
@@ -197,6 +202,10 @@ func (s *SettingsDialog) createGeneralTab() *container.TabItem {
if !s.config.Scrobbling.Enabled {
durationEnabled.Disable()
}
if !s.clientDecidesScrobble {
percentEntry.Disable()
durationEnabled.Disable()
}
scrobbleEnabled := widget.NewCheck("Send playback statistics to server", func(checked bool) {
s.config.Scrobbling.Enabled = checked
@@ -205,9 +214,11 @@ func (s *SettingsDialog) createGeneralTab() *container.TabItem {
durationEnabled.Disable()
durationEntry.Disable()
} else {
percentEntry.Enable()
durationEnabled.Enable()
if durationEnabled.Checked {
if s.clientDecidesScrobble {
percentEntry.Enable()
durationEnabled.Enable()
}
if durationEnabled.Checked && s.clientDecidesScrobble {
durationEntry.Enable()
}
}