Use less dangerous ways of joining strings
authorJoseph Nuthalapati <njoseph@riseup.net>
Fri, 13 Dec 2019 18:11:31 +0000 (23:41 +0530)
committerJoseph Nuthalapati <njoseph@riseup.net>
Fri, 13 Dec 2019 18:11:31 +0000 (23:41 +0530)
Signed-off-by: Joseph Nuthalapati <njoseph@riseup.net>
clitube.nim
preferences.nim

index 3714c13612433ed295690aec1a41063ecfde2110..a9642916326dfd6a13a472b6045c74d3cade3656 100644 (file)
@@ -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(" "))
index 00daf485e8d759efde40a724c1863b5c7a4674f6..a9ef4116486e39207800e6cc563bcf0052c206d8 100644 (file)
@@ -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