mirror of
https://github.com/ksyasuda/aniwrapper.git
synced 2024-10-28 04:44:11 -07:00
update aniwrapper to allow passing in search query for stream/download
This commit is contained in:
parent
7c71e05317
commit
d8b5f2b94a
47
aniwrapper
47
aniwrapper
@ -73,7 +73,6 @@ run() {
|
|||||||
if ((IS_PLAY_FROM_FILE == 0 && GET_QUALITY == 1)); then
|
if ((IS_PLAY_FROM_FILE == 0 && GET_QUALITY == 1)); then
|
||||||
get_quality
|
get_quality
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if ((SILENT == 1)); then
|
if ((SILENT == 1)); then
|
||||||
if ((IS_CUSTOM_THEME == 0)); then
|
if ((IS_CUSTOM_THEME == 0)); then
|
||||||
"$CMD" -D"$DPI" -Sq "$QUALITY" -t "$theme" "$@"
|
"$CMD" -D"$DPI" -Sq "$QUALITY" -t "$theme" "$@"
|
||||||
@ -218,7 +217,6 @@ parse_args() {
|
|||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
done
|
done
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
check_flags() {
|
check_flags() {
|
||||||
@ -227,7 +225,7 @@ check_flags() {
|
|||||||
seppuku "verbose and silent options cannot be used together"
|
seppuku "verbose and silent options cannot be used together"
|
||||||
fi
|
fi
|
||||||
if ((IS_ROFI == 0 && IS_DOWNLOAD == 0)); then
|
if ((IS_ROFI == 0 && IS_DOWNLOAD == 0)); then
|
||||||
run -c
|
run -c "$@"
|
||||||
exit $?
|
exit $?
|
||||||
elif ((IS_ROFI == 0 && IS_DOWNLOAD == 1)); then
|
elif ((IS_ROFI == 0 && IS_DOWNLOAD == 1)); then
|
||||||
printf "%s" "Enter download dir: "
|
printf "%s" "Enter download dir: "
|
||||||
@ -236,21 +234,33 @@ check_flags() {
|
|||||||
if [ ! -d "$dl_dir" ]; then
|
if [ ! -d "$dl_dir" ]; then
|
||||||
mkdir -p "$dl_dir" || seppuku "Error creating directory: $dl_dir"
|
mkdir -p "$dl_dir" || seppuku "Error creating directory: $dl_dir"
|
||||||
fi
|
fi
|
||||||
run "-cd $dl_dir"
|
run "-cd $dl_dir" "$@"
|
||||||
exit $?
|
exit $?
|
||||||
elif ((IS_ROFI == 1 && IS_PLAY_FROM_FILE == 1 && IS_CUSTOM_THEME == 1)); then
|
elif ((IS_ROFI == 1 && IS_PLAY_FROM_FILE == 1 && IS_CUSTOM_THEME == 1)); then
|
||||||
run "-f$play_path" -T "$CFG_FILE"
|
run "-f$play_path" -T "$CFG_FILE" "$@"
|
||||||
exit $?
|
exit $?
|
||||||
elif ((IS_ROFI == 1 && IS_PLAY_FROM_FILE == 1 && IS_CUSTOM_THEME == 0)); then
|
elif ((IS_ROFI == 1 && IS_PLAY_FROM_FILE == 1 && IS_CUSTOM_THEME == 0)); then
|
||||||
run "-f$play_path" -t "$theme"
|
run "-f$play_path" -t "$theme" "$@"
|
||||||
exit $?
|
exit $?
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
get_dl_dir() {
|
||||||
|
dl_dir=$(
|
||||||
|
rofi -dpi "$DPI" -dmenu -config "$CFG_FILE" \
|
||||||
|
-mesg "$(generate_span "Enter the path to the download directory, or leave blank to go with the default: $HOME/Videos/sauce/")" \
|
||||||
|
-l 1 -p "Enter download dir:"
|
||||||
|
)
|
||||||
|
# if dl_dir is none set to current directory
|
||||||
|
[ "$dl_dir" == "" ] && dl_dir="$DEFAULT_DOWNLOAD"
|
||||||
|
}
|
||||||
|
|
||||||
########
|
########
|
||||||
# Main #
|
# Main #
|
||||||
########
|
########
|
||||||
main() {
|
main() {
|
||||||
|
((SILENT != 1)) && lg "CONFIG DIR: $CFG_DIR"
|
||||||
|
((SILENT != 1)) && lg "ROFI CFG: $CFG_FILE"
|
||||||
choice=$(echo "${options[@]}" | rofi -dpi "$DPI" -dmenu -only-match -sep '|' \
|
choice=$(echo "${options[@]}" | rofi -dpi "$DPI" -dmenu -only-match -sep '|' \
|
||||||
-config "$CFG_FILE" -l 7 -i -p "Aniwrapper")
|
-config "$CFG_FILE" -l 7 -i -p "Aniwrapper")
|
||||||
|
|
||||||
@ -271,14 +281,7 @@ main() {
|
|||||||
# download
|
# download
|
||||||
# ---------------------------------------------------------------------------
|
# ---------------------------------------------------------------------------
|
||||||
lg "Download anime"
|
lg "Download anime"
|
||||||
dl_dir=$(
|
get_dl_dir && run -d "$dl_dir"
|
||||||
rofi -dpi "$DPI" -dmenu -config "$CFG_FILE" \
|
|
||||||
-mesg "$(generate_span "Enter the path to the download directory, or leave blank to go with the default: $HOME/Videos/sauce/")" \
|
|
||||||
-l 1 -p "Enter download dir:"
|
|
||||||
)
|
|
||||||
# if dl_dir is none set to current directory
|
|
||||||
[ "$dl_dir" == "" ] && dl_dir="$DEFAULT_DOWNLOAD"
|
|
||||||
run -d "$dl_dir"
|
|
||||||
;;
|
;;
|
||||||
3.)
|
3.)
|
||||||
|
|
||||||
@ -348,7 +351,15 @@ main() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
parse_args "$@"
|
parse_args "$@"
|
||||||
((SILENT != 1)) && lg "CONFIG DIR: $CFG_DIR"
|
shift $((OPTIND - 1))
|
||||||
((SILENT != 1)) && lg "ROFI CFG: $CFG_FILE"
|
if [ $# -gt 0 ]; then
|
||||||
check_flags
|
check_flags "$*"
|
||||||
main
|
if [ "$IS_DOWNLOAD" -eq 0 ]; then
|
||||||
|
run "$*"
|
||||||
|
elif [ "$IS_DOWNLOAD" -eq 1 ]; then
|
||||||
|
get_dl_dir && run -d "$dl_dir" "$*"
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
check_flags
|
||||||
|
main
|
||||||
|
fi
|
||||||
|
Loading…
Reference in New Issue
Block a user