X-Git-Url: https://njoseph.me/gitweb/nimcoon.git/blobdiff_plain/ebee3b71ff95f04e0d5d6a2afbabf054b00b1e55..a2319a3ffe086b965e3925c811c8b7bdfef49f86:/clitube.nim diff --git a/clitube.nim b/clitube.nim index 3714c13..a964291 100644 --- a/clitube.nim +++ b/clitube.nim @@ -53,7 +53,6 @@ for kind, key, value in getopt(): of cmdEnd: discard -let noVideo = if musicOnly: "--no-video" else: "" if "https://www.youtube.com" in searchQuery: discard execProcess(&"{player} {searchQuery}") @@ -69,5 +68,10 @@ let number = parseInt(readLine(stdin)) styledEcho "\n", fgGreen, "Playing ", styleBright, fgMagenta, searchResults[number].title +var command = @[player, searchResults[number].url] + +if musicOnly: + command.add("--no-video") + # Play the video using the preferred/available media player -discard execProcess(&"{player} {noVideo} {searchResults[number].url}") +discard execProcess(command.join(" "))