taggart

Simple golang tagging filesystem webapp
Log | Files | Refs

commit 363e7c39b166cf9e9ad8aa13921948e4398534ee
parent 0528d7d098e7b15edea009980c2db3a48fafeca4
Author: breadcat <breadcat@users.noreply.github.com>
Date:   Thu, 25 Sep 2025 17:02:59 +0100

Fix bug where playlists would fail

Diffstat:
Mmain.go | 4++--
1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/main.go b/main.go @@ -1007,7 +1007,7 @@ func ytdlpHandler(w http.ResponseWriter, r *http.Request) { // Step 1: Get the expected filename first outTemplate := filepath.Join(config.UploadDir, "%(title)s.%(ext)s") - filenameCmd := exec.Command("yt-dlp", "-f", "mp4", "-o", outTemplate, "--get-filename", videoURL) + filenameCmd := exec.Command("yt-dlp", "--playlist-items", "1", "-f", "mp4", "-o", outTemplate, "--get-filename", videoURL) filenameBytes, err := filenameCmd.Output() if err != nil { http.Error(w, fmt.Sprintf("Failed to get filename: %v", err), http.StatusInternalServerError) @@ -1026,7 +1026,7 @@ func ytdlpHandler(w http.ResponseWriter, r *http.Request) { } // Step 2: Download with yt-dlp using the full output template - downloadCmd := exec.Command("yt-dlp", "-f", "mp4", "-o", outTemplate, videoURL) + downloadCmd := exec.Command("yt-dlp", "--playlist-items", "1", "-f", "mp4", "-o", outTemplate, videoURL) downloadCmd.Stdout = os.Stdout downloadCmd.Stderr = os.Stderr if err := downloadCmd.Run(); err != nil {