mirror of
https://github.com/ksyasuda/aniwrapper.git
synced 2024-11-22 03:19:53 -08:00
add 480p quality
This commit is contained in:
parent
3647be366f
commit
3b5511cfb4
13
ani-cli
13
ani-cli
@ -917,6 +917,7 @@ main() {
|
|||||||
;;
|
;;
|
||||||
Q)
|
Q)
|
||||||
if ((IS_ROFI == 1)); then
|
if ((IS_ROFI == 1)); then
|
||||||
|
qualities="1. best|2. 1080p|3. 720p|4. 480p|5. 360p|6. worst"
|
||||||
case "$quality" in
|
case "$quality" in
|
||||||
best)
|
best)
|
||||||
cur_quality=0
|
cur_quality=0
|
||||||
@ -927,20 +928,20 @@ main() {
|
|||||||
720p)
|
720p)
|
||||||
cur_quality=2
|
cur_quality=2
|
||||||
;;
|
;;
|
||||||
360p)
|
480p)
|
||||||
cur_quality=3
|
cur_quality=3
|
||||||
;;
|
;;
|
||||||
worst)
|
360p)
|
||||||
cur_quality=4
|
cur_quality=4
|
||||||
;;
|
;;
|
||||||
*)
|
worst)
|
||||||
cur_quality=0
|
cur_quality=5
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
choice=$(rofi -dmenu -dpi "$DPI" -config "$ROFI_CFG" \
|
choice=$(rofi -dmenu -dpi "$DPI" -config "$ROFI_CFG" \
|
||||||
-theme-str 'listview {columns: 1;} window {width: 20%;}' \
|
-theme-str 'listview {columns: 1;} window {width: 20%;}' \
|
||||||
-i -l 5 -only-match -sep '|' -a "$cur_quality" -mesg "$(generate_span "Current quality: $quality")" \
|
-i -l 6 -only-match -sep '|' -a "$cur_quality" -mesg "$(generate_span "Current quality: $quality")" \
|
||||||
-p "Choose quality:" <<< "1. best|2. 1080p|3. 720p|4. 360p|5. worst")
|
-p "Choose quality:" <<< "$qualities")
|
||||||
quality=$(awk '{ print $2 }' <<< "$choice")
|
quality=$(awk '{ print $2 }' <<< "$choice")
|
||||||
else
|
else
|
||||||
qualities="best|1080p|720p|480p|360p|worst"
|
qualities="best|1080p|720p|480p|360p|worst"
|
||||||
|
45
aniwrapper
45
aniwrapper
@ -10,8 +10,8 @@ CFG_DIR="${XDG_CONFIG_HOME:-$HOME/.config}/aniwrapper"
|
|||||||
CFG_FILE="$CFG_DIR/themes/aniwrapper.rasi"
|
CFG_FILE="$CFG_DIR/themes/aniwrapper.rasi"
|
||||||
DEFAULT_DOWNLOAD="$HOME/Videos/sauce"
|
DEFAULT_DOWNLOAD="$HOME/Videos/sauce"
|
||||||
ROFI_THEME="aniwrapper.rasi"
|
ROFI_THEME="aniwrapper.rasi"
|
||||||
THEMES="aniwrapper (default)|dracula|doomone|fancy|material|nord|nord2|onedark"
|
THEMES="aniwrapper|dracula|doomone|fancy|material|nord|nord2|onedark"
|
||||||
QUALITIES="1. best|2. 1080p|3. 720p|4. 360p|5. worst"
|
QUALITIES="1. best|2. 1080p|3. 720p|4. 480p|5. 360p|6. worst"
|
||||||
SUPPORTED_PLAYERS="mpv|mplayer|vlc"
|
SUPPORTED_PLAYERS="mpv|mplayer|vlc"
|
||||||
QUALITY=best
|
QUALITY=best
|
||||||
PLAYER_FN=mpv
|
PLAYER_FN=mpv
|
||||||
@ -54,7 +54,7 @@ Options:
|
|||||||
-Q <query> query the history database
|
-Q <query> query the history database
|
||||||
-v verbose output
|
-v verbose output
|
||||||
-S silent mode (suppress output to stdout) [cannot be used with -v]
|
-S silent mode (suppress output to stdout) [cannot be used with -v]
|
||||||
-t <aniwrapper (default)|dracula|doomone|fancy|flamingo|material|onedark> change rofi theme
|
-t <aniwrapper (default)|dracula|doomone|fancy|material|nord|nord2|onedark> change rofi theme
|
||||||
-T <config_path> specify custom rofi theme
|
-T <config_path> specify custom rofi theme
|
||||||
"
|
"
|
||||||
}
|
}
|
||||||
@ -113,7 +113,7 @@ run() {
|
|||||||
get_quality() {
|
get_quality() {
|
||||||
if ((IS_ROFI == 1)); then
|
if ((IS_ROFI == 1)); then
|
||||||
selection=$(rofi -dpi "$DPI" -dmenu -config "$CFG_FILE" \
|
selection=$(rofi -dpi "$DPI" -dmenu -config "$CFG_FILE" \
|
||||||
-l 5 -selected-row 0 -a 0 \
|
-l 6 -selected-row 0 -a 0 \
|
||||||
-theme-str 'listview {columns: 1;} window {width: 20%;}' \
|
-theme-str 'listview {columns: 1;} window {width: 20%;}' \
|
||||||
-p "Choose video quality:" \
|
-p "Choose video quality:" \
|
||||||
-sep '|' -only-match <<< "$QUALITIES")
|
-sep '|' -only-match <<< "$QUALITIES")
|
||||||
@ -131,6 +131,40 @@ get_quality() {
|
|||||||
lg "selected quality: $QUALITY"
|
lg "selected quality: $QUALITY"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# return the index in $THEMES of $ROFI_THEME
|
||||||
|
get_theme_idx() {
|
||||||
|
case "$ROFI_THEME" in
|
||||||
|
aniwrapper.rasi)
|
||||||
|
theme_idx=0
|
||||||
|
;;
|
||||||
|
aniwrapper-dracula.rasi)
|
||||||
|
theme_idx=1
|
||||||
|
;;
|
||||||
|
aniwrapper-doomone.rasi)
|
||||||
|
theme_idx=2
|
||||||
|
;;
|
||||||
|
aniwrapper-fancy.rasi)
|
||||||
|
theme_idx=3
|
||||||
|
;;
|
||||||
|
aniwrapper-material.rasi)
|
||||||
|
theme_idx=4
|
||||||
|
;;
|
||||||
|
aniwrapper-nord.rasi)
|
||||||
|
theme_idx=5
|
||||||
|
;;
|
||||||
|
aniwrapper-nord2.rasi)
|
||||||
|
theme_idx=6
|
||||||
|
;;
|
||||||
|
aniwrapper-onedark.rasi)
|
||||||
|
theme_idx=7
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
exit 1
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
printf "%s" "$theme_idx"
|
||||||
|
}
|
||||||
|
|
||||||
# generates a span mesg for rofi given
|
# generates a span mesg for rofi given
|
||||||
# input: message: str
|
# input: message: str
|
||||||
generate_span() {
|
generate_span() {
|
||||||
@ -395,7 +429,8 @@ main() {
|
|||||||
choice=$(rofi -dmenu -config "$CFG_FILE" -dpi "$DPI" \
|
choice=$(rofi -dmenu -config "$CFG_FILE" -dpi "$DPI" \
|
||||||
-theme-str 'listview {columns: 1;} window {width: 45%;}' \
|
-theme-str 'listview {columns: 1;} window {width: 45%;}' \
|
||||||
-only-match -l 4 -i -p "Choose theme: " -sep '|' \
|
-only-match -l 4 -i -p "Choose theme: " -sep '|' \
|
||||||
-theme-str 'listview { columns: 2; }' <<< "$THEMES")
|
-theme-str 'listview { columns: 2; }' \
|
||||||
|
-a "$(get_theme_idx)" <<< "$THEMES")
|
||||||
theme=$(awk '{ print $1 }' <<< "$choice")
|
theme=$(awk '{ print $1 }' <<< "$choice")
|
||||||
set_theme "$theme"
|
set_theme "$theme"
|
||||||
main
|
main
|
||||||
|
Loading…
Reference in New Issue
Block a user