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

@ -12,10 +12,10 @@ import (
)
type Track 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 LoadTracks(cfg *config.Config) (tracks []*Track, err error) {
@ -23,7 +23,7 @@ func LoadTracks(cfg *config.Config) (tracks []*Track, err error) {
if d.Mode().IsRegular() {
hash := sha512.Sum512([]byte(path))
tracks = append(tracks, &Track{
Id: hash[:63],
Id: hash[:],
Name: strings.TrimSuffix(d.Name(), filepath.Ext(d.Name())),
Path: path,
Enabled: len(strings.Split(path, "/")) == 2,