Skip to content
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: where_mpv checks for mpv than ANI_CLI_PLAYER #1424

Merged
merged 9 commits into from
Sep 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/ani-cli.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ on:
- master
pull_request:
paths:
- "/ani-cli"
- "**ani-cli"

jobs:
sh-checker:
Expand Down
23 changes: 7 additions & 16 deletions ani-cli
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/bin/sh

version_number="4.9.1"
version_number="4.9.2"

# UI

Expand Down Expand Up @@ -116,16 +116,13 @@ dep_ch() {
}

where_iina() {
[ -n "$ANI_CLI_PLAYER" ] && printf "%s" "$ANI_CLI_PLAYER" && return 0
command -v iina >/dev/null && printf "iina" && return 0
[ -e "/Applications/IINA.app/Contents/MacOS/iina-cli" ] && echo "/Applications/IINA.app/Contents/MacOS/iina-cli" && return 0
dep_ch iina # exit with formating
printf "%s" "iina" && return 0
port19x marked this conversation as resolved.
Show resolved Hide resolved
}

where_mpv() {
command -v "$ANI_CLI_PLAYER" >/dev/null && printf "%s" "$ANI_CLI_PLAYER" && return 0
command -v "flatpak" >/dev/null && flatpak info io.mpv.Mpv >/dev/null 2>&1 && printf "%s" "flatpak_mpv" && return 0
dep_ch mpv # exit with formating
printf "%s" "mpv" && return 0
}

# SCRAPING
Expand Down Expand Up @@ -339,17 +336,11 @@ download_dir="${ANI_CLI_DOWNLOAD_DIR:-.}"
log_episode="${ANI_CLI_LOG:-1}"
quality="${ANI_CLI_QUALITY:-best}"
case "$(uname -a)" in
*Darwin*) # mac OS
player_function="$(where_iina)"
[ $? -eq 0 ] || exit $?
;;
*Darwin*) player_function="${ANI_CLI_PLAYER:-$(where_iina)}" ;; # mac OS
*ndroid*) player_function="${ANI_CLI_PLAYER:-android_mpv}" ;; # Android OS (termux)
*MINGW* | *WSL2*) player_function="${ANI_CLI_PLAYER:-mpv.exe}" ;; # Windows OS
*ish*) player_function="${ANI_CLI_PLAYER:-iSH}" ;; # iOS (iSH)
*) # Linux OS
player_function="${ANI_CLI_PLAYER:-$(where_mpv)}"
[ $? -eq 0 ] || exit $?
;;
*) player_function="${ANI_CLI_PLAYER:-$(where_mpv)}" ;; # Linux OS
esac

no_detach="${ANI_CLI_NO_DETACH:-0}"
Expand Down Expand Up @@ -444,8 +435,8 @@ case "$player_function" in
download) dep_ch "ffmpeg" "aria2c" ;;
android*) printf "\33[2K\rChecking of players on Android is disabled\n" ;;
*iSH*) printf "\33[2K\rChecking of players on iOS is disabled\n" ;;
*iina*) true ;; # handled out of band in where_iina
*mpv*) true ;; # handled out of band in where_mpv
*IINA*) true ;; # handled out of band in where_iina
flatpak_mpv) true ;; # handled out of band in where_mpv
*) dep_ch "$player_function" ;;
esac

Expand Down