test via manual and $TEST

master
Bel LaPointe 2021-05-14 09:32:41 -04:00
parent 71588dee79
commit d256ad7916
2 changed files with 9 additions and 0 deletions

View File

@ -3,6 +3,7 @@ package youtubedl
import ( import (
"fmt" "fmt"
"log" "log"
"os"
"os/exec" "os/exec"
"path" "path"
) )
@ -15,6 +16,10 @@ func New() (*Client, error) {
} }
func (c *Client) Download(video, local string) error { func (c *Client) Download(video, local string) error {
if _, ok := os.LookupEnv("TEST"); ok {
log.Println("youtube-dl download", video, local)
return nil
}
errs := []error{} errs := []error{}
for _, extras := range [][]string{ for _, extras := range [][]string{
[]string{"--add-metadata", "--metadata-from-title", ".*[0-9]/[0-9][0-9] (?P<title>.+)"}, []string{"--add-metadata", "--metadata-from-title", ".*[0-9]/[0-9][0-9] (?P<title>.+)"},

View File

@ -3,10 +3,14 @@ package youtubedl
import ( import (
"errors" "errors"
"log" "log"
"os"
"os/exec" "os/exec"
) )
func install() error { func install() error {
if _, ok := os.LookupEnv("TEST"); ok {
return nil
}
if err := installPyPip3FFMPEG(); err != nil { if err := installPyPip3FFMPEG(); err != nil {
return err return err
} }