downlad into temp folder then move to out folder when done, temp replace with my fork until upstream PR is merged

This commit is contained in:
2026-02-12 23:26:08 -05:00
parent bd643344ef
commit a2a0aabb3a
5 changed files with 28 additions and 7 deletions

View File

@@ -91,13 +91,17 @@ func GetFormats(url string) (*FormatOptions, error) {
return formatOpts, nil
}
func DownloadVideo(out_dir, url string, opts DownloadOptions, progressChan chan<- ProgressUpdate) {
func DownloadVideo(out_dir, temp_dir, url string, opts DownloadOptions, progressChan chan<- ProgressUpdate) {
defer close(progressChan)
homePath := "home:" + out_dir
tempPath := "temp:" + temp_dir
var lastPhase string
dl := ytdlp.New().
SetWorkDir(out_dir).
Paths(homePath).
Paths(tempPath).
RecodeVideo("mp4").
ProgressFunc(100*time.Millisecond, func(prog ytdlp.ProgressUpdate) {
// Detect phase transition -- differentiate "downloading" as the main download