Skip to content
This repository has been archived by the owner on Nov 21, 2022. It is now read-only.

Commit

Permalink
Remove unused path variables from decodeVideoStream
Browse files Browse the repository at this point in the history
  • Loading branch information
Nyah Check authored and Nyah committed Apr 9, 2020
1 parent fd38f95 commit f73a6db
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 7 deletions.
2 changes: 1 addition & 1 deletion download.go
Original file line number Diff line number Diff line change
Expand Up @@ -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{})
Expand Down
4 changes: 2 additions & 2 deletions download_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
Expand All @@ -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)
}
}
Expand Down
8 changes: 4 additions & 4 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -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))
Expand All @@ -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)
}

Expand Down

0 comments on commit f73a6db

Please sign in to comment.