-proc findSupportedPlayer(): string =
- for player in supported_players:
- let playerBin = execProcess("which " & player)
- if playerBin.len != 0:
- return strip(playerBin)
+# Hard-coded terminal colors
+proc reset(): string {.procvar.} = "\e[0m"
+proc bold*(s: string): string {.procvar.} = "\e[1m" & s & reset()
+
+proc fgMagenta*(s: string): string {.procvar.} = "\e[35m" & s & reset()
+proc fgCyan*(s: string): string {.procvar.} = "\e[36m" & s & reset()
+
+type SearchResult = tuple[title: string, url: string]
+
+proc selectMediaPlayer(): string =
+ let availablePlayers = filterIt(supportedPlayers, execProcess("which " & it).len != 0)
+ if len(availablePlayers) == 0:
+ echo "Please install one of the supported media players: ", supportedPlayers
+ raise newException(OSError, "No supported media player found")
+ else:
+ return availablePlayers[0]