Closed shadow5013 closed 3 years ago
Added that option in the config. The new config for player would look like:
{
"players": {
"mpv": {
"executable": "mpv",
"opts": [],
},
}
}
It works. But it would be nice to also have something like --player-opts "options here"
for temporary options.
Passing options, multiple at that, would be difficult with that method (for the user). The quotes would require to be escaped and it'd be a hassle anyway. In my opinion, modifying the config would be the only reasonable and simpler way.
Firstly, the quotes wouldn't require to be escaped. Everything inside quotes will be passed as an argument of --player-opts
. Quotes just preserve the literal value of each character. In other words, everything inside quotes is escaped. Here is the output of a test file where i echoed the arguments of player-opts
$ python cli.py --player-opts "--vo=gpu --gpu-context=drm"
--vo=gpu --gpu-context=drm
You can just parse opts from configuration file, concatenate it with opts from --player-opts
and then pass it to mpv.
Secondly, modifying the config file is fine for permanent options. But it'd rather be hassle for one-time options. Hope you can understand.
Alright, I've added the player-opts
to stream
. The format however is not --player-opts "--vo=gpu --gpu-context=drm"
, it is a much simpler --player-opts "--vo=gpu" "--gpu-context=drm"
and yes, it is appended to the default args (args in the config of course.)
There might be a problem with parsing.
$ ./animdl.py stream 'jujutsu' --player-opts "--speed=1.5" "--mute=yes"
░█████╗░███╗░░██╗██╗███╗░░░███╗██████╗░██╗░░░░░
██╔══██╗████╗░██║██║████╗░████║██╔══██╗██║░░░░░
███████║██╔██╗██║██║██╔████╔██║██║░░██║██║░░░░░
██╔══██║██║╚████║██║██║╚██╔╝██║██║░░██║██║░░░░░
██║░░██║██║░╚███║██║██║░╚═╝░██║██████╔╝███████╗
╚═╝░░╚═╝╚═╝░░╚══╝╚═╝╚═╝░░░░░╚═╝╚═════╝░╚══════╝v1.3.0
A highly efficient anime downloader and streamer
Usage: animdl.py stream [OPTIONS] QUERY
Try 'animdl.py stream --help' for help.
Error: no such option: --mute
So, the click.options
with multiple
works kinda differently than I thought. It works rather with
animdl.py stream 'jujutsu' --player-opts "--speed=1.5" --player-opts "--mute=yes"
than listing the commands one after other. This is a bit too weird. If you're fine with this, let me know or I'll just add a regex argument parser that does parsing through a single string.
A single string would be more convenient.
Aight, done. (Just recalled that click has shlex.split
, ignore the wrong referencing on the latest commit)
Working correctly. Thank you.
It would be very useful to be able to pass options to mpv. For instance, it is possible to play video without x server with
--vo=drm
etc.