fix anime selection menu styling

getting list of active elements for rofi was broken due to bad not actually
incrementing the loop each iteration
This commit is contained in:
ksyasuda 2022-01-01 18:59:11 -08:00
parent ef5e8b6ec3
commit ce75838882
2 changed files with 33 additions and 14 deletions

View File

@ -33,7 +33,6 @@ however using the ani-cli script itself is also possible
**Table of Contents**
- [Aniwrapper](#aniwrapper)
- [Introduction](#introduction)
- [Setup](#setup)
- [Skip Intro Script](#skip-intro-script)
@ -95,7 +94,7 @@ episode introduction by skipping to the next moment of silence in the video
### Arch Linux
`aniwrapper-git` is available on the AUR for Arch users
`aniwrapper-git` is available on the [AUR](https://aur.archlinux.org/packages/aniwrapper-git/) for Arch users
```sh
paru -S aniwrapper-git
@ -107,7 +106,7 @@ yay -S aniwrapper-git
To install manually, make sure the dependencies are installed first
### Install the Dependencies
#### Install the Dependencies
```sh
# Arch
@ -117,7 +116,7 @@ pacman -S --needed grep curl sed mpv ffmpeg rofi sqlite3
apt install grep curl sed mpv ffmpeg rofi sqlite3
```
### Clone the repo
#### Clone the repo
Use the following command to clone the Git repository locally and switch into the cloned directory
@ -125,7 +124,7 @@ Use the following command to clone the Git repository locally and switch into th
git clone https://github.com/ksyasuda/aniwrapper && cd aniwrapper
```
### Run the setup and install the script
#### Run the setup and install the script
After switching into the `aniwrapper` directory, run the following commands to set up and install the script
@ -142,6 +141,23 @@ There are several menus used to drive the program forward
The first menu consists of a search box and a list of anime titles corresponding to past valid searches. Choose an option from the menu, or enter in a unique search query to search for a new anime. The result from this will be used to query against `gogoanime` and return similar named anime
### Dealing with conflicting search queries / rofi grabbing from search list
I can write more about it later, but in this program, rofi is configured to search with case insensitivity and select the best match from the list if there are matches. This can make it difficult at times to write a search query that does not trigger a selection from the rofi menu
<div align="center">
![selection with query 'isekai'](https://imgur.com/c2U4kdn.png)
Once your history starts filling up, it becomes progressively more difficult to form unique search queries
![selection with dash](https://imgur.com/eS7DgDU.png)
The workaround for this is to prepend a dash ` -` to the search query<br/>
The above output was produced by searching: `isekai -`
</div>
As of the update on 2022-01-01, if selecting an anime from the search history list, the [anime selection](#anime-selection) menu will be skipped and the program will move on to [episode selection](#episode-selection)
## Anime Selection
The next menu is where you select the anime to watch from a narrowed down list. Elements that have a blue border and text color indicate which anime have been watched before
@ -240,10 +256,10 @@ This would open/download episodes 1 2 3 4 5 6
<div align="center">
Aniwrapper Main Menu
![aniwrapper frontpage](https://imgur.com/ZAmoEUA.png)
Aniwrapper Streaming Menu
![aniwrapper streaming options](https://imgur.com/jVJQERk.png)
![aniwrapper anime selection](https://imgur.com/eS7DgDU.png)
More to come soon... maybe
</div>

11
ani-cli
View File

@ -351,21 +351,24 @@ anime_selection() {
check_db "$anime" "search"
if [[ $? -gt 0 ]]; then
log "SEARCHED BEFORE"
if [[ "$searched" == "" ]]; then
searched="$((cnt++))"
if [ -z "$searched" ]; then
searched="$cnt"
else
searched="$searched, $((cnt++))"
searched="$searched, $cnt"
fi
fi
((++cnt))
done
log "SEARCHED: $searched"
# get the anime from indexed list
msg="<span foreground='peachpuff' style='italic' size='small' weight='normal'>Query: $query</span>"
user_input=$(printf "${menu[@]}" |
rofi -dmenu -config "$CFG_DIR/${ROFI_CFG}" \
-a "$searched" \
-l 12 -i -p "Enter number:")
-l 12 -i -p "Enter number:" \
-mesg "$msg")
[ -z "$user_input" ] && return 1
choice=$(printf '%s\n' "$user_input" | awk '{print $1}')