strip-beats/app/run.go
2023-09-06 16:56:55 -05:00

41 lines
479 B
Go

package app
import (
"fmt"
"os"
"codeberg.org/danjones000/strip-beats/media"
)
type AppStep int
const (
Pick AppStep = iota
Watch
Restart
Quit
)
func quit() {
PickAgain()
fmt.Println("Goodbye!")
os.Exit(0)
}
func Run(step AppStep) {
for step < Quit {
switch step {
case Pick:
PickAgain()
PickFileWithConf()
if file == nil {
quit()
}
case Watch:
media.Watch(file.Format.Path)
case Quit:
quit()
}
step = (step + 1) % Restart
}
}