Skip to content

Commit fde5470

Browse files
authored
feat: no-detach (#1264)
1 parent 08aff13 commit fde5470

File tree

2 files changed

+12
-2
lines changed

2 files changed

+12
-2
lines changed

ani-cli

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#!/bin/sh
22

3-
version_number="4.7.5"
3+
version_number="4.7.6"
44

55
# UI
66

@@ -65,6 +65,8 @@ help_info() {
6565
Use rofi instead of fzf for the interactive menu
6666
--skip
6767
Use ani-skip to skip the intro of the episode (mpv only)
68+
--no-detach
69+
Don't detach the player (useful for in-terminal playback, mpv only)
6870
--skip-title <title>
6971
Use given title as ani-skip query
7072
-U, --update
@@ -238,7 +240,7 @@ play_episode() {
238240
[ -z "$ANI_CLI_NON_INTERACTIVE" ] && printf "All links:\n%s\nSelected link:\n" "$links"
239241
printf "%s\n" "$episode"
240242
;;
241-
mpv*) nohup "$player_function" $skip_flag --force-media-title="${allanime_title}Episode ${ep_no}" "$episode" >/dev/null 2>&1 & ;;
243+
mpv*) $([ "$no_detach" = 0 ] && echo "nohup") "$player_function" $skip_flag --force-media-title="${allanime_title}Episode ${ep_no}" "$episode" >/dev/null 2>&1 & ;;
242244
android_mpv) nohup am start --user 0 -a android.intent.action.VIEW -d "$episode" -n is.xyz.mpv/.MPVActivity >/dev/null 2>&1 & ;;
243245
android_vlc) nohup am start --user 0 -a android.intent.action.VIEW -d "$episode" -n org.videolan.vlc/org.videolan.vlc.gui.video.VideoPlayerActivity -e "title" "${allanime_title}Episode ${ep_no}" >/dev/null 2>&1 & ;;
244246
iina) nohup "$player_function" --no-stdin --keep-running --mpv-force-media-title="${allanime_title}Episode ${ep_no}" "$episode" >/dev/null 2>&1 & ;;
@@ -303,6 +305,7 @@ case "$(uname -a)" in
303305
*) player_function="${ANI_CLI_PLAYER:-mpv}" ;; # Linux OS
304306
esac
305307

308+
no_detach="${ANI_CLI_NO_DETACH:-0}"
306309
use_external_menu="${ANI_CLI_EXTERNAL_MENU:-0}"
307310
skip_intro="${ANI_CLI_SKIP_INTRO:-0}"
308311
# shellcheck disable=SC2154
@@ -359,6 +362,7 @@ while [ $# -gt 0 ]; do
359362
shift
360363
;;
361364
--dub) mode="dub" ;;
365+
--no-detach) no_detach=1 ;;
362366
--rofi) use_external_menu=1 ;;
363367
--skip) skip_intro=1 ;;
364368
--skip-title)

ani-cli.1

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,9 @@ Use rofi instead of fzf for the interactive menu
6161
\fB\--skip\fR
6262
Use ani-skip to skip the intro of the episode (mpv only)
6363
.TP
64+
\fB\--no-detach\fR
65+
Don't detach the player (useful for in-terminal playback, mpv only)
66+
.TP
6467
\fB\--skip-title\fR \fI\,<title>\/\fR
6568
Specify the title to use for ani-skip
6669
.PP
@@ -99,6 +102,9 @@ Controls the default source. Valid is history (equivalent to -c), everything els
99102
\fBANI_CLI_SKIP_INTRO\fR
100103
Controls if ani-skip is used to skip intros (works with mpv only). Can be 0 (disabled) or 1 (enabled). Default is 0.
101104
.TP
105+
\fBANI_CLI_NO_DETACH\fR
106+
Controls if mpv is detached from the main process for playback, which can be useful for use with terminal renderers such as kitty. (works with mpv only). Can be 0 (disabled) or 1 (enabled). Default is 0.
107+
.TP
102108
\fBANI_CLI_SKIP_TITLE\fR
103109
Overrides the anime title to query for skip times. Can be any string value. Default is empty, resolving to the anime title as given by ani-cli.
104110
.PP

0 commit comments

Comments
 (0)