Terminal interface to find, download, and stream movies, TV shows, and live TV using local media players.
refactor: harden core and drop dead weight
Samir Hossainsd07f46750f26
diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.ymlnew file mode 100644index 0000000..9c2fcda--- /dev/null+++ b/.github/workflows/ci.yml@@ -0,0 +1,39 @@+name: CI++on:+ pull_request:+ push:+ branches: [main]++jobs:+ quality:+ name: Quality (${{ matrix.os }})+ runs-on: ${{ matrix.os }}+ strategy:+ fail-fast: false+ matrix:+ os: [ubuntu-latest, macos-latest, windows-latest]+ steps:+ - uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4+ - uses: dtolnay/rust-toolchain@4cda84d5c5c54efe2404f9d843567869ab1699d4 # stable+ with:+ toolchain: 1.90.0+ components: rustfmt, clippy+ - run: cargo fmt --check+ - run: cargo clippy --all-targets --locked -- -D warnings+ - name: Audit dependencies+ if: matrix.os == 'ubuntu-latest'+ run: cargo install cargo-audit --locked && cargo audit+ - name: Verify package+ if: matrix.os == 'ubuntu-latest'+ run: cargo package --locked++ msrv:+ name: Rust 1.90 compatibility+ runs-on: ubuntu-latest+ steps:+ - uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4+ - uses: dtolnay/rust-toolchain@4cda84d5c5c54efe2404f9d843567869ab1699d4 # stable+ with:+ toolchain: 1.90.0+ - run: cargo check --all-targets --lockeddiff --git a/.github/workflows/homebrew.yml b/.github/workflows/homebrew.ymlindex 789edee..6c0efee 100644--- a/.github/workflows/homebrew.yml+++ b/.github/workflows/homebrew.yml@@ -12,7 +12,7 @@ jobs:contents: writesteps:- name: Checkout repository- uses: actions/checkout@v4+ uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4with:fetch-depth: 0@@ -27,27 +27,26 @@ jobs:echo "version=$CLEAN_VERSION" >> $GITHUB_OUTPUTecho "tag=$VERSION" >> $GITHUB_OUTPUT- ASSET_URL="https://github.com/${{ github.repository }}/releases/download/$VERSION/MovieBox_macOS_Universal.tar.gz"- echo "Downloading $ASSET_URL"- curl -sL "$ASSET_URL" -o macos_binary.tar.gz-- SHA256=$(sha256sum macos_binary.tar.gz | awk '{print $1}')- echo "sha256=$SHA256" >> $GITHUB_OUTPUT+ BASE_URL="https://github.com/${{ github.repository }}/releases/download/$VERSION"+ curl -fsSL "$BASE_URL/MovieBox_macOS_Universal.tar.gz" -o macos.tar.gz+ curl -fsSL "$BASE_URL/MovieBox_Linux_x64.tar.gz" -o linux-x64.tar.gz+ curl -fsSL "$BASE_URL/MovieBox_Linux_arm64.tar.gz" -o linux-arm64.tar.gz+ echo "macos_sha=$(sha256sum macos.tar.gz | awk '{print $1}')" >> $GITHUB_OUTPUT+ echo "linux_x64_sha=$(sha256sum linux-x64.tar.gz | awk '{print $1}')" >> $GITHUB_OUTPUT+ echo "linux_arm64_sha=$(sha256sum linux-arm64.tar.gz | awk '{print $1}')" >> $GITHUB_OUTPUT- name: Update Formularun: |FORMULA_FILE="Formula/moviebox-tui.rb"VERSION="${{ steps.release.outputs.version }}"- TAG="${{ steps.release.outputs.tag }}"- SHA256="${{ steps.release.outputs.sha256 }}"-- sed -i "s/version \".*\"/version \"$VERSION\"/" "$FORMULA_FILE"- sed -i "s|url \".*\"|url \"https://github.com/${{ github.repository }}/releases/download/$TAG/MovieBox_macOS_Universal.tar.gz\"|" "$FORMULA_FILE"- sed -i "s/sha256 \".*\"/sha256 \"$SHA256\"/" "$FORMULA_FILE"+ sed -i "s/VERSION = \".*\"/VERSION = \"$VERSION\"/" "$FORMULA_FILE"+ sed -i "s/MACOS_SHA256 = \".*\"/MACOS_SHA256 = \"${{ steps.release.outputs.macos_sha }}\"/" "$FORMULA_FILE"+ sed -i "s/LINUX_X64_SHA256 = \".*\"/LINUX_X64_SHA256 = \"${{ steps.release.outputs.linux_x64_sha }}\"/" "$FORMULA_FILE"+ sed -i "s/LINUX_ARM64_SHA256 = \".*\"/LINUX_ARM64_SHA256 = \"${{ steps.release.outputs.linux_arm64_sha }}\"/" "$FORMULA_FILE"- name: Commit and Push Changes- uses: stefanzweifel/git-auto-commit-action@v5+ uses: stefanzweifel/git-auto-commit-action@b863ae1933cb653a53c021fe36dbb774e1fb9403 # v5with:- commit_message: "chore(homebrew): update formula to ${{ github.event.release.tag_name }}"+ commit_message: "chore(homebrew): update formula to v${{ steps.release.outputs.version }}"file_pattern: "Formula/moviebox-tui.rb"branch: maindiff --git a/.github/workflows/publish.yml b/.github/workflows/publish.ymlindex 69908ed..4ed7c93 100644--- a/.github/workflows/publish.yml+++ b/.github/workflows/publish.yml@@ -1,23 +1,24 @@name: Publish to Crates.ioon:- push:- branches:- - main- paths:- - "Cargo.toml"+ release:+ types: [published]jobs:publish:name: Publishruns-on: ubuntu-lateststeps:- - uses: actions/checkout@v4+ - uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4+ with:+ ref: ${{ github.event.release.tag_name }}- name: Install Rust- uses: dtolnay/rust-toolchain@stable+ uses: dtolnay/rust-toolchain@4cda84d5c5c54efe2404f9d843567869ab1699d4 # stable+ with:+ toolchain: 1.90.0- name: Publish to crates.ioenv:CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }}- run: cargo publish+ run: cargo publish --lockeddiff --git a/.github/workflows/release.yml b/.github/workflows/release.ymlindex 0aab4a0..5fd08d4 100644--- a/.github/workflows/release.yml+++ b/.github/workflows/release.yml@@ -8,7 +8,7 @@ on:- "Cargo.toml"permissions:- contents: write+ contents: readjobs:check-version:@@ -18,7 +18,7 @@ jobs:version: ${{ steps.check.outputs.version }}is_new: ${{ steps.check.outputs.is_new }}steps:- - uses: actions/checkout@v4+ - uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4- name: Get version from Cargo.tomlid: checkrun: |@@ -35,18 +35,38 @@ jobs:env:GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}+ quality:+ name: Release quality gate+ needs: check-version+ if: needs.check-version.outputs.is_new == 'true'+ runs-on: ubuntu-latest+ steps:+ - uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4+ - uses: dtolnay/rust-toolchain@4cda84d5c5c54efe2404f9d843567869ab1699d4 # stable+ with:+ toolchain: 1.90.0+ components: rustfmt, clippy+ - run: cargo fmt --check+ - run: cargo clippy --all-targets --locked -- -D warnings+ - run: cargo install cargo-audit --locked && cargo audit+ - run: cargo package --locked+ - uses: dtolnay/rust-toolchain@4cda84d5c5c54efe2404f9d843567869ab1699d4 # stable+ with:+ toolchain: 1.90.0+ - run: cargo check --all-targets --locked+build:name: Build ${{ matrix.target }}- needs: check-version+ needs: [check-version, quality]if: needs.check-version.outputs.is_new == 'true'runs-on: ${{ matrix.os }}strategy:fail-fast: falsematrix:include:- - target: x86_64-unknown-linux-gnu+ - target: x86_64-unknown-linux-muslos: ubuntu-latest- - target: aarch64-unknown-linux-gnu+ - target: aarch64-unknown-linux-muslos: ubuntu-latest- target: x86_64-apple-darwinos: macos-latest@@ -54,26 +74,25 @@ jobs:os: macos-latest- target: x86_64-pc-windows-msvcos: windows-latest+ - target: aarch64-pc-windows-msvc+ os: windows-lateststeps:- - uses: actions/checkout@v4-- - name: Install cross-compilation tools- if: matrix.os == 'ubuntu-latest' && matrix.target == 'aarch64-unknown-linux-gnu'- run: sudo apt-get update && sudo apt-get install -y gcc-aarch64-linux-gnu libc6-dev-arm64-cross+ - uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4- name: Install Rust- uses: dtolnay/rust-toolchain@stable+ uses: dtolnay/rust-toolchain@4cda84d5c5c54efe2404f9d843567869ab1699d4 # stablewith:+ toolchain: 1.90.0targets: ${{ matrix.target }}- - name: Build Binary- run: |- if [ "${{ matrix.target }}" == "aarch64-unknown-linux-gnu" ]; then- export CARGO_TARGET_AARCH64_UNKNOWN_LINUX_GNU_LINKER=aarch64-linux-gnu-gcc- fi- cargo build --release --target ${{ matrix.target }}- shell: bash+ - name: Build Linux binary+ if: matrix.os == 'ubuntu-latest'+ run: cargo install cross --locked && cross build --release --locked --target ${{ matrix.target }}++ - name: Build macOS or Windows binary+ if: matrix.os != 'ubuntu-latest'+ run: cargo build --release --locked --target ${{ matrix.target }}- name: Archive Unixif: matrix.os != 'windows-latest'@@ -83,9 +102,9 @@ jobs:cp README.md dist/cp LICENSE-* dist/ || true- if [ "${{ matrix.target }}" == "x86_64-unknown-linux-gnu" ]; then+ if [ "${{ matrix.target }}" == "x86_64-unknown-linux-musl" ]; thentar -czvf MovieBox_Linux_x64.tar.gz -C dist .- elif [ "${{ matrix.target }}" == "aarch64-unknown-linux-gnu" ]; then+ elif [ "${{ matrix.target }}" == "aarch64-unknown-linux-musl" ]; thentar -czvf MovieBox_Linux_arm64.tar.gz -C dist .elsetar -czvf moviebox-tui-${{ matrix.target }}.tar.gz -C dist .@@ -98,10 +117,14 @@ jobs:cp target\${{ matrix.target }}\release\moviebox-tui.exe dist\cp README.md dist\cp LICENSE-* dist\ || echo "No license files found"- Compress-Archive -Path dist\* -DestinationPath MovieBox_Windows_x64.zip+ if ("${{ matrix.target }}" -eq "aarch64-pc-windows-msvc") {+ Compress-Archive -Path dist\* -DestinationPath MovieBox_Windows_arm64.zip+ } else {+ Compress-Archive -Path dist\* -DestinationPath MovieBox_Windows_x64.zip+ }- name: Upload Artifact- uses: actions/upload-artifact@v4+ uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4with:name: binary-${{ matrix.target }}path: |@@ -114,16 +137,16 @@ jobs:if: needs.check-version.outputs.is_new == 'true'runs-on: macos-lateststeps:- - uses: actions/checkout@v4+ - uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4- name: Download x86_64 artifact- uses: actions/download-artifact@v4+ uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # v4with:name: binary-x86_64-apple-darwinpath: x86_64- name: Download aarch64 artifact- uses: actions/download-artifact@v4+ uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # v4with:name: binary-aarch64-apple-darwinpath: aarch64@@ -140,7 +163,7 @@ jobs:tar -czvf ../../MovieBox_macOS_Universal.tar.gz .- name: Upload Universal Artifact- uses: actions/upload-artifact@v4+ uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4with:name: binary-universal-apple-darwinpath: MovieBox_macOS_Universal.tar.gz@@ -150,12 +173,31 @@ jobs:needs: [check-version, build, build-macos-universal]if: needs.check-version.outputs.is_new == 'true'runs-on: ubuntu-latest+ permissions:+ attestations: write+ contents: write+ id-token: writesteps:- - uses: actions/download-artifact@v4+ - uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # v4with:path: artifacts+ - name: Generate checksums+ run: |+ find artifacts -type f \( -name '*.tar.gz' -o -name '*.zip' \) -print0 |+ sort -z |+ while IFS= read -r -d '' file; do+ hash=$(sha256sum "$file" | awk '{print $1}')+ echo "$hash $(basename "$file")"+ done > SHA256SUMS+ - name: Attest release artifacts+ uses: actions/attest-build-provenance@43d14bc2b83dec42d39ecae14e916627a18bb661 # v3+ with:+ subject-path: |+ artifacts/**/*.tar.gz+ artifacts/**/*.zip+ SHA256SUMS- name: Generate Release Notes and Publish- uses: softprops/action-gh-release@v2+ uses: softprops/action-gh-release@3bb12739c298aeb8a4eeaf626c5b8d85266b0e65 # v2with:tag_name: "v${{ needs.check-version.outputs.version }}"name: "MovieBox TUI v${{ needs.check-version.outputs.version }}"@@ -163,3 +205,4 @@ jobs:files: |artifacts/**/*.tar.gzartifacts/**/*.zip+ SHA256SUMSdiff --git a/Cargo.lock b/Cargo.lockindex e0caa23..f58471f 100644--- a/Cargo.lock+++ b/Cargo.lock@@ -17,24 +17,6 @@ dependencies = ["memchr",]-[[package]]-name = "aligned"-version = "0.4.3"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "ee4508988c62edf04abd8d92897fca0c2995d907ce1dfeaf369dac3716a40685"-dependencies = [- "as-slice",-]--[[package]]-name = "aligned-vec"-version = "0.6.4"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "dc890384c8602f339876ded803c97ad529f3842aba97f6392b3dba0dd171769b"-dependencies = [- "equator",-]-[[package]]name = "allocator-api2"version = "0.2.21"@@ -56,38 +38,6 @@ dependencies = ["num-traits",]-[[package]]-name = "arbitrary"-version = "1.4.2"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "c3d036a3c4ab069c7b410a2ce876bd74808d2d0888a82667669f8e783a898bf1"--[[package]]-name = "arg_enum_proc_macro"-version = "0.3.4"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "0ae92a5119aa49cdbcf6b9f893fe4e1d98b04ccbf82ee0584ad948a44a734dea"-dependencies = [- "proc-macro2",- "quote",- "syn 2.0.119",-]--[[package]]-name = "arrayvec"-version = "0.7.8"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "d3fb67a6e08acf24fdeccbac2cb6ac4305825bd1f117462e0e6f2f193345ad56"--[[package]]-name = "as-slice"-version = "0.2.1"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "516b6b4f0e40d50dcda9365d53964ec74560ad4284da2e7fc97122cd83174516"-dependencies = [- "stable_deref_trait",-]-[[package]]name = "atomic"version = "0.6.1"@@ -109,49 +59,6 @@ version = "1.5.1"source = "registry+https://github.com/rust-lang/crates.io-index"checksum = "f2032f911046de80f0a198e0901378627c33f59ea0ac00e363d481118bd70a53"-[[package]]-name = "av-scenechange"-version = "0.14.1"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "0f321d77c20e19b92c39e7471cf986812cbb46659d2af674adc4331ef3f18394"-dependencies = [- "aligned",- "anyhow",- "arg_enum_proc_macro",- "arrayvec",- "log",- "num-rational",- "num-traits",- "pastey",- "rayon",- "thiserror 2.0.19",- "v_frame",- "y4m",-]--[[package]]-name = "av1-grain"-version = "0.2.5"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "8cfddb07216410377231960af4fcab838eaa12e013417781b78bd95ee22077f8"-dependencies = [- "anyhow",- "arrayvec",- "log",- "nom 8.0.0",- "num-rational",- "v_frame",-]--[[package]]-name = "avif-serialize"-version = "0.8.9"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "e7178fe5f7d460b13895ebb9dcb28a3a6216d2df2574a0806cb51b555d297f38"-dependencies = [- "arrayvec",-]-[[package]]name = "aws-lc-rs"version = "1.17.3"@@ -206,12 +113,6 @@ version = "0.6.3"source = "registry+https://github.com/rust-lang/crates.io-index"checksum = "349f9b6a179ed607305526ca489b34ad0a41aed5f7980fa90eb03160b69598fb"-[[package]]-name = "bit_field"-version = "0.10.3"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "1e4b40c7323adcfc0a41c4b88143ed58346ff65a288fc144329c5c45e05d70c6"-[[package]]name = "bitflags"version = "1.3.2"@@ -224,15 +125,6 @@ version = "2.13.1"source = "registry+https://github.com/rust-lang/crates.io-index"checksum = "b588b76d00fde79687d7646a9b5bdf3cc0f655e0bbd080335a95d7e96f3587da"-[[package]]-name = "bitstream-io"-version = "4.10.0"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "7eff00be299a18769011411c9def0d827e8f2d7bf0c3dbf53633147a8867fd1f"-dependencies = [- "no_std_io2",-]-[[package]]name = "bitvec"version = "1.1.1"@@ -263,12 +155,6 @@ dependencies = ["hybrid-array",]-[[package]]-name = "built"-version = "0.8.0"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "f4ad8f11f288f48ca24471bbd51ac257aaeaaa07adae295591266b792902ae64"-[[package]]name = "bumpalo"version = "3.20.3"@@ -525,12 +411,6 @@ dependencies = ["winapi",]-[[package]]-name = "crunchy"-version = "0.2.4"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "460fbee9c2c2f33933d720630a6a0bac33ba7053db5344fac858d4b8952d77d5"-[[package]]name = "crypto-common"version = "0.1.7"@@ -757,26 +637,6 @@ version = "1.17.0"source = "registry+https://github.com/rust-lang/crates.io-index"checksum = "9e5e8f6c15a24b9a3ee5efec809ccd006d3b30e8b3bb63c39af737c7f87daa1d"-[[package]]-name = "equator"-version = "0.4.2"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "4711b213838dfee0117e3be6ac926007d7f433d7bbe33595975d4190cb07e6fc"-dependencies = [- "equator-macro",-]--[[package]]-name = "equator-macro"-version = "0.4.2"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "44f23cf4b44bfce11a86ace86f8a73ffdec849c9fd00a386a53d278bd9e81fb3"-dependencies = [- "proc-macro2",- "quote",- "syn 2.0.119",-]-[[package]]name = "equivalent"version = "1.0.2"@@ -802,23 +662,6 @@ dependencies = ["num-traits",]-[[package]]-name = "exr"-version = "1.74.2"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "711fe42c9964295e01ee3fba3f9fe0e1d24b98886950d68efe81b1c76e21adf3"-dependencies = [- "bit_field",- "half",- "lebe",- "miniz_oxide",- "num-complex",- "pulp",- "rayon-core",- "smallvec",- "zune-inflate",-]-[[package]]name = "fancy-regex"version = "0.11.0"@@ -835,12 +678,6 @@ version = "1.0.0"source = "registry+https://github.com/rust-lang/crates.io-index"checksum = "dd2e7510819d6fbf51a5545c8f922716ecfb14df168a3242f7d33e0239efe6a1"-[[package]]-name = "fax"-version = "0.2.7"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "caf1079563223d5d59d83c85886a56e586cfd5c1a26292e971a0fa266531ac5a"-[[package]]name = "fdeflate"version = "0.3.7"@@ -1097,17 +934,6 @@ dependencies = ["weezl",]-[[package]]-name = "half"-version = "2.7.1"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "6ea2d84b969582b4b1864a92dc5d27cd2b77b622a8d79306834f1be5ba20d84b"-dependencies = [- "cfg-if",- "crunchy",- "zerocopy",-]-[[package]]name = "hashbrown"version = "0.16.1"@@ -1395,17 +1221,11 @@ dependencies = ["bytemuck","byteorder-lite","color_quant",- "exr","gif","image-webp","moxcms","num-traits","png",- "qoi",- "ravif",- "rayon",- "rgb",- "tiff","zune-core","zune-jpeg",]@@ -1420,12 +1240,6 @@ dependencies = ["quick-error",]-[[package]]-name = "imgref"-version = "1.12.2"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "89194689a993ab15268672e99e7b0e19da2da3268ac682e8f02d29d4d1434cd7"-[[package]]name = "indoc"version = "2.0.7"@@ -1448,17 +1262,6 @@ dependencies = ["syn 2.0.119",]-[[package]]-name = "interpolate_name"-version = "0.2.4"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "c34819042dc3d3971c46c2190835914dfbe0c3c13f61449b2997f4e9722dfa60"-dependencies = [- "proc-macro2",- "quote",- "syn 2.0.119",-]-[[package]]name = "ipnet"version = "2.12.0"@@ -1573,28 +1376,12 @@ version = "1.5.0"source = "registry+https://github.com/rust-lang/crates.io-index"checksum = "bbd2bcb4c963f2ddae06a2efc7e9f3591312473c50c6685e1f298068316e66fe"-[[package]]-name = "lebe"-version = "0.5.3"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "7a79a3332a6609480d7d0c9eab957bca6b455b91bb84e66d19f5ff66294b85b8"-[[package]]name = "libc"version = "0.2.189"source = "registry+https://github.com/rust-lang/crates.io-index"checksum = "3eaf3ede3fee6db1a4c2ee091bf8a8b4dccdc6d17f656fb07896ee72867612f2"-[[package]]-name = "libfuzzer-sys"-version = "0.4.13"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "a9fd2f41a1cba099f79a0b6b6c35656cf7c03351a7bae8ff0f28f25270f929d2"-dependencies = [- "arbitrary",- "cc",-]-[[package]]name = "libm"version = "0.2.16"@@ -1667,15 +1454,6 @@ version = "0.4.33"source = "registry+https://github.com/rust-lang/crates.io-index"checksum = "0ceec5bc11778974d1bcb055b18002eba7f4b3518b6a0081b3af5f21666da9ad"-[[package]]-name = "loop9"-version = "0.1.5"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "0fae87c125b03c1d2c0150c90365d7d6bcc53fb73a9acaef207d2d065860f062"-dependencies = [- "imgref",-]-[[package]]name = "lru"version = "0.18.1"@@ -1729,16 +1507,6 @@ dependencies = ["syn 2.0.119",]-[[package]]-name = "maybe-rayon"-version = "0.1.1"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "8ea1f30cedd69f0a2954655f7188c6a834246d2bcf1e315e2ac40c4b24dc9519"-dependencies = [- "cfg-if",- "rayon",-]-[[package]]name = "md-5"version = "0.11.0"@@ -1824,6 +1592,7 @@ dependencies = ["ratatui","ratatui-image","reqwest",+ "rustls","scraper","semver","serde",@@ -1864,15 +1633,6 @@ dependencies = ["memoffset",]-[[package]]-name = "no_std_io2"-version = "0.9.4"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "418abd1b6d34fbf6cae440dc874771b0525a604428704c76e48b29a5e67b8003"-dependencies = [- "memchr",-]-[[package]]name = "nom"version = "7.1.3"@@ -1883,41 +1643,6 @@ dependencies = ["minimal-lexical",]-[[package]]-name = "nom"-version = "8.0.0"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "df9761775871bdef83bee530e60050f7e54b1105350d6884eb0fb4f46c2f9405"-dependencies = [- "memchr",-]--[[package]]-name = "noop_proc_macro"-version = "0.3.0"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "0676bb32a98c1a483ce53e500a81ad9c3d5b3f7c920c28c24e9cb0980d0b5bc8"--[[package]]-name = "num-bigint"-version = "0.4.8"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "c89e69e7e0f03bea5ef08013795c25018e101932225a656383bd384495ecc367"-dependencies = [- "num-integer",- "num-traits",-]--[[package]]-name = "num-complex"-version = "0.4.6"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "73f88a1307638156682bada9d7604135552957b7818057dcef22705b4d509495"-dependencies = [- "bytemuck",- "num-traits",-]-[[package]]name = "num-conv"version = "0.2.2"@@ -1935,26 +1660,6 @@ dependencies = ["syn 2.0.119",]-[[package]]-name = "num-integer"-version = "0.1.46"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "7969661fd2958a5cb096e56c8e1ad0444ac2bbcd0061bd28660485a44879858f"-dependencies = [- "num-traits",-]--[[package]]-name = "num-rational"-version = "0.4.2"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "f83d14da390562dca69fc84082e73e548e1ad308d24accdedd2720017cb37824"-dependencies = [- "num-bigint",- "num-integer",- "num-traits",-]-[[package]]name = "num-traits"version = "0.2.19"@@ -2064,18 +1769,6 @@ dependencies = ["windows-link",]-[[package]]-name = "paste"-version = "1.0.15"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "57c0d7b74b563b49d38dae00a0c37d4d6de9b432382b2892f0574ddcae73fd0a"--[[package]]-name = "pastey"-version = "0.1.1"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "35fb2e5f958ec131621fdd531e9fc186ed768cbe395337403ae56c17a74c68ec"-[[package]]name = "percent-encoding"version = "2.3.2"@@ -2246,63 +1939,12 @@ dependencies = ["unicode-ident",]-[[package]]-name = "profiling"-version = "1.0.18"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "3d595e54a326bc53c1c197b32d295e14b169e3cfeaa8dc82b529f947fba6bcf5"-dependencies = [- "profiling-procmacros",-]--[[package]]-name = "profiling-procmacros"-version = "1.0.18"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "4488a4a36b9a4ba6b9334a32a39971f77c1436ec82c38707bce707699cc3bbcb"-dependencies = [- "quote",- "syn 2.0.119",-]--[[package]]-name = "pulp"-version = "0.22.3"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "046aa45b989642ec2e4717c8e72d677b13edd831a4d3b6cf37d9a3e54912496a"-dependencies = [- "bytemuck",- "cfg-if",- "libm",- "num-complex",- "paste",- "pulp-wasm-simd-flag",- "raw-cpuid",- "reborrow",- "version_check",-]--[[package]]-name = "pulp-wasm-simd-flag"-version = "0.1.1"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "1d8f70e07b9c3962945a74e59ca1c511bba65b6419468acc217c457d93f3c740"-[[package]]name = "pxfm"version = "0.1.30"source = "registry+https://github.com/rust-lang/crates.io-index"checksum = "d55d956fa96f5ec02be2e13af0e20391a5aa83d6a074e3ad368959d0fab299ea"-[[package]]-name = "qoi"-version = "0.4.1"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "7f6d64c71eb498fe9eae14ce4ec935c555749aef511cca85b5568910d6e48001"-dependencies = [- "bytemuck",-]-[[package]]name = "quantette"version = "0.5.1"@@ -2383,7 +2025,7 @@ dependencies = ["once_cell","socket2","tracing",- "windows-sys 0.61.2",+ "windows-sys 0.52.0",][[package]]@@ -2420,7 +2062,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"checksum = "22f6172bdec972074665ed81ed53b71da00bfc44b65a753cfde883ec4c702a1a"dependencies = ["libc",- "rand_chacha 0.3.1",+ "rand_chacha","rand_core 0.6.4",]@@ -2430,7 +2072,6 @@ version = "0.9.5"source = "registry+https://github.com/rust-lang/crates.io-index"checksum = "b9ef1d0d795eb7d84685bca4f72f3649f064e6641543d3a8c415898726a57b41"dependencies = [- "rand_chacha 0.9.0","rand_core 0.9.5",]@@ -2455,16 +2096,6 @@ dependencies = ["rand_core 0.6.4",]-[[package]]-name = "rand_chacha"-version = "0.9.0"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "d3022b5f1df60f26e1ffddd6c66e8aa15de382ae63b3a0c1bfc0e4d3e3f325cb"-dependencies = [- "ppv-lite86",- "rand_core 0.9.5",-]-[[package]]name = "rand_core"version = "0.6.4"@@ -2479,9 +2110,6 @@ name = "rand_core"version = "0.9.5"source = "registry+https://github.com/rust-lang/crates.io-index"checksum = "76afc826de14238e6e8c374ddcc1fa19e374fd8dd986b0d2af0d02377261d83c"-dependencies = [- "getrandom 0.3.4",-][[package]]name = "rand_core"@@ -2625,65 +2253,6 @@ dependencies = ["unicode-width",]-[[package]]-name = "rav1e"-version = "0.8.1"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "43b6dd56e85d9483277cde964fd1bdb0428de4fec5ebba7540995639a21cb32b"-dependencies = [- "aligned-vec",- "arbitrary",- "arg_enum_proc_macro",- "arrayvec",- "av-scenechange",- "av1-grain",- "bitstream-io",- "built",- "cfg-if",- "interpolate_name",- "itertools",- "libc",- "libfuzzer-sys",- "log",- "maybe-rayon",- "new_debug_unreachable",- "noop_proc_macro",- "num-derive",- "num-traits",- "paste",- "profiling",- "rand 0.9.5",- "rand_chacha 0.9.0",- "simd_helpers",- "thiserror 2.0.19",- "v_frame",- "wasm-bindgen",-]--[[package]]-name = "ravif"-version = "0.13.0"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "e52310197d971b0f5be7fe6b57530dcd27beb35c1b013f29d66c1ad73fbbcc45"-dependencies = [- "avif-serialize",- "imgref",- "loop9",- "quick-error",- "rav1e",- "rayon",- "rgb",-]--[[package]]-name = "raw-cpuid"-version = "11.6.0"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "498cd0dc59d73224351ee52a95fee0f1a617a2eae0e7d9d720cc622c73a54186"-dependencies = [- "bitflags 2.13.1",-]-[[package]]name = "rayon"version = "1.12.0"@@ -2704,12 +2273,6 @@ dependencies = ["crossbeam-utils",]-[[package]]-name = "reborrow"-version = "0.5.5"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "03251193000f4bd3b042892be858ee50e8b3719f2b08e5833ac4353724632430"-[[package]]name = "redox_syscall"version = "0.5.18"@@ -2787,9 +2350,7 @@ checksum = "219c5811de6525e5416c7d5d53bb656d3afdbc6c5af816e0802bcfa42dbdc1c3"dependencies = ["base64","bytes",- "futures-channel","futures-core",- "futures-util","http","http-body","http-body-util",@@ -2818,12 +2379,6 @@ dependencies = ["web-sys",]-[[package]]-name = "rgb"-version = "0.8.53"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "47b34b781b31e5d73e9fbc8689c70551fd1ade9a19e3e28cfec8580a79290cc4"-[[package]]name = "ring"version = "0.17.14"@@ -2887,6 +2442,7 @@ checksum = "3c54fcab019b409d04215d3a17cb438fd7fbf192ee61461f20f4fe18704bc138"dependencies = ["aws-lc-rs","once_cell",+ "ring","rustls-pki-types","rustls-webpki","subtle",@@ -3184,15 +2740,6 @@ dependencies = ["simdutf8",]-[[package]]-name = "simd_helpers"-version = "0.1.0"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "95890f873bec569a0362c235787f3aca6e1e887302ba4840839bcc6459c42da6"-dependencies = [- "quote",-]-[[package]]name = "simdutf8"version = "0.1.5"@@ -3387,7 +2934,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"checksum = "d4ea810f0692f9f51b382fff5893887bb4580f5fa246fde546e0b13e7fcee662"dependencies = ["fnv",- "nom 7.1.3",+ "nom","phf","phf_codegen",]@@ -3483,20 +3030,6 @@ dependencies = ["syn 3.0.3",]-[[package]]-name = "tiff"-version = "0.11.3"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "b63feaf3343d35b6ca4d50483f94843803b0f51634937cc2ec519fc32232bc52"-dependencies = [- "fax",- "flate2",- "half",- "quick-error",- "weezl",- "zune-jpeg",-]-[[package]]name = "time"version = "0.3.54"@@ -3738,17 +3271,6 @@ dependencies = ["wasm-bindgen",]-[[package]]-name = "v_frame"-version = "0.3.9"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "666b7727c8875d6ab5db9533418d7c764233ac9c0cff1d469aec8fa127597be2"-dependencies = [- "aligned-vec",- "num-traits",- "wasm-bindgen",-]-[[package]]name = "version_check"version = "0.9.5"@@ -4201,12 +3723,6 @@ dependencies = ["tap",]-[[package]]-name = "y4m"-version = "0.8.0"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "7a5a4b21e1a62b67a2970e6831bc091d7b87e119e7f9791aef9702e3bef04448"-[[package]]name = "yoke"version = "0.8.3"@@ -4322,15 +3838,6 @@ version = "0.5.1"source = "registry+https://github.com/rust-lang/crates.io-index"checksum = "cb8a0807f7c01457d0379ba880ba6322660448ddebc890ce29bb64da71fb40f9"-[[package]]-name = "zune-inflate"-version = "0.2.54"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "73ab332fe2f6680068f3582b16a24f90ad7096d5d39b974d1c0aff0125116f02"-dependencies = [- "simd-adler32",-]-[[package]]name = "zune-jpeg"version = "0.5.15"diff --git a/Cargo.toml b/Cargo.tomlindex beda4fb..b289eb9 100644--- a/Cargo.toml+++ b/Cargo.toml@@ -10,7 +10,7 @@ license = "MIT OR Apache-2.0"keywords = ["tui", "moviebox", "streaming", "movies", "cli"]categories = ["command-line-utilities", "multimedia"]readme = "README.md"-rust-version = "1.85.0"+rust-version = "1.90.0"[dependencies]base64 = "0.22.1"@@ -18,13 +18,14 @@ crossterm = { version = "0.29.0", features = ["event-stream"] }dirs = "6.0.0"futures = "0.3.31"hmac = "0.13.0"-image = "0.25.10"+image = { version = "0.25.10", default-features = false, features = ["gif", "jpeg", "png", "webp"] }lru = "0.18.1"md-5 = "0.11.0"rand = "0.10.2"ratatui = "0.30.2"-ratatui-image = { version = "11.0.6", default-features = false, features = ["crossterm", "image-defaults"] }-reqwest = { version = "0.13.4", default-features = false, features = ["json", "rustls", "blocking"] }+ratatui-image = { version = "11.0.6", default-features = false, features = ["crossterm"] }+reqwest = { version = "0.13.4", default-features = false, features = ["json", "rustls"] }+rustls = { version = "0.23.42", default-features = false, features = ["ring", "std"] }scraper = "0.24.0"semver = "1.0.28"serde = { version = "1.0.228", features = ["derive"] }@@ -40,6 +41,12 @@ mimalloc = "0.1.52"name = "moviebox_tui"path = "src/lib.rs"+[lints.clippy]+collapsible_else_if = "allow"+collapsible_if = "allow"+manual_is_multiple_of = "allow"+nonminimal_bool = "allow"+[profile.release]lto = truecodegen-units = 1diff --git a/Formula/moviebox-tui.rb b/Formula/moviebox-tui.rbindex 6d31d08..8e028bd 100644--- a/Formula/moviebox-tui.rb+++ b/Formula/moviebox-tui.rb@@ -1,11 +1,29 @@class MovieboxTui < Formula+ VERSION = "0.1.7"+ MACOS_SHA256 = "a7ff0f876d7170531df514da366a24f339a229625e60941a1c18b3b2147b7efa"+ LINUX_X64_SHA256 = "22c25c1c93e1623b3fca77678412b1307bf2725301d8a9b1cfb877d3520a6c77"+ LINUX_ARM64_SHA256 = "a45aa3b1c408ea02e07f7930a53ee051c5b55b63d03d04ebab984ec857a2db97"+desc "Stream movies, shows, anime, and live TV from your terminal"homepage "https://github.com/mesamirh/MovieBox-Tui"- url "https://github.com/mesamirh/MovieBox-Tui/releases/download/v0.1.7/MovieBox_macOS_Universal.tar.gz"- version "0.1.7"- sha256 "a7ff0f876d7170531df514da366a24f339a229625e60941a1c18b3b2147b7efa"+ version VERSIONlicense "MIT"+ on_macos do+ url "https://github.com/mesamirh/MovieBox-Tui/releases/download/v#{VERSION}/MovieBox_macOS_Universal.tar.gz"+ sha256 MACOS_SHA256+ end++ on_linux do+ if Hardware::CPU.arm?+ url "https://github.com/mesamirh/MovieBox-Tui/releases/download/v#{VERSION}/MovieBox_Linux_arm64.tar.gz"+ sha256 LINUX_ARM64_SHA256+ else+ url "https://github.com/mesamirh/MovieBox-Tui/releases/download/v#{VERSION}/MovieBox_Linux_x64.tar.gz"+ sha256 LINUX_X64_SHA256+ end+ end+def installbin.install "moviebox-tui"enddiff --git a/README.md b/README.mdindex abcb416..0bc36e0 100644--- a/README.md+++ b/README.md@@ -2,261 +2,278 @@# MovieBox-TUI-**Stream movies, shows, anime, and live TV from your terminal.** <br>-Fast and clean. No configuration, no torrents, and no debrid required.+Search, browse, play, and download movies and series from a keyboard-first terminal interface.[](https://crates.io/crates/moviebox-tui)-[](https://crates.io/crates/moviebox-tui)+[](https://github.com/mesamirh/MovieBox-Tui/actions/workflows/ci.yml)[](#license)-[](#requirements)-<br>--<img src="https://raw.githubusercontent.com/mesamirh/MovieBox-Tui/main/assets/screenshots/01-home-blocky.jpg" alt="MovieBox-TUI Home" width="85%">--**[See what's new in v0.1.7 on YouTube](https://youtu.be/5M2_mjH5r5Y)**--<sub>Found a bug? [Open an issue](https://github.com/mesamirh/MovieBox-Tui/issues) so I can fix it for everyone!</sub>+<img src="https://raw.githubusercontent.com/mesamirh/MovieBox-Tui/main/assets/screenshots/01-home-blocky.jpg" alt="MovieBox-TUI home screen" width="85%"></div>+## Features-## Screenshots--<details>-<summary><b>Movie & Series Details</b></summary><br>-<p align="center">- <img src="https://raw.githubusercontent.com/mesamirh/MovieBox-Tui/main/assets/screenshots/07-movie-details.jpg" alt="Movie Details" width="49%">- <img src="https://raw.githubusercontent.com/mesamirh/MovieBox-Tui/main/assets/screenshots/08-series-details.jpg" alt="Series Details" width="49%">-</p>-</details>--<details>-<summary><b>Search & Downloads</b></summary><br>-<p align="center">- <img src="https://raw.githubusercontent.com/mesamirh/MovieBox-Tui/main/assets/screenshots/06-search-results.jpg" alt="Search Results" width="49%">- <img src="https://raw.githubusercontent.com/mesamirh/MovieBox-Tui/main/assets/screenshots/12-download-progress.jpg" alt="Download Progress" width="49%">-</p>-</details>--<details>-<summary><b>Playback & Subtitles</b></summary><br>-<p align="center">- <img src="https://raw.githubusercontent.com/mesamirh/MovieBox-Tui/main/assets/screenshots/11-player-picker.jpg" alt="Media Player Selection" width="49%">- <img src="https://raw.githubusercontent.com/mesamirh/MovieBox-Tui/main/assets/screenshots/10-playback-subtitles.jpg" alt="Subtitle Language Selection" width="49%">-</p>-</details>--<details>-<summary><b>Live TV Experience</b></summary><br>-<p align="center">- <img src="https://raw.githubusercontent.com/mesamirh/MovieBox-Tui/main/assets/screenshots/09-live-tv-list.jpg" alt="Live TV Channels" width="49%">- <img src="https://raw.githubusercontent.com/mesamirh/MovieBox-Tui/main/assets/screenshots/05-tv-help.jpg" alt="Live TV Configuration" width="49%">-</p>-</details>--<details>-<summary><b>Home Themes</b></summary><br>-<p align="center">- <img src="https://raw.githubusercontent.com/mesamirh/MovieBox-Tui/main/assets/screenshots/03-home-3d.jpg" alt="3D Block Theme" width="49%">- <img src="https://raw.githubusercontent.com/mesamirh/MovieBox-Tui/main/assets/screenshots/02-home-ascii.jpg" alt="Minimal ASCII Theme" width="49%">-</p>-</details>--<details>-<summary><b>Help & Configuration</b></summary><br>-<p align="center">- <img src="https://raw.githubusercontent.com/mesamirh/MovieBox-Tui/main/assets/screenshots/04-global-help.jpg" alt="Global Help Menu" width="85%">-</p>-</details>-+- MovieBox and 4KHDHub catalogs with isolated search, details, stream, and image caches+- Movie, series, anime, episode, quality, and subtitle browsing+- Playback through mpv, VLC, or IINA+- HTTP header forwarding for protected playback sources+- Resumable downloads with progress, retry, cancellation, and partial-file preservation+- Sequential full-season download queue with one subtitle-language preference+- IPTV playlists, categories, search, and local playlist configuration+- Kitty, Sixel, iTerm2, and text poster rendering where supported+- Configurable themes, update checks, and automatic cache cleanup-## Features+MovieBox-TUI resolves links from upstream services. Availability can change when those services change.-### Streaming & Playback-- **Instant Search & Catalogs:** Type to search instantly, or browse trending movies, shows, and anime using slash commands (e.g., `/movies`, `/anime`).-- **Seamless Local Playback:** Resolves 4K/1080p streams and opens them instantly in your preferred local video player (`mpv`, `IINA`, or `VLC`).-- **Integrated Subtitles:** Automatically fetches available subtitles and lets you select your preferred language before playback.-- **Live IPTV:** Press `Ctrl+T` to toggle Live TV mode and stream thousands of live television channels globally.+## Requirements-### Advanced Downloading-- **Batch Season Downloader:** Queue up entire television seasons for concurrent downloading with a single keystroke.-- **Resilient Downloads:** Built-in support for download resumes. If a download is interrupted or fails, it picks up right where it left off.-- **Auto-Subtitle Fetching:** Automatically downloads the best-matching `.srt` subtitle files alongside your video files.+- 64-bit Windows, macOS, or Linux+- Terminal size of at least 85×24+- One supported player: mpv, VLC, or IINA+- Internet connection-### Terminal Experience-- **Native Image Rendering:** Enjoy high-resolution movie posters rendered directly in supported terminals.-- **Dynamic Theming:** Switch between beautiful 3D block layouts and clean ASCII themes to fit your aesthetic.-- **Power-User Slash Commands:** Use terminal-style commands to update the app (`/update`), switch categories, or customize your Live TV playlists (`/config`).-- **Smart Auto-Cleanup:** A silent background worker intelligently manages and deletes old cache files to protect your disk space.+Release binaries currently cover:+| Platform | Architectures |+| --- | --- |+| macOS | Intel and Apple Silicon universal binary |+| Linux | x86_64 and ARM64 static musl binaries |+| Windows | x86_64 and ARM64 |## Installation-**Prerequisites:** You will need a terminal (at least 85×24 characters) and a local video player installed (e.g. `mpv`, `IINA`, or `VLC`).+### Homebrew — macOS or Linux-The easiest way to get started is by using our quick install scripts. These scripts will automatically download the correct version for your computer.--### Homebrew (macOS & Linux)```bashbrew tap mesamirh/moviebox-tui https://github.com/mesamirh/MovieBox-Tuibrew install moviebox-tui```-### Install Script (macOS & Linux)+The formula selects the correct macOS, Linux x86_64, or Linux ARM64 release.++### Install script — macOS or Linux+```bashcurl -fsSL https://raw.githubusercontent.com/mesamirh/MovieBox-Tui/main/install.sh | bash```-### Windows+The script detects OS and CPU architecture, verifies the release SHA-256 checksum, then installs to `/usr/local/bin`. Without write access or `sudo`, it uses `~/.local/bin`.++### PowerShell — Windows+```powershell-powershell -c "irm https://raw.githubusercontent.com/mesamirh/MovieBox-Tui/main/install.ps1 | iex"+irm https://raw.githubusercontent.com/mesamirh/MovieBox-Tui/main/install.ps1 | iex```-### Cargo (For Rust Developers)+The installer selects x86_64 or ARM64, verifies SHA-256, installs under `%LOCALAPPDATA%\MovieBox-Tui`, and adds that directory to the user PATH. Open a new terminal after first installation.++### Cargo++Requires Rust 1.90 or newer:+```bash-cargo install moviebox-tui+cargo install moviebox-tui --locked```-<details>-<summary><i>Need to uninstall?</i></summary>--- **Homebrew:** `brew uninstall moviebox-tui && brew untap mesamirh/moviebox-tui`-- **Mac/Linux:** `sudo rm -f /usr/local/bin/moviebox-tui`-- **Windows:** `Remove-Item -Recurse -Force $env:USERPROFILE\AppData\Local\MovieBox-Tui`-- **Cargo:** `cargo uninstall moviebox-tui`-</details>----## Getting Started--Once installed, just open your terminal and type `moviebox-tui` to jump in!--### Keyboard Controls--<table>- <tr>- <th align="left">Key</th>- <th align="left">Action</th>- </tr>- <tr>- <td>Alphanumeric</td>- <td>Start searching instantly</td>- </tr>- <tr>- <td><kbd>↑</kbd> <kbd>↓</kbd> <kbd>←</kbd> <kbd>→</kbd></td>- <td>Navigate menus and grids</td>- </tr>- <tr>- <td><kbd>Enter</kbd></td>- <td>View details, pick episodes, or play video</td>- </tr>- <tr>- <td><kbd>o</kbd></td>- <td>Switch to a different video player on playback</td>- </tr>- <tr>- <td><kbd>d</kbd></td>- <td>Download an episode or an entire season</td>- </tr>- <tr>- <td><kbd>Ctrl</kbd>+<kbd>p</kbd></td>- <td>Switch between different content providers / sources</td>- </tr>- <tr>- <td><kbd>Ctrl</kbd>+<kbd>t</kbd></td>- <td>Toggle Live TV mode to browse IPTV channels</td>- </tr>- <tr>- <td><kbd>?</kbd></td>- <td>Open the global help menu</td>- </tr>- <tr>- <td><kbd>q</kbd></td>- <td>Quit (or use <kbd>Esc</kbd> to go back/clear search)</td>- </tr>-</table>--### Slash Commands-You can type these special commands straight into the search bar:--<table>- <tr>- <th align="left">Command</th>- <th align="left">Category</th>- <th align="left">Description</th>- </tr>- <tr>- <td><code>/discover</code> or <code>/home</code></td>- <td>Streaming</td>- <td>See what's trending right now</td>- </tr>- <tr>- <td><code>/movies</code>, <code>/shows</code>, <code>/anime</code></td>- <td>Streaming</td>- <td>Jump straight to a specific category</td>- </tr>- <tr>- <td><code>/list</code></td>- <td>Live TV</td>- <td>Show the list of available live channels</td>- </tr>- <tr>- <td><code>/config</code></td>- <td>Live TV</td>- <td>Open the TV configuration menu to add your own m3u playlists</td>- </tr>- <tr>- <td><code>/update</code></td>- <td>General</td>- <td>Check to see if there's a new version of the app</td>- </tr>- <tr>- <td><code>/toggle-update</code></td>- <td>General</td>- <td>Turn automatic background update checking on or off</td>- </tr>-</table>---## Contributing--I'd love your help making this even better! If you've got a big feature in mind, it's usually best to open an issue first so we can chat about it.+### Build from source```bashgit clone https://github.com/mesamirh/MovieBox-Tui.gitcd MovieBox-Tui-cargo build+cargo build --release --locked```-Just try to follow [Conventional Commits](https://www.conventionalcommits.org/) and make sure `cargo fmt` and `cargo clippy` are happy before you open a PR. You can check out [CONTRIBUTING.md](CONTRIBUTING.md) for the full rundown.+Binary location: `target/release/moviebox-tui` (`moviebox-tui.exe` on Windows).+## Player setup-## Credits & Legal+MovieBox-TUI checks standard application locations, PATH executables, and Linux Flatpak installations.-Live TV channel playlists are graciously provided by [iptv-org/iptv](https://github.com/iptv-org/iptv).+Detected automatically:-> **Disclaimer:** This is a third-party client. It does not host or store any media and only resolves links from upstream APIs. Intended for personal use only.+- macOS: `/Applications`, `~/Applications`, Homebrew/PATH+- Linux: PATH, Flatpak mpv, Flatpak VLC+- Windows: PATH, common Program Files locations, Microsoft Store aliases+Portable or custom installations can be selected with environment variables:-## Community & Support+| Player | Variable |+| --- | --- |+| mpv | `MOVIEBOX_MPV_PATH` |+| VLC | `MOVIEBOX_VLC_PATH` |+| IINA | `MOVIEBOX_IINA_PATH` |-The best way to support MovieBox-TUI is simply to use it, share it, and leave a star on GitHub!+macOS/Linux example:-If you'd like to buy me a coffee for the late nights spent coding, you can use the addresses below.+```bash+export MOVIEBOX_MPV_PATH="$HOME/Apps/mpv"+moviebox-tui+```-- **EVM:** `0x7ea20d5fa29d87f33195f5a3b211ff94038d794c`-- **BTC:** `3MEAtqtRWrQBhnaMi3Zuf5nt2efNUS2LUQ`-- **LTC:** `ltc1qhjkq2n6tsayxj56n3c53uqv23v8vqhvc9g3vxl`+Windows PowerShell example:----+```powershell+$env:MOVIEBOX_VLC_PATH = "D:\Apps\VLC\vlc.exe"+moviebox-tui+```-<div align="center">+IINA is macOS-only. mpv provides the broadest source-header compatibility.-Dual-licensed under [MIT](LICENSE-MIT) or [Apache 2.0](LICENSE-APACHE) at your option.<br>-Built by [**@mesamirh**](https://github.com/mesamirh)+## Usage-<sub>Not affiliated with any third-party content providers or operators.</sub>+Run:-</div>+```bash+moviebox-tui+```++### Main controls++| Key | Action |+| --- | --- |+| Arrow keys | Navigate lists, grids, seasons, episodes, and dialogs |+| Enter | Open or confirm selection |+| Esc / `b` | Close dialog or go back |+| `o` | Choose another player |+| `d` | Download selected episode or season |+| `r` | Refresh current content |+| `Ctrl+P` | Switch content provider |+| `Ctrl+T` | Toggle IPTV mode |+| `?` | Show help |+| `q` | Quit |++### Commands++| Command | Action |+| --- | --- |+| `/discover`, `/home` | Open discovery view |+| `/movies` | Browse movies |+| `/shows` | Browse series |+| `/anime` | Browse anime |+| `/list` | Show IPTV channels |+| `/config` | Configure IPTV playlists |+| `/update` | Check for a newer release |+| `/toggle-update` | Enable or disable automatic update checks |+| `/clear-cache` | Remove cached application data |++`/update` checks availability and shows the release location; it does not replace the running binary. Re-run the installer or Homebrew upgrade command to update.++## Downloads++Downloads are stored under the operating system Downloads directory:++```text+MovieBox-TUI/+├── Movies/+└── Series/<title>/Season <number>/+```++Season downloads run sequentially to limit disk and network pressure. After choosing a subtitle language for the first episode, the same language is requested for remaining episodes when available. Missing subtitles do not discard completed video files.++Interrupted downloads preserve `.part` and resume metadata files. Starting the same download again attempts to resume it.++## Configuration and cache++MovieBox-TUI uses standard OS directories:++| Platform | Configuration | Cache |+| --- | --- | --- |+| Linux | `${XDG_CONFIG_HOME:-~/.config}/moviebox-tui` | `${XDG_CACHE_HOME:-~/.cache}/moviebox-tui` |+| macOS | `~/Library/Application Support/moviebox-tui` | `~/Library/Caches/moviebox-tui` |+| Windows | `%APPDATA%\moviebox-tui` | `%LOCALAPPDATA%\moviebox-tui` |++Catalog providers use separate cache namespaces. Expired or invalid cache entries are discarded automatically; files older than seven days are cleaned at startup.++## Updating++Homebrew:++```bash+brew update+brew upgrade moviebox-tui+```++Script installations: run the same install command again. Cargo installations:++```bash+cargo install moviebox-tui --locked --force+```++## Uninstallation++Homebrew:++```bash+brew uninstall moviebox-tui+brew untap mesamirh/moviebox-tui+```++Script installation:++```bash+sudo rm -f /usr/local/bin/moviebox-tui+rm -f "$HOME/.local/bin/moviebox-tui"+```++Windows PowerShell:++```powershell+Remove-Item -Recurse -Force "$env:LOCALAPPDATA\MovieBox-Tui"+```++Cargo:++```bash+cargo uninstall moviebox-tui+```++Configuration and cache directories remain until removed manually.++## Troubleshooting++### No media player found++Confirm player runs from terminal:++```bash+mpv --version+vlc --version+```++For portable installs, set corresponding `MOVIEBOX_*_PATH` variable.++### Images do not render++Image support depends on terminal protocol. Text UI remains usable without graphics. Resize/focus crashes involving Sixel should be reported with OS, terminal name, and `moviebox-tui --version`.++### Linux command not found after script install++Add local binary directory to shell PATH:++```bash+export PATH="$HOME/.local/bin:$PATH"+```++Persist that line in shell profile when needed.++## Development++Before submitting changes:++```bash+cargo fmt --check+cargo clippy --all-targets --locked -- -D warnings+cargo audit+cargo package --locked+```++See [CONTRIBUTING.md](CONTRIBUTING.md) for contribution guidance.++## Legal++MovieBox-TUI does not host media. It is not affiliated with MovieBox, 4KHDHub, IPTV providers, player projects, or terminal vendors. Users are responsible for complying with laws and service terms applicable to them.++## License++Licensed under either [MIT](LICENSE-MIT) or [Apache-2.0](LICENSE-APACHE), at your option.diff --git a/install.ps1 b/install.ps1index 5d8d29d..b284ce6 100644--- a/install.ps1+++ b/install.ps1@@ -8,7 +8,8 @@ function Write-Err { param([string]$Message) Write-Host "ERROR: $Message" -Foreg$InstallDir = "$env:LOCALAPPDATA\MovieBox-Tui"$ExePath = "$InstallDir\moviebox-tui.exe"-$ZipFile = "$env:TEMP\MovieBox_Windows_x64.zip"+$TempDir = Join-Path ([System.IO.Path]::GetTempPath()) ("moviebox-tui-" + [guid]::NewGuid())+New-Item -ItemType Directory -Force -Path $TempDir | Out-NullWrite-Info "Fetching latest version information..."try {@@ -24,20 +25,17 @@ try {}$IsUpdate = $false+$CurrentVersion = "unknown"if (Test-Path $ExePath) {try {- $Strings = (Select-String -Path $ExePath -Pattern "--version" -Quiet -ErrorAction SilentlyContinue)- if ($Strings) {- $CurrentVersionOutput = (& $ExePath --version 2>&1 | Out-String)- if ($CurrentVersionOutput -match "moviebox-tui\s+([\d\.]+)") {- $CurrentVersion = $matches[1]- if ("v$CurrentVersion" -eq $Version) {- Write-Success "You already have the latest version ($Version) installed."- exit 0- }+ $CurrentVersionOutput = (& $ExePath --version 2>&1 | Out-String)+ if ($CurrentVersionOutput -match "moviebox-tui\s+([\d\.]+)") {+ $CurrentVersion = $matches[1]+ if ("v$CurrentVersion" -eq $Version) {+ Write-Success "You already have the latest version ($Version) installed."+ exit 0}}- if (-not $CurrentVersion) { $CurrentVersion = "unknown" }Write-Info "Updating MovieBox-TUI from v$CurrentVersion to $Version..."$IsUpdate = $true@@ -55,15 +53,40 @@ if (Test-Path $ExePath) {Write-Info "Installing MovieBox-TUI $Version..."}-$Url = "https://github.com/mesamirh/MovieBox-Tui/releases/download/$Version/MovieBox_Windows_x64.zip"+$Architecture = if ($env:PROCESSOR_ARCHITEW6432) { $env:PROCESSOR_ARCHITEW6432 } else { $env:PROCESSOR_ARCHITECTURE }+if ($Architecture -eq "ARM64") {+ $ArchiveName = "MovieBox_Windows_arm64.zip"+} elseif ($Architecture -eq "AMD64") {+ $ArchiveName = "MovieBox_Windows_x64.zip"+} else {+ Write-Err "Unsupported Windows architecture: $Architecture"+}+$ZipFile = Join-Path $TempDir $ArchiveName+$ChecksumFile = Join-Path $TempDir "SHA256SUMS"+$BaseUrl = "https://github.com/mesamirh/MovieBox-Tui/releases/download/$Version"+$Url = "$BaseUrl/$ArchiveName"Write-Info "Downloading release archive..."try {Invoke-WebRequest -Uri $Url -OutFile $ZipFile -UseBasicParsing+ Invoke-WebRequest -Uri "$BaseUrl/SHA256SUMS" -OutFile $ChecksumFile -UseBasicParsing} catch {+ Remove-Item $TempDir -Recurse -Force -ErrorAction SilentlyContinueWrite-Err "Download failed. Please check your internet connection."}+$ChecksumLine = Get-Content $ChecksumFile | Where-Object { $_ -match "\s+$([regex]::Escape($ArchiveName))$" } | Select-Object -First 1+if (-not $ChecksumLine) {+ Remove-Item $TempDir -Recurse -Force -ErrorAction SilentlyContinue+ Write-Err "Release checksum is missing for $ArchiveName."+}+$ExpectedHash = ($ChecksumLine -split '\s+')[0]+$ActualHash = (Get-FileHash -Path $ZipFile -Algorithm SHA256).Hash+if ($ActualHash -ne $ExpectedHash) {+ Remove-Item $TempDir -Recurse -Force -ErrorAction SilentlyContinue+ Write-Err "Checksum verification failed."+}+if (-not (Test-Path $InstallDir)) {New-Item -ItemType Directory -Force -Path $InstallDir | Out-Null}@@ -72,14 +95,11 @@ Write-Info "Extracting files..."try {Expand-Archive -Path $ZipFile -DestinationPath $InstallDir -Force} catch {+ Remove-Item $TempDir -Recurse -Force -ErrorAction SilentlyContinueWrite-Err "Failed to extract archive."}-if ($IsUpdate) {- Remove-Item $ExePath -Force -ErrorAction SilentlyContinue-}--Remove-Item $ZipFile -Force+Remove-Item $TempDir -Recurse -Force$UserPath = [Environment]::GetEnvironmentVariable("PATH", "User")if ($UserPath -notmatch [regex]::Escape($InstallDir)) {diff --git a/install.sh b/install.shindex add2e25..197d9cd 100755--- a/install.sh+++ b/install.sh@@ -1,5 +1,5 @@-#!/bin/bash-set -e+#!/usr/bin/env bash+set -euo pipefaillog_info() { echo -e "\033[0;34m$1\033[0m"; }log_success() { echo -e "\033[0;32m$1\033[0m"; }@@ -14,20 +14,15 @@ command -v curl >/dev/null 2>&1 || log_err "curl is required but not installed.command -v tar >/dev/null 2>&1 || log_err "tar is required but not installed. Please install it."log_info "Fetching latest version information..."-LATEST_RELEASE=$(curl -sI "https://github.com/mesamirh/MovieBox-Tui/releases/latest")-VERSION=$(echo "$LATEST_RELEASE" | grep -i '^location:' | awk -F '/' '{print $NF}' | tr -d '\r')+if ! LATEST_RELEASE=$(curl -fsSI "https://github.com/mesamirh/MovieBox-Tui/releases/latest"); then+ log_err "Failed to fetch latest version from GitHub."+fi+VERSION=$(echo "$LATEST_RELEASE" | grep -i '^location:' | awk -F '/' '{print $NF}' | tr -d '\r') || true[ -z "$VERSION" ] && log_err "Failed to fetch latest version from GitHub API."if command -v "$BIN_NAME" > /dev/null 2>&1; then- if strings "$APP_PATH" 2>/dev/null | grep -q "\-\-version"; then- CURRENT_VERSION=$($BIN_NAME --version 2>/dev/null | awk '{print $2}')- else- CURRENT_VERSION="unknown"- fi-- if [ -z "$CURRENT_VERSION" ]; then- CURRENT_VERSION="unknown"- fi+ CURRENT_VERSION=$($BIN_NAME --version 2>/dev/null | awk '{print $2}') || true+ CURRENT_VERSION=${CURRENT_VERSION:-unknown}if [ "v$CURRENT_VERSION" = "$VERSION" ]; thenlog_success "You already have the latest version ($VERSION) installed."@@ -58,6 +53,7 @@ elsefiURL="https://github.com/mesamirh/MovieBox-Tui/releases/download/$VERSION/$FILE"+CHECKSUM_URL="https://github.com/mesamirh/MovieBox-Tui/releases/download/$VERSION/SHA256SUMS"TMP_DIR=$(mktemp -d)trap 'rm -rf "$TMP_DIR"' EXIT@@ -66,6 +62,20 @@ if ! curl -fsSL --progress-bar "$URL" -o "$TMP_DIR/$FILE"; thenlog_err "Download failed. Please check your internet connection."fi+if ! curl -fsSL "$CHECKSUM_URL" -o "$TMP_DIR/SHA256SUMS"; then+ log_err "Checksum download failed. Refusing unverified installation."+fi+EXPECTED_SHA=$(awk -v file="$FILE" '$2 == file {print $1}' "$TMP_DIR/SHA256SUMS")+[ -z "$EXPECTED_SHA" ] && log_err "Release checksum is missing for $FILE."+if command -v sha256sum >/dev/null 2>&1; then+ ACTUAL_SHA=$(sha256sum "$TMP_DIR/$FILE" | awk '{print $1}')+elif command -v shasum >/dev/null 2>&1; then+ ACTUAL_SHA=$(shasum -a 256 "$TMP_DIR/$FILE" | awk '{print $1}')+else+ log_err "sha256sum or shasum is required to verify the release."+fi+[ "$ACTUAL_SHA" != "$EXPECTED_SHA" ] && log_err "Checksum verification failed."+log_info "Extracting files..."tar -xzf "$TMP_DIR/$FILE" -C "$TMP_DIR"@@ -74,13 +84,17 @@ if [ ! -f "$TMP_DIR/$BIN_NAME" ]; thenfilog_info "Moving binary to $INSTALL_DIR..."-if [ -w "$INSTALL_DIR" ]; then- mv "$TMP_DIR/$BIN_NAME" "$APP_PATH"- chmod +x "$APP_PATH"-else+if [ -d "$INSTALL_DIR" ] && [ -w "$INSTALL_DIR" ]; then+ install -m 755 "$TMP_DIR/$BIN_NAME" "$APP_PATH"+elif command -v sudo >/dev/null 2>&1; thenlog_info "Requires sudo privileges to write to $INSTALL_DIR..."- sudo mv "$TMP_DIR/$BIN_NAME" "$APP_PATH"- sudo chmod +x "$APP_PATH"+ sudo mkdir -p "$INSTALL_DIR"+ sudo install -m 755 "$TMP_DIR/$BIN_NAME" "$APP_PATH"+else+ INSTALL_DIR="$HOME/.local/bin"+ APP_PATH="$INSTALL_DIR/$BIN_NAME"+ mkdir -p "$INSTALL_DIR"+ install -m 755 "$TMP_DIR/$BIN_NAME" "$APP_PATH"fiif ! echo "$PATH" | tr ':' '\n' | grep -q "^$INSTALL_DIR$"; thendiff --git a/scripts/release.sh b/scripts/release.shdeleted file mode 100755index a665988..0000000--- a/scripts/release.sh+++ /dev/null@@ -1,49 +0,0 @@-#!/bin/bash-set -e--echo "Starting builds for all platforms..."--rm -rf dist .tmp_build-mkdir -p dist-mkdir -p .tmp_build--echo "Building macOS Universal Binary..."-cargo build --target aarch64-apple-darwin --release-cargo build --target x86_64-apple-darwin --release-lipo -create \- target/aarch64-apple-darwin/release/moviebox-tui \- target/x86_64-apple-darwin/release/moviebox-tui \- -output .tmp_build/moviebox-tui-tar -czf dist/MovieBox_macOS_Universal.tar.gz -C .tmp_build moviebox-tui-rm .tmp_build/moviebox-tui-echo "macOS Universal build complete!"--echo "Building Windows Executable..."-cargo build --target x86_64-pc-windows-gnu --release-cp target/x86_64-pc-windows-gnu/release/moviebox-tui.exe .tmp_build/moviebox-tui.exe-cd .tmp_build && zip -q ../dist/MovieBox_Windows_x64.zip moviebox-tui.exe && cd ..-rm .tmp_build/moviebox-tui.exe-echo "Windows build complete!"--echo "Building Linux Binary (via Docker)..."-if ! docker info > /dev/null 2>&1; then- echo "Warning: Docker is not running! Please open the Docker app on your Mac and run this script again to build the Linux version."-else- CROSS_CONTAINER_OPTS="--platform linux/amd64" cross build --target x86_64-unknown-linux-musl --release- cp target/x86_64-unknown-linux-musl/release/moviebox-tui .tmp_build/moviebox-tui- tar -czf dist/MovieBox_Linux_x64.tar.gz -C .tmp_build moviebox-tui-- echo "Building Linux ARM64 Binary (via Docker)..."- cargo clean- CROSS_CONTAINER_OPTS="--platform linux/amd64" cross build --target aarch64-unknown-linux-musl --release- cp target/aarch64-unknown-linux-musl/release/moviebox-tui .tmp_build/moviebox-tui- tar -czf dist/MovieBox_Linux_arm64.tar.gz -C .tmp_build moviebox-tui-- echo "Linux builds complete!"-fi--rm -rf .tmp_build--echo ""-echo "All done! Your release files are packed and ready to upload to GitHub:"-ls -lh distdiff --git a/src/cache.rs b/src/cache.rsindex d40f20a..11e4e13 100644--- a/src/cache.rs+++ b/src/cache.rs@@ -320,7 +320,15 @@ pub fn set_homepage_cache(tab_id: &str, page: usize, data: &serde_json::Value) {}pub fn get_image_path(id: &str) -> PathBuf {- let mut path = get_cache_dir("images");+ get_namespaced_image_path(ProviderKind::MovieBox.cache_key(), id)+}++fn get_namespaced_image_path(namespace: &str, id: &str) -> PathBuf {+ let mut path = dirs::cache_dir().unwrap_or_else(std::env::temp_dir);+ path.push("moviebox-tui");+ path.push(namespace);+ path.push("images");+ let _ = fs::create_dir_all(&path);use md5::{Digest, Md5};let mut hasher = Md5::new();hasher.update(id.as_bytes());@@ -335,7 +343,11 @@ pub fn get_image_path(id: &str) -> PathBuf {}pub fn get_image_cache(id: &str) -> Option<Vec<u8>> {- let path = get_image_path(id);+ get_namespaced_image_cache(ProviderKind::MovieBox.cache_key(), id)+}++pub fn get_namespaced_image_cache(namespace: &str, id: &str) -> Option<Vec<u8>> {+ let path = get_namespaced_image_path(namespace, id);if path.exists() {if let Ok(metadata) = std::fs::metadata(&path) {if let Ok(modified) = metadata.modified() {@@ -353,7 +365,11 @@ pub fn get_image_cache(id: &str) -> Option<Vec<u8>> {}pub fn set_image_cache(id: &str, bytes: &[u8]) {- let path = get_image_path(id);+ set_namespaced_image_cache(ProviderKind::MovieBox.cache_key(), id, bytes);+}++pub fn set_namespaced_image_cache(namespace: &str, id: &str, bytes: &[u8]) {+ let path = get_namespaced_image_path(namespace, id);let stamp = std::time::SystemTime::now().duration_since(std::time::UNIX_EPOCH).unwrap_or_default()diff --git a/src/main.rs b/src/main.rsindex 9412212..9679007 100644--- a/src/main.rs+++ b/src/main.rs@@ -5,28 +5,27 @@ static GLOBAL: mimalloc::MiMalloc = mimalloc::MiMalloc;struct TerminalGuard;+fn restore_terminal() {+ let _ = crossterm::execute!(+ std::io::stdout(),+ crossterm::cursor::Show,+ crossterm::event::DisableMouseCapture,+ crossterm::event::DisableFocusChange,+ crossterm::terminal::LeaveAlternateScreen+ );+ let _ = crossterm::terminal::disable_raw_mode();+}+impl Drop for TerminalGuard {fn drop(&mut self) {- let _ = crossterm::terminal::disable_raw_mode();- let _ = crossterm::execute!(- std::io::stdout(),- crossterm::terminal::LeaveAlternateScreen,- crossterm::event::DisableMouseCapture,- crossterm::event::DisableFocusChange- );+ restore_terminal();}}#[tokio::main]async fn main() -> std::io::Result<()> {std::panic::set_hook(Box::new(|info| {- let _ = crossterm::terminal::disable_raw_mode();- let _ = crossterm::execute!(- std::io::stdout(),- crossterm::terminal::LeaveAlternateScreen,- crossterm::event::DisableMouseCapture,- crossterm::event::DisableFocusChange- );+ restore_terminal();eprintln!("{}", info);}));@@ -44,6 +43,7 @@ async fn main() -> std::io::Result<()> {ratatui::backend::CrosstermBackend::new(std::io::BufWriter::with_capacity(65536, stdout));let mut terminal = ratatui::Terminal::new(backend)?;crossterm::terminal::enable_raw_mode()?;+ let _guard = TerminalGuard;crossterm::execute!(std::io::stdout(),crossterm::terminal::EnterAlternateScreen,@@ -53,8 +53,6 @@ async fn main() -> std::io::Result<()> {moviebox_tui::cache::clean_old_cache_background();- let _guard = TerminalGuard;-let mut app = App::new();app.run(&mut terminal).await}diff --git a/src/providers/iptv_org/m3u.rs b/src/providers/iptv_org/m3u.rsindex 461c88a..8b9d062 100644--- a/src/providers/iptv_org/m3u.rs+++ b/src/providers/iptv_org/m3u.rs@@ -1,5 +1,5 @@use serde::{Deserialize, Serialize};-use std::fs;+use std::hash::{Hash, Hasher};use std::path::PathBuf;use std::time::SystemTime;@@ -14,6 +14,7 @@ pub struct Channel {pub struct M3UParser {cache_dir: PathBuf,+ client: reqwest::Client,}impl Default for M3UParser {@@ -28,19 +29,23 @@ impl M3UParser {cache_dir.push("moviebox-tui");cache_dir.push("tv_playlists");std::fs::create_dir_all(&cache_dir).ok();- Self { cache_dir }+ let client = reqwest::Client::builder()+ .connect_timeout(std::time::Duration::from_secs(10))+ .timeout(std::time::Duration::from_secs(30))+ .build()+ .unwrap_or_default();+ Self { cache_dir, client }}pub async fn fetch_playlist(&self,url: &str,- filename: &str,) -> Result<Vec<Channel>, Box<dyn std::error::Error>> {- let file_path = self.cache_dir.join(filename);+ let file_path = self.cache_dir.join(cache_filename(url));let mut needs_download = true;if file_path.exists() {- if let Ok(metadata) = fs::metadata(&file_path) {+ if let Ok(metadata) = tokio::fs::metadata(&file_path).await {if let Ok(modified) = metadata.modified() {if let Ok(duration) = SystemTime::now().duration_since(modified) {if duration.as_secs() < 24 * 3600 {@@ -52,12 +57,18 @@ impl M3UParser {}let content = if needs_download {- let client = reqwest::Client::new();- let res = client.get(url).send().await?.text().await?;- fs::write(&file_path, &res).ok();+ let res = self+ .client+ .get(url)+ .send()+ .await?+ .error_for_status()?+ .text()+ .await?;+ let _ = tokio::fs::write(&file_path, &res).await;res} else {- fs::read_to_string(&file_path)?+ tokio::fs::read_to_string(&file_path).await?};Ok(self.parse_m3u(&content))@@ -116,3 +127,9 @@ impl M3UParser {channels}}++fn cache_filename(raw: &str) -> String {+ let mut hasher = std::collections::hash_map::DefaultHasher::new();+ raw.hash(&mut hasher);+ format!("{:016x}.m3u", hasher.finish())+}diff --git a/src/providers/moviebox/mod.rs b/src/providers/moviebox/mod.rsindex d50d9d6..cda54e9 100644--- a/src/providers/moviebox/mod.rs+++ b/src/providers/moviebox/mod.rs@@ -18,15 +18,7 @@ impl MovieBoxClient {}pub async fn suggest(&self, query: &str) -> Result<Value, ScraperError> {- let payload = json!({- "keyword": query,- "page": 1,- "perPage": 20,- "subjectType": "All",- "tabId": "All"- });- self.post("/wefeed-mobile-bff/subject-api/search/v2", &payload)- .await+ self.search(query, 1).await}pub async fn get_details(&self, subject_id: &str) -> Result<Value, ScraperError> {diff --git a/src/tui/app.rs b/src/tui/app.rsindex bbb90cf..f1a345a 100644--- a/src/tui/app.rs+++ b/src/tui/app.rs@@ -126,17 +126,101 @@ impl App {fn persist_config(&self) {if let Some(config_dir) = dirs::config_dir() {let app_dir = config_dir.join("moviebox-tui");- let _ = std::fs::create_dir_all(&app_dir);+ if std::fs::create_dir_all(&app_dir).is_err() {+ return;+ }let config = serde_json::json!({"auto_update": self.state.auto_update,"last_update_check": self.state.last_update_check,"active_provider": self.state.active_provider.cache_key(),"active_theme": self.state.active_theme_kind});- let _ = std::fs::write(app_dir.join("config.json"), config.to_string());+ let path = app_dir.join("config.json");+ let temporary = app_dir.join(format!("config.{}.tmp", std::process::id()));+ if std::fs::write(&temporary, config.to_string()).is_ok()+ && std::fs::rename(&temporary, &path).is_err()+ {+ let _ = std::fs::remove_file(&path);+ let _ = std::fs::rename(&temporary, &path);+ }}}+ fn launch_player(+ &self,+ kind: crate::tui::state::PlayerKind,+ link: String,+ subtitle: Option<String>,+ headers: Vec<(String, String)>,+ ) {+ let client = self.client.http_client().clone();+ let sender = self.action_sender.clone();+ tokio::spawn(async move {+ let mut local_subtitle = subtitle.clone();+ let mut temporary_subtitle = None;+ if matches!(+ kind,+ crate::tui::state::PlayerKind::Vlc | crate::tui::state::PlayerKind::Iina+ ) && let Some(url) = subtitle+ && let Ok(Ok(response)) =+ tokio::time::timeout(std::time::Duration::from_secs(30), client.get(url).send())+ .await+ && let Ok(response) = response.error_for_status()+ && let Ok(bytes) = response.bytes().await+ {+ let path = std::env::temp_dir().join(format!(+ "moviebox_sub_{}_{}.srt",+ std::process::id(),+ std::time::SystemTime::now()+ .duration_since(std::time::UNIX_EPOCH)+ .unwrap_or_default()+ .as_nanos()+ ));+ if tokio::fs::write(&path, bytes).await.is_ok() {+ local_subtitle = Some(path.to_string_lossy().into_owned());+ temporary_subtitle = Some(path);+ }+ }++ let mut command =+ crate::tui::player::command(kind, &link, local_subtitle.as_deref(), &headers);+ command.stdout(std::process::Stdio::null());+ command.stderr(std::process::Stdio::null());++ #[cfg(unix)]+ {+ use std::os::unix::process::CommandExt;+ command.process_group(0);+ }+ #[cfg(windows)]+ {+ use std::os::windows::process::CommandExt;+ command.creation_flags(0x08000000);+ }++ match command.spawn() {+ Ok(mut child) => {+ if let Some(path) = temporary_subtitle {+ tokio::task::spawn_blocking(move || {+ let _ = child.wait();+ let _ = std::fs::remove_file(path);+ });+ }+ }+ Err(error) => {+ if let Some(path) = temporary_subtitle {+ let _ = tokio::fs::remove_file(path).await;+ }+ sender+ .send(Action::SetStatus(format!(+ "Error: failed to launch media player: {error}"+ )))+ .ok();+ }+ }+ });+ }+fn switch_provider(&mut self, provider: ProviderKind) {if self.state.is_tv_mode {return;@@ -490,15 +574,54 @@ impl App {if let Some(subtitle_url) = subtitle_url {let subtitle_path = destination.with_extension("srt");- let subtitle_client = client.clone();- tokio::spawn(async move {- if let Ok(response) = subtitle_client.get(subtitle_url).send().await- && response.status().is_success()- && let Ok(bytes) = response.bytes().await- {- let _ = tokio::fs::write(subtitle_path, bytes).await;+ let result = tokio::time::timeout(+ std::time::Duration::from_secs(30),+ client.get(subtitle_url).send(),+ )+ .await;+ match result {+ Ok(Ok(response)) => match response.error_for_status() {+ Ok(response) => match response.bytes().await {+ Ok(bytes) => {+ if let Err(error) = tokio::fs::write(subtitle_path, bytes).await {+ sender+ .send(Action::SetStatus(format!(+ "Error: subtitle write failed: {error}"+ )))+ .ok();+ }+ }+ Err(error) => {+ sender+ .send(Action::SetStatus(format!(+ "Error: subtitle download failed: {error}"+ )))+ .ok();+ }+ },+ Err(error) => {+ sender+ .send(Action::SetStatus(format!(+ "Error: subtitle download failed: {error}"+ )))+ .ok();+ }+ },+ Ok(Err(error)) => {+ sender+ .send(Action::SetStatus(format!(+ "Error: subtitle download failed: {error}"+ )))+ .ok();}- });+ Err(_) => {+ sender+ .send(Action::SetStatus(+ "Error: subtitle download timed out".to_string(),+ ))+ .ok();+ }+ }}let progress_sender = sender.clone();@@ -625,7 +748,7 @@ impl App {loop {if self.state.clear_terminal_before_draw {terminal.current_buffer_mut().reset();- let _ = terminal.backend_mut().clear();+ terminal.backend_mut().clear()?;terminal.swap_buffers();self.state.clear_terminal_before_draw = false;self.state.dirty = true;@@ -1036,12 +1159,8 @@ impl App {);let mut all_channels = Vec::new();for url in urls_to_fetch {- let filename = url- .split('/')- .next_back()- .unwrap_or("playlist.m3u");if let Ok(channels) =- parser.fetch_playlist(&url, filename).await+ parser.fetch_playlist(&url).await{all_channels.extend(channels);}@@ -1295,7 +1414,7 @@ impl App {}Action::ToggleTvMode => {self.state.is_tv_mode = !self.state.is_tv_mode;- self.state.tick_count = 0; // Reset animation+ self.state.tick_count = 0;if self.state.is_tv_mode {self.state.tv_config_popup = false;self.state.search_query.clear();@@ -1323,8 +1442,7 @@ impl App {let parser = crate::providers::iptv_org::m3u::M3UParser::new();let mut all_channels = Vec::new();for url in loaded_urls {- let filename = url.split('/').next_back().unwrap_or("playlist.m3u");- if let Ok(channels) = parser.fetch_playlist(&url, filename).await {+ if let Ok(channels) = parser.fetch_playlist(&url).await {all_channels.extend(channels);}}@@ -2769,7 +2887,11 @@ impl App {tokio::spawn(async move {if let Ok(Some(bytes)) = tokio::task::spawn_blocking({let id_clone = id2.clone();- move || crate::cache::get_image_cache(&id_clone)+ move || {+ crate::cache::get_namespaced_image_cache(+ "iptv", &id_clone,+ )+ }}).await{@@ -2797,7 +2919,8 @@ impl App {let bytes_clone = bytes.clone();let id_clone = id2.clone();let _ = tokio::task::spawn_blocking(move || {- crate::cache::set_image_cache(+ crate::cache::set_namespaced_image_cache(+ "iptv",&id_clone,&bytes_clone,)@@ -2963,10 +3086,16 @@ impl App {let url_clone = url.to_string();let action_tx = self.action_sender.clone();let id_clone = id.clone();+ let provider = self.state.active_provider;tokio::spawn(async move {if let Ok(Some(bytes)) = tokio::task::spawn_blocking({let id_clone = id_clone.clone();- move || crate::cache::get_image_cache(&id_clone)+ move || {+ crate::cache::get_namespaced_image_cache(+ provider.cache_key(),+ &id_clone,+ )+ }}).await{@@ -2995,7 +3124,11 @@ impl App {let bytes_clone = bytes.clone();let id_clone2 = id_clone.clone();let _ = tokio::task::spawn_blocking(move || {- crate::cache::set_image_cache(&id_clone2, &bytes_clone)+ crate::cache::set_namespaced_image_cache(+ provider.cache_key(),+ &id_clone2,+ &bytes_clone,+ )}).await;if let Ok(Ok(img)) = tokio::task::spawn_blocking(move || {@@ -3441,10 +3574,16 @@ impl App {let url_clone = url.to_string();let action_tx = self.action_sender.clone();let id_clone = id.clone();+ let provider = context.provider;tokio::spawn(async move {if let Ok(Some(bytes)) = tokio::task::spawn_blocking({let id_clone = id_clone.clone();- move || crate::cache::get_image_cache(&id_clone)+ move || {+ crate::cache::get_namespaced_image_cache(+ provider.cache_key(),+ &id_clone,+ )+ }}).await{@@ -3471,7 +3610,11 @@ impl App {let bytes_clone = bytes.clone();let id_clone2 = id_clone.clone();let _ = tokio::task::spawn_blocking(move || {- crate::cache::set_image_cache(&id_clone2, &bytes_clone)+ crate::cache::set_namespaced_image_cache(+ provider.cache_key(),+ &id_clone2,+ &bytes_clone,+ )}).await;if let Ok(Ok(img)) = tokio::task::spawn_blocking(move || {@@ -4326,57 +4469,7 @@ impl App {}Action::LaunchPlayer(kind, link, sub) => {self.state.player_picker_popup = false;- let client = self.client.http_client().clone();- tokio::spawn(async move {- let mut local_sub = sub.clone();- let mut sub_temp_path = None;- if kind == crate::tui::state::PlayerKind::Vlc- || kind == crate::tui::state::PlayerKind::Iina- {- if let Some(s_url) = sub {- if let Ok(resp) = client.get(&s_url).send().await {- if let Ok(bytes) = resp.bytes().await {- let temp_path = std::env::temp_dir().join(format!(- "moviebox_sub_{}.srt",- std::time::SystemTime::now()- .duration_since(std::time::UNIX_EPOCH)- .unwrap_or_default()- .as_millis()- ));- if tokio::fs::write(&temp_path, bytes).await.is_ok() {- local_sub = Some(temp_path.to_string_lossy().to_string());- sub_temp_path = Some(temp_path);- }- }- }- }- }-- let mut cmd =- crate::tui::player::command(kind, &link, local_sub.as_deref(), &[]);- cmd.stdout(std::process::Stdio::null());- cmd.stderr(std::process::Stdio::null());-- #[cfg(unix)]- {- use std::os::unix::process::CommandExt;- cmd.process_group(0);- }- #[cfg(windows)]- {- use std::os::windows::process::CommandExt;- cmd.creation_flags(0x08000000);- }-- if let Ok(mut child) = cmd.spawn() {- if let Some(path) = sub_temp_path {- tokio::task::spawn_blocking(move || {- let _ = child.wait();- let _ = std::fs::remove_file(path);- });- }- }- });+ self.launch_player(kind, link, sub, Vec::new());}Action::LaunchPlayback(kind, source) => {self.state.player_picker_popup = false;@@ -4386,69 +4479,17 @@ impl App {self.state.status_timer = 180;return None;}- let client = self.client.http_client().clone();- tokio::spawn(async move {- let mut local_sub = source.subtitle.clone();- let mut sub_temp_path = None;- if kind == crate::tui::state::PlayerKind::Vlc- || kind == crate::tui::state::PlayerKind::Iina- {- if let Some(s_url) = source.subtitle.as_ref() {- if let Ok(resp) = client.get(s_url).send().await {- if let Ok(bytes) = resp.bytes().await {- let temp_path = std::env::temp_dir().join(format!(- "moviebox_sub_{}.srt",- std::time::SystemTime::now()- .duration_since(std::time::UNIX_EPOCH)- .unwrap_or_default()- .as_millis()- ));- if tokio::fs::write(&temp_path, bytes).await.is_ok() {- local_sub = Some(temp_path.to_string_lossy().to_string());- sub_temp_path = Some(temp_path);- }- }- }- }- }-- let mut cmd = crate::tui::player::command(- kind,- &source.url,- local_sub.as_deref(),- &source.headers,- );- cmd.stdout(std::process::Stdio::null());- cmd.stderr(std::process::Stdio::null());- #[cfg(unix)]- {- use std::os::unix::process::CommandExt;- cmd.process_group(0);- }- #[cfg(windows)]- {- use std::os::windows::process::CommandExt;- cmd.creation_flags(0x08000000);- }- if let Ok(mut child) = cmd.spawn() {- if let Some(path) = sub_temp_path {- tokio::task::spawn_blocking(move || {- let _ = child.wait();- let _ = std::fs::remove_file(path);- });- }- }- });+ self.launch_player(kind, source.url, source.subtitle, source.headers);}Action::CheckForUpdates => {let update_sender = self.action_sender.clone();- tokio::task::spawn_blocking(move || {- let start = std::time::Instant::now();- let result = crate::tui::updater::check(env!("CARGO_PKG_VERSION"));+ tokio::spawn(async move {+ let start = tokio::time::Instant::now();+ let result = crate::tui::updater::check(env!("CARGO_PKG_VERSION")).await;let elapsed = start.elapsed();if elapsed.as_millis() < 1500 {- std::thread::sleep(std::time::Duration::from_millis(1500) - elapsed);+ tokio::time::sleep(std::time::Duration::from_millis(1500) - elapsed).await;}match result {diff --git a/src/tui/event.rs b/src/tui/event.rsindex 55edc0b..a92ff6f 100644--- a/src/tui/event.rs+++ b/src/tui/event.rs@@ -5,8 +5,6 @@ use tokio::sync::mpsc;pub struct EventHandler {receiver: mpsc::Receiver<Action>,- #[allow(dead_code)]- sender: mpsc::Sender<Action>,}impl EventHandler {@@ -28,8 +26,9 @@ impl EventHandler {Some(event) = reader.next() => {match event {Ok(CrosstermEvent::Key(key)) => {- let is_press = key.kind == KeyEventKind::Press;- if is_press && event_sender.try_send(Action::Key(key)).is_err() {}+ if matches!(key.kind, KeyEventKind::Press | KeyEventKind::Repeat) {+ let _ = event_sender.send(Action::Key(key)).await;+ }}Ok(CrosstermEvent::Mouse(mouse)) => {match mouse.kind {@@ -48,6 +47,12 @@ impl EventHandler {Ok(CrosstermEvent::Resize(w, h)) => {let _ = event_sender.try_send(Action::Resize(w, h));}+ Err(error) => {+ let _ = event_sender.send(Action::SetStatus(format!(+ "Error: terminal input failed: {error}"+ ))).await;+ break;+ }_ => {}}}@@ -55,7 +60,7 @@ impl EventHandler {}});- Self { receiver, sender }+ Self { receiver }}pub async fn next(&mut self) -> Option<Action> {diff --git a/src/tui/player.rs b/src/tui/player.rsindex 033034d..f8d5ba7 100644--- a/src/tui/player.rs+++ b/src/tui/player.rs@@ -11,7 +11,7 @@ pub fn detect() -> Vec<PlayerKind> {let mut players = Vec::new();#[cfg(target_os = "macos")]- if Path::new("/Applications/IINA.app").exists() || command_exists("iina") {+ if iina_available() {players.push(PlayerKind::Iina);}@@ -26,7 +26,10 @@ pub fn detect() -> Vec<PlayerKind> {}pub fn supports_headers(kind: PlayerKind, headers: &[(String, String)]) -> bool {- kind != PlayerKind::Vlc || headers.is_empty()+ kind != PlayerKind::Vlc+ || headers.iter().all(|(name, _)| {+ name.eq_ignore_ascii_case("referer") || name.eq_ignore_ascii_case("user-agent")+ })}pub fn command(@@ -91,7 +94,10 @@ fn mpv_command(#[cfg(target_os = "macos")]fn iina_command(url: &str, subtitle: Option<&str>, headers: &[(String, String)]) -> Command {- let mut command = if Path::new("/Applications/IINA.app").exists() {+ let configured = configured_executable("MOVIEBOX_IINA_PATH");+ let mut command = if let Some(executable) = configured {+ Command::new(executable)+ } else if iina_app_exists() {let mut c = Command::new("open");c.arg("-a").arg("IINA").arg("--args");c@@ -140,38 +146,81 @@ fn vlc_command(url: &str, subtitle: Option<&str>, headers: &[(String, String)])}fn mpv_executable() -> Option<String> {+ if let Some(executable) = configured_executable("MOVIEBOX_MPV_PATH") {+ return Some(executable);+ }let fallback = if cfg!(target_os = "windows") {"mpv.exe"} else {"mpv"};- first_executable(&[MPV_WINDOWS, MPV_MACOS], fallback)- .or_else(|| flatpak_executable("io.mpv.Mpv"))+ #[allow(unused_mut)]+ let mut paths = vec![MPV_WINDOWS.to_string(), MPV_MACOS.to_string()];+ #[cfg(target_os = "macos")]+ if let Some(home) = dirs::home_dir() {+ paths.push(+ home.join("Applications/mpv.app/Contents/MacOS/mpv")+ .to_string_lossy()+ .into_owned(),+ );+ }+ #[cfg(windows)]+ if let Ok(local) = std::env::var("LOCALAPPDATA") {+ paths.push(format!(r"{local}\Programs\mpv\mpv.exe"));+ }+ first_executable(&paths, fallback).or_else(|| flatpak_executable("io.mpv.Mpv"))}fn vlc_executable() -> Option<String> {+ if let Some(executable) = configured_executable("MOVIEBOX_VLC_PATH") {+ return Some(executable);+ }let fallback = if cfg!(target_os = "windows") {"vlc.exe"} else {"vlc"};- let paths = vec![VLC_WINDOWS, VLC_WINDOWS_X86, VLC_MACOS];+ #[allow(unused_mut)]+ let mut paths = vec![+ VLC_WINDOWS.to_string(),+ VLC_WINDOWS_X86.to_string(),+ VLC_MACOS.to_string(),+ ];++ #[cfg(target_os = "macos")]+ if let Some(home) = dirs::home_dir() {+ paths.push(+ home.join("Applications/VLC.app/Contents/MacOS/VLC")+ .to_string_lossy()+ .into_owned(),+ );+ }#[cfg(windows)]let windows_app_path = std::env::var("LOCALAPPDATA").map(|l| format!(r"{}\Microsoft\WindowsApps\vlc.exe", l)).unwrap_or_default();- #[allow(unused_mut)]- let mut static_paths: Vec<&str> = paths.clone();-#[cfg(windows)]if !windows_app_path.is_empty() {- static_paths.push(&windows_app_path);+ paths.push(windows_app_path);}- first_executable(&static_paths, fallback).or_else(|| flatpak_executable("org.videolan.VLC"))+ first_executable(&paths, fallback).or_else(|| flatpak_executable("org.videolan.VLC"))+}++#[cfg(target_os = "macos")]+fn iina_available() -> bool {+ configured_executable("MOVIEBOX_IINA_PATH").is_some()+ || iina_app_exists()+ || command_exists("iina")+}++#[cfg(target_os = "macos")]+fn iina_app_exists() -> bool {+ Path::new("/Applications/IINA.app").exists()+ || dirs::home_dir().is_some_and(|home| home.join("Applications/IINA.app").exists())}fn flatpak_executable(app_id: &str) -> Option<String> {@@ -191,14 +240,21 @@ fn flatpak_executable(app_id: &str) -> Option<String> {None}-fn first_executable(paths: &[&str], fallback: &str) -> Option<String> {+fn first_executable(paths: &[String], fallback: &str) -> Option<String> {paths.iter().find(|path| Path::new(path).exists())- .map(|path| (*path).to_string())+ .cloned().or_else(|| command_exists(fallback).then(|| fallback.to_string()))}+fn configured_executable(variable: &str) -> Option<String> {+ std::env::var(variable)+ .ok()+ .filter(|value| !value.trim().is_empty())+ .filter(|value| Path::new(value).exists() || command_exists(value))+}+fn command_exists(command: &str) -> bool {let mut cmd = Command::new(command);cmd.arg("--version")@@ -209,5 +265,5 @@ fn command_exists(command: &str) -> bool {use std::os::windows::process::CommandExt;cmd.creation_flags(0x08000000);}- cmd.output().is_ok()+ cmd.output().is_ok_and(|output| output.status.success())}diff --git a/src/tui/screens/home.rs b/src/tui/screens/home.rsindex 872b180..cfd9b2d 100644--- a/src/tui/screens/home.rs+++ b/src/tui/screens/home.rs@@ -882,11 +882,11 @@ pub fn draw(frame: &mut Frame, area: Rect, state: &mut AppState, theme: &Theme)let dropdown_rows = Layout::default().direction(Direction::Vertical).constraints([- Constraint::Length(1), // Header- Constraint::Length(visible_count as u16), // List- Constraint::Length(1), // Separator- Constraint::Length(1), // Footer text- Constraint::Length(1), // Pad below footer+ Constraint::Length(1),+ Constraint::Length(visible_count as u16),+ Constraint::Length(1),+ Constraint::Length(1),+ Constraint::Length(1),]).split(dropdown_area);let items: Vec<ratatui::widgets::ListItem> = statediff --git a/src/tui/state.rs b/src/tui/state.rsindex f832a9f..bc648b8 100644--- a/src/tui/state.rs+++ b/src/tui/state.rs@@ -78,7 +78,6 @@ pub struct AppState {pub show_episode_download_confirm: bool,pub episode_download_confirm_yes_selected: bool,pub is_waiting_for_download_stream: bool,- pub is_downloading: bool,pub is_fetching_streams: bool,pub stream_error: Option<String>,pub preview_cache: lru::LruCache<String, serde_json::Value>,@@ -148,7 +147,6 @@ pub struct AppState {pub pending_play_link: Option<String>,pub pending_open_with: bool,pub basic_terminal: bool,- pub username: String,pub is_tv_mode: bool,pub tv_config_popup: bool,@@ -189,7 +187,6 @@ impl Default for AppState {show_episode_download_confirm: false,episode_download_confirm_yes_selected: false,is_waiting_for_download_stream: false,- is_downloading: false,is_fetching_streams: false,stream_error: None,preview_cache: lru::LruCache::new(std::num::NonZeroUsize::new(30).unwrap()),@@ -252,14 +249,6 @@ impl Default for AppState {subtitle_list_state: ListState::default(),pending_play_link: None,pending_open_with: false,- username: std::env::var("USER")- .or_else(|_| std::env::var("USERNAME"))- .unwrap_or_else(|_| "Friend".to_string())- .split('\\')- .next_back()- .unwrap_or("Friend")- .to_string(),-is_tv_mode: false,tv_config_popup: false,tv_channels: Vec::new(),diff --git a/src/tui/updater.rs b/src/tui/updater.rsindex e8ad2e1..eacff7c 100644--- a/src/tui/updater.rs+++ b/src/tui/updater.rs@@ -1,11 +1,8 @@const OWNER: &str = "mesamirh";const REPOSITORY: &str = "MovieBox-Tui";-pub fn check(current: &str) -> Result<Option<String>, String> {- let releases = fetch_releases()?;- let release = releases- .first()- .ok_or_else(|| "No published releases".to_string())?;+pub async fn check(current: &str) -> Result<Option<String>, String> {+ let release = fetch_release().await?;if !is_newer(current, &release.version) {return Ok(None);@@ -22,8 +19,8 @@ fn is_newer(current: &str, other: &str) -> bool {}}-fn fetch_releases() -> Result<Vec<Release>, String> {- let url = format!("https://api.github.com/repos/{OWNER}/{REPOSITORY}/releases?per_page=20");+async fn fetch_release() -> Result<Release, String> {+ let url = format!("https://api.github.com/repos/{OWNER}/{REPOSITORY}/releases/latest");let client = http_client()?;let mut request = client.get(&url);@@ -33,31 +30,23 @@ fn fetch_releases() -> Result<Vec<Release>, String> {let resp = request.send()+ .await.map_err(|e| format!("GitHub request failed: {e}"))?;let status = resp.status();if !status.is_success() {- let body = resp.text().unwrap_or_default();+ let body = resp.text().await.unwrap_or_default();return Err(format!("GitHub API {status}: {body}"));}- let items: Vec<serde_json::Value> = resp.json().map_err(|e| format!("bad JSON: {e}"))?;-- items- .into_iter()- .map(|r| {- let tag = r["tag_name"]- .as_str()- .ok_or("missing tag_name")?- .to_string();- Ok(Release {- version: tag.trim_start_matches('v').to_string(),- })- })- .collect()+ let item: serde_json::Value = resp.json().await.map_err(|e| format!("bad JSON: {e}"))?;+ let tag = item["tag_name"].as_str().ok_or("missing tag_name")?;+ Ok(Release {+ version: tag.trim_start_matches('v').to_string(),+ })}-fn http_client() -> Result<reqwest::blocking::Client, String> {- reqwest::blocking::Client::builder()+fn http_client() -> Result<reqwest::Client, String> {+ reqwest::Client::builder().user_agent("MovieBox-Tui").timeout(std::time::Duration::from_secs(30)).connect_timeout(std::time::Duration::from_secs(10))