-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathmain.go
86 lines (71 loc) · 1.59 KB
/
main.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
package main
import (
"embed"
"io"
"github.com/charmbracelet/huh"
"github.com/hajimehoshi/go-mp3"
"github.com/hajimehoshi/oto"
)
var (
//go:embed assets
fs embed.FS
ans bool
note string = `
You've shouldered so much responsibility at a young age,
And you have gracefully held your head high through it all.
Your dreams are valid and I'm so proud of you and all you do.
I love that you exist.
Now I would like to ask the most beautiful woman in the universe,
The one whom Lilies blush at her sight,
The one whom Roses are too embarrassed to bloom in her presence.
`
lyrics string = `
You're my hunny bunch Sugar plum,
Pumpy-umpy-umpkin
You're my sweetie pie
You're my cuppy cake
Gum drops
Snoogums boogums, you are...
The apple of my eye
And I love you so and I want you to know
That I'll always be right here
And I love to sing, sweet songs to you
Because you are so dear
`
)
func main() {
huh.NewForm(
huh.NewGroup(
huh.NewNote().
Description(note),
huh.NewConfirm().
Title("Will you be my valentine?").Value(&ans),
),
).Run()
if ans == true {
go playSong("assets/cupcake.mp3")
huh.NewNote().Title("The Cuppycake Song").Description(lyrics).Run()
}
}
func playSong(file string) error {
f, err := fs.Open(file)
if err != nil {
return err
}
defer f.Close()
d, err := mp3.NewDecoder(f)
if err != nil {
return err
}
c, err := oto.NewContext(d.SampleRate(), 2, 2, 8192)
if err != nil {
return err
}
defer c.Close()
p := c.NewPlayer()
defer p.Close()
if _, err := io.Copy(p, d); err != nil {
return err
}
return nil
}