mirror of
https://github.com/ksyasuda/aniwrapper.git
synced 2024-11-22 03:19:53 -08:00
Compare commits
No commits in common. "7ae041e95a849f4943dc0438fbe807c6738a3cd0" and "50af29a5bd8a4bbb7c9829d90cc860fe1eb03cf7" have entirely different histories.
7ae041e95a
...
50af29a5bd
44
ani-cli
44
ani-cli
@ -9,7 +9,6 @@ THEMES="aniwrapper (default)|dracula|doomone|fancy|flamingo|material|nord|onedar
|
||||
ANIWRAPPER_ICON_PATH="$CFG_DIR/icons/icon-64.png"
|
||||
MAISAN_ICON_PATH="$CFG_DIR/icons/MYsan.png"
|
||||
DPI=96
|
||||
IS_ROFI=1
|
||||
VERBOSE=0
|
||||
SILENT=0
|
||||
|
||||
@ -429,14 +428,14 @@ get_search_query() {
|
||||
ORDER BY search_date DESC;"
|
||||
|
||||
msg="Choose from list of searched anime below, or enter a unique name of an anime to search for"
|
||||
if [ "$IS_ROFI" -eq 1 ]; then
|
||||
if [ "$is_rofi" -eq 1 ]; then
|
||||
query=$(rofi -dpi "$DPI" -dmenu -l 15 -p "Search Anime:" \
|
||||
-mesg "$(generate_span "$msg")" \
|
||||
-config "$ROFI_CFG" < <(run_stmt "$stmt"))
|
||||
# Remove the id from the query
|
||||
query="${query//[1-9]*\. /}"
|
||||
lg "Query: $query"
|
||||
elif [ "$IS_ROFI" -eq 0 ]; then
|
||||
elif [ "$is_rofi" -eq 0 ]; then
|
||||
printf "Search Anime: "
|
||||
read -r query
|
||||
fi
|
||||
@ -478,7 +477,7 @@ search_eps() {
|
||||
anime_selection() {
|
||||
# Select anime from query results
|
||||
search_results=$*
|
||||
if [ "$IS_ROFI" -eq 1 ]; then
|
||||
if [ "$is_rofi" -eq 1 ]; then
|
||||
count=1
|
||||
menu=()
|
||||
res=()
|
||||
@ -550,7 +549,7 @@ anime_selection() {
|
||||
|
||||
lg "CHOICE: $choice"
|
||||
|
||||
if [ "$IS_ROFI" -eq 1 ]; then
|
||||
if [ "$is_rofi" -eq 1 ]; then
|
||||
# check both choice and name are set
|
||||
if [[ ! "$choice" ]] || [[ ! "$name" ]]; then
|
||||
die "Invalid choice... committing seppuku"
|
||||
@ -585,7 +584,7 @@ anime_selection() {
|
||||
|
||||
episode_selection() {
|
||||
ep_choice_start="1"
|
||||
if [ "$IS_ROFI" -eq 1 ]; then
|
||||
if [ "$is_rofi" -eq 1 ]; then
|
||||
# select episode number for anime
|
||||
lg "Anime ID: $anime_id"
|
||||
stmt="SELECT DISTINCT episode_number \
|
||||
@ -742,6 +741,7 @@ parse_args() {
|
||||
trap "printf '$c_reset'" INT HUP
|
||||
scrape=query
|
||||
quality=best
|
||||
is_rofi=1
|
||||
is_download=0
|
||||
download_dir="."
|
||||
half_ep=0
|
||||
@ -770,7 +770,7 @@ parse_args() {
|
||||
lg "passed in quality: $quality"
|
||||
;;
|
||||
c)
|
||||
IS_ROFI=0
|
||||
is_rofi=0
|
||||
;;
|
||||
f)
|
||||
scrape="file"
|
||||
@ -950,7 +950,7 @@ main() {
|
||||
fi
|
||||
printf "$c_blue[${c_cyan}%s$c_blue] $c_magenta%s$c_reset\n" "r" "replay current episode"
|
||||
printf "$c_blue[${c_cyan}%s$c_blue] $c_yellow%s$c_reset\n" "a" "search for another anime"
|
||||
printf "$c_blue[${c_cyan}%s$c_blue] $c_magenta%s$c_reset\n" "Q" "change video quality"
|
||||
# printf "$c_blue[${c_cyan}%s$c_blue] $c_magenta%s$c_reset\n" "h" "search history"
|
||||
printf "$c_blue[${c_cyan}%s$c_blue] $c_red%s$c_reset\n" "q" "exit"
|
||||
printf "${c_blue}Enter choice:${c_green} "
|
||||
read -r choice
|
||||
@ -965,8 +965,14 @@ main() {
|
||||
;;
|
||||
|
||||
s)
|
||||
episode_selection
|
||||
episode=$ep_choice_start
|
||||
printf "${c_blue}Choose episode $c_cyan[1-%d]$c_reset:$c_green " "$last_ep_number"
|
||||
read -r episode
|
||||
if [ "$(echo "$episode" | cut -c1-1)" = "h" ]; then
|
||||
half_ep=1
|
||||
episode=$(echo "$episode" | cut -c2-)
|
||||
fi
|
||||
printf "$c_reset"
|
||||
[ "$episode" -eq "$episode" ] 2> /dev/null || die "Invalid number entered"
|
||||
;;
|
||||
|
||||
r)
|
||||
@ -977,24 +983,6 @@ main() {
|
||||
episode=$ep_choice_start
|
||||
lg "NEW EPISODE: $selection_id - $episode"
|
||||
;;
|
||||
Q)
|
||||
qualities="best|1080p|720p|480p|360p|worst"
|
||||
if ((IS_ROFI == 1)); then
|
||||
choice=$(rofi -dmenu -dpi "$DPI" -config "$ROFI_CFG" \
|
||||
-i -l 5 -only-match -sep '|' \
|
||||
-p "Choose quality:" <<< "1. best (default)|2. 1080p|3. 720p|4. 360p|5. worst")
|
||||
quality=$(awk '{ print $2 }' <<< "$choice")
|
||||
else
|
||||
printf "${c_blue}Choose quality: [$qualities]:$c_reset "
|
||||
read -r quality
|
||||
while [[ ! "$quality" =~ ($qualities) ]]; do
|
||||
lg "$quality not a valid quality"
|
||||
printf "${c_blue}Choose quality: [$qualities]:$c_reset "
|
||||
read -r quality
|
||||
done
|
||||
fi
|
||||
episode=$((episode))
|
||||
;;
|
||||
|
||||
q)
|
||||
break
|
||||
|
@ -103,14 +103,8 @@ get_quality() {
|
||||
-sep '|' -only-match <<< "$QUALITIES")
|
||||
QUALITY=$(awk '{print $2}' <<< "$selection")
|
||||
else
|
||||
qualities="best|1080p|720p|480p|360p|worst"
|
||||
printf "%s" "Choose quality: [$qualities]: "
|
||||
printf "%s" "Enter quality [$QUALITIES]: "
|
||||
read -r QUALITY
|
||||
while [[ ! "$QUALITY" =~ ($qualities) ]]; do
|
||||
lg "$QUALITY not a valid quality -> [$qualities]"
|
||||
printf "%s" "Choose quality: [$qualities]: "
|
||||
read -r QUALITY
|
||||
done
|
||||
fi
|
||||
lg "selected quality: $QUALITY"
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user