Skip to content

Commit

Permalink
fix: support using non brew iina as a player on macos
Browse files Browse the repository at this point in the history
Co-authored-by: Amr AlSamahy <[email protected]>
  • Loading branch information
port19x and asamahy committed Aug 16, 2024
1 parent 267880f commit 01894dd
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions ani-cli
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/bin/sh

version_number="4.8.11"
version_number="4.8.12"

# UI

Expand Down Expand Up @@ -113,6 +113,13 @@ dep_ch() {
done
}

where_iina() {
[ -n "$ANI_CLI_PLAYER" ] && echo "$ANI_CLI_PLAYER" && return 0
[ -n "$(command -v iina)" ] && echo "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
}

# SCRAPING

# extract the video links from response of embed urls, extract mp4 links form m3u8 lists
Expand Down Expand Up @@ -322,7 +329,7 @@ mode="${ANI_CLI_MODE:-sub}"
download_dir="${ANI_CLI_DOWNLOAD_DIR:-.}"
quality="${ANI_CLI_QUALITY:-best}"
case "$(uname -a)" in
*Darwin*) player_function="${ANI_CLI_PLAYER:-iina}" ;; # mac OS
*Darwin*) player_function=$(where_iina) ;; # mac OS
*ndroid*) player_function="${ANI_CLI_PLAYER:-android_mpv}" ;; # Android OS (termux)
*neptune*) player_function="${ANI_CLI_PLAYER:-flatpak_mpv}" ;; # steamdeck OS
*MINGW* | *WSL2*) player_function="${ANI_CLI_PLAYER:-mpv.exe}" ;; # Windows OS
Expand Down Expand Up @@ -418,6 +425,7 @@ case "$player_function" in
;;
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
*) dep_ch "$player_function" ;;
esac

Expand Down

0 comments on commit 01894dd

Please sign in to comment.