mirror of
https://github.com/AynaLivePlayer/AynaLivePlayer.git
synced 2025-12-06 18:32:50 +08:00
add usesysplaylist option
This commit is contained in:
@@ -58,7 +58,9 @@ func main() {
|
||||
global.EventManager.Start()
|
||||
}()
|
||||
gui.MainWindow.ShowAndRun()
|
||||
global.Logger.Info("closing internal server")
|
||||
internal.Stop()
|
||||
global.Logger.Infof("closing event manager")
|
||||
global.EventManager.Stop()
|
||||
if *dev {
|
||||
i18n.SaveTranslation()
|
||||
|
||||
@@ -52,6 +52,14 @@
|
||||
"en": "Basic",
|
||||
"zh-CN": "基础设置"
|
||||
},
|
||||
"gui.config.basic.use_system_playlist": {
|
||||
"en": "Play system playlist when no music",
|
||||
"zh-CN": "是否播放闲置歌单(实验性)"
|
||||
},
|
||||
"gui.config.basic.use_system_playlist.prompt": {
|
||||
"en": "Yes",
|
||||
"zh-CN": "是"
|
||||
},
|
||||
"gui.history.artist": {
|
||||
"en": "Artist",
|
||||
"zh-CN": "歌手"
|
||||
|
||||
@@ -124,6 +124,13 @@ func (b *bascicConfig) CreatePanel() fyne.CanvasObject {
|
||||
checkUpdateBtn := widget.NewButton(i18n.T("gui.config.basic.check_update"), func() {
|
||||
global.EventManager.CallA(events.CheckUpdateCmd, events.CheckUpdateCmdEvent{})
|
||||
})
|
||||
b.panel = container.NewVBox(randomPlaylist, skipWhenErr, outputDevice, checkUpdateBox, checkUpdateBtn)
|
||||
useSysPlaylistBtn := container.NewHBox(
|
||||
widget.NewLabel(i18n.T("gui.config.basic.use_system_playlist")),
|
||||
component.NewCheckOneWayBinding(
|
||||
i18n.T("gui.config.basic.use_system_playlist.prompt"),
|
||||
&config.General.UseSystemPlaylist,
|
||||
config.General.UseSystemPlaylist),
|
||||
)
|
||||
b.panel = container.NewVBox(randomPlaylist, useSysPlaylistBtn, skipWhenErr, outputDevice, checkUpdateBox, checkUpdateBtn)
|
||||
return b.panel
|
||||
}
|
||||
|
||||
@@ -79,15 +79,20 @@ func Initialize() {
|
||||
})
|
||||
|
||||
checkUpdate()
|
||||
MainWindow.SetFixedSize(true)
|
||||
MainWindow.SetFixedSize(config.General.FixedSize)
|
||||
if config.General.ShowSystemTray {
|
||||
setupSysTray()
|
||||
} else {
|
||||
MainWindow.SetCloseIntercept(
|
||||
func() {
|
||||
// save twice i don;t care
|
||||
// todo: save twice i don;t care
|
||||
_ = config.SaveToConfigFile(config.ConfigPath)
|
||||
MainWindow.Close()
|
||||
})
|
||||
}
|
||||
MainWindow.SetOnClosed(func() {
|
||||
if playerWindow != nil {
|
||||
playerWindow.Close()
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
@@ -65,13 +65,17 @@ func handlePlayNext() {
|
||||
events.PlaylistNextCmdEvent{
|
||||
Remove: true,
|
||||
})
|
||||
} else {
|
||||
return
|
||||
}
|
||||
if !config.General.UseSystemPlaylist {
|
||||
// do not play system playlist
|
||||
return
|
||||
}
|
||||
log.Infof("Try to play next media in system playlist")
|
||||
global.EventManager.CallA(events.PlaylistNextCmd(model.PlaylistIDSystem),
|
||||
events.PlaylistNextCmdEvent{
|
||||
Remove: false,
|
||||
})
|
||||
}
|
||||
})
|
||||
|
||||
global.EventManager.RegisterA(
|
||||
|
||||
@@ -37,6 +37,6 @@ func Stop() {
|
||||
//sysmediacontrol.Destroy()
|
||||
liveroom.StopAndSave()
|
||||
playlist.Close()
|
||||
player.StopMpvPlayer()
|
||||
plugins.ClosePlugins()
|
||||
player.StopMpvPlayer()
|
||||
}
|
||||
|
||||
@@ -151,7 +151,7 @@ func (p *playlist) Next(delete bool) {
|
||||
p.Lock.Lock()
|
||||
if p.Size() == 0 {
|
||||
// no media in the playlist
|
||||
// do not issue any event
|
||||
// do not dispatch any event
|
||||
p.Lock.Unlock()
|
||||
return
|
||||
}
|
||||
|
||||
@@ -9,6 +9,8 @@ type _GeneralConfig struct {
|
||||
AutoCheckUpdate bool
|
||||
ShowSystemTray bool
|
||||
PlayNextOnFail bool
|
||||
UseSystemPlaylist bool
|
||||
FixedSize bool
|
||||
}
|
||||
|
||||
func (c *_GeneralConfig) Name() string {
|
||||
@@ -23,4 +25,6 @@ var General = &_GeneralConfig{
|
||||
Width: 960,
|
||||
Height: 480,
|
||||
PlayNextOnFail: false,
|
||||
UseSystemPlaylist: true,
|
||||
FixedSize: true,
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user