🚧 Ask for next step

This commit is contained in:
Dan Jones 2023-09-06 18:46:09 -05:00
commit 5472d7376a
5 changed files with 26 additions and 11 deletions

View file

@ -3,11 +3,11 @@ package app
import (
"fmt"
"os"
p "path"
"codeberg.org/danjones000/strip-beats/files"
"codeberg.org/danjones000/strip-beats/input/boolean"
"codeberg.org/danjones000/strip-beats/media"
"codeberg.org/danjones000/strip-beats/utils"
"github.com/rkoesters/xdg/trash"
)
@ -37,7 +37,7 @@ func PickFileWithConf() media.Probe {
good := false
for !good {
path = files.PickRandomFile()
msg = fmt.Sprintf("We've selected %s\nIs that ok?", getShortPath(path))
msg = fmt.Sprintf("We've selected %s\nIs that ok?", utils.GetShortPath(path))
good = boolean.Choose(msg)
if !good {
good = boolean.Choose("Would you like to quit?")
@ -81,10 +81,3 @@ func Finish() {
}
PickAgain()
}
func getShortPath(path string) string {
base := p.Base(path)
dir := p.Dir(path)
dir = p.Base(dir)
return fmt.Sprintf("%s/%s", dir, base)
}

View file

@ -4,6 +4,7 @@ import (
"fmt"
"os"
"codeberg.org/danjones000/strip-beats/input/boolean"
"codeberg.org/danjones000/strip-beats/media"
)
@ -31,11 +32,15 @@ func Run(step AppStep) {
if file == nil {
quit()
}
watch := boolean.Choose(fmt.Sprintf("Would you like to watch %s?", file.ShortPath()))
if watch {
step = Watch
}
case Watch:
media.Watch(file.Format.Path)
step = Quit // @todo
case Quit:
quit()
}
step = (step + 1) % Restart
}
}