Skip to content

Commit 2c58392

Browse files
authored
Merge pull request #94 from paubineau/fix/youtube-download-dir
fix(youtube): Correctly build download path in youtube saveVideo function
2 parents cad3f09 + 2958ad7 commit 2c58392

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

src/downloader/youtube.go

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ import (
99
"net/url"
1010
"os"
1111
"os/exec"
12+
"path/filepath"
1213
"strings"
1314

1415
cfg "explo/src/config"
@@ -181,7 +182,7 @@ func saveVideo(c Youtube, track models.Track, stream *goutubedl.DownloadResult)
181182
}
182183
}()
183184

184-
input := fmt.Sprintf("%s%s.tmp", c.DownloadDir, track.File)
185+
input := filepath.Join(c.DownloadDir, track.File+".tmp")
185186
file, err := os.Create(input)
186187
if err != nil {
187188
slog.Error("failed to create song file", "context", err.Error())
@@ -202,7 +203,7 @@ func saveVideo(c Youtube, track models.Track, stream *goutubedl.DownloadResult)
202203
return false
203204
}
204205

205-
cmd := ffmpeg.Input(input).Output(fmt.Sprintf("%s%s", c.DownloadDir, track.File), ffmpeg.KwArgs{
206+
cmd := ffmpeg.Input(input).Output(filepath.Join(c.DownloadDir, track.File), ffmpeg.KwArgs{
206207
"map": "0:a",
207208
"metadata": []string{"artist=" + track.Artist, "title=" + track.Title, "album=" + track.Album},
208209
"loglevel": "error",

0 commit comments

Comments
 (0)