Skip to content

Commit 9df7cfa

Browse files
authored
Merge pull request #37 from LumePart/feat/file-exension
rename file extension for youtube downloads
2 parents d02c739 + bc67cf2 commit 9df7cfa

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/downloader/youtube.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ func (c *Youtube) QueryTrack(track *models.Track) error { // Queries youtube for
7575
func (c *Youtube) GetTrack(track *models.Track) error {
7676
ctx := context.Background() // ctx for yt-dlp
7777

78-
track.File = getFilename(track.Title, track.Artist)
78+
track.File = getFilename(track.Title, track.Artist)+".opus"
7979
track.Present = fetchAndSaveVideo(ctx, *c, *track)
8080

8181
if track.Present {
@@ -128,7 +128,7 @@ func saveVideo(c Youtube, track models.Track, stream *goutubedl.DownloadResult)
128128
}
129129
}()
130130

131-
input := fmt.Sprintf("%s%s_TEMP.mp3", c.DownloadDir, track.File)
131+
input := fmt.Sprintf("%s%s.tmp", c.DownloadDir, track.File)
132132
file, err := os.Create(input)
133133
if err != nil {
134134
log.Fatalf("failed to create song file: %s", err.Error())
@@ -148,7 +148,7 @@ func saveVideo(c Youtube, track models.Track, stream *goutubedl.DownloadResult)
148148
return false
149149
}
150150

151-
cmd := ffmpeg.Input(input).Output(fmt.Sprintf("%s%s.mp3", c.DownloadDir, track.File), ffmpeg.KwArgs{
151+
cmd := ffmpeg.Input(input).Output(fmt.Sprintf("%s%s", c.DownloadDir, track.File), ffmpeg.KwArgs{
152152
"map": "0:a",
153153
"metadata": []string{"artist=" + track.Artist, "title=" + track.Title, "album=" + track.Album},
154154
"loglevel": "error",

0 commit comments

Comments
 (0)