From f73a6db5a6fc0f579f9d9404f803407618fb882a Mon Sep 17 00:00:00 2001 From: Nyah Check Date: Thu, 9 Apr 2020 01:06:23 -0700 Subject: [PATCH] Remove unused path variables from decodeVideoStream --- download.go | 2 +- download_test.go | 4 ++-- main.go | 8 ++++---- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/download.go b/download.go index 457b3e2..92f1649 100644 --- a/download.go +++ b/download.go @@ -37,7 +37,7 @@ func fixExtension(str string) string { // decodeVideoStream processes downloaded video stream and // decodeVideoStream calls helper functions and writes the // output in the required format -func decodeVideoStream(videoUrl, path, format string) error { +func decodeVideoStream(videoUrl, format string) error { // Get video data res, err := goutubedl.New(context.Background(), videoUrl, goutubedl.Options{}) diff --git a/download_test.go b/download_test.go index f8cfd54..de83282 100644 --- a/download_test.go +++ b/download_test.go @@ -22,7 +22,7 @@ func TestApi(t *testing.T) { // path := "test" for i, table := range tables { - err := decodeVideoStream(table.url, "~/Downloads", "mp3") + err := decodeVideoStream(table.url, "mp3") if err != nil { t.Errorf("videoId(%d): expected %q, actual %q", i, table.id, err) } @@ -31,7 +31,7 @@ func TestApi(t *testing.T) { func BenchmarkVideoId(b *testing.B) { for n := 0; n < b.N; n++ { - if err := decodeVideoStream(tables[0].url, "~/Downloads", "mp3"); err != nil { + if err := decodeVideoStream(tables[0].url, "mp3"); err != nil { b.Errorf("Error downloading video: %v", err) } } diff --git a/main.go b/main.go index be4ca09..463d7f1 100644 --- a/main.go +++ b/main.go @@ -89,18 +89,18 @@ func parseUrls(urls string) []string { func beginDownload(urls []string) { if len(urls) < 2 { - if err := decodeVideoStream(urls[0], path, format); err != nil { + if err := decodeVideoStream(urls[0], format); err != nil { logrus.Errorf("Unable to beginDownload: %v", err) } } else { - if err := concurrentDownload(MAXDOWNLOADS, format, path, urls); err != nil { + if err := concurrentDownload(MAXDOWNLOADS, format, urls); err != nil { logrus.Errorf("Unable to concurrently download videos: %v with errors => %v", urls, err) } } } //DownloadStreams download a batch of elements asynchronously -func concurrentDownload(maxOperations int, format, outputPath string, urls []string) <-chan error { +func concurrentDownload(maxOperations int, format string, urls []string) <-chan error { var wg sync.WaitGroup wg.Add(len(urls)) @@ -109,7 +109,7 @@ func concurrentDownload(maxOperations int, format, outputPath string, urls []str for _, url := range urls { go func(url string) { defer wg.Done() - ch <- decodeVideoStream(url, path, format) + ch <- decodeVideoStream(url, format) }(url) }