mirror of
https://github.com/ksyasuda/aniwrapper.git
synced 2024-11-22 03:19:53 -08:00
update themes and allow for specifying dpi with -D
This commit is contained in:
parent
e5bb21b4e1
commit
9662a28aa4
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
|
||||
|
43
aniwrapper
43
aniwrapper
@ -6,19 +6,20 @@ set -Eeo pipefail
|
||||
# Globals #
|
||||
#############
|
||||
CMD="/usr/bin/ani-cli"
|
||||
DEFAULT_DOWNLOAD="$HOME/Videos/sauce"
|
||||
CFG_DIR="${XDG_CONFIG_HOME:-$HOME/.config}/aniwrapper"
|
||||
CFG_FILE="$CFG_DIR/themes/aniwrapper.rasi"
|
||||
DEFAULT_DOWNLOAD="$HOME/Videos/sauce"
|
||||
ROFI_THEME="aniwrapper.rasi"
|
||||
CFG_FILE="$CFG_DIR/themes/$ROFI_THEME"
|
||||
THEMES="aniwrapper (default)|dracula|doomone|fancy|flamingo|material|nord|onedark"
|
||||
QUALITIES="1. high|2. normal (default)|3. low"
|
||||
QUALITY=normal
|
||||
THEMES="aniwrapper (default)|dracula|fancy|flamingo|material|nord|onedark"
|
||||
DPI=96
|
||||
GET_QUALITY=0
|
||||
VERBOSE=0
|
||||
IS_ROFI=1
|
||||
IS_CUSTOM_THEME=0
|
||||
IS_DOWNLOAD=0
|
||||
IS_PLAY_FROM_FILE=0
|
||||
IS_CUSTOM_THEME=0
|
||||
IS_ROFI=1
|
||||
VERBOSE=0
|
||||
|
||||
quit="6. Quit"
|
||||
options="1. Stream|2. Download|3. Continue|4. Play from File|5. Sync History|$quit"
|
||||
@ -43,7 +44,7 @@ Options:
|
||||
-d download episode in command-line mode
|
||||
-C connect to history database
|
||||
|
||||
-t <aniwrapper (default)|dracula|fancy|flamingo|material|onedark> change rofi theme
|
||||
-t <aniwrapper (default)|dracula|doomone|fancy|flamingo|material|onedark> change rofi theme
|
||||
-T <config_path> specify custom rofi theme
|
||||
-f <path_to_directory> (no trailing slash) specify starting directory for play for file mode
|
||||
-Q <query> query the history database
|
||||
@ -71,19 +72,19 @@ run() {
|
||||
get_quality
|
||||
fi
|
||||
if [[ "$IS_CUSTOM_THEME" -eq 1 ]] && [[ "$VERBOSE" -eq 0 ]]; then
|
||||
"$CMD" -q "$QUALITY" -T "$CFG_FILE" "$@"
|
||||
"$CMD" -D"$DPI" -q "$QUALITY" -T "$CFG_FILE" "$@"
|
||||
elif [[ "$IS_CUSTOM_THEME" -eq 1 ]] && [[ "$VERBOSE" -eq 1 ]]; then
|
||||
"$CMD" -vq "$QUALITY" -T "$CFG_FILE" "$@"
|
||||
"$CMD" -D"$DPI" -vq "$QUALITY" -T "$CFG_FILE" "$@"
|
||||
elif [[ "$VERBOSE" -eq 0 ]]; then
|
||||
"$CMD" -q "$QUALITY" -t "$theme" "$@"
|
||||
"$CMD" -D"$DPI" -q "$QUALITY" -t "$theme" "$@"
|
||||
else
|
||||
"$CMD" -vq "$QUALITY" -t "$theme" "$@"
|
||||
"$CMD" -D"$DPI" -vq "$QUALITY" -t "$theme" "$@"
|
||||
fi
|
||||
}
|
||||
|
||||
get_quality() {
|
||||
if [ "$IS_ROFI" -eq 1 ]; then
|
||||
selection=$(rofi -dmenu -config "$CFG_FILE" \
|
||||
selection=$(rofi -dpi "$DPI" -dmenu -config "$CFG_FILE" \
|
||||
-l 3 -selected-row 1 \
|
||||
-theme-str 'listview {columns: 1;}' -p "Choose video quality:" \
|
||||
-sep '|' <<< "$QUALITIES")
|
||||
@ -99,12 +100,12 @@ get_quality() {
|
||||
# input: message: str
|
||||
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"
|
||||
}
|
||||
|
||||
parse_args() {
|
||||
while getopts 'vhqcdf:-:t:T:CQ:' OPT; do
|
||||
while getopts 'vhqcdf:-:t:T:CQ:D:' OPT; do
|
||||
case "$OPT" in
|
||||
h)
|
||||
help_text
|
||||
@ -142,6 +143,9 @@ parse_args() {
|
||||
dracula)
|
||||
ROFI_THEME=aniwrapper-dracula.rasi
|
||||
;;
|
||||
doomone | doom-one)
|
||||
ROFI_THEME=aniwrapper-doomone.rasi
|
||||
;;
|
||||
fancy)
|
||||
ROFI_THEME=aniwrapper-fancy.rasi
|
||||
;;
|
||||
@ -179,6 +183,9 @@ parse_args() {
|
||||
[ ! -f "$CFG_FILE" ] && seppuku "config file $CFG_FILE does not exist"
|
||||
IS_CUSTOM_THEME=1
|
||||
;;
|
||||
D)
|
||||
DPI="$OPTARG"
|
||||
;;
|
||||
*)
|
||||
help_text
|
||||
exit 1
|
||||
@ -215,7 +222,7 @@ check_flags() {
|
||||
# Main #
|
||||
########
|
||||
main() {
|
||||
choice=$(echo "${options[@]}" | rofi -dmenu -only-match -sep '|' \
|
||||
choice=$(echo "${options[@]}" | rofi -dpi "$DPI" -dmenu -only-match -sep '|' \
|
||||
-config "$CFG_FILE" -l 6 -i -p "Aniwrapper")
|
||||
|
||||
[ "$choice" == "$quit" ] && quit
|
||||
@ -235,7 +242,7 @@ main() {
|
||||
# download
|
||||
# ---------------------------------------------------------------------------
|
||||
logger "Download anime"
|
||||
dl_dir=$(rofi -dmenu -config "$CFG_FILE" \
|
||||
dl_dir=$(rofi -dpi "$DPI" -dmenu -config "$CFG_FILE" \
|
||||
-l 1 -p "Enter download dir:")
|
||||
# if dl_dir is none set to current directory
|
||||
[ "$dl_dir" == "" ] && dl_dir="$DEFAULT_DOWNLOAD"
|
||||
@ -256,7 +263,7 @@ main() {
|
||||
logger "Play from file selected"
|
||||
IS_PLAY_FROM_FILE=1
|
||||
span=$(printf '%s\n%s\n' "$(generate_span "Provide a valid path to a directory or leave blank to go with the default: $HOME/Videos/sauce/")" "$(generate_span "The program will begin searching for media files from the supplied directory")")
|
||||
play_dir=$(rofi -dmenu -config "$CFG_FILE" \
|
||||
play_dir=$(rofi -dpi "$DPI" -dmenu -config "$CFG_FILE" \
|
||||
-l 1 -mesg "$span" -p "Enter path to starting directory:")
|
||||
if [ -z "$play_dir" ]; then
|
||||
mkdir -p "$DEFAULT_DOWNLOAD" || seppuku "error creating default download directory"
|
||||
@ -268,7 +275,7 @@ main() {
|
||||
;;
|
||||
5.)
|
||||
logger "Sync history database"
|
||||
roficmd="rofi -dmenu -config $CFG_FILE -l 0 -p"
|
||||
roficmd="rofi -dpi "$DPI" -dmenu -config $CFG_FILE -l 0 -p"
|
||||
username=$($roficmd "Enter the username of the remote user:")
|
||||
[ -z "$username" ] && seppuku "No username provided... exiting"
|
||||
host=$($roficmd "Enter the host for the remote machine (eg 192.168.1.99):")
|
||||
|
192
themes/aniwrapper-doomone.rasi
Normal file
192
themes/aniwrapper-doomone.rasi
Normal file
@ -0,0 +1,192 @@
|
||||
configuration {
|
||||
font: "Open Sans 12";
|
||||
show-icons: true;
|
||||
icon-theme: "Fluent-Dark";
|
||||
display-drun: "Apps";
|
||||
drun-display-format: "{name}";
|
||||
}
|
||||
|
||||
|
||||
* {
|
||||
background: #24282f;
|
||||
foreground: #bbc2cf;
|
||||
black: #464b55;
|
||||
red: #ff6c6b;
|
||||
green: #98be65;
|
||||
yellow: #ecbe7b;
|
||||
blue: #51afef;
|
||||
magenta: #c678dd;
|
||||
cyan: #46d9ff;
|
||||
white: #bbc2cf;
|
||||
selected: #82aaff;
|
||||
|
||||
spacing: 2;
|
||||
background-color: var(background);
|
||||
|
||||
normal-background: var(background);
|
||||
normal-foreground: var(foreground);
|
||||
alternate-normal-background: var(background);
|
||||
alternate-normal-foreground: var(foreground);
|
||||
selected-normal-background: var(foreground);
|
||||
selected-normal-foreground: var(background);
|
||||
|
||||
active-background: var(background);
|
||||
active-foreground: var(blue);
|
||||
alternate-active-background: var(background);
|
||||
alternate-active-foreground: var(blue);
|
||||
selected-active-background: var(blue);
|
||||
selected-active-foreground: var(magenta);
|
||||
|
||||
urgent-background: var(background);
|
||||
urgent-foreground: var(red);
|
||||
alternate-urgent-background: var(background);
|
||||
alternate-urgent-foreground: var(red);
|
||||
selected-urgent-background: var(background);
|
||||
selected-urgent-foreground: var(background);
|
||||
}
|
||||
element {
|
||||
padding: 4px 0px 4px 7px;
|
||||
spacing: 5px;
|
||||
border: 0;
|
||||
cursor: pointer;
|
||||
margin: 1px 0px;
|
||||
border-radius: 6px;
|
||||
}
|
||||
element normal.normal {
|
||||
background-color: var(normal-background);
|
||||
text-color: var(normal-foreground);
|
||||
background-color: transparent;
|
||||
}
|
||||
element normal.urgent {
|
||||
background-color: var(urgent-background);
|
||||
text-color: var(urgent-foreground);
|
||||
}
|
||||
element normal.active {
|
||||
background-color: var(active-background);
|
||||
text-color: var(active-foreground);
|
||||
}
|
||||
element selected.normal {
|
||||
background-color: var(blue);
|
||||
text-color: var(black);
|
||||
}
|
||||
element selected.urgent {
|
||||
background-color: var(selected-urgent-background);
|
||||
text-color: var(selected-urgent-foreground);
|
||||
}
|
||||
element selected.active {
|
||||
background-color: var(cyan);
|
||||
text-color: var(black);
|
||||
}
|
||||
element alternate.normal {
|
||||
background-color: var(alternate-normal-background);
|
||||
text-color: var(alternate-normal-foreground);
|
||||
background-color: transparent;
|
||||
}
|
||||
element alternate.urgent {
|
||||
background-color: var(alternate-urgent-background);
|
||||
text-color: var(alternate-urgent-foreground);
|
||||
}
|
||||
element alternate.active {
|
||||
background-color: var(alternate-active-background);
|
||||
text-color: var(alternate-active-foreground);
|
||||
}
|
||||
element-text {
|
||||
background-color: rgba(0, 0, 0, 0%);
|
||||
text-color: inherit;
|
||||
highlight: inherit;
|
||||
cursor: inherit;
|
||||
}
|
||||
element-icon {
|
||||
background-color: rgba(0, 0, 0, 0%);
|
||||
size: 1.0000em;
|
||||
text-color: inherit;
|
||||
cursor: inherit;
|
||||
}
|
||||
window {
|
||||
padding: 0;
|
||||
border: 0;
|
||||
background-color: var(background);
|
||||
width: 75%;
|
||||
border-radius: 12px;
|
||||
}
|
||||
mainbox {
|
||||
padding: 0;
|
||||
border: 0;
|
||||
}
|
||||
message {
|
||||
margin: 0px 0px 7px 15px;
|
||||
border: 0;
|
||||
}
|
||||
textbox {
|
||||
border: 0;
|
||||
text-color: var(foreground);
|
||||
margin: 0;
|
||||
}
|
||||
listview {
|
||||
margin: 0px 5px 2px 5px;
|
||||
scrollbar: true;
|
||||
spacing: 2px;
|
||||
fixed-height: 0;
|
||||
columns: 2;
|
||||
border: 0;
|
||||
}
|
||||
scrollbar {
|
||||
padding: 0;
|
||||
handle-width: 14px;
|
||||
border: 0;
|
||||
handle-color: var(selected);
|
||||
}
|
||||
button {
|
||||
spacing: 0;
|
||||
text-color: var(normal-foreground);
|
||||
cursor: pointer;
|
||||
}
|
||||
button selected {
|
||||
background-color: var(selected-normal-background);
|
||||
text-color: var(selected-normal-foreground);
|
||||
}
|
||||
|
||||
entry {
|
||||
spacing: 0;
|
||||
cursor: text;
|
||||
text-color: var(normal-foreground);
|
||||
background-color: var(black);
|
||||
}
|
||||
|
||||
inputbar {
|
||||
padding: 7px;
|
||||
margin: 7px;
|
||||
spacing: 0;
|
||||
text-color: var(normal-foreground);
|
||||
children: [ prompt,textbox-prompt-colon,entry,case-indicator ];
|
||||
background-color: transparent;
|
||||
}
|
||||
|
||||
case-indicator {
|
||||
spacing: 0;
|
||||
text-color: var(yellow);
|
||||
margin: 0 0 0 0.5%;
|
||||
}
|
||||
|
||||
entry {
|
||||
padding: 4px 8px;
|
||||
spacing: 0;
|
||||
text-color: var(blue);
|
||||
border-radius: 6px;
|
||||
}
|
||||
|
||||
prompt {
|
||||
spacing: 0;
|
||||
text-color: var(magenta);
|
||||
padding: 4px 0px;
|
||||
background-color: transparent;
|
||||
}
|
||||
|
||||
textbox-prompt-colon {
|
||||
expand: false;
|
||||
str: ":";
|
||||
margin: 0px 0.3em 0em 0em ;
|
||||
text-color: var(magenta);
|
||||
padding: 4px 0px;
|
||||
background-color: transparent;
|
||||
}
|
@ -6,7 +6,7 @@
|
||||
|
||||
configuration {
|
||||
sidebar-mode: false;
|
||||
font: "Open Sans 15";
|
||||
font: "Open Sans 11";
|
||||
}
|
||||
|
||||
* {
|
||||
|
@ -1,5 +1,5 @@
|
||||
* {
|
||||
font: "Open Sans 15";
|
||||
font: "Open Sans 12";
|
||||
nord0: #2e3440;
|
||||
nord1: #3b4252;
|
||||
nord2: #434c5e;
|
||||
|
@ -1,5 +1,5 @@
|
||||
configuration {
|
||||
font: "Open Sans 15";
|
||||
font: "Open Sans 11";
|
||||
display-drun: "Dmenu";
|
||||
scroll-method: 0;
|
||||
disable-history: false;
|
||||
|
Loading…
Reference in New Issue
Block a user