Getting soundcloud to work [ci skip]
This commit is contained in:
parent
9d29d77dfa
commit
67c8b696a4
|
@ -103,6 +103,7 @@ func (sc SoundCloud) NewSong(user *gumble.User, trackData *jsonq.JsonQuery, play
|
|||
thumbnail: thumbnail,
|
||||
submitter: user,
|
||||
duration: string(duration),
|
||||
format: "mp3",
|
||||
playlist: playlist,
|
||||
skippers: make([]string, 0),
|
||||
dontSkip: false,
|
||||
|
|
|
@ -169,6 +169,7 @@ func (yt YouTube) NewSong(user *gumble.User, id, offset string, playlist Playlis
|
|||
offset: int((offsetDays * 86400) + (offsetHours * 3600) + (offsetMinutes * 60) + offsetSeconds),
|
||||
duration: durationString,
|
||||
thumbnail: thumbnail,
|
||||
format: "m4a",
|
||||
skippers: make([]string, 0),
|
||||
playlist: playlist,
|
||||
dontSkip: false,
|
||||
|
|
|
@ -20,6 +20,7 @@ type YouTubeDLSong struct {
|
|||
duration string
|
||||
url string
|
||||
offset int
|
||||
format string
|
||||
playlist Playlist
|
||||
skippers []string
|
||||
dontSkip bool
|
||||
|
@ -40,7 +41,7 @@ func (dl *YouTubeDLSong) Download() error {
|
|||
|
||||
// Checks to see if song is already downloaded
|
||||
if _, err := os.Stat(fmt.Sprintf("%s/.mumbledj/songs/%s", dj.homeDir, dl.Filename())); os.IsNotExist(err) {
|
||||
cmd := exec.Command("youtube-dl", "--no-mtime", "--output", fmt.Sprintf("%s/.mumbledj/songs/%s", dj.homeDir, dl.Filename()), "--format", "m4a", "--prefer-ffmpeg", dl.url)
|
||||
cmd := exec.Command("youtube-dl", "--no-mtime", "--output", fmt.Sprintf("%s/.mumbledj/songs/%s", dj.homeDir, dl.Filename()), "--format", dl.format, "--prefer-ffmpeg", dl.url)
|
||||
output, err := cmd.CombinedOutput()
|
||||
if err == nil {
|
||||
if dj.conf.Cache.Enabled {
|
||||
|
@ -48,9 +49,9 @@ func (dl *YouTubeDLSong) Download() error {
|
|||
}
|
||||
return nil
|
||||
} else {
|
||||
args := "youtube-dl "
|
||||
args := ""
|
||||
for s := range cmd.Args {
|
||||
args += cmd.Args[s]
|
||||
args += cmd.Args[s] + " "
|
||||
}
|
||||
Verbose(args)
|
||||
Verbose(string(output))
|
||||
|
@ -153,7 +154,7 @@ func (dl *YouTubeDLSong) ID() string {
|
|||
|
||||
// Filename returns the filename of the Song.
|
||||
func (dl *YouTubeDLSong) Filename() string {
|
||||
return dl.id + ".m4a"
|
||||
return dl.id + dl.format
|
||||
}
|
||||
|
||||
// Duration returns the duration of the Song.
|
||||
|
|
Reference in a new issue