X-Git-Url: https://njoseph.me/gitweb/nimcoon.git/blobdiff_plain/86e6cb72964db0443c6b5527892f49721079f72a..e08e5cbe091074b7cd05bfe131edb2af70b26bc9:/src/nimcoon.nim diff --git a/src/nimcoon.nim b/src/nimcoon.nim index 265409d..f3b29c6 100644 --- a/src/nimcoon.nim +++ b/src/nimcoon.nim @@ -4,8 +4,11 @@ import strutils, tables -import config -import lib +import + config, + lib, + types, + youtube proc parseArguments(): CommandLineOptions = @@ -45,16 +48,17 @@ proc main() = if(not isValidOptions(options)): quit(1) - if searchQuery.startswith("https:") or searchQuery.startswith("magnet:"): + if searchQuery.startswith("http") or searchQuery.startswith("magnet"): if options["download"]: directDownload(sanitizeURL(searchQuery), options["musicOnly"]) else: directPlay(sanitizeURL(searchQuery), player, options) quit(0) - let searchResults = extractTitlesAndUrls(getYoutubePage(searchQuery)) + let searchResults = getSearchResults(searchQuery) + let numResults = min(limit, len(searchResults)) - present(searchResults, options, (0, limit-1), player) + present(searchResults, options, (0, numResults-1), player) when isMainModule: