Skip to content

Commit fed9cd5

Browse files
committed
feat: add lazy-playlist support for instant downloading of large playlists
1 parent 4e8c761 commit fed9cd5

2 files changed

Lines changed: 17 additions & 1 deletion

File tree

‎downloader.go‎

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,12 +99,28 @@ func searchCmd(query string) tea.Cmd {
9999
func startDownloadTask(c chan tea.Msg, url, saveDir, saveFilename, format, browser string) {
100100
outtmpl := filepath.Join(saveDir, saveFilename+"."+format)
101101
isPlaylist := strings.Contains(url, "list=") || strings.Contains(url, "playlist")
102+
103+
args := []string{
104+
"-f", "bestaudio/best",
105+
"--extract-audio",
106+
"--audio-format", format,
107+
"--no-warnings",
108+
"--newline",
109+
"--progress",
110+
"--ignore-errors",
111+
"--no-cache-dir",
112+
"--lazy-playlist", // START DOWNLOADING IMMEDIATELY WITHOUT WAITING FOR ENTIRE LIST
113+
}
114+
102115
if isPlaylist {
103116
outtmpl = filepath.Join(saveDir, saveFilename, "%(title)s.%(ext)s")
104117
os.MkdirAll(filepath.Join(saveDir, saveFilename), 0755)
118+
} else {
119+
args = append(args, "--no-playlist")
105120
}
106121

107-
args := []string{"-f", "bestaudio/best", "--extract-audio", "--audio-format", format, "-o", outtmpl, "--no-warnings", "--newline", "--progress", "--ignore-errors"}
122+
args = append(args, "-o", outtmpl)
123+
108124
if browser != "" && browser != "none" {
109125
args = append(args, "--cookies-from-browser", browser)
110126
}

‎soundsnatch‎

4.66 KB
Binary file not shown.

0 commit comments

Comments
 (0)