From: Joseph Nuthalapati Date: Wed, 4 Dec 2019 19:17:42 +0000 (+0530) Subject: Preferences go into a config file X-Git-Tag: 0.1.0~46 X-Git-Url: https://njoseph.me/gitweb/nimcoon.git/commitdiff_plain/2f0b842856236b0d6dd126d50e64eba272f3f61e Preferences go into a config file --- diff --git a/TODO.md b/TODO.md index b6f9883..2c41ca8 100644 --- a/TODO.md +++ b/TODO.md @@ -2,8 +2,8 @@ - [x] Pretty colors in terminal - [x] Get rid of temp file or make one temp file per user +- [x] Preferences should go into a config file - [ ] Terminal color themes? -- [ ] Preferences should go into a config file - [ ] Use cligen to create a proper CLI - +- [ ] Spawn video player and quit immediately diff --git a/clitube.nim b/clitube.nim index 89e863c..0c21a94 100644 --- a/clitube.nim +++ b/clitube.nim @@ -10,11 +10,7 @@ import strutils import uri import xmltree -# Supported video players in order of preference -let supportedPlayers = ["mpv", "vlc"] - -# Only show these many results -let limit = 10 +import preferences type SearchResult = tuple[title: string, url: string] @@ -54,7 +50,7 @@ let searchResults = extractTitlesAndUrls(getYoutubePage(input)) presentVideoOptions(searchResults) stdout.styledWrite(fgYellow, "Choose video number: ") -let number: int = parseInt(readLine(stdin)) +let number = parseInt(readLine(stdin)) styledEcho "\n", fgGreen, "Playing ", styleBright, fgMagenta, searchResults[number].title diff --git a/preferences.nim b/preferences.nim new file mode 100644 index 0000000..078ea9e --- /dev/null +++ b/preferences.nim @@ -0,0 +1,9 @@ +# Your preferences here. + +# Supported video players in order of preference. +# Should be able to play YouTube videos directly. +let supportedPlayers* = ["mpv", "vlc"] + +# Only show these many results +let limit* = 10 +