Files
bap-room-packager/main.go
T
2026-04-16 00:13:24 -05:00

46 lines
993 B
Go

package main
import (
"flag"
"github.com/charmbracelet/log"
)
func main() {
if err := mainErr(); err != nil {
panic(err)
}
}
func mainErr() error {
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
}
err = CheckDuplicateRooms(roomFolders)
if err != nil {
log.Errorf("Error in room assigmnents: %v", err)
return nil
}
AssignExtraRooms(roomFolders, *roomPerNight)
// only deletes DATA/NIGHT_* folders and the CF.ini file
err = EmptyOut(*outPath)
if err != nil {
return err
}
return CopyOut(roomFolders, *outPath, *splash1len, *splash2len)
}