Compare commits

..

No commits in common. "aa8c052c93de705b810ffcf5ced3e631b30a781c" and "a87b30f88c6719745caf79e0c2013614dfd014f8" have entirely different histories.

2 changed files with 6 additions and 7 deletions

View File

@ -4,6 +4,7 @@ import (
"context" "context"
"dndmusicbot/ffmpeg" "dndmusicbot/ffmpeg"
discordspeaker "dndmusicbot/speaker" discordspeaker "dndmusicbot/speaker"
"dndmusicbot/ytdl"
"encoding/json" "encoding/json"
"fmt" "fmt"
"log" "log"
@ -162,7 +163,7 @@ func (app *App) ambianceAdd(payload ...interface{}) {
return return
} }
err := DownloadAmbiance(amburl, ambtitle) err := ytdl.DownloadAmbiance(amburl, ambtitle)
if err != nil { if err != nil {
log.Println(err) log.Println(err)
return return
@ -383,7 +384,7 @@ func (app *App) loadPlaylist(payload ...interface{}) {
} }
_, yt, err := app.cache.GetOrCreateBytes(vid+".txt", func() ([]byte, error) { _, yt, err := app.cache.GetOrCreateBytes(vid+".txt", func() ([]byte, error) {
uri, err := NewYTdl(vid) uri, err := ytdl.NewYTdl(vid)
if err != nil { if err != nil {
return nil, err return nil, err
} }

View File

@ -1,4 +1,4 @@
package main package ytdl
import ( import (
"fmt" "fmt"
@ -9,9 +9,8 @@ import (
var yturl = "https://youtu.be/%s" var yturl = "https://youtu.be/%s"
func NewYTdl(vid string) ([]byte, error) { func NewYTdl(vid string) ([]byte, error) {
ytdl := config.GetString("youtube.ytdl")
uri, err := exec.Command( uri, err := exec.Command(
ytdl, "./bin/yt-dlp_linux",
fmt.Sprintf(yturl, vid), fmt.Sprintf(yturl, vid),
"--cookies", "./cookies.txt", "--cookies", "./cookies.txt",
"--no-call-home", "--no-call-home",
@ -30,9 +29,8 @@ func NewYTdl(vid string) ([]byte, error) {
} }
func DownloadAmbiance(uri string, name string) error { func DownloadAmbiance(uri string, name string) error {
ytdl := config.GetString("youtube.ytdl")
err := exec.Command( err := exec.Command(
ytdl, "./bin/yt-dlp_linux",
uri, uri,
"-x", "-x",
"--audio-format", "mp3", "--audio-format", "mp3",