]> njoseph.me Git - nimcoon.git/commitdiff
Use aria2c download manager if available
authorJoseph Nuthalapati <njoseph@riseup.net>
Tue, 16 Jun 2020 02:00:53 +0000 (07:30 +0530)
committerJoseph Nuthalapati <njoseph@riseup.net>
Tue, 16 Jun 2020 02:06:15 +0000 (07:36 +0530)
README.md
src/lib.nim

index ddba7a1a3a7aa10853ef6c3b8e667b29f3a0442d..3043deab5a1c87a11757c1d4c22e5e4aa3927c80 100644 (file)
--- 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:
index d36e2c22d718e09a233723ec8b011cdf9385d8f7..30334588040993ba0a5c1d5fb900048ad855205c 100644 (file)
@@ -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 =