View source: R/program_management.R
| find_ffmpeg | R Documentation |
Each of these functions returns the location of one program as a string:
find_ffmpeg(), find_ffprobe(), find_ffplay() and find_mediainfo().
find_ffmpeg()
find_mediainfo()
find_ffprobe()
find_ffplay()
The function looks on the PATH first. If the program is not there, the
function reads the location that set_program() saved. That location is in
a file under tools::R_user_dir("tidymedia", "config"). If neither place has
the program, the function gives a warning and returns NULL.
The location of the program as a string, or NULL when it could
not be found.
A saved location that no longer works gives a warning, and the function
returns NULL. The warning has one of three classes that you can catch:
tidymedia_location_gone: the function read the location, but no program
is there now. The condition holds the program name in tm_program and the
location in tm_location, as the file holds it.
tidymedia_location_not_executable: a file is at the saved location, and
it cannot be run. Give it permission to execute, or use the set_*()
function to point at another copy. The condition holds the program name in
tm_program and the location in tm_location, as the file holds it.
This case does not arise
on Windows, which has no execute bit. There a location is read the way R's
own Sys.which() reads it, except that a folder never counts and a
leading ~ is expanded.
tidymedia_location_unreadable: the file does not hold exactly one
location. It is empty, has more than one line, or has one empty line. The
condition holds the program name in tm_program and the file in
tm_file.
A line that holds only spaces counts as a location. So it gives
tidymedia_location_gone, not tidymedia_location_unreadable.
To fix any of the three, forget the location with unset_program(), or
replace it with set_program(). A file that cannot be run can also be fixed
by giving it permission to execute.
Versions of the package before 0.2.0 saved locations in a different folder,
rappdirs::user_config_dir("tidymedia", "R"). The functions still read a
file in that folder. They read it only when the current folder has no file
for the program. program_status() looks in the same places, in the same
order.
A tidymedia_location_unreadable warning names the file that the function
read. That file can be the one in the old folder.
set_program() writes to the current folder only. After it writes a file
for a program, the old file for that program is not read.
unset_program() removes the file in both folders. So the old location does
not come back after the current file is gone.
set_program() to save the location of a program that is not on
the PATH, and install_on_win() to download FFmpeg on Windows.
Other program management functions:
install_on_win(),
program_status(),
set_program(),
unset_program()
# Returns the path to the binary, or NULL with a warning if it is not found
find_ffmpeg()
find_mediainfo()
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.