handle -P param
This commit is contained in:
@@ -91,16 +91,22 @@ func (p *Process) Start() {
|
||||
|
||||
buildFilename(&p.Output)
|
||||
|
||||
params := append([]string{
|
||||
params := []string{
|
||||
strings.Split(p.Url, "?list")[0], //no playlist
|
||||
"--newline",
|
||||
"--no-colors",
|
||||
"--no-playlist",
|
||||
"--progress-template",
|
||||
strings.NewReplacer("\n", "", "\t", "", " ", "").Replace(template),
|
||||
"-o",
|
||||
fmt.Sprintf("%s/%s", out.Path, out.Filename),
|
||||
}, p.Params...)
|
||||
}
|
||||
|
||||
// if user asked to manually override the output path...
|
||||
if !slices.Includes(params, "-P") {
|
||||
params = append(params, "-o")
|
||||
params = append(params, fmt.Sprintf("%s/%s", out.Path, out.Filename))
|
||||
}
|
||||
|
||||
params = append(params, p.Params...)
|
||||
|
||||
// ----------------- main block ----------------- //
|
||||
cmd := exec.Command(config.Instance().DownloaderPath, params...)
|
||||
|
||||
@@ -15,7 +15,6 @@ import (
|
||||
"time"
|
||||
|
||||
"github.com/go-chi/chi/v5"
|
||||
"github.com/go-chi/chi/v5/middleware"
|
||||
"github.com/go-chi/cors"
|
||||
"github.com/marcopeocchi/yt-dlp-web-ui/server/config"
|
||||
"github.com/marcopeocchi/yt-dlp-web-ui/server/dbutils"
|
||||
@@ -77,6 +76,8 @@ func RunBlocking(host string, port int, frontend fs.FS, dbPath string) {
|
||||
go gracefulShutdown(srv, &mdb)
|
||||
go autoPersist(time.Minute*5, &mdb, logger)
|
||||
|
||||
logger.Info("yt-dlp-webui started", slog.Int("port", port))
|
||||
|
||||
if err := srv.ListenAndServe(); err != nil {
|
||||
logger.Warn("http server stopped", slog.String("err", err.Error()))
|
||||
}
|
||||
@@ -103,7 +104,8 @@ func newServer(c serverConfig) *http.Server {
|
||||
})
|
||||
|
||||
r.Use(corsMiddleware.Handler)
|
||||
r.Use(middleware.Logger)
|
||||
// use in dev
|
||||
// r.Use(middleware.Logger)
|
||||
|
||||
r.Mount("/", http.FileServer(http.FS(c.frontend)))
|
||||
|
||||
|
||||
Reference in New Issue
Block a user