-
Notifications
You must be signed in to change notification settings - Fork 588
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: allow using --select-nth with --continue #1366
Conversation
Allows using --select-nth with --continue to select the anime when there's multiple to choose from.
as i said before, u cant even predict which index will have which anime, making this useless |
Yes, it's unpredictable which anime it downloads/plays. But it also doesn't matter. I just want to periodically run the script to have all my animes downloaded (ani-cli -d -c -S 1). I get that it kind of mis-uses what --select-nth was meant for, but it works. |
Valid use case for a tiny change |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wonder how this code doesn't trigger SC2015
I tried checking the same code without the id= part and shellcheck gives a SC2015 (info) on it.. |
ani-cli
Outdated
@@ -427,7 +427,8 @@ case "$search" in | |||
anime_list=$(while read -r ep_no id title; do process_hist_entry & done <"$histfile") | |||
wait | |||
[ -z "$anime_list" ] && die "No unwatched series in history!" | |||
id=$(printf "%s" "$anime_list" | nl -w 2 | sed 's/^[[:space:]]//' | nth "Select anime: " | cut -f1) | |||
# Prompts for the anime, or selects based on the index (--select-nth) value if provided: | |||
[ -z "${index##*[!0-9]*}" ] && id=$(printf "%s" "$anime_list" | nl -w 2 | sed 's/^[[:space:]]//' | nth "Select anime: " | cut -f1) || id=$(printf "%s" "$anime_list" | sed -n "${index}p" | cut -f1) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would have expected the logic to go like this, but maybe I'm missing something
[ -z "${index##*[!0-9]*}" ] && id=$(printf "%s" "$anime_list" | nl -w 2 | sed 's/^[[:space:]]//' | nth "Select anime: " | cut -f1) || id=$(printf "%s" "$anime_list" | sed -n "${index}p" | cut -f1) | |
[ -z "${index##*[!0-9]*}" ] && id=$(printf "%s" "$anime_list" | nl -w 2 | sed 's/^[[:space:]]//' | nth "Select anime: " | cut -f1) | |
[ -z "${index##*[!0-9]*}" ] || id=$(printf "%s" "$anime_list" | sed -n "${index}p" | cut -f1) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also prefer port's approach. would be better off being verbose
|
@@ -1,6 +1,6 @@ | |||
#!/bin/sh | |||
|
|||
version_number="4.8.9" | |||
version_number="4.8.10" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
bump it to 4.9.0
ani-cli
Outdated
@@ -427,7 +427,8 @@ case "$search" in | |||
anime_list=$(while read -r ep_no id title; do process_hist_entry & done <"$histfile") | |||
wait | |||
[ -z "$anime_list" ] && die "No unwatched series in history!" | |||
id=$(printf "%s" "$anime_list" | nl -w 2 | sed 's/^[[:space:]]//' | nth "Select anime: " | cut -f1) | |||
# Prompts for the anime, or selects based on the index (--select-nth) value if provided: | |||
[ -z "${index##*[!0-9]*}" ] && id=$(printf "%s" "$anime_list" | nl -w 2 | sed 's/^[[:space:]]//' | nth "Select anime: " | cut -f1) || id=$(printf "%s" "$anime_list" | sed -n "${index}p" | cut -f1) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also prefer port's approach. would be better off being verbose
ani-cli
Outdated
@@ -427,7 +427,8 @@ case "$search" in | |||
anime_list=$(while read -r ep_no id title; do process_hist_entry & done <"$histfile") | |||
wait | |||
[ -z "$anime_list" ] && die "No unwatched series in history!" | |||
id=$(printf "%s" "$anime_list" | nl -w 2 | sed 's/^[[:space:]]//' | nth "Select anime: " | cut -f1) | |||
# Prompts for the anime, or selects based on the index (--select-nth) value if provided: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
also u can remove the comment. not really necessary with the context
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I dunno how to do this without making another branch and pull-request like you guys, but what about this:
--- ani-cli 2024-06-10 07:55:18.846673971 -0500
+++ ani-cli.fireegl-2 2024-06-11 08:21:47.636001449 -0500
@@ -427,7 +427,10 @@
anime_list=$(while read -r ep_no id title; do process_hist_entry & done <"$histfile")
wait
[ -z "$anime_list" ] && die "No unwatched series in history!"
- id=$(printf "%s" "$anime_list" | nl -w 2 | sed 's/^[[:space:]]//' | nth "Select anime: " | cut -f1)
+ case "$index" in
+ ''|*[!0-9]*) id=$(printf "%s" "$anime_list" | nl -w 2 | sed 's/^[[:space:]]//' | nth "Select anime: " | cut -f1) ;;
+ *) id=$(printf "%s" "$anime_list" | sed -n "${index}p" | cut -f1) ;;
+ esac
[ -z "$id" ] && exit 1
title=$(printf "%s" "$anime_list" | grep "$id" | cut -f2 | sed 's/ - episode.*//')
ep_list=$(episodes_list "$id")
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
dont use case
. to maintain parity with rest of the codebase, just check it twice like port did. not very efficient but meh who cares.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
just pull the changes ? i assume u havent pulled the version bump port did.
and make a new commit
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
dont open a new pr please
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if u cannot do this, i can make the changes
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please do. =)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done, if ure having issues u can just use the github editor line . just open the file on gh and use the pen button to edit there
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
port can handle the rest
@71zenith you sure we wanna bump to 4.9? |
We do have countdown to next episode as a feature I guess |
i believe we have enough fixes accumulated? did we aim at having some milestones for each release? |
Let's wait for the logger feature then. |
@71zenith you're gonna approve or no? |
approved, sorry i was at school |
I like your work ! |
Allows using --select-nth with --continue to select the anime when there's multiple to choose from.
Pull Request Template
Type of change
Description
This adds a check for --select-nth when using --continue to select the anime, so it can be done non-interactively.
Updated to work with the current code base. =)
Checklist
-c
history and continue work-d
downloads work-s
syncplay works-q
quality works-v
vlc works-e
select episode works-S
select index works-r
range selection works--skip
ani-skip works--skip-title
ani-skip title argument works--no-detach
no detach works--dub
and regular (sub) mode both work-h
help info is up to dateAdditional Testcases