30 lines
555 B
Go
30 lines
555 B
Go
package cmd
|
|
|
|
import (
|
|
"fmt"
|
|
"os/exec"
|
|
|
|
"gitnet.fr/deblan/mu-go/internal/fs"
|
|
)
|
|
|
|
func PlayerCmd(files fs.Files) *exec.Cmd {
|
|
cmd := exec.Command("mpv", "-fs")
|
|
|
|
for _, f := range files {
|
|
cmd.Args = append(cmd.Args, f.Url)
|
|
}
|
|
|
|
return cmd
|
|
}
|
|
|
|
func DownloadCmds(files fs.Files, directory string) []*exec.Cmd {
|
|
var cmds []*exec.Cmd
|
|
|
|
for _, f := range files {
|
|
output := fmt.Sprintf("%s/%s", directory, f.Name)
|
|
cmd := exec.Command("wget", "-o", "/dev/stdout", "-c", "--show-progress", "-O", output, f.Url)
|
|
cmds = append(cmds, cmd)
|
|
}
|
|
|
|
return cmds
|
|
}
|