2023-09-06 16:56:55 -05:00
|
|
|
package app
|
|
|
|
|
|
|
|
|
|
import (
|
|
|
|
|
"fmt"
|
|
|
|
|
"os"
|
|
|
|
|
|
2023-11-11 18:51:38 -06:00
|
|
|
"codeberg.org/danjones000/strip-beats/io/boolean"
|
2023-09-06 16:56:55 -05:00
|
|
|
"codeberg.org/danjones000/strip-beats/media"
|
2023-09-24 16:40:24 -05:00
|
|
|
"codeberg.org/danjones000/strip-beats/media/brainz"
|
2023-09-06 16:56:55 -05:00
|
|
|
)
|
|
|
|
|
|
|
|
|
|
type AppStep int
|
|
|
|
|
|
|
|
|
|
const (
|
|
|
|
|
Pick AppStep = iota
|
|
|
|
|
Watch
|
2023-09-08 11:00:07 -05:00
|
|
|
Fade
|
2023-09-23 21:57:56 -05:00
|
|
|
Print
|
2023-09-06 16:56:55 -05:00
|
|
|
Restart
|
|
|
|
|
Quit
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
func quit() {
|
|
|
|
|
PickAgain()
|
|
|
|
|
fmt.Println("Goodbye!")
|
|
|
|
|
os.Exit(0)
|
|
|
|
|
}
|
|
|
|
|
|
2023-09-08 18:48:21 -05:00
|
|
|
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()
|
|
|
|
|
}
|
|
|
|
|
|
2023-09-09 21:02:43 -05:00
|
|
|
func testMb() {
|
|
|
|
|
id := "497f2f22-809b-4c9e-a692-72f7d8dcaaa2"
|
2023-09-24 16:40:24 -05:00
|
|
|
mb, err := brainz.GetRecording(id)
|
2023-09-09 21:02:43 -05:00
|
|
|
if err != nil {
|
|
|
|
|
panic(err)
|
|
|
|
|
}
|
|
|
|
|
fmt.Printf("%+v\n", mb)
|
|
|
|
|
quit()
|
|
|
|
|
}
|
|
|
|
|
|
2023-09-23 21:57:56 -05:00
|
|
|
func testPrint() {
|
2023-10-29 11:14:44 -05:00
|
|
|
// SetFile("/home/drj/MyFiles/Videos/WebShows/YouTube/Dolly_Parton_-_Topic/Just_Because_I_m_a_Woman.Dolly_Parton_-_Topic.Fmv-XQerVkM.webm")
|
2023-11-11 17:01:01 -06:00
|
|
|
// SetFile("/home/drj/MyFiles/Videos/WebShows/YouTube/Whitney_Houston/I_Will_Always_Love_You_Ultimate_Collection_Edit.Whitney_Houston.rB7z_l8mBxw.mp4")
|
|
|
|
|
SetFile("/home/drj/MyFiles/Music/Original_Broadway_Cast_of_Hamilton/Hamilton/d02t12-We_Know.m4a")
|
|
|
|
|
// SetFile("/home/drj/MyFiles/Videos/WebShows/YouTube/KaceyMusgravesVEVO/Kacey_Musgraves_-_Biscuits-nGIUtLO_x8g.mp4")
|
|
|
|
|
// SetFile("/home/drj/MyFiles/Videos/WebShows/YouTube/Willie_Nelson_-_Topic/Too_Sick_To_Pray.Willie_Nelson_-_Topic.8QgBXo41j2E.webm")
|
2023-09-23 21:57:56 -05:00
|
|
|
print()
|
|
|
|
|
|
|
|
|
|
quit()
|
|
|
|
|
}
|
|
|
|
|
|
2023-09-06 16:56:55 -05:00
|
|
|
func Run(step AppStep) {
|
|
|
|
|
for step < Quit {
|
|
|
|
|
switch step {
|
|
|
|
|
case Pick:
|
|
|
|
|
PickAgain()
|
|
|
|
|
PickFileWithConf()
|
|
|
|
|
if file == nil {
|
|
|
|
|
quit()
|
|
|
|
|
}
|
2023-09-06 18:46:09 -05:00
|
|
|
watch := boolean.Choose(fmt.Sprintf("Would you like to watch %s?", file.ShortPath()))
|
|
|
|
|
if watch {
|
|
|
|
|
step = Watch
|
2023-09-08 11:00:07 -05:00
|
|
|
} else {
|
|
|
|
|
step = mainMenu()
|
2023-09-06 18:46:09 -05:00
|
|
|
}
|
2023-09-06 16:56:55 -05:00
|
|
|
case Watch:
|
|
|
|
|
media.Watch(file.Format.Path)
|
2023-09-08 13:17:12 -05:00
|
|
|
fadeAns := boolean.Choose(fmt.Sprintf("Would you like to trim/fade %s?", file.ShortPath()))
|
|
|
|
|
if fadeAns {
|
2023-09-08 11:00:07 -05:00
|
|
|
step = Fade
|
|
|
|
|
} else {
|
|
|
|
|
step = mainMenu()
|
|
|
|
|
}
|
2023-09-08 13:17:12 -05:00
|
|
|
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
|
2023-09-23 21:57:56 -05:00
|
|
|
case Print:
|
|
|
|
|
print()
|
|
|
|
|
step = mainMenu()
|
2023-09-06 16:56:55 -05:00
|
|
|
case Quit:
|
|
|
|
|
quit()
|
2023-09-08 11:00:07 -05:00
|
|
|
default:
|
2023-09-08 13:17:12 -05:00
|
|
|
step = mainMenu()
|
2023-09-06 16:56:55 -05:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|