🚧 Work on fingerprinting music
This commit is contained in:
parent
dac33a7688
commit
cfef5a6c7a
3 changed files with 59 additions and 2 deletions
12
app/menu.go
12
app/menu.go
|
|
@ -21,6 +21,11 @@ func (st AppStep) Title() string {
|
||||||
return mustpick
|
return mustpick
|
||||||
}
|
}
|
||||||
return fmt.Sprintf("Trim and/or add fade to %s", file.ShortPath())
|
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:
|
case Restart:
|
||||||
return "Forget current selection"
|
return "Forget current selection"
|
||||||
case Quit:
|
case Quit:
|
||||||
|
|
@ -31,6 +36,9 @@ func (st AppStep) Title() string {
|
||||||
}
|
}
|
||||||
|
|
||||||
func (st AppStep) Text() string {
|
func (st AppStep) Text() string {
|
||||||
|
if st == Print {
|
||||||
|
return "Use fpcalc, AcousticId, and MusicBrainz to identify the song"
|
||||||
|
}
|
||||||
return ""
|
return ""
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -44,6 +52,8 @@ func (st AppStep) Rune() rune {
|
||||||
return 'f'
|
return 'f'
|
||||||
case Restart:
|
case Restart:
|
||||||
return 'r'
|
return 'r'
|
||||||
|
case Print:
|
||||||
|
return 'a'
|
||||||
case Quit:
|
case Quit:
|
||||||
return 'q'
|
return 'q'
|
||||||
default:
|
default:
|
||||||
|
|
@ -60,7 +70,7 @@ func mainMenu() AppStep {
|
||||||
if file == nil {
|
if file == nil {
|
||||||
steps = []list.Option{Pick, Quit}
|
steps = []list.Option{Pick, Quit}
|
||||||
} else {
|
} 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)
|
step := list.List("What would you like to do next?", steps, nil)
|
||||||
|
|
|
||||||
35
app/print.go
Normal file
35
app/print.go
Normal file
|
|
@ -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)
|
||||||
|
}
|
||||||
14
app/run.go
14
app/run.go
|
|
@ -14,6 +14,7 @@ const (
|
||||||
Pick AppStep = iota
|
Pick AppStep = iota
|
||||||
Watch
|
Watch
|
||||||
Fade
|
Fade
|
||||||
|
Print
|
||||||
Restart
|
Restart
|
||||||
Quit
|
Quit
|
||||||
)
|
)
|
||||||
|
|
@ -48,8 +49,16 @@ func testMb() {
|
||||||
quit()
|
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) {
|
func Run(step AppStep) {
|
||||||
testMb()
|
// testMb()
|
||||||
|
testPrint()
|
||||||
for step < Quit {
|
for step < Quit {
|
||||||
switch step {
|
switch step {
|
||||||
case Pick:
|
case Pick:
|
||||||
|
|
@ -79,6 +88,9 @@ func Run(step AppStep) {
|
||||||
media.Watch(tmpfile.Format.Path)
|
media.Watch(tmpfile.Format.Path)
|
||||||
}
|
}
|
||||||
step = mainMenu() // @todo ask to check new file
|
step = mainMenu() // @todo ask to check new file
|
||||||
|
case Print:
|
||||||
|
print()
|
||||||
|
step = mainMenu()
|
||||||
case Quit:
|
case Quit:
|
||||||
quit()
|
quit()
|
||||||
default:
|
default:
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue