feat: spool media inputs to disk and report producer progress

This commit is contained in:
Levi committed 2026-09-16 23:16:19 +08:00
1 parent e99ef6c7f4
commit e0ced260e2
36 files changed
+1747 -366

No files matched your search

+26
View File
@@ -0,0 +1,26 @@
package download
import (
"os"
"path/filepath"
"github.com/GopeedLab/gopeed/internal/tempfiles"
)
// TempDir may be shared with the OS or other applications. Initialization never
// removes its contents; shutdown only removes paths created by this downloader.
func (d *Downloader) setupTempDir() error {
if d.cfg.TempDir == "" {
d.cfg.TempDir = os.TempDir()
}
root, err := filepath.Abs(d.cfg.TempDir)
if err != nil {
return err
}
if err := os.MkdirAll(root, 0700); err != nil {
return err
}
d.cfg.TempDir = root
d.tempFiles = &tempfiles.Scope{}
return nil
}