mirror of
https://github.com/ksyasuda/aniwrapper.git
synced 2024-10-28 04:44:11 -07:00
update location of database and rofi config file
This commit is contained in:
parent
9254956775
commit
ec2e46df66
24
ani-cli
24
ani-cli
@ -6,7 +6,7 @@ player_fn="mpv"
|
|||||||
|
|
||||||
prog="ani-cli"
|
prog="ani-cli"
|
||||||
logfile="${XDG_CACHE_HOME:-$HOME/.cache}/ani-hsts"
|
logfile="${XDG_CACHE_HOME:-$HOME/.cache}/ani-hsts"
|
||||||
history_db="history.sqlite3"
|
history_db="${XDG_CONFIG_HOME:-$HOME/.ani-cli}/history.sqlite3"
|
||||||
|
|
||||||
c_red="\033[1;31m"
|
c_red="\033[1;31m"
|
||||||
c_green="\033[1;32m"
|
c_green="\033[1;32m"
|
||||||
@ -16,7 +16,7 @@ c_magenta="\033[1;35m"
|
|||||||
c_cyan="\033[1;36m"
|
c_cyan="\033[1;36m"
|
||||||
c_reset="\033[0m"
|
c_reset="\033[0m"
|
||||||
|
|
||||||
rofi_cmd="rofi -config ~/SudacodeRice/rofi/rofidmenu.rasi -dmenu -l 10 -i -p 'Enter Choice:'"
|
rofi_cmd="rofi -config ${XDG_CONFIG_HOME:-$HOME/.ani-cli}/meh.rasi -dmenu -l 10 -i -p 'Enter Choice:'"
|
||||||
|
|
||||||
help_text() {
|
help_text() {
|
||||||
while IFS= read line; do
|
while IFS= read line; do
|
||||||
@ -151,7 +151,7 @@ get_search_query() {
|
|||||||
hist=$(echo "$stmt" | sqlite3 "$history_db")
|
hist=$(echo "$stmt" | sqlite3 "$history_db")
|
||||||
cnt=$(printf "%s\n" "$cnt_stmt" | sqlite3 "$history_db")
|
cnt=$(printf "%s\n" "$cnt_stmt" | sqlite3 "$history_db")
|
||||||
if [ -z "$*" ]; then
|
if [ -z "$*" ]; then
|
||||||
query=$(printf "%s\n" "${hist[@]}" | rofi -dmenu -l "$cnt" -p "Search Anime:" -config ~/SudacodeRice/rofi/rofidmenu.rasi)
|
query=$(printf "%s\n" "${hist[@]}" | rofi -dmenu -l "$cnt" -p "Search Anime:" -config ${XDG_CONFIG_HOME:-$HOME/.ani-cli}/meh.rasi)
|
||||||
# if [[ "$query" != "" ]]; then
|
# if [[ "$query" != "" ]]; then
|
||||||
# insert_history "$query" "search"
|
# insert_history "$query" "search"
|
||||||
# else
|
# else
|
||||||
@ -192,7 +192,7 @@ anime_selection() {
|
|||||||
$search_results
|
$search_results
|
||||||
EOF
|
EOF
|
||||||
|
|
||||||
user_input=$(printf "${menu[@]}" | rofi -dmenu -config ~/SudacodeRice/rofi/rofidmenu.rasi -l 10 -i -p "Enter number:")
|
user_input=$(printf "${menu[@]}" | rofi -dmenu -config ${XDG_CONFIG_HOME:-$HOME/.ani-cli}/meh.rasi -l 10 -i -p "Enter number:")
|
||||||
|
|
||||||
choice=$(printf '%s\n' "$user_input" | awk '{print $1}')
|
choice=$(printf '%s\n' "$user_input" | awk '{print $1}')
|
||||||
name=$(printf '%s\n' "$user_input" | awk '{print $NF}')
|
name=$(printf '%s\n' "$user_input" | awk '{print $NF}')
|
||||||
@ -234,7 +234,12 @@ episode_selection() {
|
|||||||
printf "Range of episodes can be specified: start_number end_number\n"
|
printf "Range of episodes can be specified: start_number end_number\n"
|
||||||
|
|
||||||
# printf "${c_blue}Choose episode $c_cyan[1-%d]$c_reset:$c_green " $last_ep_number
|
# printf "${c_blue}Choose episode $c_cyan[1-%d]$c_reset:$c_green " $last_ep_number
|
||||||
choice=$(rofi -config ~/SudacodeRice/rofi/rofidmenu.rasi -dmenu -l 1 -i -p "Choose episode:")
|
# choice=$(rofi -config ${XDG_CONFIG_HOME:-$HOME/.ani-cli}/meh.rasi -dmenu -l 1 -i -p "Choose episode:")
|
||||||
|
stmt="SELECT DISTINCT episode_number FROM watch_history WHERE anime_name = '$anime_id'"
|
||||||
|
cnt_stmt="SELECT DISTINCT COUNT(*) FROM watch_history WHERE anime_name = '$anime_id'"
|
||||||
|
hist=$(echo "$stmt" | sqlite3 "$history_db")
|
||||||
|
cnt=$(printf "%s\n" "$cnt_stmt" | sqlite3 "$history_db")
|
||||||
|
choice=$(printf "%s\n" "${hist[@]}" | rofi -dmenu -l "$cnt" -p "Search Anime:" -config ${XDG_CONFIG_HOME:-$HOME/.ani-cli}/meh.rasi)
|
||||||
ep_choice_start=$(printf '%s\n' "$choice" | awk '{print $1}')
|
ep_choice_start=$(printf '%s\n' "$choice" | awk '{print $1}')
|
||||||
ep_choice_end=$(printf '%s\n' "$choice" | awk '{print $2}')
|
ep_choice_end=$(printf '%s\n' "$choice" | awk '{print $2}')
|
||||||
# echo "$ep_choice_start $ep_choice_end"
|
# echo "$ep_choice_start $ep_choice_end"
|
||||||
@ -253,7 +258,12 @@ open_episode() {
|
|||||||
err "Episode out of range"
|
err "Episode out of range"
|
||||||
# printf "${c_blue}Choose episode $c_cyan[1-%d]$c_reset:$c_green " $last_ep_number
|
# printf "${c_blue}Choose episode $c_cyan[1-%d]$c_reset:$c_green " $last_ep_number
|
||||||
# read episode
|
# read episode
|
||||||
episode=$(rofi -dmenu -l 1 -p "${c_blue}Choose episode")
|
stmt="SELECT DISTINCT episode_number FROM watch_history WHERE anime_name = '$anime_id'"
|
||||||
|
cnt_stmt="SELECT DISTINCT COUNT(*) FROM watch_history WHERE anime_name = '$anime_id'"
|
||||||
|
hist=$(echo "$stmt" | sqlite3 "$history_db")
|
||||||
|
cnt=$(printf "%s\n" "$cnt_stmt" | sqlite3 "$history_db")
|
||||||
|
episode=$(printf "%s\n" "${hist[@]}" | rofi -dmenu -l "$cnt" -p "Choose Episode:" -config ${XDG_CONFIG_HOME:-$HOME/.ani-cli}/meh.rasi)
|
||||||
|
# episode=$(rofi -dmenu -l 1 -p "Choose episode:")
|
||||||
printf "$c_reset"
|
printf "$c_reset"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@ -340,7 +350,7 @@ if [[ "$list_history" -eq 1 ]]; then
|
|||||||
cnt_stmt="SELECT DISTINCT COUNT(*) FROM search_history"
|
cnt_stmt="SELECT DISTINCT COUNT(*) FROM search_history"
|
||||||
hist=$(echo "$stmt" | sqlite3 "$history_db")
|
hist=$(echo "$stmt" | sqlite3 "$history_db")
|
||||||
cnt=$(printf "%s\n" "$cnt_stmt" | sqlite3 "$history_db")
|
cnt=$(printf "%s\n" "$cnt_stmt" | sqlite3 "$history_db")
|
||||||
printf "%s\n" "${hist[@]}" | rofi -config ~/SudacodeRice/rofi/rofidmenu.rasi -dmenu -l "$cnt" -i -p "Search History"
|
printf "%s\n" "${hist[@]}" | rofi -config ${XDG_CONFIG_HOME:-$HOME/.ani-cli}/meh.rasi -dmenu -l "$cnt" -i -p "Search History"
|
||||||
exit 0
|
exit 0
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
42
db.sh
42
db.sh
@ -1,32 +1,42 @@
|
|||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
DIR="$HOME"/'ani-cli/'
|
||||||
DB='history.sqlite3'
|
DB='history.sqlite3'
|
||||||
|
|
||||||
while getopts 'cdr' OPT; do
|
log() {
|
||||||
|
printf "%s\n" "$1"
|
||||||
|
}
|
||||||
|
|
||||||
|
while getopts 'cdrq' OPT; do
|
||||||
case "$OPT" in
|
case "$OPT" in
|
||||||
c)
|
c)
|
||||||
printf "%s\n" "Creating database..."
|
log "Creating database..."
|
||||||
sqlite3 "$DB" <sql/anime_search_history.sql
|
sqlite3 "$DIR"/"$DB" <sql/anime_search_history.sql
|
||||||
sqlite3 "$DB" <sql/watch_history.sql
|
sqlite3 "$DIR"/"$DB" <sql/watch_history.sql
|
||||||
printf "%s\n" "Created database..."
|
log "Created database..."
|
||||||
;;
|
;;
|
||||||
d)
|
d)
|
||||||
printf "%s\n" "Deleting database..."
|
log "Deleting database..."
|
||||||
rm -rf "$DB"
|
rm -rf "$DIR"/"$DB"
|
||||||
printf "%s\n" "Database deleted..."
|
log "Database deleted..."
|
||||||
;;
|
;;
|
||||||
|
|
||||||
r)
|
r)
|
||||||
printf "%s\n" "Deleting database..."
|
log "Deleting database..."
|
||||||
rm -rf "$DB"
|
rm -rf "$DIR"/"$DB"
|
||||||
printf "%s\n" "Database deleted..."
|
log "Database deleted..."
|
||||||
printf "%s\n" "Creating database..."
|
log "Creating database..."
|
||||||
sqlite3 "$DB" <sql/anime_search_history.sql
|
sqlite3 "$DIR"/"$DB" <sql/anime_search_history.sql
|
||||||
sqlite3 "$DB" <sql/watch_history.sql
|
sqlite3 "$DIR"/"$DB" <sql/watch_history.sql
|
||||||
printf "%s\n" "Created database..."
|
log "Created database..."
|
||||||
|
;;
|
||||||
|
q)
|
||||||
|
log "Connecting to database..."
|
||||||
|
sqlite3 "$DIR"/"$DB"
|
||||||
|
log "Ending connection to databse..."
|
||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
printf "%s\n" "Don't get here"
|
log "Don't get here"
|
||||||
exit 1
|
exit 1
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
|
136
themes/meh.rasi
Normal file
136
themes/meh.rasi
Normal file
@ -0,0 +1,136 @@
|
|||||||
|
/*******************************************************
|
||||||
|
* ROFI configs i3 Apps menu for EndeavourOS
|
||||||
|
* Maintainer: joekamprad <joekamprad@endeavouros.com>
|
||||||
|
*******************************************************/
|
||||||
|
configuration {
|
||||||
|
font: "mononoki Nerd Font 14";
|
||||||
|
show-icons: true;
|
||||||
|
icon-theme: "Arc-X-D";
|
||||||
|
display-drun: "Dmenu";
|
||||||
|
scroll-method: 0;
|
||||||
|
disable-history: false;
|
||||||
|
sidebar-mode: true;
|
||||||
|
markup: true;
|
||||||
|
}
|
||||||
|
|
||||||
|
@import "~/.config/rofi/arc_dark_transparent_colors.rasi"
|
||||||
|
|
||||||
|
window {
|
||||||
|
background-color: @background;
|
||||||
|
border: 0;
|
||||||
|
padding: 25;
|
||||||
|
width: 69%;
|
||||||
|
}
|
||||||
|
listview {
|
||||||
|
lines: 10;
|
||||||
|
columns: 3;
|
||||||
|
}
|
||||||
|
mainbox {
|
||||||
|
border: 0;
|
||||||
|
padding: 15;
|
||||||
|
}
|
||||||
|
message {
|
||||||
|
border: 2px 0px 0px ;
|
||||||
|
border-color: @separatorcolor;
|
||||||
|
padding: 1px ;
|
||||||
|
}
|
||||||
|
textbox {
|
||||||
|
text-color: @foreground;
|
||||||
|
}
|
||||||
|
listview {
|
||||||
|
fixed-height: 0;
|
||||||
|
border: 8px 0px 0px ;
|
||||||
|
border-color: @separatorcolor;
|
||||||
|
spacing: 10px ;
|
||||||
|
scrollbar: false;
|
||||||
|
padding: 2px 0px 0px ;
|
||||||
|
}
|
||||||
|
element {
|
||||||
|
border: 0;
|
||||||
|
padding: 8px ;
|
||||||
|
}
|
||||||
|
element-text {
|
||||||
|
background-color: inherit;
|
||||||
|
text-color: inherit;
|
||||||
|
}
|
||||||
|
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: @active-background;
|
||||||
|
text-color: @active-foreground;
|
||||||
|
}
|
||||||
|
element.selected.normal {
|
||||||
|
background-color: @selected-normal-background;
|
||||||
|
text-color: @selected-normal-foreground;
|
||||||
|
}
|
||||||
|
element.selected.urgent {
|
||||||
|
background-color: @selected-urgent-background;
|
||||||
|
text-color: @selected-urgent-foreground;
|
||||||
|
}
|
||||||
|
element.selected.active {
|
||||||
|
background-color: @selected-active-background;
|
||||||
|
text-color: @selected-active-foreground;
|
||||||
|
}
|
||||||
|
element.alternate.normal {
|
||||||
|
background-color: @alternate-normal-background;
|
||||||
|
text-color: @alternate-normal-foreground;
|
||||||
|
}
|
||||||
|
element.alternate.urgent {
|
||||||
|
background-color: @alternate-urgent-background;
|
||||||
|
text-color: @alternate-urgent-foreground;
|
||||||
|
}
|
||||||
|
element.alternate.active {
|
||||||
|
background-color: @alternate-active-background;
|
||||||
|
text-color: @alternate-active-foreground;
|
||||||
|
}
|
||||||
|
scrollbar {
|
||||||
|
width: 4px ;
|
||||||
|
border: 0;
|
||||||
|
handle-color: @normal-foreground;
|
||||||
|
handle-width: 8px ;
|
||||||
|
padding: 0;
|
||||||
|
}
|
||||||
|
mode-switcher {
|
||||||
|
border: 2px 0px 0px ;
|
||||||
|
border-color: @separatorcolor;
|
||||||
|
}
|
||||||
|
button {
|
||||||
|
spacing: 0;
|
||||||
|
text-color: @normal-foreground;
|
||||||
|
}
|
||||||
|
button.selected {
|
||||||
|
background-color: @selected-normal-background;
|
||||||
|
text-color: @selected-normal-foreground;
|
||||||
|
}
|
||||||
|
inputbar {
|
||||||
|
spacing: 0;
|
||||||
|
text-color: @normal-foreground;
|
||||||
|
padding: 5px ;
|
||||||
|
}
|
||||||
|
case-indicator {
|
||||||
|
spacing: 0;
|
||||||
|
text-color: @normal-foreground;
|
||||||
|
}
|
||||||
|
entry {
|
||||||
|
spacing: 0;
|
||||||
|
text-color: @normal-foreground;
|
||||||
|
}
|
||||||
|
prompt {
|
||||||
|
spacing: 0;
|
||||||
|
text-color: dodgerblue;
|
||||||
|
}
|
||||||
|
inputbar {
|
||||||
|
children: [ prompt,textbox-prompt-colon,entry,case-indicator ];
|
||||||
|
}
|
||||||
|
textbox-prompt-colon {
|
||||||
|
expand: false;
|
||||||
|
str: ":";
|
||||||
|
margin: 0px 0.3em 0em 0em ;
|
||||||
|
text-color: @normal-foreground;
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user