From 62e872eb73d63d2c853a45a578d090365c965141 Mon Sep 17 00:00:00 2001 From: Derisis13 <66648475+Derisis13@users.noreply.github.com> Date: Wed, 18 Sep 2024 16:20:00 +0200 Subject: [PATCH] feat: added flag for mpv as flatpak (#1411) Co-authored-by: port19 --- .github/workflows/ani-cli.yml | 6 +++--- .github/workflows/markdown.yml | 2 +- .github/workflows/version.yml | 2 +- ani-cli | 24 ++++++++++++++++-------- 4 files changed, 21 insertions(+), 13 deletions(-) diff --git a/.github/workflows/ani-cli.yml b/.github/workflows/ani-cli.yml index 0f31093dd..387313e4f 100644 --- a/.github/workflows/ani-cli.yml +++ b/.github/workflows/ani-cli.yml @@ -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: @@ -26,7 +26,7 @@ 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" @@ -34,6 +34,6 @@ jobs: 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"' diff --git a/.github/workflows/markdown.yml b/.github/workflows/markdown.yml index 0dacb020b..6bc210753 100644 --- a/.github/workflows/markdown.yml +++ b/.github/workflows/markdown.yml @@ -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 diff --git a/.github/workflows/version.yml b/.github/workflows/version.yml index d8ce20d21..0dce9c044 100644 --- a/.github/workflows/version.yml +++ b/.github/workflows/version.yml @@ -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 diff --git a/ani-cli b/ani-cli index d00427b08..18da3f674 100755 --- a/ani-cli +++ b/ani-cli @@ -1,6 +1,6 @@ #!/bin/sh -version_number="4.9.0" +version_number="4.9.1" # UI @@ -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 @@ -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}" @@ -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