From d7688e977df2d65d032a5535318a4a913bee625f Mon Sep 17 00:00:00 2001 From: Joseph Nuthalapati Date: Thu, 4 Jun 2020 23:34:21 +0530 Subject: [PATCH] Allow http urls to .torrent files to be streamed --- README.md | 2 +- src/lib.nim | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 75adeaa..2968502 100644 --- a/README.md +++ b/README.md @@ -13,7 +13,7 @@ only the standard library. - [x] Search for videos using keywords - [x] Stream videos and music from YouTube - [x] Play direct links from YouTube and PeerTube -- [x] Stream video and music from magnet links +- [x] Stream video and music from magnet links and hyperlinks to torrent files - [x] Download music - [x] Download video - [x] Play playlists (MPV only) diff --git a/src/lib.nim b/src/lib.nim index 0a008b8..24aa930 100644 --- a/src/lib.nim +++ b/src/lib.nim @@ -106,7 +106,7 @@ func sanitizeURL*(url: string): string = urlLongen(stripZshEscaping(url)) proc directPlay*(url: string, player: string, options: Table[string, bool]) = - if url.startswith("magnet:"): + if url.startswith("magnet:") or url.endswith(".torrent"): if options["musicOnly"]: # TODO Replace with WebTorrent once it supports media player options discard execShellCmd(&"peerflix '{url}' -a --{player} -- --no-video") -- 2.43.0