Implement alarm sound

This commit is contained in:
nemunaire 2022-10-14 20:08:03 +02:00
commit df31c4dcd1
15 changed files with 531 additions and 50 deletions

View file

@ -19,13 +19,13 @@ type Gong struct {
Enabled bool `json:"enabled"`
}
func currentGongPath(cfg *config.Config) string {
func CurrentGongPath(cfg *config.Config) string {
return filepath.Join(cfg.GongsDir, CURRENT_GONG)
}
func LoadGongs(cfg *config.Config) (gongs []*Gong, err error) {
// Retrieve the path of the current gong
current_gong, err := os.Readlink(currentGongPath(cfg))
current_gong, err := os.Readlink(CurrentGongPath(cfg))
if err == nil {
current_gong, _ = filepath.Abs(filepath.Join(cfg.GongsDir, current_gong))
}
@ -65,7 +65,7 @@ func (g *Gong) Rename(newName string) error {
}
func (g *Gong) SetDefault(cfg *config.Config) error {
linkpath := currentGongPath(cfg)
linkpath := CurrentGongPath(cfg)
os.Remove(linkpath)
pabs, err := filepath.Abs(g.Path)