To receive notifications about scheduled maintenance, please subscribe to the mailing-list gitlab-operations@sympa.ethz.ch. You can subscribe to the mailing-list at https://sympa.ethz.ch

Commit fcce2e07 authored by Christof Gerber's avatar Christof Gerber
Browse files

Check for executable youtube-dl

parent 4ca2fb50
Pipeline #35017 failed with stages
in 2 minutes and 29 seconds
......@@ -291,7 +291,6 @@ func GetVideoURL(id string) (video *url.URL, audio *url.URL, err error) {
// run command
cmd := exec.Command("youtube-dl", args...)
out, err := cmd.Output()
log.Info(string(out))
if err != nil {
return nil, nil, err
}
......
......@@ -3,11 +3,22 @@ package youtubedl
import (
"fmt"
"github.com/stretchr/testify/assert"
"log"
"os"
"os/exec"
"path/filepath"
"testing"
)
func TestMain(m *testing.M) {
// Make sure youtube-dl binary exists
_, err := exec.LookPath("youtube-dl")
if err != nil {
log.Fatal(err)
}
os.Exit(m.Run())
}
func TestGetPlaylistVideos(t *testing.T) {
assert.Equal(t, true, os.Getenv("YOUTUBE_DATA_API_KEY") != "")
videos, err := GetPlaylistVideos("PLpTJzCmGYaZFjE7jfH1tKFZt9rtqvvuj0", os.Getenv("YOUTUBE_DATA_API_KEY"))
......@@ -16,10 +27,10 @@ func TestGetPlaylistVideos(t *testing.T) {
}
func TestGetYouTubeDownloadLink(t *testing.T) {
_, _, err := GetVideoURL("OsFEV35tWsg")
video, audio, err := GetVideoURL("OsFEV35tWsg")
assert.Equal(t, nil, err)
//assert.Equal(t, "/videoplayback", video.Path)
//assert.Equal(t, "/videoplayback", audio.Path)
assert.Equal(t, "/videoplayback", video.Path)
assert.Equal(t, "/videoplayback", audio.Path)
}
func TestVideoIDToSub(t *testing.T) {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment