1 | package bot |
||
2 | |||
3 | import ( |
||
4 | "fmt" |
||
5 | "os/exec" |
||
6 | "strconv" |
||
7 | ) |
||
8 | |||
9 | // Song contains information about song |
||
10 | type Song struct { |
||
11 | Media string |
||
12 | Title string |
||
13 | Duration *string |
||
14 | Id string |
||
0 ignored issues
–
show
introduced
by
![]() |
|||
15 | } |
||
16 | |||
17 | // Ffmpeg returns ffmpeg executable command |
||
18 | func (song Song) Ffmpeg(volume float32) *exec.Cmd { |
||
19 | return exec.Command("ffmpeg", "-i", song.Media, "-f", "s16le", "-reconnect", "1", "-reconnect_at_eof", "1", "-reconnect_streamed", "1", "-reconnect_delay_max", "2", "-filter:a", fmt.Sprintf("volume=%.3f", volume), "-ar", strconv.Itoa(FRAME_RATE), "-ac", |
||
20 | strconv.Itoa(CHANNELS), "pipe:1") |
||
21 | } |
||
22 | |||
23 | // NewSong creates and returns new song |
||
24 | func NewSong(media, title, id string) *Song { |
||
25 | song := new(Song) |
||
26 | song.Media = media |
||
27 | song.Title = title |
||
28 | song.Id = id |
||
29 | return song |
||
30 | } |
||
31 |