Skip to content

Commit

Permalink
feat: added flag for mpv as flatpak (#1411)
Browse files Browse the repository at this point in the history
Co-authored-by: port19 <port19@port19.xyz>
  • Loading branch information
Derisis13 and port19x authored Sep 18, 2024
1 parent 765136d commit 62e872e
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 13 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/ani-cli.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ jobs:
name: Shellcheck + Shfmt
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Run the sh-checker
uses: luizm/action-sh-checker@master
env:
Expand All @@ -26,14 +26,14 @@ jobs:
name: Executable Bit
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: test exec bit
run: test -x "./ani-cli"

check-no-awk:
name: No Awk Allowed
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: verify that noone added awk
run: '! grep awk "./ani-cli"'
2 changes: 1 addition & 1 deletion .github/workflows/markdown.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,5 +22,5 @@ jobs:
name: Find Trailing Whitespace
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- uses: ocular-d/trailing-spaces@0.0.2
2 changes: 1 addition & 1 deletion .github/workflows/version.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ jobs:
name: Version Bump
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: check version bump
Expand Down
24 changes: 16 additions & 8 deletions ani-cli
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/bin/sh

version_number="4.9.0"
version_number="4.9.1"

# UI

Expand Down Expand Up @@ -122,6 +122,12 @@ where_iina() {
dep_ch iina # exit with formating
}

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
}

# SCRAPING

# extract the video links from response of embed urls, extract mp4 links form m3u8 lists
Expand Down Expand Up @@ -333,12 +339,17 @@ download_dir="${ANI_CLI_DOWNLOAD_DIR:-.}"
log_episode="${ANI_CLI_LOG:-1}"
quality="${ANI_CLI_QUALITY:-best}"
case "$(uname -a)" in
*Darwin*) player_function="$(where_iina)" ;; # mac OS
*Darwin*) # mac OS
player_function="$(where_iina)"
[ $? -eq 0 ] || exit $?
;;
*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
*ish*) player_function="${ANI_CLI_PLAYER:-iSH}" ;; # iOS (iSH)
*) player_function="${ANI_CLI_PLAYER:-mpv}" ;; # Linux OS
*) # Linux OS
player_function="${ANI_CLI_PLAYER:-$(where_mpv)}"
[ $? -eq 0 ] || exit $?
;;
esac

no_detach="${ANI_CLI_NO_DETACH:-0}"
Expand Down Expand Up @@ -431,13 +442,10 @@ if [ -z "$ANI_CLI_NON_INTERACTIVE" ]; then dep_ch fzf || true; fi
case "$player_function" in
debug) ;;
download) dep_ch "ffmpeg" "aria2c" ;;
flatpak*)
dep_ch "flatpak"
flatpak info io.mpv.Mpv >/dev/null 2>&1 || die "Program \"mpv (flatpak)\" not found. Please install it."
;;
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
*) dep_ch "$player_function" ;;
esac

Expand Down

0 comments on commit 62e872e

Please sign in to comment.