-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path1200-saad-alghamidi.sh
executable file
·122 lines (104 loc) · 3.01 KB
/
1200-saad-alghamidi.sh
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
#!/bin/sh
PATH_MUROTAL="/home/zeroc0d3/Documents/murotal/1200_Saad_AlGhamidi"
DOWNLOAD_PATH="https://ia903200.us.archive.org/20/items/SaadAl-GhamidiPerJuz"
ID_CODE="12"
COL_RED="\033[22;31m"
COL_GREEN="\033[22;32m"
COL_BLUE="\033[22;34m"
COL_END="\033[0m"
get_time() {
DATE=`date '+%Y-%m-%d %H:%M:%S'`
}
print_line0() {
echo "$COL_GREEN=====================================================================================$COL_END"
}
print_line1() {
echo "$COL_GREEN-------------------------------------------------------------------------------------$COL_END"
}
print_line2() {
echo "-------------------------------------------------------------------------------------"
}
logo() {
clear
print_line0
echo "$COL_RED'########:'########:'########:::'#######:::'######::::'#####:::'########:::'#######:: $COL_END"
echo "$COL_RED..... ##:: ##.....:: ##.... ##:'##.... ##:'##... ##::'##.. ##:: ##.... ##:'##.... ##: $COL_END"
echo "$COL_RED:::: ##::: ##::::::: ##:::: ##: ##:::: ##: ##:::..::'##:::: ##: ##:::: ##:..::::: ##: $COL_END"
echo "$COL_RED::: ##:::: ######::: ########:: ##:::: ##: ##::::::: ##:::: ##: ##:::: ##::'#######:: $COL_END"
echo "$COL_RED:: ##::::: ##...:::: ##.. ##::: ##:::: ##: ##::::::: ##:::: ##: ##:::: ##::...... ##: $COL_END"
echo "$COL_RED: ##:::::: ##::::::: ##::. ##:: ##:::: ##: ##::: ##:. ##:: ##:: ##:::: ##:'##:::: ##: $COL_END"
echo "$COL_RED ########: ########: ##:::. ##:. #######::. ######:::. #####::: ########::. #######:: $COL_END"
echo "$COL_RED........::........::..:::::..:::.......::::......:::::.....::::........::::.......::: $COL_END"
print_line1
echo "$COL_GREEN# $TITLE :: ver-$VER $COL_END"
}
header() {
logo
print_line0
get_time
echo "$COL_RED# BEGIN PROCESS..... (Please Wait) $COL_END"
echo "$COL_RED# Start at: $DATE $COL_END"
}
footer() {
print_line0
get_time
echo "$COL_RED# Finish at: $DATE $COL_END"
echo "$COL_RED# END PROCESS..... $COL_END\n"
}
download_murotal_perjuz() {
mkdir -p $PATH_MUROTAL
cd $PATH_MUROTAL
counter=1
while [ $counter -le 30 ]
do
if [ $counter -lt 10 ]
then
download_below10 $counter
else
download_upper10 $counter
fi
((counter++))
done
}
download_below10() {
JUZ="0$1"
DOWNLOAD_LINK="$DOWNLOAD_PATH/$JUZ.mp3"
FNAME="$PATH_MUROTAL/$ID_CODE$JUZ.mp3"
msg_download $JUZ $DOWNLOAD_LINK
skip_exists $FNAME $DOWNLOAD_LINK
echo "- DONE - "
echo ""
}
download_upper10() {
JUZ="$1"
DOWNLOAD_LINK="$DOWNLOAD_PATH/$JUZ.mp3"
FNAME="$PATH_MUROTAL/$ID_CODE$JUZ.mp3"
msg_download $JUZ $DOWNLOAD_LINK
skip_exists $FNAME $DOWNLOAD_LINK
echo "- DONE - "
echo ""
}
msg_download() {
print_line2
get_time
echo "$COL_BLUE[ $DATE ] ##### Download Juz: $1 "
echo "$COL_GREEN[ $DATE ] wget $2 $COL_END"
get_time
print_line2
}
skip_exists() {
if [[ -f "$1" ]]
then
echo ">> Skip for existing file $1 ..."
else
# echo "wget -O $1 $2"
wget -O $1 $2
fi
}
main() {
header
download_murotal_perjuz
footer
}
### START HERE ###
main $@