Add a fullScreen option

Signed-off-by: Joseph Nuthalapati's avatarJoseph Nuthalapati <[email protected]>
parent d1cf01c8
Pipeline #108453171 passed with stage
in 56 seconds
......@@ -17,7 +17,7 @@ import preferences
type
SearchResult = tuple[title: string, url: string]
CommandLineOptions = tuple[searchQuery: string, musicOnly: bool, feelingLucky: bool]
CommandLineOptions = tuple[searchQuery: string, musicOnly: bool, feelingLucky: bool, fullScreen: bool]
let logger = newConsoleLogger()
setLogFilter(lvlInfo)
......@@ -35,6 +35,7 @@ proc parseOptions(): CommandLineOptions =
searchQuery = ""
musicOnly = false
feelingLucky = false
fullScreen = false
for kind, key, value in getopt():
case kind
......@@ -44,10 +45,11 @@ proc parseOptions(): CommandLineOptions =
case key
of "m", "music": musicOnly = true
of "l", "lucky": feelingLucky = true
of "f", "full-screen": fullScreen = true
of cmdEnd:
discard
return (searchQuery, musicOnly, feelingLucky)
return (searchQuery, musicOnly, feelingLucky, fullScreen)
proc getYoutubePage(searchQuery: string): string =
let queryParam = encodeUrl(searchQuery)
......@@ -79,7 +81,7 @@ proc directPlay(searchQuery: string, player: string) =
proc main() =
let
player = selectMediaPlayer()
(searchQuery, musicOnly, feelingLucky) = parseOptions()
(searchQuery, musicOnly, feelingLucky, fullScreen) = parseOptions()
if searchQuery.startswith("https:") or searchQuery.startswith("magnet:"):
directPlay(searchQuery, player)
......@@ -100,6 +102,12 @@ proc main() =
if musicOnly:
command.add("--no-video")
if fullScreen:
if player == "cvlc":
command.add("--fullscreen")
if player == "mpv":
command.add("--fs")
# Play the video using the preferred/available media player
play(command.join(" "))
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment