Compare commits

...

4 Commits

Author SHA1 Message Date
ksyasuda
9f80566b6e change continue to use search history so sorting works as intended 2022-02-09 20:52:54 -08:00
ksyasuda
024bb138f0 Merge branch 'master' of github.com:ksyasuda/aniwrapper 2022-02-09 20:23:22 -08:00
ksyasuda
3b5511cfb4 add 480p quality 2022-02-09 20:22:54 -08:00
ksyasuda
3647be366f remove flamingo theme and add nord2 2022-02-09 19:50:26 -08:00
4 changed files with 172 additions and 164 deletions

29
ani-cli
View File

@ -4,7 +4,7 @@ CFG_DIR="${XDG_CONFIG_HOME:-$HOME/.config}/aniwrapper"
HISTORY_DB="$CFG_DIR/history.sqlite3" HISTORY_DB="$CFG_DIR/history.sqlite3"
ROFI_CFG="$CFG_DIR/themes/aniwrapper.rasi" ROFI_CFG="$CFG_DIR/themes/aniwrapper.rasi"
ROFI_THEME="aniwrapper.rasi" ROFI_THEME="aniwrapper.rasi"
THEMES="aniwrapper (default)|dracula|doomone|fancy|flamingo|material|nord|onedark" THEMES="aniwrapper (default)|dracula|doomone|fancy|material|nord|nord2|onedark"
ANIWRAPPER_ICON_PATH="$CFG_DIR/icons/icon-64.png" ANIWRAPPER_ICON_PATH="$CFG_DIR/icons/icon-64.png"
MAISAN_ICON_PATH="$CFG_DIR/icons/MYsan.png" MAISAN_ICON_PATH="$CFG_DIR/icons/MYsan.png"
DPI=96 DPI=96
@ -738,15 +738,15 @@ parse_args() {
fancy) fancy)
ROFI_THEME=aniwrapper-fancy.rasi ROFI_THEME=aniwrapper-fancy.rasi
;; ;;
flamingo)
ROFI_THEME=aniwrapper-flamingo.rasi
;;
material) material)
ROFI_THEME=aniwrapper-material.rasi ROFI_THEME=aniwrapper-material.rasi
;; ;;
nord) nord)
ROFI_THEME=aniwrapper-nord.rasi ROFI_THEME=aniwrapper-nord.rasi
;; ;;
nord2)
ROFI_THEME=aniwrapper-nord2.rasi
;;
onedark) onedark)
ROFI_THEME=aniwrapper-onedark.rasi ROFI_THEME=aniwrapper-onedark.rasi
;; ;;
@ -805,11 +805,11 @@ main() {
;; ;;
history) history)
BASE_URL="$(curl -s -L -o /dev/null -w "%{url_effective}\n" https://gogoanime.cm)" BASE_URL="$(curl -s -L -o /dev/null -w "%{url_effective}\n" https://gogoanime.cm)"
stmt="SELECT DISTINCT anime_name FROM watch_history ORDER BY watch_date DESC" stmt="SELECT DISTINCT anime_name FROM search_history ORDER BY search_date DESC"
search_results="$(printf "%s\n" "$stmt" | sqlite3 -noheader "$HISTORY_DB")" search_results="$(run_stmt "$stmt")"
[ -z "$search_results" ] && die "History is empty" [ -z "$search_results" ] && die "History is empty"
if ! anime_selection "${search_results[@]}"; then if ! anime_selection "${search_results[@]}"; then
die "No anime selection found" die "No anime selected"
fi fi
lg "SELECTION: $selection_id" lg "SELECTION: $selection_id"
@ -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: 25%;}' \
-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"

View File

@ -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|flamingo|material|nord|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,8 +113,8 @@ 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: 25%;}' \
-p "Choose video quality:" \ -p "Choose video quality:" \
-sep '|' -only-match <<< "$QUALITIES") -sep '|' -only-match <<< "$QUALITIES")
QUALITY=$(awk '{print $2}' <<< "$selection") QUALITY=$(awk '{print $2}' <<< "$selection")
@ -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() {
@ -154,15 +188,15 @@ set_theme() {
fancy) fancy)
ROFI_THEME=aniwrapper-fancy.rasi ROFI_THEME=aniwrapper-fancy.rasi
;; ;;
flamingo)
ROFI_THEME=aniwrapper-flamingo.rasi
;;
material) material)
ROFI_THEME=aniwrapper-material.rasi ROFI_THEME=aniwrapper-material.rasi
;; ;;
nord) nord)
ROFI_THEME=aniwrapper-nord.rasi ROFI_THEME=aniwrapper-nord.rasi
;; ;;
nord2)
ROFI_THEME=aniwrapper-nord2.rasi
;;
onedark) onedark)
ROFI_THEME=aniwrapper-onedark.rasi ROFI_THEME=aniwrapper-onedark.rasi
;; ;;
@ -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

