improved file read/copy logic

This commit is contained in:
zomo
2025-12-24 13:58:02 -06:00
parent 658ad890f5
commit 32ed104b60
10 changed files with 337 additions and 153 deletions

25
main.go
View File

@@ -1,8 +1,6 @@
package main
const BASEPATH = "./rooms"
const OUTPATH = "./rooms_out"
const ROOM_PER_NIGHT = 4
import "flag"
func main() {
if err := mainErr(); err != nil {
@@ -11,12 +9,27 @@ func main() {
}
func mainErr() error {
roomFolders, err := LoadRoomFolders(BASEPATH)
basePath := flag.String("basePath", "./rooms", "path to your rooms collection")
outPath := flag.String("outPath", "./rooms_out", "output path")
roomPerNight := flag.Int("roomPerNight", 4, "rooms per night")
splash1len := flag.Int("splash1", 2, "number of seconds splashscreen 1 will take")
splash2len := flag.Int("splash2", 2, "number of seconds splashscreen 2 will take")
flag.Parse()
roomFolders, err := LoadRoomFolders(*basePath)
if err != nil {
return err
}
AssignExtraRooms(roomFolders, ROOM_PER_NIGHT)
AssignExtraRooms(roomFolders, *roomPerNight)
return CopyOut(roomFolders, OUTPATH)
// only deletes DATA/NIGHT_* folders and the CF.ini file
err = EmptyOut(*outPath)
if err != nil {
return err
}
return CopyOut(roomFolders, *outPath, *splash1len, *splash2len)
}