diff --git a/.gitignore b/.gitignore index 30517a6..1720537 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,3 @@ run.bat run.sh +audio/*.dca diff --git a/audio/readme.txt b/audio/readme.txt new file mode 100644 index 0000000..e6306f8 --- /dev/null +++ b/audio/readme.txt @@ -0,0 +1,3 @@ +Place .dca audio files here. +Naming convention is as follows: command_soundname.dca +This will result in "!command soundname". diff --git a/main.go b/main.go index 2200c4c..d7ed8c0 100644 --- a/main.go +++ b/main.go @@ -82,28 +82,30 @@ var COLLECTIONS []*SoundCollection func createCollections() { files, _ := ioutil.ReadDir("./audio") for _, f := range files { - soundfile := strings.Split(strings.Replace(f.Name(), ".dca", "", -1), "_") - containsPrefix := false - containsSound := false + if strings.Contains(f.Name(), ".dca") { + soundfile := strings.Split(strings.Replace(f.Name(), ".dca", "", -1), "_") + containsPrefix := false + containsSound := false - if len(COLLECTIONS) == 0 { - addNewSoundCollection(soundfile[0], soundfile[1]) - } - for _, c := range COLLECTIONS { - if c.Prefix == soundfile[0] { - containsPrefix = true - for _, sound := range c.Sounds { - if sound.Name == soundfile[1] { - containsSound = true + if len(COLLECTIONS) == 0 { + addNewSoundCollection(soundfile[0], soundfile[1]) + } + for _, c := range COLLECTIONS { + if c.Prefix == soundfile[0] { + containsPrefix = true + for _, sound := range c.Sounds { + if sound.Name == soundfile[1] { + containsSound = true + } + } + if !containsSound { + c.Sounds = append(c.Sounds, createSound(soundfile[1], 1, 250)) } } - if !containsSound { - c.Sounds = append(c.Sounds, createSound(soundfile[1], 1, 250)) - } } - } - if !containsPrefix { - addNewSoundCollection(soundfile[0], soundfile[1]) + if !containsPrefix { + addNewSoundCollection(soundfile[0], soundfile[1]) + } } } } diff --git a/templates/home.html b/templates/home.html index 248a28f..bb29ff8 100644 --- a/templates/home.html +++ b/templates/home.html @@ -1,4 +1,3 @@ -{{ define "title"}}
{{ template "content" . }}
+