Add support for changing the MP3 audio player through the ESV_PLAYER environment variable
This commit is contained in:
parent
3751040fe0
commit
0147fe1c60
2 changed files with 19 additions and 7 deletions
14
esv.1
14
esv.1
|
@ -18,11 +18,16 @@ is a program that displays passages of the Bible on your terminal.
|
||||||
It can also play recorded audio tracks of certain passages,
|
It can also play recorded audio tracks of certain passages,
|
||||||
through integration with the
|
through integration with the
|
||||||
.Xr mpg123 1
|
.Xr mpg123 1
|
||||||
utility.
|
utility. While audio is playing, you can use the standard mpg123
|
||||||
|
controls: spacebar to pause/resume, comma to rewind, period
|
||||||
|
to fast-forward, etc. Read about the
|
||||||
|
.Fl C
|
||||||
|
option in mpg123's manual for more information.
|
||||||
|
.Pp
|
||||||
If a text passage is too long for standard display on a terminal,
|
If a text passage is too long for standard display on a terminal,
|
||||||
.Nm
|
.Nm
|
||||||
will put it through a text pager (default less) in order for you to be able to
|
will put it through a text pager (default less) in order for you to be able to
|
||||||
scroll through the text with ease. This behaviour can be disabled by passing
|
scroll through the text. This behaviour can be disabled by passing
|
||||||
the
|
the
|
||||||
.Fl P
|
.Fl P
|
||||||
flag.
|
flag.
|
||||||
|
@ -73,6 +78,11 @@ What pager to use when the passage is over 32 lines long, rather than using
|
||||||
the
|
the
|
||||||
.Ic less
|
.Ic less
|
||||||
utility.
|
utility.
|
||||||
|
.It Ev ESV_PLAYER
|
||||||
|
What MP3 player to use for playing audio, rather than using mpg123.
|
||||||
|
Using mpg123 is recommended over other players such as mpv, because
|
||||||
|
mpv's controls don't work well when started by another process
|
||||||
|
for some reason.
|
||||||
.Sh FILES
|
.Sh FILES
|
||||||
.Bl -tag -width ~/.config/esv.conf
|
.Bl -tag -width ~/.config/esv.conf
|
||||||
.It Pa ~/.config/esv.conf
|
.It Pa ~/.config/esv.conf
|
||||||
|
|
12
main.d
12
main.d
|
@ -38,6 +38,7 @@ enum DEFAULT_PAGER = "less";
|
||||||
|
|
||||||
enum ENV_CONFIG = "ESV_CONFIG";
|
enum ENV_CONFIG = "ESV_CONFIG";
|
||||||
enum ENV_PAGER = "ESV_PAGER";
|
enum ENV_PAGER = "ESV_PAGER";
|
||||||
|
enum ENV_PLAYER = "ESV_PLAYER";
|
||||||
|
|
||||||
bool optAudio;
|
bool optAudio;
|
||||||
string optConfigPath;
|
string optConfigPath;
|
||||||
|
@ -175,14 +176,15 @@ int main(string[] args)
|
||||||
return 1;
|
return 1;
|
||||||
} else {
|
} else {
|
||||||
string tmpf = esv.getAudioVerses(args[1], args[2]);
|
string tmpf = esv.getAudioVerses(args[1], args[2]);
|
||||||
string mpegPlayer;
|
string mpegPlayer = environment.get(ENV_PLAYER, DEFAULT_MPEGPLAYER);
|
||||||
// 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
|
||||||
if (DEFAULT_MPEGPLAYER == "mpg123")
|
// or use the ESV_PLAYER environment variable
|
||||||
mpegPlayer = DEFAULT_MPEGPLAYER ~ " -q ";
|
if (mpegPlayer == "mpg123")
|
||||||
else if (DEFAULT_MPEGPLAYER == "mpv")
|
mpegPlayer = mpegPlayer ~ " -q ";
|
||||||
mpegPlayer = DEFAULT_MPEGPLAYER ~ " --msg-level=all=no ";
|
else if (mpegPlayer == "mpv")
|
||||||
|
mpegPlayer = mpegPlayer ~ " --msg-level=all=no ";
|
||||||
else
|
else
|
||||||
mpegPlayer = DEFAULT_MPEGPLAYER ~ " ";
|
mpegPlayer = DEFAULT_MPEGPLAYER ~ " ";
|
||||||
// spawn mpg123
|
// spawn mpg123
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue