-
Notifications
You must be signed in to change notification settings - Fork 51
Customization tricks
Some times you just want to listen to the audio of a video and conveniently there --no-video
flag on your ff2mpv.py saving some bandwidth and other resources. But (if using the addon function) there is no way to control the volume and other properties of the video, this can be solved with --force-windows=yes
flag to display the mpv client. In your ff2mpv.py
or ff2mpv
:
args = ["mpv", "--force-windows=yes", "--no-video", url]
These flags can be put in a profile too in your mpv.conf
(as all your flags can). The appended lines would look like this:
[music]
no-video
force-windows=yes
The name "music" can be "potato" if you want, this is just a variable.
Then in your native client:
args = ["mpv", "--profile=music", url]
Similar to the above, you can add subtitles with a custom profile:
[subs]
slang=en,eng,english
sub-auto=fuzzy
ytdl-raw-options=ignore-config=,sub-lang="en.*",write-sub=,write-auto-sub=
...in this case, you'd patch your native client like so:
args = ["mpv", "--profile=subs", url]
Depending on how you use ff2mpv
and mpv
, you may find that you need to add custom behavior for certain domains and URL patterns. For example, you might want to:
- Add HTTP Basic credentials to a URL
- Transform a URL to match your locality
For simplicity's sake, ff2mpv
does not support URL modification within the add-on itself, and probably never will.
However, with a little bit of Ruby (or Python), you can accomplish the same thing within the native client: just test the url
variable against whatever conditions you require.
For example, here's how you could add some sort of authentication to a URL whose host is example.com
with the Ruby native client:
if URI(url).hostname == "example.com"
url = add_auth url
end
Note, however, that url
is not guaranteed to be a well-formatted URI -- it can be anything selected by the user in the browser.