Use custom identifiers

This commit is contained in:
nemunaire 2022-10-04 15:47:06 +02:00
commit 299f3ba0cf
5 changed files with 45 additions and 16 deletions

View file

@ -13,10 +13,10 @@ import (
const CURRENT_GONG = "_current_gong"
type Gong struct {
Id []byte `json:"id"`
Name string `json:"name"`
Path string `json:"path"`
Enabled bool `json:"enabled"`
Id Identifier `json:"id"`
Name string `json:"name"`
Path string `json:"path"`
Enabled bool `json:"enabled"`
}
func currentGongPath(cfg *config.Config) string {
@ -36,7 +36,7 @@ func LoadGongs(cfg *config.Config) (gongs []*Gong, err error) {
hash := sha512.Sum512([]byte(path))
pabs, _ := filepath.Abs(path)
gongs = append(gongs, &Gong{
Id: hash[:63],
Id: hash[:],
Name: strings.TrimSuffix(d.Name(), filepath.Ext(d.Name())),
Path: path,
Enabled: current_gong == pabs,