strip-beats/app/run.go
2023-09-08 13:17:12 -05:00

63 lines
1.1 KiB
Go

package app
import (
"fmt"
"os"
"codeberg.org/danjones000/strip-beats/input/boolean"
"codeberg.org/danjones000/strip-beats/media"
)
type AppStep int
const (
Pick AppStep = iota
Watch
Fade
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()
}
watch := boolean.Choose(fmt.Sprintf("Would you like to watch %s?", file.ShortPath()))
if watch {
step = Watch
} else {
step = mainMenu()
}
case Watch:
media.Watch(file.Format.Path)
fadeAns := boolean.Choose(fmt.Sprintf("Would you like to trim/fade %s?", file.ShortPath()))
if fadeAns {
step = Fade
} else {
step = mainMenu()
}
case Fade:
fadeFile()
listenFaded := boolean.Choose(fmt.Sprintf("Would you like to listen to %s?", tmpfile.ShortPath()))
if listenFaded {
media.Watch(tmpfile.Format.Path)
}
step = mainMenu() // @todo ask to check new file
case Quit:
quit()
default:
step = mainMenu()
}
}
}