CBA to do a proper numerical sort. For-loop it is.
This commit is contained in:
parent
3e81bb9d34
commit
78935b8048
30
main.go
30
main.go
@ -7,6 +7,7 @@ import (
|
||||
"log"
|
||||
"net/http"
|
||||
"os"
|
||||
"strconv"
|
||||
"time"
|
||||
)
|
||||
|
||||
@ -50,26 +51,27 @@ func main() {
|
||||
|
||||
func (core *Core) logicController() {
|
||||
|
||||
// Find all the json files and chuck 'em in a slice
|
||||
var files []string
|
||||
// // Find all the json files and chuck 'em in a slice
|
||||
// var files []string
|
||||
|
||||
entries, err := os.ReadDir(core.folder)
|
||||
if err != nil {
|
||||
log.Fatal(err)
|
||||
}
|
||||
// entries, err := os.ReadDir(core.folder)
|
||||
// if err != nil {
|
||||
// log.Fatal(err)
|
||||
// }
|
||||
|
||||
for _, e := range entries {
|
||||
if string(e.Name())[len(e.Name())-5:] == ".json" {
|
||||
files = append(files, e.Name())
|
||||
}
|
||||
}
|
||||
// for _, e := range entries {
|
||||
// if string(e.Name())[len(e.Name())-5:] == ".json" {
|
||||
// files = append(files, e.Name())
|
||||
// }
|
||||
// }
|
||||
|
||||
core.logger.Println("(LC) processing the following files", files)
|
||||
core.logger.Println("(LC) processing slides")
|
||||
|
||||
/// Periodically change contents
|
||||
for {
|
||||
for _, file := range files {
|
||||
contents, err := os.ReadFile(core.folder + "/" + file)
|
||||
for i := 1; i <= 75; i++ {
|
||||
core.logger.Println("Pushing slide: " + strconv.FormatInt(int64(i), 10) + ".json")
|
||||
contents, err := os.ReadFile(core.folder + "/" + strconv.FormatInt(int64(i), 10) + ".json")
|
||||
core.check(err)
|
||||
core.cache = string(contents)
|
||||
time.Sleep(time.Duration(core.delay) * time.Second)
|
||||
|
Loading…
x
Reference in New Issue
Block a user