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