-
Notifications
You must be signed in to change notification settings - Fork 0
/
Audio-Bible
190 lines (171 loc) · 6.06 KB
/
Audio-Bible
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
#!/bin/bash
###############################################################
# Setup Text Colors
black=$(tput setaf 16)
white=$(tput setaf 15)
gray=$(tput setaf 236)
blue=$(tput setaf 21)
green=$(tput setaf 28)
red=$(tput setaf 1)
cyan=$(tput setaf 36)
purple=$(tput setaf 128)
brown=$(tput setaf 130)
yellow=$(tput setaf 226)
orange=$(tput setaf 202)
pink=$(tput setaf 207)
lgray=$(tput setaf 246)
lblue=$(tput setaf 39)
lgreen=$(tput setaf 118)
lred=$(tput setaf 9)
lcyan=$(tput setaf 14)
lpurple=$(tput setaf 99)
blgray=$(tput setab 246) # Background Light Gray
BoGreen=$(tput bold; tput setaf 28) # Bold Green
ReverseGR=$(tput setaf 28; tput rev) # Reverse Green
invis=$(tput civis) # Invisible Cursor
norm=$(tput cnorm) # Normal Cursor
standout=$(tput smso)
blink=$(tput blink)
reverse=$(tput rev)
bold=$(tput bold)
reset=$(tput sgr0) # Reset text attributes to normal
###############################################################
Banner() {
printf "%b\n" "${green}"
command cat << 'EOF'
Total chapters in each book
Gen:50 Job:42 Hab:3 Col:4
Exod:40 Ps:150 Zeph:3 1Thess:5
Lev:27 Prov:31 Hag:2 2Thess:3
Num:36 Eccl:12 Zech:14 1Tim:6
Deut:34 Song:8 Mal:4 2Tim:4
Josh:24 Isa:66 Matt:28 Titus:3
Judg:21 Jer:52 Mark:16 Phlm:1
Ruth:4 Lam:5 Luke:24 Heb:13
1Sam:31 Ezek:48 John:21 Jas:5
2Sam:24 Dan:12 Acts:28 1Pet:5
1Kgs:22 Hos:14 Rom:16 2Pet:3
2Kgs:25 Joel:3 1Cor:16 1John:5
1Chr:29 Amos:9 2Cor:13 2John:1
2Chr:36 Obad:1 Gal:6 3John:1
Ezra:10 Jonah:4 Eph:6 Jude:1
Neh:13 Mic:7 Phil:4 Rev:22
Esth:10 Nah:3
EOF
printf "%b" "${orange}"
command cat << 'EOF'
Provided by NIV Dramatized Audio Bible © 2011 by Zondervan. https://www.zondervan.com/
https://www.biblegateway.com/ The Bible in multiple languages, versions, and formats
EOF
printf "%b" "${reset}"
}
NIV() {
Banner
printf "%b" "${purple}"
printf "\n"
printf "%b\n" "Type book and chapter you want to listen to.
Example: Rom 7"
printf "%b\n" "${lcyan}"
read -r -p "Book & Chapter
" line
book=$(printf "%s" "${line}" | awk '{print $1}')
chapter=$(printf "%s" "${line}" | awk '{print $2}')
#tput cuu 27
#tput el1
#tput ed
tput cnorm
printf "%b" "${green}"
printf "%b\n" "---------------------------------------------------------------------------------------------"
printf "%b" "${gray}"
printf "%b\n" "P for Pause & Play Left, Right, Up, Down Arrows for Fwd & Rev\n"
printf "\n"
printf "%b\n" "While playing type ctrl-Z then type bg to backgroud the process and continue
listening while still working in the terminal. To get back type fg to foreground the process"
printf "%b" "${green}"
printf "%b\n" "---------------------------------------------------------------------------------------------"
tput cnorm
tput sgr0
curl -s https://www.biblegateway.com/audio/dramatized/niv/"${book}"."${chapter}" | grep -Eo 'https.*mp3' | xargs mpv
Options
}
Multi() {
Banner
#tput setaf 5
#printf "\n"
#printf "%b\n" "Type book and chapters you want to listen to.
#Example Rom 3 7 this will play Romans chapter 3 thru 7"
#tput setaf 14
#read -r -p "Book & Chapters
# " line
book="${1}"
start="${2}"
end="${3}"
chapters=$(printf ""${start}" "${end}"")
printf "%b" "${green}"
printf "%b\n" "---------------------------------------------------------------------------------------------"
printf "%b" "${gray}"
printf "%b\n" "P for Pause & Play Left, Right, Up, Down Arrows for Fwd & Rev\n"
printf "\n"
printf "%b\n" "While playing type ctrl-Z then type bg to backgroud the process and continue
listening while still working in the terminal. To get back type fg to foreground the process"
printf "%b" "${green}"
printf "%b\n" "---------------------------------------------------------------------------------------------"
printf "%b" "Playing "${book}" Chapters ${chapters}\n"
tput sc
for i in $(seq ${chapters}); do
tput rc
tput ed
#printf "%b\n" "https://www.biblegateway.com/audio/dramatized/niv/"${book}"."${i}""
curl -s https://www.biblegateway.com/audio/dramatized/niv/"${book}"."${i}" | grep -Eo 'https.*mp3' | xargs mpv
done
exit
}
Options() {
printf "%b\n"
printf "%b\n" "This script can take arguments if desired\n"
scriptname=$(basename "${0}")
printf "%b\n" "---------------------------------------------------------------------------------------------\n"
printf "%b" "${scriptname}" " -m Book Firstchap Lastchap
Enters multi-mode "${red}"(-m)"${reset}" and plays consecutive chapters\n\n"
printf "%b" "${purple}" "Example:"
printf "%b\n" "${orange}" ""${scriptname}" -m Rom 3 7 "${reset}" will play Romans Chapters 3 thru 7"
printf "%b\n"
printf "%b\n" "---------------------------------------------------------------------------------------------\n"
printf "%b" "${scriptname}" " Book Chap
Enters single chapter mode and will only play a single chapter\n\n"
printf "%b" "${purple}" "Example:" "${reset}"
printf "%b\n" "${orange}" ""${scriptname}" Rom 3 "${reset}" will play Romans Chapter 3"
printf "%b\n"
printf "%b\n" "---------------------------------------------------------------------------------------------\n"
printf "%b" "${scriptname}" " Without argument will prompt for the book and single chapter to play\n\n"
printf "%b" "${purple}" "Example:" "${reset}"
printf "%b\n" "${orange}" ""${scriptname}""${reset}""
exit
}
if [ $# -eq 0 ]
then
NIV
elif [ $# -eq 2 ]
then
Banner
book=${1}
chapter=${2}
printf "%b" "${green}"
printf "%b" "---------------------------------------------------------------------------------------------\n"
printf "%b" "${gray}"
printf "%b\n" "P for Pause & Play Left, Right, Up, Down Arrows for Fwd & Rev\n"
printf "%b\n" "While playing type ctrl-Z then type bg to backgroud the process and continue
listening while still working in the terminal. To get back type fg to foreground the process"
printf "%b" "${green}"
printf "%b" "---------------------------------------------------------------------------------------------\n"
printf "%b" "${norm}"
printf "%b" "${reset}"
curl -s https://www.biblegateway.com/audio/dramatized/niv/"${book}"."${chapter}" | grep -Eo 'https.*mp3' | xargs mpv
Options
exit
elif [ $# -eq 4 ] && [ "$1" == "-m" ]
then
Multi "$2" "$3" "$4"
else
Options
fi