Use custom identifiers
This commit is contained in:
parent
b2d50972ed
commit
299f3ba0cf
5 changed files with 45 additions and 16 deletions
|
|
@ -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,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue