This is a sample Red script which purpose is to automatically hook an external audio track for any video file played. It works transparently by finding the appropriate audio and invoking your favorite media player, presenting you with a choice when appropriate.
a+v 28-Mar-2021
Syntax: a+v [options] <vfile>
Options:
--config <conffile> default: <exe-name>.conf
--player <plcmd> default: mpv
--avcall <avcmd> default: "(player)" "(vfile)" --audio-file
"(afile)"
--vcall <vcmd> default: "(player)" "(vfile)"
--size <query-size> default: 400x150
--font-name <query-font-name>
--font-size <query-font-size> default: 12
-x, --exclude <xmasks> Don't treat files with this mask as audio
-q, --quiet Suppress output (to avoid spawning a new
terminal)
--version Display program version and exit
-h, --help Display this help text and exit
- Optionally, edit
a+v.conf
to set yourplayer
or other stuff. Almost any value defined bya+v
function can be overridden in config. - Use
assoc
andftype
commands to invoke thea+v.exe
, like this:
for %i in (.mkv .mp4 .wmv) do assoc %i=player
ftype player=c:\bin\a+v.exe "%1"
- Download Red (use nightly builds!)
- Clone this repository
- Download all the dependencies. To do that in Red console type:
foreach url [
https://gitlab.com/hiiamboris/red-cli/-/raw/master/cli.red
https://gitlab.com/hiiamboris/red-mezz-warehouse/-/raw/master/glob.red
https://gitlab.com/hiiamboris/red-mezz-warehouse/-/raw/master/composite.red
https://gitlab.com/hiiamboris/red-mezz-warehouse/-/raw/master/setters.red
https://gitlab.com/hiiamboris/red-mezz-warehouse/-/raw/master/with.red
][
set [_ file] split-path url
write probe file read url
]
- Compile the exe:
red -r -e a+v.red
- If you're compiling for Windows, use
-t MSDOS
flag (should be the default) and then run this command from the Red console:
flip-exe-flag %a+v.exe
This will stop Windows from automatically showing a console for it. This step only relevant for --quiet
option, if you wish to call the player without a terminal window.