From a2319a3ffe086b965e3925c811c8b7bdfef49f86 Mon Sep 17 00:00:00 2001 From: Joseph Nuthalapati Date: Fri, 13 Dec 2019 23:41:31 +0530 Subject: [PATCH] Use less dangerous ways of joining strings Signed-off-by: Joseph Nuthalapati --- clitube.nim | 8 ++++++-- preferences.nim | 2 +- 2 files changed, 7 insertions(+), 3 deletions(-) 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(" ")) diff --git a/preferences.nim b/preferences.nim index 00daf48..a9ef411 100644 --- a/preferences.nim +++ b/preferences.nim @@ -2,7 +2,7 @@ # Supported video players in order of preference. # Should be able to play YouTube videos directly. -let supportedPlayers* = ["cvlc", "mpv"] +let supportedPlayers* = ["mpv", "cvlc"] # Only show these many results let limit* = 10 -- 2.43.0