View File

@ -1,141 +0,0 @@
/**
* User: keystroke3
* Copyright: keystroke3
*
*/
configuration {
sidebar-mode: false;
font: "Open Sans 12";
}
* {
text-color: @foreground;
active-background: rgb(170, 70, 104);
active-foreground: @foreground;
normal-background: @background;
normal-foreground: @foreground;
urgent-background: #9E2A5E;
urgent-foreground: @foreground;
alternate-active-background: @background;
alternate-active-foreground: @foreground;
alternate-normal-background: @background;
alternate-normal-foreground: @foreground;
alternate-urgent-background: @background;
alternate-urgent-foreground: @foreground;
selected-active-background: #9E2A5E;
selected-active-foreground: @foreground;
selected-normal-background: rgb(170, 70, 104);
selected-normal-foreground: #0c0816;
selected-urgent-background: #9D596B;
selected-urgent-foreground: @foreground;
background-color: #0c0816;
background: #D03C6E30;
foreground: #8fc5c6;
spacing: 0;
}
window {
location: west;
anchor: west;
height: 70%;
width: 45%;
orientation: vertical;
children: [mainbox];
border: 2px 2px 2px 0px;
border-color: @active-background;
hide-scrollbar: true;
}
mainbox {
spacing: 0.2em;
children: [inputbar, listview];
}
listview {
spacing: 0.6em;
dynamic: false;
cycle: true;
padding: 0px 5px 0px 5px;
}
inputbar {
border-radius: 50%;
padding: 5px;
border-spacing: 5px 0 0 0;
border: 1px;
spacing: 10px;
margin: 5px 0 10px;
border-color: @foreground;
}
entry{
padding: 2px;
}
prompt{
padding: 5px;
background-color: @foreground;
text-color: @background-color;
border: 1px;
border-radius: 50%;
}
element {
padding: 10px;
border-radius: 50%;
}
element normal.normal {
background-color: @normal-background;
text-color: @normal-foreground;
}
element normal.urgent {
background-color: @urgent-background;
text-color: @urgent-foreground;
}
element normal.active {
background-color: #0390fc;
text-color: @active-foreground;
}
element selected.normal {
background-color: @selected-normal-background;
text-color: @selected-normal-foreground;
border-color: @active-background;
}
element selected.urgent {
background-color: @selected-urgent-background;
text-color: @selected-urgent-foreground;
}
element selected.active {
background-color: @selected-normal-background;
text-color: #0390fc;
/* text-color: @selected-active-foreground; */
}
element alternate.normal {
background-color: @normal-background;
text-color: @normal-foreground;
}
element alternate.urgent {
background-color: @urgent-background;
text-color: @urgent-foreground;
}
element alternate.active {
/* background-color: @active-background; */
background-color: #0390fc;
text-color: @active-foreground;
}

View File

@ -0,0 +1,113 @@
/*******************************************************************************
* ROUNDED THEME FOR ROFI
* User : LR-Tech
* Theme Repo : https://github.com/lr-tech/rofi-themes-collection
*******************************************************************************/
* {
font: "Roboto 12";
background-color: transparent;
text-color: @fg0;
margin: 0px;
padding: 0px;
spacing: 0px;
bg0: #2E3440F2;
bg1: #3B4252;
bg2: #4C566A80;
bg3: #88C0D0F2;
fg0: #D8DEE9;
fg1: #ECEFF4;
fg2: #D8DEE9;
fg3: #4C566A;
}
window {
location: center;
width: 80%;
border-radius: 24px;
background-color: @bg0;
anchor: center;
}
mainbox {
padding: 12px;
}
inputbar {
background-color: @bg1;
border-color: @bg3;
border: 2px;
border-radius: 16px;
padding: 8px 16px;
spacing: 8px;
children: [ prompt, entry, case-indicator ];
}
prompt {
text-color: @fg2;
}
entry {
placeholder: "Search";
placeholder-color: @fg3;
text-color: @fg0;
}
case-indicator {
spacing: 0;
text-color: @bg3;
}
message {
margin: 12px 0 0;
border-radius: 16px;
border-color: @bg2;
background-color: @bg2;
}
textbox {
padding: 8px 24px;
}
listview {
background-color: transparent;
margin: 12px 0 0;
lines: 12;
columns: 2;
fixed-height: false;
scrollbar: false;
}
element {
padding: 8px 16px;
spacing: 8px;
border-radius: 16px;
}
element normal active, element alternate active {
background-color: @bg3;
}
element selected normal, element selected active {
background-color: @bg3;
text-color: @bg1;
}
element-icon {
size: 1em;
vertical-align: 0.5;
}
element-text {
text-color: inherit;
}
element selected {
text-color: @bg1;
}