From: Joseph Nuthalapati Date: Thu, 4 Jun 2020 18:04:21 +0000 (+0530) Subject: Allow http urls to .torrent files to be streamed X-Git-Tag: 0.4.0~3 X-Git-Url: http://njoseph.me/gitweb/nimcoon.git/commitdiff_plain/d7688e977df2d65d032a5535318a4a913bee625f Allow http urls to .torrent files to be streamed --- 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")