fix selecting from search history and add icon to download notification

icon installed to $XDG_CONFIG_HOME/aniwrapper/
This commit is contained in:
ksyasuda 2021-12-30 11:57:53 -08:00
parent 5d0ddd59b0
commit ae66b83df2
3 changed files with 20 additions and 5 deletions

View File

@ -16,5 +16,13 @@ uninstall:
$(RM) $(DESTDIR)$(PREFIX)/bin/ani-cli $(RM) $(DESTDIR)$(PREFIX)/bin/ani-cli
$(RM) $(DESTDIR)$(PREFIX)/bin/aniwrapper $(RM) $(DESTDIR)$(PREFIX)/bin/aniwrapper
.PHONY: all install uninstall dev reinstall:
$(RM) $(DESTDIR)$(PREFIX)/bin/ani-cli
$(RM) $(DESTDIR)$(PREFIX)/bin/aniwrapper
cp ani-cli $(DESTDIR)$(PREFIX)/bin/ani-cli
cp aniwrapper $(DESTDIR)$(PREFIX)/bin/aniwrapper
chmod 0755 $(DESTDIR)$(PREFIX)/bin/ani-cli
chmod 0755 $(DESTDIR)$(PREFIX)/bin/aniwrapper
.PHONY: all install uninstall dev reinstall

10
ani-cli
View File

@ -11,6 +11,7 @@ VERBOSE=0
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)
CFG_DIR="$XDG_CONFIG_HOME/aniwrapper" CFG_DIR="$XDG_CONFIG_HOME/aniwrapper"
ROFI_CFG="meh.rasi" ROFI_CFG="meh.rasi"
ANIWRAPPER_ICON_PATH="$CFG_DIR/aniwrapper.png"
HISTORY_DB="$XDG_CONFIG_HOME/aniwrapper/history.sqlite3" HISTORY_DB="$XDG_CONFIG_HOME/aniwrapper/history.sqlite3"
@ -294,7 +295,10 @@ get_search_query() {
-mesg "$span" \ -mesg "$span" \
-config "$CFG_DIR/${ROFI_CFG}") -config "$CFG_DIR/${ROFI_CFG}")
# Remove the id from the query
query="${query//[1-9]*\. /}" query="${query//[1-9]*\. /}"
# Remove trailing whitespace to avoid being converted to '-' next step
query="${query// /}"
log "Query: $query" log "Query: $query"
else else
query=$* query=$*
@ -401,8 +405,6 @@ anime_selection() {
episode_selection() { episode_selection() {
# select episode number for anime # select episode number for anime
[ "$is_download" -eq 1 ] &&
printf "Range of episodes can be specified: start_number end_number\n"
log "Anime ID: $anime_id" log "Anime ID: $anime_id"
stmt="SELECT DISTINCT episode_number \ stmt="SELECT DISTINCT episode_number \
FROM watch_history \ FROM watch_history \
@ -498,8 +500,8 @@ open_episode() {
mkdir -p "$anime_id" || die "Could not create directory" mkdir -p "$anime_id" || die "Could not create directory"
cd "$anime_id" || die "Could not enter subdirectory $ddir/$anime_id" cd "$anime_id" || die "Could not enter subdirectory $ddir/$anime_id"
ffmpeg -i "$play_link" -c copy "${anime_id}-${episode}.mkv" >/dev/null 2>&1 && ffmpeg -i "$play_link" -c copy "${anime_id}-${episode}.mkv" >/dev/null 2>&1 &&
notify-send "Downloaded episode: $episode" || notify-send -i "$ANIWRAPPER_ICON_PATH" "Download finished for episode: $episode" ||
notify-send "Download failed episode: $episode, please retry or check your internet connection" notify-send -i "$ANIWRAPPER_ICON_PATH" "Download failed for episode: $episode. Please retry or check your internet connection"
# printf "${c_green}Downloaded episode: %s${c_reset}\n" "$episode" || # printf "${c_green}Downloaded episode: %s${c_reset}\n" "$episode" ||
# printf "${c_red}Download failed episode: %s , please retry or check your internet connection${c_reset}\n" "$episode" # printf "${c_red}Download failed episode: %s , please retry or check your internet connection${c_reset}\n" "$episode"
} }

View File

@ -28,6 +28,7 @@ log() {
# 2. create history databases in $DIR # 2. create history databases in $DIR
# 3. move theme files to $DIR # 3. move theme files to $DIR
# 4. move skip-intro.lua into mpv/scripts folder # 4. move skip-intro.lua into mpv/scripts folder
# 5. move the aniwrapper icon to $XDG_CONFIG_HOME/aniwrapper/ directory
run_setup() { run_setup() {
log "INSTALL DIR: $DIR" log "INSTALL DIR: $DIR"
@ -60,6 +61,10 @@ run_setup() {
else else
log "skip-intro.lua already exists in $XDG_CONFIG_HOME/mpv/scripts/" log "skip-intro.lua already exists in $XDG_CONFIG_HOME/mpv/scripts/"
fi fi
# install aniwrapper icon
# xdg-icon-resource install --size 64 ./assets/icons/icon-64.png aniwrapper --novendor
cp .assets/icons/icon-64.png "$XDG_CONFIG_HOME/aniwrapper/icon-64.png"
} }
if [[ ! -d "$DIR" ]]; then if [[ ! -d "$DIR" ]]; then