mirror of
https://github.com/ksyasuda/aniwrapper.git
synced 2025-12-06 14:53:37 -08:00
update themes and allow for specifying dpi with -D
This commit is contained in:
40
ani-cli
40
ani-cli
@@ -1,24 +1,21 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
VERBOSE=0
|
||||
|
||||
BASE_URL=$(curl -s -L -o /dev/null -w "%{url_effective}\n" https://gogoanime.cm)
|
||||
CFG_DIR="${XDG_CONFIG_HOME:-$HOME/.config}/aniwrapper"
|
||||
HISTORY_DB="$CFG_DIR/history.sqlite3"
|
||||
PLAYER_CMD="mpv"
|
||||
ROFI_CFG="$CFG_DIR/themes/aniwrapper.rasi"
|
||||
ROFI_THEME="aniwrapper.rasi"
|
||||
THEMES="aniwrapper (default)|dracula|doomone|fancy|flamingo|material|nord|onedark"
|
||||
ANIWRAPPER_ICON_PATH="$CFG_DIR/icons/icon-64.png"
|
||||
MAISAN_ICON_PATH="$CFG_DIR/icons/MYsan.png"
|
||||
ROFI_THEME="aniwrapper.rasi"
|
||||
ROFI_CFG="$CFG_DIR/themes/$ROFI_THEME"
|
||||
PLAYER_CMD="mpv"
|
||||
THEMES="aniwrapper (default)|dracula|fancy|flamingo|material|nord|onedark"
|
||||
DPI=96
|
||||
VERBOSE=0
|
||||
|
||||
# dependencies: grep, sed, curl, video_player, rofi, sqlite3
|
||||
# video_player ( needs to be able to play urls )
|
||||
player_fn="mpv"
|
||||
playable="\.mp4|\.mkv|\.ts|\.mp3|\.webm"
|
||||
playable_list="mp4,mkv,ts,mp3,webm"
|
||||
prog="ani-cli"
|
||||
|
||||
c_red="\033[1;31m"
|
||||
c_green="\033[1;32m"
|
||||
c_yellow="\033[1;33m"
|
||||
@@ -394,7 +391,7 @@ find_media() {
|
||||
get_directory_data "$inp"
|
||||
[ -z "$inputlist" ] && return 1
|
||||
|
||||
selection=$(rofi -dmenu -only-match -async-pre-read 33 -config "$ROFI_CFG" \
|
||||
selection=$(rofi -dpi "$DPI" -dmenu -only-match -async-pre-read 33 -config "$ROFI_CFG" \
|
||||
-l 15 -i -sep '|' -mesg "$(generate_span "Current directory: $inp")" -a "$watched" \
|
||||
-p "Enter selection" <<< "$inputlist")
|
||||
|
||||
@@ -430,9 +427,9 @@ get_search_query() {
|
||||
hist=$(run_stmt "$stmt")
|
||||
|
||||
msg="Choose from list of searched anime below, or enter a unique name of an anime to search for"
|
||||
span="<span foreground='peachpuff' style='italic' size='small' weight='light'>$msg</span>"
|
||||
span="$(generate_span "$msg")"
|
||||
if [ -z "$*" ] && [ "$is_rofi" -eq 1 ]; then
|
||||
query=$(rofi -dmenu -l 15 -p "Search Anime:" \
|
||||
query=$(rofi -dpi "$DPI" -dmenu -l 15 -p "Search Anime:" \
|
||||
-mesg "$span" \
|
||||
-config "$ROFI_CFG" <<< "${hist[@]}")
|
||||
# Remove the id from the query
|
||||
@@ -449,7 +446,7 @@ get_search_query() {
|
||||
|
||||
generate_span() {
|
||||
msg="$*"
|
||||
span="<span foreground='peachpuff' style='italic' size='small' weight='light'>$msg</span>"
|
||||
span="<span foreground='#ecbe7b' style='italic' size='small'>$msg</span>"
|
||||
printf "%s\n" "$span"
|
||||
}
|
||||
|
||||
@@ -493,9 +490,9 @@ anime_selection() {
|
||||
logger "SEARCHED: $searched"
|
||||
|
||||
# get the anime from indexed list
|
||||
msg="<span foreground='peachpuff' style='italic' size='small' weight='normal'><b>Query: $query</b></span>"
|
||||
msg="$(generate_span "Query: $query")"
|
||||
user_input=$(printf "${menu[@]}" |
|
||||
rofi -dmenu -config "$ROFI_CFG" \
|
||||
rofi -dpi "$DPI" -dmenu -config "$ROFI_CFG" \
|
||||
-a "$searched" \
|
||||
-l 12 -i -p "Enter selection:" \
|
||||
-async-pre-read 33 \
|
||||
@@ -591,11 +588,10 @@ episode_selection() {
|
||||
done
|
||||
|
||||
# get user choice and set the start and end
|
||||
# msg='<span foreground="peachpuff" style="italic" size="small" weight="light"></span>'
|
||||
msg=$(printf "%s\n%s\n" "$(generate_span "<b>Anime Name: $anime_id</b>")" "$(generate_span "Range of episodes can be provided as: START_EPISODE - END_EPISODE")")
|
||||
msg=$(printf "%s\n%s" "$(generate_span "Anime Name: $anime_id")" "$(generate_span "Range of episodes can be provided as: START_EPISODE - END_EPISODE")")
|
||||
choice=$(
|
||||
seq 1 "$last_ep_number" |
|
||||
rofi -dmenu -l 12 \
|
||||
rofi -dpi "$DPI" -dmenu -l 12 \
|
||||
-a "$watch_history" \
|
||||
-p "Select Episode [1, $last_ep_number]:" \
|
||||
-mesg "$msg" \
|
||||
@@ -736,7 +732,7 @@ is_rofi=1
|
||||
is_download=0
|
||||
download_dir="."
|
||||
half_ep=0
|
||||
while getopts 'hd:Hsvq:c-:f:t:T:CQ:' OPT; do
|
||||
while getopts 'hd:Hsvq:c-:f:t:T:CQ:D:' OPT; do
|
||||
case "$OPT" in
|
||||
h)
|
||||
help_text
|
||||
@@ -791,6 +787,9 @@ while getopts 'hd:Hsvq:c-:f:t:T:CQ:' OPT; do
|
||||
dracula)
|
||||
ROFI_THEME=aniwrapper-dracula.rasi
|
||||
;;
|
||||
doomone | doom-one)
|
||||
ROFI_THEME=aniwrapper-doomone.rasi
|
||||
;;
|
||||
fancy)
|
||||
ROFI_THEME=aniwrapper-fancy.rasi
|
||||
;;
|
||||
@@ -830,6 +829,9 @@ while getopts 'hd:Hsvq:c-:f:t:T:CQ:' OPT; do
|
||||
sqlite3 -line "$CFG_DIR/history.sqlite3" "$query"
|
||||
exit $?
|
||||
;;
|
||||
D)
|
||||
DPI="$OPTARG"
|
||||
;;
|
||||
*)
|
||||
printf "%s\n" "Invalid option"
|
||||
exit 1
|
||||
|
||||
Reference in New Issue
Block a user