bot/song.go   A
last analyzed

Size/Duplication

Total Lines 29
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
cc 2
eloc 19
dl 0
loc 29
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A bot.Song.Ffmpeg 0 3 1
A bot.NewSong 0 6 1
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
struct field Id should be ID
Loading history...
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