From: Joseph Nuthalapati Date: Tue, 16 Jun 2020 02:00:53 +0000 (+0530) Subject: Use aria2c download manager if available X-Git-Tag: 0.5.0~6 X-Git-Url: https://njoseph.me/gitweb/nimcoon.git/commitdiff_plain/0c2f03858ecba0812c1b92bd5d2ace75e676ddaa?hp=bd7117ada0e5f895e38c0476683e9adcae6dbd04 Use aria2c download manager if available --- 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 =