diff --git a/app/menu.go b/app/menu.go index 2189e1f..2e5cdd1 100644 --- a/app/menu.go +++ b/app/menu.go @@ -21,6 +21,11 @@ func (st AppStep) Title() string { return mustpick } return fmt.Sprintf("Trim and/or add fade to %s", file.ShortPath()) + case Print: + if file == nil { + return mustpick + } + return fmt.Sprintf("Should we try to identify %s", file.ShortPath()) case Restart: return "Forget current selection" case Quit: @@ -31,6 +36,9 @@ func (st AppStep) Title() string { } func (st AppStep) Text() string { + if st == Print { + return "Use fpcalc, AcousticId, and MusicBrainz to identify the song" + } return "" } @@ -44,6 +52,8 @@ func (st AppStep) Rune() rune { return 'f' case Restart: return 'r' + case Print: + return 'a' case Quit: return 'q' default: @@ -60,7 +70,7 @@ func mainMenu() AppStep { if file == nil { steps = []list.Option{Pick, Quit} } else { - steps = []list.Option{Pick, Watch, Fade, Quit} + steps = []list.Option{Pick, Watch, Fade, Print, Quit} } step := list.List("What would you like to do next?", steps, nil) diff --git a/app/print.go b/app/print.go new file mode 100644 index 0000000..a815206 --- /dev/null +++ b/app/print.go @@ -0,0 +1,35 @@ +package app + +import ( + "fmt" + + "codeberg.org/danjones000/strip-beats/media" + // "github.com/akrennmair/slice" +) + +func print() { + if file == nil { + PickFileWithConf() + } + 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) + } + ids, err := media.LookupFingerprint(fp) + if err != nil { + panic(err) + } + var recs []media.MbRecording + for _, res := range ids.Results { + for _, rec := range res.Recordings { + err = media.FillMbRecording(&rec) + if err != nil { + panic(err) + } + recs = append(recs, rec) + + } + } + + fmt.Printf("%+v\n", recs) +} diff --git a/app/run.go b/app/run.go index 6fabf95..710e23c 100644 --- a/app/run.go +++ b/app/run.go @@ -14,6 +14,7 @@ const ( Pick AppStep = iota Watch Fade + Print Restart Quit ) @@ -48,8 +49,16 @@ func testMb() { quit() } +func testPrint() { + SetFile("/home/drj/MyFiles/Videos/WebShows/YouTube/Dolly_Parton_-_Topic/Just_Because_I_m_a_Woman.Dolly_Parton_-_Topic.Fmv-XQerVkM.webm") + print() + + quit() +} + func Run(step AppStep) { - testMb() + // testMb() + testPrint() for step < Quit { switch step { case Pick: @@ -79,6 +88,9 @@ func Run(step AppStep) { media.Watch(tmpfile.Format.Path) } step = mainMenu() // @todo ask to check new file + case Print: + print() + step = mainMenu() case Quit: quit() default: