-
Notifications
You must be signed in to change notification settings - Fork 16
/
run.sh
executable file
·202 lines (185 loc) · 4.45 KB
/
run.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
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
191
192
193
194
195
196
197
198
199
200
201
202
#!/bin/bash
SCRIPT_PATH="main.py"
TYPE="anime"
NAME="Name-Goes-Here"
LANGUAGE="Deutsch" # most common: ["Deutsch","Ger-Sub","English"]
SEASON=0 # 0 means all seasons otherwise specify the season you want
NUM_RUNS=1
DLMODE="Series"
PROVIDER="VOE"
# Reset
Color_Off='\033[0m' # Text Reset
# Regular Colors
Black='\033[0;30m' # Black
Red='\033[0;31m' # Red
Green='\033[0;32m' # Green
Yellow='\033[0;33m' # Yellow
Blue='\033[0;34m' # Blue
Purple='\033[0;35m' # Purple
Cyan='\033[0;36m' # Cyan
White='\033[0;37m' # White
# Background
On_Black='\033[0;40m' # Black
On_Red='\033[0;41m' # Red
On_Green='\033[0;42m' # Green
On_Yellow='\033[0;43m' # Yellow
On_Blue='\033[0;44m' # Blue
On_Purple='\033[0;45m' # Purple
On_Cyan='\033[0;46m' # Cyan
On_White='\033[0;47m' # White
function choose_from_menu() {
local prompt="$1" outvar="$2"
shift
shift
local options=("$@") cur=0 count=${#options[@]} index=0
local esc=$(echo -en "\033") # cache ESC as test doesn't allow esc codes
printf "$prompt\n"
COLOR_OFF='\033[0m'
BICYAN='\033[1;96m'
WHITE='\033[0;37m'
BLACK='\033[0;30m'
while true
do
# list all options (option list is zero-based)
index=0
for o in "${options[@]}"
do
if [ "$index" == "$cur" ]
then echo -e " ${BICYAN}> $o${COLOR_OFF}" # mark & highlight the current option
else echo -e " $o"
fi
index=$(( $index + 1 ))
done
read -s -n3 key # wait for user to key in arrows or ENTER
case $key in
$esc[A)
cur=$(( $cur - 1 ))
if [ "$cur" -lt 0 ]; then
cur=0
fi ;;
$esc[B)
cur=$(( $cur + 1 ))
if [ "$cur" -ge "$count" ]; then
cur=$(( $count - 1 ))
fi ;;
'') break ;;
*) ;;
esac
echo -en "\033[${count}A" # go up to the beginning to re-render
done
# export the selection to the requested output variable
printf "${COLOR_OFF}"
printf -v $outvar "${options[$cur]}"
}
selectionsType=(
"Anime"
"TV-show"
"Quit"
)
choose_from_menu "Please select a download type:" selectedType "${selectionsType[@]}"
case $selectedType in
"Anime")
TYPE="anime"
;;
"TV-show")
TYPE="serie"
;;
"Quit")
exit
;;
*) echo "invalid option $REPLY";;
esac
echo ""
selectionsDlMode=(
"Seasons"
"Movies"
"Quit"
)
choose_from_menu "Please select the download mode:" selectedDlMode "${selectionsDlMode[@]}"
case $selectedDlMode in
"Seasons")
DLMODE="series"
;;
"Movies")
DLMODE="movies"
;;
"Quit")
exit
;;
*) echo "invalid option $REPLY";;
esac
echo ""
selectionsLanguage=(
"German"
"English"
"GerSub"
"Quit"
)
choose_from_menu "Please select a language:" selectedLanguage "${selectionsLanguage[@]}"
case $selectedLanguage in
"German")
LANGUAGE="Deutsch"
;;
"English")
LANGUAGE="English"
;;
"GerSub")
LANGUAGE="Ger-Sub"
;;
"Quit")
exit
;;
*) echo "invalid option $REPLY";;
esac
echo""
echo -e "Type in the name"
echo -e "example URL: https://aniworld.to/anime/stream/made-in-abyss/staffel-1"
echo -e "[${Green}made-in-abyss${Color_Off}]"
read -p " > " NAME
echo""
selectionsSeason=(
"All"
"Custom"
"Quit"
)
choose_from_menu "Please select a season:" selectedSeason "${selectionsSeason[@]}"
case $selectedSeason in
"All")
SEASON=0
;;
"Custom")
read -p "Enter the season number: " SEASON
;;
"Quit")
exit
;;
*) echo "invalid option $REPLY";;
esac
echo ""
selectionsProvider=(
"VOE"
"Streamtape"
"Vidoza"
"Quit"
)
choose_from_menu "Please select a provider:" selectedProvider "${selectionsProvider[@]}"
case $selectedProvider in
"VOE")
PROVIDER="VOE"
;;
"Streamtape")
PROVIDER="Streamtape"
;;
"Vidoza")
PROVIDER="Vidoza"
;;
"Quit")
exit
;;
*) echo "invalid option $REPLY";;
esac
echo ""
for ((i=1; i<=NUM_RUNS; i++))
do
python3 "$SCRIPT_PATH" --type "$TYPE" --name "$NAME" --lang "$LANGUAGE" --mode "$DLMODE" --season_override "$SEASON" --provider "$PROVIDER"
done