esv: rename mpegPlayer to player

This commit is contained in:
Jeremy Baxter 2024-06-25 15:53:39 +12:00
parent 59c92c8db7
commit 6096e01e01

16
esv.d
View file

@ -167,30 +167,30 @@ key = %s
esv = new ESVApi(apiKey);
if (aFlag) {
string tmpf, mpegPlayer;
string tmpf, player;
try
tmpf = esv.getAudioPassage(args[1], args[2]);
catch (CurlException e)
die(e.msg);
mpegPlayer = environment.get(cf.playerEnv, cf.mp3Player);
player = environment.get(cf.playerEnv, cf.mp3Player);
/* check for an audio player */
enforceDie(
executeShell(
format!"command -v %s >/dev/null 2>&1"(mpegPlayer)
format!"command -v %s >/dev/null 2>&1"(player)
).status == 0,
mpegPlayer ~ " is required for audio mode; cannot continue");
player ~ " is required for audio mode; cannot continue");
/* esv has built-in support for mpg123 and mpv.
* other players will work, just recompile with
* the DEFAULT_MPEGPLAYER enum set differently
* or use the ESV_PLAYER environment variable */
mpegPlayer ~=
mpegPlayer == "mpg123" ? " -q " :
mpegPlayer == "mpv" ? " --msg-level=all=no " : " ";
player ~=
player == "mpg123" ? " -q " :
player == "mpv" ? " --msg-level=all=no " : " ";
/* spawn the player */
executeShell(mpegPlayer ~ tmpf);
executeShell(player ~ tmpf);
return 0;
}