strip-beats/app/run.go
2023-09-08 18:48:21 -05:00

78 lines
1.4 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 testFp() {
fp, err := media.Fingerprint("/home/drj/MyFiles/Videos/WebShows/YouTube/Dolly_Parton_-_Topic/Just_Because_I_m_a_Woman.Dolly_Parton_-_Topic.Fmv-XQerVkM.webm")
if err != nil {
panic(err)
}
// fmt.Printf("%+v\n", fp)
ids, err := media.LookupFingerprint(fp)
if err != nil {
panic(err)
}
fmt.Printf("%+v\n", ids)
quit()
}
func Run(step AppStep) {
testFp()
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()
}
}
}