From 0c2f03858ecba0812c1b92bd5d2ace75e676ddaa Mon Sep 17 00:00:00 2001 From: Joseph Nuthalapati Date: Tue, 16 Jun 2020 07:30:53 +0530 Subject: [PATCH] Use aria2c download manager if available --- README.md | 4 +++- src/lib.nim | 5 ++++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index ddba7a1..3043dea 100644 --- a/README.md +++ b/README.md @@ -40,9 +40,11 @@ pip3 install --user youtube-dl Install PeerFlix and WebTorrent ```sh -npm install --global peerflix webtorrent +npm install --global peerflix webtorrent-cli ``` +(Optional) If you want your YouTube downloads to be faster, install `aria2` download manager. + ### Installing using Nimble NimCoon can be installed from Nimble repositories: diff --git a/src/lib.nim b/src/lib.nim index d36e2c2..3033458 100644 --- a/src/lib.nim +++ b/src/lib.nim @@ -156,7 +156,10 @@ proc directDownload*(url: string, musicOnly: bool) = let args = if musicOnly: buildMusicDownloadArgs(url) else: buildVideoDownloadArgs(url) - discard execShellCmd(&"youtube-dl {args.join(\" \")}") + if isInstalled("aria2c"): + discard execShellCmd(&"youtube-dl {args.join(\" \")} --external-downloader aria2c --external-downloader-args '-x 16 -s 16 -k 2M'") + else: + discard execShellCmd(&"youtube-dl {args.join(\" \")}") proc offerSelection(searchResults: SearchResults, options: Table[string, bool], selectionRange: SelectionRange): string = -- 2.43.0