make use of config for customisability
This commit is contained in:
@ -1,28 +1,27 @@
|
||||
#!/usr/bin/bash
|
||||
|
||||
source "$HOME"/.config/Hentai.conf
|
||||
|
||||
IGREEN="\033[0;92m" # Intense Green
|
||||
IYELLOW="\033[0;93m" # Intense Yellow
|
||||
IRED='\033[0;91m' # Intense Red
|
||||
NO_COLOR="\033[0m" # Text Reset
|
||||
IN_FILE="$1_generated.txt"
|
||||
SUCCESS_FILE="$1_success.txt"
|
||||
FAIL_FILE="$1_failed.txt"
|
||||
|
||||
IN_FILE="${tmp_dir}/${1}_generated.txt"
|
||||
SUCCESS_FILE="${log_dir}/${1}_success.txt"
|
||||
FAIL_FILE="${log_dir}/${1}_failed.txt"
|
||||
|
||||
download() {
|
||||
SUCCESS="false"
|
||||
|
||||
for ((n=0;n<5;n++)); do
|
||||
if [[ $1 =~ "iwara.tv" ]]; then
|
||||
if yt-dlp --config-locations ./yt-dlp/iwara.conf -o "${2}/%(id)s.%(ext)s" "$1"; then
|
||||
echo "$1" >> "$SUCCESS_FILE"
|
||||
SUCCESS="true"
|
||||
break
|
||||
return 0
|
||||
fi
|
||||
else
|
||||
if gallery-dl --config ./gallery-dl/config.json --directory "$2" "$1"; then
|
||||
echo "$1" >> "$SUCCESS_FILE"
|
||||
SUCCESS="true"
|
||||
break
|
||||
return 0
|
||||
fi
|
||||
fi
|
||||
echo -e "${IYELLOW}download failed${NO_COLOR}"
|
||||
@ -38,26 +37,14 @@ download() {
|
||||
fi
|
||||
done
|
||||
|
||||
[[ $SUCCESS != \t\r\u\e ]] && echo "$1" >> "$FAIL_FILE"
|
||||
echo "$1" >> "$FAIL_FILE"
|
||||
}
|
||||
|
||||
if [[ -f $FAIL_FILE ]]; then
|
||||
[[ -f "${FAIL_FILE}.old" ]] && rm -f "${FAIL_FILE}.old"
|
||||
mv "$FAIL_FILE" "${FAIL_FILE}.old"
|
||||
fi
|
||||
[[ -z $2 ]] && exit 1
|
||||
Hentai generate "$1" "$tmp_dir" || exit 1
|
||||
|
||||
if [[ -f $SUCCESS_FILE ]]; then
|
||||
[[ -f "${SUCCESS_FILE}.old" ]] && rm -f "${SUCCESS_FILE}.old"
|
||||
mv "$SUCCESS_FILE" "${SUCCESS_FILE}.old"
|
||||
fi
|
||||
|
||||
[[ -f $IN_FILE ]] && rm $IN_FILE
|
||||
Hentai generate "$1"
|
||||
|
||||
if [[ $(echo $?) -ne 0 ]]; then
|
||||
echo -e "${IRED}Hentai failed to execute properly${NO_COLOR}"
|
||||
exit 1
|
||||
fi
|
||||
[[ -f $FAIL_FILE ]] && rm -f "$FAIL_FILE"
|
||||
[[ -f $SUCCESS_FILE ]] && rm -f "$SUCCESS_FILE"
|
||||
|
||||
while IFS= read -r line; do
|
||||
url=$(awk '{print $1}' <<< "$line")
|
||||
|
Reference in New Issue
Block a user