Compare commits

..

No commits in common. "9f80566b6eddc3cddf57da0963bef23088615b4b" and "260d212e22db6af6c2f017e7332b025d207b2809" have entirely different histories.

4 changed files with 164 additions and 172 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|material|nord|nord2|onedark" THEMES="aniwrapper (default)|dracula|doomone|fancy|flamingo|material|nord|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 search_history ORDER BY search_date DESC" stmt="SELECT DISTINCT anime_name FROM watch_history ORDER BY watch_date DESC"
search_results="$(run_stmt "$stmt")" search_results="$(printf "%s\n" "$stmt" | sqlite3 -noheader "$HISTORY_DB")"
[ -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 selected" die "No anime selection found"
fi fi
lg "SELECTION: $selection_id" lg "SELECTION: $selection_id"
@ -917,7 +917,6 @@ 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
@ -928,20 +927,20 @@ main() {
720p) 720p)
cur_quality=2 cur_quality=2
;; ;;
480p) 360p)
cur_quality=3 cur_quality=3
;; ;;
360p) worst)
cur_quality=4 cur_quality=4
;; ;;
worst) *)
cur_quality=5 cur_quality=0
;; ;;
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: 25%;}' \ -theme-str 'listview {columns: 1;} window {width: 20%;}' \
-i -l 6 -only-match -sep '|' -a "$cur_quality" -mesg "$(generate_span "Current quality: $quality")" \ -i -l 5 -only-match -sep '|' -a "$cur_quality" -mesg "$(generate_span "Current quality: $quality")" \
-p "Choose quality:" <<< "$qualities") -p "Choose quality:" <<< "1. best|2. 1080p|3. 720p|4. 360p|5. worst")
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|dracula|doomone|fancy|material|nord|nord2|onedark" THEMES="aniwrapper (default)|dracula|doomone|fancy|flamingo|material|nord|onedark"
QUALITIES="1. best|2. 1080p|3. 720p|4. 480p|5. 360p|6. worst" QUALITIES="1. best|2. 1080p|3. 720p|4. 360p|5. 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|material|nord|nord2|onedark> change rofi theme -t <aniwrapper (default)|dracula|doomone|fancy|flamingo|material|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 6 -selected-row 0 -a 0 \ -l 5 -selected-row 0 -a 0 \
-theme-str 'listview {columns: 1;} window {width: 25%;}' \ -theme-str 'listview {columns: 1;} window {width: 20%;}' \
-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,40 +131,6 @@ 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() {
@ -188,15 +154,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
;; ;;
@ -429,8 +395,7 @@ 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; }' \ -theme-str 'listview { columns: 2; }' <<< "$THEMES")
-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

@ -0,0 +1,141 @@
/**
* 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

@ -1,113 +0,0 @@
/*******************************************************************************
* 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;
}