New simple bootstrap layout and audio files readme

minor tweak to check files for ".dca" substring first.
This commit is contained in:
da
2017-01-18 23:44:32 +01:00
parent 3ebdb69945
commit a1c79296a9
7 changed files with 79 additions and 28 deletions
+20 -18
View File
@@ -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])
}
}
}
}