diff --git a/main.go b/main.go index f730464..3f284dc 100644 --- a/main.go +++ b/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)