mirror of
https://github.com/AynaLivePlayer/AynaLivePlayer.git
synced 2025-12-15 22:48:16 +08:00
rewrite using IoC and DI
This commit is contained in:
@@ -8,7 +8,7 @@ import (
|
||||
|
||||
const (
|
||||
ProgramName = "卡西米尔唱片机"
|
||||
Version = "beta 0.9.3"
|
||||
Version = "beta 0.9.5"
|
||||
)
|
||||
|
||||
const (
|
||||
@@ -55,7 +55,7 @@ func init() {
|
||||
fmt.Println("config not found, using default config")
|
||||
ConfigFile = ini.Empty()
|
||||
}
|
||||
for _, cfg := range []Config{Log, Player, Provider, General} {
|
||||
for _, cfg := range []Config{Log, General} {
|
||||
LoadConfig(cfg)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,55 +0,0 @@
|
||||
package config
|
||||
|
||||
type _PlayerConfig struct {
|
||||
PlaylistData string
|
||||
Playlists []*PlayerPlaylist `ini:"-"`
|
||||
//PlaylistsProvider []string
|
||||
PlaylistIndex int
|
||||
PlaylistRandom bool
|
||||
UserPlaylistRandom bool
|
||||
AudioDevice string
|
||||
Volume float64
|
||||
SkipPlaylist bool
|
||||
}
|
||||
|
||||
type PlayerPlaylist struct {
|
||||
ID string
|
||||
Provider string
|
||||
}
|
||||
|
||||
func (c *_PlayerConfig) Name() string {
|
||||
return "Player"
|
||||
}
|
||||
|
||||
func (c *_PlayerConfig) OnLoad() {
|
||||
//c.Playlists = make([]*PlayerPlaylist, 0)
|
||||
_ = LoadJson(c.PlaylistData, &c.Playlists)
|
||||
}
|
||||
|
||||
func (c *_PlayerConfig) OnSave() {
|
||||
_ = SaveJson(c.PlaylistData, &c.Playlists)
|
||||
}
|
||||
|
||||
var Player = &_PlayerConfig{
|
||||
PlaylistData: "playlists.json",
|
||||
Playlists: []*PlayerPlaylist{
|
||||
{
|
||||
"2382819181",
|
||||
"netease",
|
||||
},
|
||||
{
|
||||
"4987059624",
|
||||
"netease",
|
||||
},
|
||||
{
|
||||
"list1",
|
||||
"local",
|
||||
},
|
||||
},
|
||||
PlaylistIndex: 0,
|
||||
PlaylistRandom: true,
|
||||
UserPlaylistRandom: false,
|
||||
AudioDevice: "auto",
|
||||
Volume: 100,
|
||||
SkipPlaylist: false,
|
||||
}
|
||||
@@ -1,16 +0,0 @@
|
||||
package config
|
||||
|
||||
type _ProviderConfig struct {
|
||||
BaseConfig
|
||||
Priority []string
|
||||
LocalDir string
|
||||
}
|
||||
|
||||
func (c *_ProviderConfig) Name() string {
|
||||
return "Provider"
|
||||
}
|
||||
|
||||
var Provider = &_ProviderConfig{
|
||||
Priority: []string{"netease", "kuwo", "bilibili", "local", "bilibili-video"},
|
||||
LocalDir: "./music",
|
||||
}
|
||||
Reference in New Issue
Block a user