From 2f0b842856236b0d6dd126d50e64eba272f3f61e Mon Sep 17 00:00:00 2001 From: Joseph Nuthalapati Date: Thu, 5 Dec 2019 00:47:42 +0530 Subject: [PATCH] Preferences go into a config file --- TODO.md | 4 ++-- clitube.nim | 8 ++------ preferences.nim | 9 +++++++++ 3 files changed, 13 insertions(+), 8 deletions(-) create mode 100644 preferences.nim 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 + -- 2.43.0