From 8d06ad6913cf2c0a0714523d6925d3038950f50a Mon Sep 17 00:00:00 2001 From: Joseph Nuthalapati Date: Wed, 3 Jun 2020 00:58:10 +0530 Subject: [PATCH] Start replacing PeerFlix with WebTorrent --- README.md | 8 ++++---- src/lib.nim | 4 +++- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index 7af3591..75adeaa 100644 --- a/README.md +++ b/README.md @@ -26,18 +26,18 @@ only the standard library. Nim Coon depends on the following: - youtube-dl - mpv (recommended) or vlc -- peerflix (for magnet links) +- peerflix and webtorrent (for magnet links) -Install VLC or MPV using your distribution's package manager. +Install MPV or VLC using your distribution's package manager. Install YouTube-dl ``` sh pip3 install --user youtube-dl ``` -Install PeerFlix +Install PeerFlix and WebTorrent ```sh -npm install --global peerflix +npm install --global peerflix webtorrent ``` ### Installing using Nimble diff --git a/src/lib.nim b/src/lib.nim index 4305b2c..0a008b8 100644 --- a/src/lib.nim +++ b/src/lib.nim @@ -108,9 +108,11 @@ func sanitizeURL*(url: string): string = proc directPlay*(url: string, player: string, options: Table[string, bool]) = if url.startswith("magnet:"): if options["musicOnly"]: + # TODO Replace with WebTorrent once it supports media player options discard execShellCmd(&"peerflix '{url}' -a --{player} -- --no-video") else: - discard execProcess("peerflix", args=[url, &"--{player}"], options=processOptions) + # WebTorrent is so much faster! + discard execProcess("webtorrent", args=[url, &"--{player}"], options=processOptions) else: play(player, options, url) -- 2.43.0