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