From 3e33ea6643b30f8cc401f3cf5cf2124f2e537e28 Mon Sep 17 00:00:00 2001 From: Tamas Csikel Date: Sun, 25 Oct 2026 14:01:47 +0100 Subject: [PATCH] Initial Netflex TV app --- .gitea/workflows/release.yml | 44 + .gitignore | 4 + AGENTS.md | 42 + Cargo.lock | 7076 ++++++++++++++++++++++++++++++++++ Cargo.toml | 37 + README.md | 36 + app.toml | 24 + build.rs | 7 + icon.png | Bin 0 -> 19722 bytes package.sh | 28 + src/api.rs | 1693 ++++++++ src/app.rs | 1293 +++++++ src/config.rs | 98 + src/detail.rs | 572 +++ src/format.rs | 399 ++ src/home.rs | 823 ++++ src/main.rs | 62 + src/page.rs | 963 +++++ src/player.rs | 714 ++++ src/screens/detail.rs | 608 +++ src/screens/home.rs | 283 ++ src/screens/mod.rs | 210 + src/screens/source.rs | 559 +++ src/task.rs | 49 + tools/mock_server.py | 320 ++ ui/app.slint | 204 + ui/overlays.slint | 66 + ui/page.slint | 773 ++++ ui/player.slint | 358 ++ ui/signin.slint | 132 + ui/types.slint | 82 + 31 files changed, 17559 insertions(+) create mode 100644 .gitea/workflows/release.yml create mode 100644 .gitignore create mode 100644 AGENTS.md create mode 100644 Cargo.lock create mode 100644 Cargo.toml create mode 100644 README.md create mode 100644 app.toml create mode 100644 build.rs create mode 100644 icon.png create mode 100755 package.sh create mode 100644 src/api.rs create mode 100644 src/app.rs create mode 100644 src/config.rs create mode 100644 src/detail.rs create mode 100644 src/format.rs create mode 100644 src/home.rs create mode 100644 src/main.rs create mode 100644 src/page.rs create mode 100644 src/player.rs create mode 100644 src/screens/detail.rs create mode 100644 src/screens/home.rs create mode 100644 src/screens/mod.rs create mode 100644 src/screens/source.rs create mode 100644 src/task.rs create mode 100644 tools/mock_server.py create mode 100644 ui/app.slint create mode 100644 ui/overlays.slint create mode 100644 ui/page.slint create mode 100644 ui/player.slint create mode 100644 ui/signin.slint create mode 100644 ui/types.slint diff --git a/.gitea/workflows/release.yml b/.gitea/workflows/release.yml new file mode 100644 index 0000000..36c0ae2 --- /dev/null +++ b/.gitea/workflows/release.yml @@ -0,0 +1,44 @@ +# On a tag (v1.2.3): build inside a SmartFox checkout (sf-ui lives there), +# sign, and publish a release with the three store assets. +# +# Secrets: +# SF_SIGNING_KEY base64 of key.pem on one line (base64 -w0 key.pem) +# SMARTFOX_TOKEN read access to bluefox/fox-in-the-box (it is private) +name: release +on: + push: + tags: ["v*"] +jobs: + release: + runs-on: ubuntu-latest + container: + image: debian:trixie + env: + SMARTFOX_REPO: gitea.bluefox.support/bluefox/fox-in-the-box + steps: + - name: Checkout + run: | + apt-get update -qq + apt-get install -y -qq --no-install-recommends build-essential pkg-config curl ca-certificates git jq \ + libfontconfig1-dev libfreetype-dev libxkbcommon-dev \ + libgstreamer1.0-dev libgstreamer-plugins-base1.0-dev >/dev/null + git clone --depth 1 "https://oauth2:${{ secrets.SMARTFOX_TOKEN }}@${SMARTFOX_REPO}.git" work + git clone --depth 1 --branch "$GITHUB_REF_NAME" \ + "${GITHUB_SERVER_URL%%://*}://oauth2:${{ secrets.GITHUB_TOKEN }}@${GITHUB_SERVER_URL#*://}/${GITHUB_REPOSITORY}.git" work/apps/netflex-tv + - name: Build and sign + env: + SF_SIGNING_KEY: ${{ secrets.SF_SIGNING_KEY }} + run: | + curl -sSf https://sh.rustup.rs | sh -s -- -y -q --profile minimal + export PATH="$HOME/.cargo/bin:$PATH" + cd work/apps/netflex-tv && ./package.sh + - name: Release + env: + TOKEN: ${{ secrets.GITHUB_TOKEN }} + run: | + api="$GITHUB_SERVER_URL/api/v1/repos/$GITHUB_REPOSITORY/releases" + id=$(curl -fsS -H "Authorization: token $TOKEN" -H "Content-Type: application/json" \ + -d "{\"tag_name\":\"$GITHUB_REF_NAME\",\"name\":\"$GITHUB_REF_NAME\"}" "$api" | jq -r .id) + for f in work/apps/netflex-tv/dist/*; do + curl -fsS -H "Authorization: token $TOKEN" -F "attachment=@$f" "$api/$id/assets?name=$(basename "$f")" >/dev/null + done diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..4d7fb51 --- /dev/null +++ b/.gitignore @@ -0,0 +1,4 @@ +/target +/pkg +/dist +key.pem diff --git a/AGENTS.md b/AGENTS.md new file mode 100644 index 0000000..d786d9b --- /dev/null +++ b/AGENTS.md @@ -0,0 +1,42 @@ +# Notes for AI agents working on Netflex TV + +Read first: +- `../../docs/store-app-guide.md`: what a Fennec OS store app must be (manifest, sandbox, remote, packaging, release). +- `../../docs/sf-ui.md`: the UI kit. Liquid Glass model, components, focus, dev tools, pitfalls. + +## Layout + +``` +app.toml store manifest (id support.bluefox.netflex; permissions network, gpu, audio) +src/main.rs window, glass layer (lists every exported [GlassRect]), images, controller +src/app.rs Controller: screens (message, signin, home, detail, player), Back stack, start-up, sign-in +src/home.rs tabs (Kezdőlap, Filmek, Sorozatok, Listám, Keresés): rows, focus, lazy images, backdrop, search +src/detail.rs title page: Play/Continue/Next target, My List, seasons, episodes +src/player.rs sources -> /api/play/start -> probe -> sf_ui::video::Player; tracks, seek, OSD, progress +src/api.rs Netflex HTTP API (mirrors netflex/packages/client/src/api.ts) +src/task.rs blocking work on a thread, result on the UI thread +ui/app.slint root: screen fades, one FocusScope -> Rust `key`, glass exports +ui/{home,detail,player,signin}.slint, ui/types.slint +tools/mock_server.py stand-in server (real Cinemeta data, password "netflex", --video file streamed) +``` + +## Rules of this codebase + +- **Rust owns state and focus.** Slint only draws. Every key goes to `Controller::key`, except while an on-screen keyboard has the focus (signin, search). +- **Short borrows:** never hold `state.borrow_mut()` while calling `images.load*`; a cached picture calls back at once. Use the `Then` enum pattern: decide under the borrow, act after it. +- **Glass:** new glass elements need their `glass` listed in a root `out property <[GlassRect]>`, and that array added in `main.rs`. Nothing Slint draws may sit under a glass pane. +- **Texts are Hungarian.** Follow the Netflex web app's behaviour (resume rules, track picking: `player.rs` tests). + +## Check your change + +```sh +cargo test +python3 tools/mock_server.py --port 7881 & +HOME=/tmp/nfhome NETFLEX_SERVER=http://127.0.0.1:7881 SF_UI_SIZE=1920x1080 \ + SF_UI_KEYS="wait wait d e v down enter wait n e t f l e x down enter wait wait wait down right enter wait wait" \ + SF_UI_SNAPSHOT=/tmp/shot.png cargo run # then look at /tmp/shot.png +``` + +- **Signed in once:** later runs start on home, so drop the sign-in keys. +- **Playback** needs Linux (GStreamer): run the mock with `--video some.mkv`. +- **On Windows** use `127.0.0.1`, not `localhost` (the IPv6 fallback costs ~2 s). diff --git a/Cargo.lock b/Cargo.lock new file mode 100644 index 0000000..27fd90e --- /dev/null +++ b/Cargo.lock @@ -0,0 +1,7076 @@ +# This file is automatically @generated by Cargo. +# It is not intended for manual editing. +version = 4 + +[[package]] +name = "ab_glyph" +version = "0.2.32" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "01c0457472c38ea5bd1c3b5ada5e368271cb550be7a4ca4a0b4634e9913f6cc2" +dependencies = [ + "ab_glyph_rasterizer", + "owned_ttf_parser", +] + +[[package]] +name = "ab_glyph_rasterizer" +version = "0.1.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "366ffbaa4442f4684d91e2cd7c5ea7c4ed8add41959a31447066e279e432b618" + +[[package]] +name = "accesskit" +version = "0.24.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d3b7f7f85a7e5f68090000ed7622545829afd484d210358702ae4cb97dd0c320" +dependencies = [ + "uuid", +] + +[[package]] +name = "accesskit_atspi_common" +version = "0.19.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "023da0e5097f46df7092d5280b02efb9bbf8d93298daeced42652463e357d636" +dependencies = [ + "accesskit", + "accesskit_consumer", + "atspi-common", + "phf", + "serde", + "zvariant", +] + +[[package]] +name = "accesskit_consumer" +version = "0.38.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5d10a236f96f87d70732e44520046785431ef01d5bcd6b041317bfadd2f88245" +dependencies = [ + "accesskit", + "hashbrown 0.16.1", +] + +[[package]] +name = "accesskit_ios" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "750c4e9f6ce888dfe8a10c0f1b5ceb646a7854fd46579d74919219d1bb314083" +dependencies = [ + "accesskit", + "accesskit_consumer", + "hashbrown 0.16.1", + "objc2 0.5.3", + "objc2-foundation 0.2.2", + "objc2-ui-kit 0.2.2", +] + +[[package]] +name = "accesskit_macos" +version = "0.26.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ce02dc63b43f0c9296af9ac946312a2dc8814427d7a64d2d600971dac55b6076" +dependencies = [ + "accesskit", + "accesskit_consumer", + "hashbrown 0.16.1", + "objc2 0.5.3", + "objc2-app-kit 0.2.2", + "objc2-foundation 0.2.2", +] + +[[package]] +name = "accesskit_unix" +version = "0.22.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "03e156ed3802e35eefe894ef2671bc6c889303d8a7e110b5e1b48f504b91362f" +dependencies = [ + "accesskit", + "accesskit_atspi_common", + "async-channel", + "async-executor", + "async-task", + "atspi", + "futures-lite", + "futures-util", + "serde", + "zbus", +] + +[[package]] +name = "accesskit_windows" +version = "0.34.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "106c2b961215864d1c2e703ee63269c25c4e80a577ffb2c1017b9c17dcdf83a1" +dependencies = [ + "accesskit", + "accesskit_consumer", + "hashbrown 0.16.1", + "static_assertions", + "windows", + "windows-core", +] + +[[package]] +name = "accesskit_winit" +version = "0.33.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d5b41e63a69f36d9f1f41e70464c7e5f72eee485ef26aab19f0b4f86e6c0a84c" +dependencies = [ + "accesskit", + "accesskit_ios", + "accesskit_macos", + "accesskit_unix", + "accesskit_windows", + "raw-window-handle", + "winit", +] + +[[package]] +name = "adler2" +version = "2.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "320119579fcad9c21884f5c4861d16174d0e06250625266f50fe6898340abefa" + +[[package]] +name = "ahash" +version = "0.8.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5a15f179cd60c4584b8a8c596927aadc462e27f2ca70c04e0071964a73ba7a75" +dependencies = [ + "cfg-if", + "getrandom 0.3.4", + "once_cell", + "version_check", + "zerocopy", +] + +[[package]] +name = "aho-corasick" +version = "1.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c982642fa9e8606056828ee9a8505737230110bb1099153c79efe865c59d12ba" +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" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "683d7910e743518b0e34f1186f92494becacb047c7b6bf616c96772180fef923" + +[[package]] +name = "android-activity" +version = "0.6.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0f2a1bb052857d5dd49572219344a7332b31b76405648eabac5bc68978251bcd" +dependencies = [ + "android-properties", + "bitflags 2.13.2", + "cc", + "jni", + "libc", + "log", + "ndk", + "ndk-context", + "ndk-sys", + "num_enum", + "thiserror 2.0.21", +] + +[[package]] +name = "android-properties" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fc7eb209b1518d6bb87b283c20095f5228ecda460da70b44f0802523dea6da04" + +[[package]] +name = "android_system_properties" +version = "0.1.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ae221649c9976a6f6c56ae1facf410f3ddb33cc661c4b7b61020a912d4237fbc" +dependencies = [ + "libc", +] + +[[package]] +name = "annotate-snippets" +version = "0.12.17" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b2a5b0a5ab8561c603f16c3b78c24a386b1f70e7fc1b1b1e8c15738828e4a176" +dependencies = [ + "anstyle", + "memchr", + "unicode-width", +] + +[[package]] +name = "anstream" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "824a212faf96e9acacdbd09febd34438f8f711fb84e09a8916013cd7815ca28d" +dependencies = [ + "anstyle", + "anstyle-parse", + "anstyle-query", + "anstyle-wincon", + "colorchoice", + "is_terminal_polyfill", + "utf8parse", +] + +[[package]] +name = "anstyle" +version = "1.0.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "940b3a0ca603d1eade50a4846a2afffd5ef57a9feac2c0e2ec2e14f9ead76000" + +[[package]] +name = "anstyle-parse" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "52ce7f38b242319f7cabaa6813055467063ecdc9d355bbb4ce0c68908cd8130e" +dependencies = [ + "utf8parse", +] + +[[package]] +name = "anstyle-query" +version = "1.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "40c48f72fd53cd289104fc64099abca73db4166ad86ea0b4341abe65af83dadc" +dependencies = [ + "windows-sys 0.61.2", +] + +[[package]] +name = "anstyle-wincon" +version = "3.0.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "291e6a250ff86cd4a820112fb8898808a366d8f9f58ce16d1f538353ad55747d" +dependencies = [ + "anstyle", + "once_cell_polyfill", + "windows-sys 0.61.2", +] + +[[package]] +name = "anyhow" +version = "1.0.104" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "330a5ed07fa54e4702c9d6c4174f74427fc0ef6e214bbd677ae50a5099946470" + +[[package]] +name = "arbitrary" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3bc62ac97cc33321f50863d514c3bc38a453947a8f9e781137e47c7401020aed" + +[[package]] +name = "arboard" +version = "3.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "aeb9553e62312c8756a5979254fc6d7da8bbeb5986a1e17037fab932f7037917" +dependencies = [ + "clipboard-win", + "log", + "objc2 0.6.5", + "objc2-app-kit 0.3.2", + "objc2-foundation 0.3.2", + "parking_lot", + "percent-encoding", + "windows-sys 0.61.2", + "wl-clipboard-rs", + "x11rb", +] + +[[package]] +name = "arc-swap" +version = "1.9.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "380962b3d93b99642e50b9febf72c071e97e8b32d86eae9cf4ef582bb960ae6e" +dependencies = [ + "rustversion", +] + +[[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 = "arrayref" +version = "0.3.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "76a2e8124351fda1ef8aaaa3bbd7ebbcb486bbcd4225aca0aa0d84bb2db8fecb" + +[[package]] +name = "arrayvec" +version = "0.7.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d3fb67a6e08acf24fdeccbac2cb6ac4305825bd1f117462e0e6f2f193345ad56" + +[[package]] +name = "as-raw-xcb-connection" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "175571dd1d178ced59193a6fc02dde1b972eb0bc56c892cde9beeceac5bf0f6b" + +[[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 = "ash" +version = "0.38.0+1.3.281" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0bb44936d800fea8f016d7f2311c6a4f97aebd5dc86f09906139ec848cf3a46f" +dependencies = [ + "libloading", +] + +[[package]] +name = "async-broadcast" +version = "0.7.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "435a87a52755b8f27fcf321ac4f04b2802e337c8c4872923137471ec39c37532" +dependencies = [ + "event-listener", + "event-listener-strategy", + "futures-core", + "pin-project-lite", +] + +[[package]] +name = "async-channel" +version = "2.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "924ed96dd52d1b75e9c1a3e6275715fd320f5f9439fb5a4a11fa51f4221158d2" +dependencies = [ + "concurrent-queue", + "event-listener-strategy", + "futures-core", + "pin-project-lite", +] + +[[package]] +name = "async-executor" +version = "1.14.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c96bf972d85afc50bf5ab8fe2d54d1586b4e0b46c97c50a0c9e71e2f7bcd812a" +dependencies = [ + "async-task", + "concurrent-queue", + "fastrand", + "futures-lite", + "pin-project-lite", + "slab", +] + +[[package]] +name = "async-io" +version = "2.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "456b8a8feb6f42d237746d4b3e9a178494627745c3c56c6ea55d92ba50d026fc" +dependencies = [ + "autocfg", + "cfg-if", + "concurrent-queue", + "futures-io", + "futures-lite", + "parking", + "polling", + "rustix 1.1.5", + "slab", + "windows-sys 0.61.2", +] + +[[package]] +name = "async-lock" +version = "3.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "290f7f2596bd5b78a9fec8088ccd89180d7f9f55b94b0576823bbbdc72ee8311" +dependencies = [ + "event-listener", + "event-listener-strategy", + "pin-project-lite", +] + +[[package]] +name = "async-process" +version = "2.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fc50921ec0055cdd8a16de48773bfeec5c972598674347252c0399676be7da75" +dependencies = [ + "async-channel", + "async-io", + "async-lock", + "async-signal", + "async-task", + "blocking", + "cfg-if", + "event-listener", + "futures-lite", + "rustix 1.1.5", +] + +[[package]] +name = "async-recursion" +version = "1.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4f8abc12baad266b1c8cec146854c195b5864b4221d4b2ca7296a7ae82d9e451" +dependencies = [ + "proc-macro2", + "quote", + "syn 3.0.9", +] + +[[package]] +name = "async-signal" +version = "0.2.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "52b5aaafa020cf5053a01f2a60e8ff5dccf550f0f77ec54a4e47285ac2bab485" +dependencies = [ + "async-io", + "async-lock", + "atomic-waker", + "cfg-if", + "futures-core", + "futures-io", + "rustix 1.1.5", + "signal-hook-registry", + "slab", + "windows-sys 0.61.2", +] + +[[package]] +name = "async-task" +version = "4.7.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8b75356056920673b02621b35afd0f7dda9306d03c79a30f5c56c44cf256e3de" + +[[package]] +name = "async-trait" +version = "0.1.92" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "82f6aeea286b8eb4dd3431a1be1b59d290ace00f5bfd8e2a159bc2a05e2c1667" +dependencies = [ + "proc-macro2", + "quote", + "syn 3.0.9", +] + +[[package]] +name = "atomic-waker" +version = "1.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1505bd5d3d116872e7271a6d4e16d81d0c8570876c8de68093a09ac269d8aac0" + +[[package]] +name = "atomic_refcell" +version = "0.1.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "21e4227379beff4205943696e6c3e0cd809bacdf3f0edd6e3dd153e2269571a4" + +[[package]] +name = "atspi" +version = "0.29.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c77886257be21c9cd89a4ae7e64860c6f0eefca799bb79127913052bd0eefb3d" +dependencies = [ + "atspi-common", + "atspi-proxies", +] + +[[package]] +name = "atspi-common" +version = "0.13.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "20c5617155740c98003016429ad13fe43ce7a77b007479350a9f8bf95a29f63d" +dependencies = [ + "enumflags2", + "serde", + "static_assertions", + "zbus", + "zbus-lockstep", + "zbus-lockstep-macros", + "zbus_names", + "zvariant", +] + +[[package]] +name = "atspi-proxies" +version = "0.13.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2230e48787ed3eb4088996eab66a32ca20c0b67bbd4fd6cdfe79f04f1f04c9fc" +dependencies = [ + "atspi-common", + "serde", + "zbus", +] + +[[package]] +name = "autocfg" +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 0.1.1", + "rayon", + "thiserror 2.0.21", + "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 = "base64" +version = "0.23.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ac07cdecf99051d9a5238b80f35af32cdeba5b336e55d957b318b50137e18da5" + +[[package]] +name = "bincode" +version = "2.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "36eaf5d7b090263e8150820482d5d93cd964a81e4019913c972f4edcc6edb740" +dependencies = [ + "serde", + "unty", +] + +[[package]] +name = "bindgen" +version = "0.72.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "993776b509cfb49c750f11b8f07a46fa23e0a1386ffc01fb1e7d343efc387895" +dependencies = [ + "bitflags 2.13.2", + "cexpr", + "clang-sys", + "itertools 0.13.0", + "log", + "prettyplease", + "proc-macro2", + "quote", + "regex", + "rustc-hash 2.1.3", + "shlex 1.3.0", + "syn 2.0.119", +] + +[[package]] +name = "bit-set" +version = "0.10.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "09ec2f926cc3060f09db9ebc5b52823d85268d24bb917e472c0c4bea35780a7d" +dependencies = [ + "bit-vec", +] + +[[package]] +name = "bit-vec" +version = "0.9.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b71798fca2c1fe1086445a7258a4bc81e6e49dcd24c8d0dd9a1e57395b603f51" + +[[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" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" + +[[package]] +name = "bitflags" +version = "2.13.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3ded4057c258ba199e2d26386d3af3780957ecaee6c4ef4041c6b4b8b97c0b06" +dependencies = [ + "serde_core", +] + +[[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 = "block2" +version = "0.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2c132eebf10f5cad5289222520a4a058514204aed6d791f1cf4fe8088b82d15f" +dependencies = [ + "objc2 0.5.3", +] + +[[package]] +name = "block2" +version = "0.6.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cdeb9d870516001442e364c5220d3574d2da8dc765554b4a617230d33fa58ef5" +dependencies = [ + "objc2 0.6.5", +] + +[[package]] +name = "blocking" +version = "1.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a70e4329df6cb94385eed412ec92375c3cdd8a6e502493d1229b6414e4036dfa" +dependencies = [ + "async-channel", + "async-task", + "futures-io", + "futures-lite", + "piper", +] + +[[package]] +name = "borsh" +version = "1.8.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "553c5d846a6ba5150c65e3b1b8ec073bcf1abc20f9b7220de384a4443ea4e20a" +dependencies = [ + "bytes", + "cfg_aliases", +] + +[[package]] +name = "built" +version = "0.8.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5c0e531d93d39c34eef561e929e8a7f86d77a5af08aac4f6d6e39976c51858e9" + +[[package]] +name = "bumpalo" +version = "3.20.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "72f5acc6cb2ba439de613abc23857ec3d78374d8ed5ac84e9d11336e87da8649" + +[[package]] +name = "by_address" +version = "1.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "64fa3c856b712db6612c019f14756e64e4bcea13337a6b33b696333a9eaa2d06" + +[[package]] +name = "bytemuck" +version = "1.25.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "95832e849adfb21180ccb6826a99da14e5d266ae5c2e668e1602cf234f153797" +dependencies = [ + "bytemuck_derive", +] + +[[package]] +name = "bytemuck_derive" +version = "1.12.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6a1f896587b6f2c069c73d2f0913e2d590c3990285cd2f0b6aa02b786b4c679c" +dependencies = [ + "proc-macro2", + "quote", + "syn 3.0.9", +] + +[[package]] +name = "byteorder-lite" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8f1fe948ff07f4bd06c30984e69f5b4899c516a3ef74f34df92a2df2ab535495" + +[[package]] +name = "bytes" +version = "1.12.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fc652a48c352aef3ea3aed32080501cf3ef6ed5da78602a020c991775b0aff04" + +[[package]] +name = "calloop" +version = "0.13.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b99da2f8558ca23c71f4fd15dc57c906239752dd27ff3c00a1d56b685b7cbfec" +dependencies = [ + "bitflags 2.13.2", + "log", + "polling", + "rustix 0.38.44", + "slab", + "thiserror 1.0.69", +] + +[[package]] +name = "calloop" +version = "0.14.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "43b32313e937c8721c9d17ee9bf60699a6402b4b7c2cb6ac1bee0ffcaa4b4e5e" +dependencies = [ + "bitflags 2.13.2", + "polling", + "rustix 1.1.5", + "tracing", +] + +[[package]] +name = "calloop-wayland-source" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "95a66a987056935f7efce4ab5668920b5d0dac4a7c99991a67395f13702ddd20" +dependencies = [ + "calloop 0.13.0", + "rustix 0.38.44", + "wayland-backend", + "wayland-client", +] + +[[package]] +name = "cc" +version = "1.10.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "86e055fa6e3e40ad6187ba25b6855eeb635d5271f8e0f0e1e9a5826b8d75bea0" +dependencies = [ + "find-msvc-tools", + "jobserver", + "libc", + "shlex 2.0.1", +] + +[[package]] +name = "cexpr" +version = "0.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6fac387a98bb7c37292057cffc56d62ecb629900026402633ae9160df93a8766" +dependencies = [ + "nom 7.1.3", +] + +[[package]] +name = "cfg-expr" +version = "0.20.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9ba9e9ec16c447027685b1f897b720e18e9a8afd00bd7332c483537e38086c9f" +dependencies = [ + "smallvec", + "target-lexicon", +] + +[[package]] +name = "cfg-if" +version = "1.0.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4e7648175b45a9a48536d676f68d918270699102aa8dab5496df06904c914600" + +[[package]] +name = "cfg_aliases" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f079e83a288787bcd14a6aea84cee5c87a67c5a3e660c30f557a3d24761b3527" + +[[package]] +name = "cgl" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0ced0551234e87afee12411d535648dd89d2e7f34c78b753395567aff3d447ff" +dependencies = [ + "libc", +] + +[[package]] +name = "chrono" +version = "0.4.45" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1aa79e62e7697b8e29b513a68abacf485adcd1fe8284a4316c5ae868e6633327" +dependencies = [ + "iana-time-zone", + "js-sys", + "num-traits", + "wasm-bindgen", + "windows-link", +] + +[[package]] +name = "clang-sys" +version = "1.9.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "157a8ba7b480713b56f4c09fd13fc3e0a22a5dfab8097ba61cbc5feef950788a" +dependencies = [ + "glob", + "libc", + "libloading", +] + +[[package]] +name = "clipboard-win" +version = "5.4.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "052af7878466feccda12ba7a6a67d019d712f296809559b47c12c8cc196d3a9a" +dependencies = [ + "error-code", +] + +[[package]] +name = "clru" +version = "0.6.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "197fd99cb113a8d5d9b6376f3aa817f32c1078f2343b714fff7d2ca44fdf67d5" +dependencies = [ + "hashbrown 0.16.1", +] + +[[package]] +name = "codespan-reporting" +version = "0.13.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "af491d569909a7e4dee0ad7db7f5341fef5c614d5b8ec8cf765732aba3cff681" +dependencies = [ + "unicode-width", +] + +[[package]] +name = "color_quant" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3d7b894f5411737b7867f4827955924d7c254fc9f4d91a6aad6b097804b1018b" + +[[package]] +name = "colorchoice" +version = "1.0.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1d07550c9036bf2ae0c684c4297d503f838287c83c53686d05370d0e139ae570" + +[[package]] +name = "combine" +version = "4.6.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4356eba6976435498d05a311ee9fc486da3bc81c200d3f0d7dd9703b41913f92" +dependencies = [ + "bytes", + "memchr", +] + +[[package]] +name = "concurrent-queue" +version = "2.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4ca0197aee26d1ae37445ee532fefce43251d24cc7c166799f4d46817f1d3973" +dependencies = [ + "crossbeam-utils", +] + +[[package]] +name = "const-field-offset" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d535c69e75b4e3c69e17205b5b37a91936c54086cecd339b70071500786acb9c" +dependencies = [ + "const-field-offset-macro", + "field-offset", +] + +[[package]] +name = "const-field-offset-macro" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "93d5848843a221ac268cfdd6bfd14e68d5d3dfa79d52c880aafab93f9517fb74" +dependencies = [ + "proc-macro2", + "quote", + "syn 3.0.9", +] + +[[package]] +name = "convert_case" +version = "0.10.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "633458d4ef8c78b72454de2d54fd6ab2e60f9e02be22f3c6104cdc8a4e0fceb9" +dependencies = [ + "unicode-segmentation", +] + +[[package]] +name = "cookie" +version = "0.18.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1a373e3602691c3cdea496d2f0ee5935151e6168fe87739483c463db1b2f2f87" +dependencies = [ + "percent-encoding", + "time", + "version_check", +] + +[[package]] +name = "cookie_store" +version = "0.22.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "15b2c103cf610ec6cae3da84a766285b42fd16aad564758459e6ecf128c75206" +dependencies = [ + "cookie", + "document-features", + "idna", + "indexmap", + "log", + "serde", + "serde_derive", + "serde_json", + "time", + "url", +] + +[[package]] +name = "core-foundation" +version = "0.9.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "91e195e091a93c46f7102ec7818a2aa394e1e1771c3ab4825963fa03e45afb8f" +dependencies = [ + "core-foundation-sys", + "libc", +] + +[[package]] +name = "core-foundation-sys" +version = "0.8.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "773648b94d0e5d620f64f280777445740e61fe701025087ec8b57f45c791888b" + +[[package]] +name = "core-graphics" +version = "0.23.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c07782be35f9e1140080c6b96f0d44b739e2278479f64e02fdab4e32dfd8b081" +dependencies = [ + "bitflags 1.3.2", + "core-foundation", + "core-graphics-types", + "foreign-types", + "libc", +] + +[[package]] +name = "core-graphics-types" +version = "0.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "45390e6114f68f718cc7a830514a96f903cccd70d02a8f6d9f643ac4ba45afaf" +dependencies = [ + "bitflags 1.3.2", + "core-foundation", + "libc", +] + +[[package]] +name = "countme" +version = "3.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7704b5fdd17b18ae31c4c1da5a2e0305a2bf17b5249300a9ee9ed7b72114c636" + +[[package]] +name = "crc32fast" +version = "1.5.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0ba106e844045ddc02c20768ac4b0b7cb45f2cc2ecbd833ac9f5dacb183c2055" +dependencies = [ + "cfg-if", +] + +[[package]] +name = "critical-section" +version = "1.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "790eea4361631c5e7d22598ecd5723ff611904e3344ce8720784c93e3d83d40b" + +[[package]] +name = "crossbeam-channel" +version = "0.5.17" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "98b0cc327b5bc766e7fda9c9260cc0fa81b43a8e240440422dff70788e3f9ef1" +dependencies = [ + "crossbeam-utils", +] + +[[package]] +name = "crossbeam-deque" +version = "0.8.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "622f3fc73690be383c7214310406f28a90e6edeadc3cea882f9d71e495b9711a" +dependencies = [ + "crossbeam-epoch", + "crossbeam-utils", +] + +[[package]] +name = "crossbeam-epoch" +version = "0.9.21" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dc74980687109a3b14c72fd458107bf0baa1da1a1a805e178d15501ba9b86d9d" +dependencies = [ + "crossbeam-utils", +] + +[[package]] +name = "crossbeam-queue" +version = "0.3.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "03e8bd762f7479489c70ed6c768ddca99d7296857de437a68dcb2a94365b3fae" +dependencies = [ + "crossbeam-utils", +] + +[[package]] +name = "crossbeam-utils" +version = "0.8.23" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a31eee39dddec8330830986fcd7625edb5a24ec90ea038215273bbc3adb08ac6" + +[[package]] +name = "crunchy" +version = "0.2.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "460fbee9c2c2f33933d720630a6a0bac33ba7053db5344fac858d4b8952d77d5" + +[[package]] +name = "ctor" +version = "0.10.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "83cf0d42651b16c6dfe68685716d18480d18a9c39c62d76e8cf3eb6ed5d8bcbf" +dependencies = [ + "dtor", +] + +[[package]] +name = "cursor-icon" +version = "1.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f27ae1dd37df86211c42e150270f82743308803d90a6f6e6651cd730d5e1732f" + +[[package]] +name = "data-url" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "be1e0bca6c3637f992fc1cc7cbc52a78c1ef6db076dbf1059c4323d6a2048376" + +[[package]] +name = "defmt" +version = "1.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e4a0795ac740cb54d7b3775c9c17345f6aaecf884c01733b39d6017738e0e3e1" +dependencies = [ + "bitflags 1.3.2", + "defmt-macros", +] + +[[package]] +name = "defmt-macros" +version = "1.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "840bb056bd99c495c9188198a258ab787c79f306d864db3e6e8451442d6d8366" +dependencies = [ + "defmt-parser", + "proc-macro2", + "quote", + "syn 3.0.9", +] + +[[package]] +name = "defmt-parser" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "71958f69fb2de856c5dd51ac9377e986ca1aa5919f931bf5395a807277f889a0" +dependencies = [ + "thiserror 2.0.21", +] + +[[package]] +name = "deranged" +version = "0.5.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9e9de72ce2ad1f90dc62fa25f0f430ef85eb4b0d8fa0be4f30373bc40a21d28e" + +[[package]] +name = "derive_more" +version = "2.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d751e9e49156b02b44f9c1815bcb94b984cdcc4396ecc32521c739452808b134" +dependencies = [ + "derive_more-impl", +] + +[[package]] +name = "derive_more-impl" +version = "2.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "799a97264921d8623a957f6c3b9011f3b5492f557bbb7a5a19b7fa6d06ba8dcb" +dependencies = [ + "convert_case", + "proc-macro2", + "quote", + "rustc_version", + "syn 2.0.119", + "unicode-xid", +] + +[[package]] +name = "dispatch" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bd0c93bb4b0c6d9b77f4435b0ae98c24d17f1c45b2ff844c6151a07256ca923b" + +[[package]] +name = "dispatch2" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1e0e367e4e7da84520dedcac1901e4da967309406d1e51017ae1abfb97adbd38" +dependencies = [ + "bitflags 2.13.2", + "objc2 0.6.5", +] + +[[package]] +name = "displaydoc" +version = "0.2.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c6232dd377dcc64799954cbd3a9bb882e9cdc1308ccd87b1c098f1fb2eaf82a8" +dependencies = [ + "proc-macro2", + "quote", + "syn 3.0.9", +] + +[[package]] +name = "dlib" +version = "0.5.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ab8ecd87370524b461f8557c119c405552c396ed91fc0a8eec68679eab26f94a" +dependencies = [ + "libloading", +] + +[[package]] +name = "document-features" +version = "0.2.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d4b8a88685455ed29a21542a33abd9cb6510b6b129abadabdcef0f4c55bc8f61" +dependencies = [ + "litrs", +] + +[[package]] +name = "downcast-rs" +version = "1.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "75b325c5dbd37f80359721ad39aca5a29fb04c89279657cffdda8736d0c0b9d2" + +[[package]] +name = "dpi" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d8b14ccef22fc6f5a8f4d7d768562a182c04ce9a3b3157b91390b52ddfdf1a76" + +[[package]] +name = "drm" +version = "0.14.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "80bc8c5c6c2941f70a55c15f8d9f00f9710ebda3ffda98075f996a0e6c92756f" +dependencies = [ + "bitflags 2.13.2", + "bytemuck", + "drm-ffi", + "drm-fourcc", + "libc", + "rustix 0.38.44", +] + +[[package]] +name = "drm-ffi" +version = "0.9.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "51a91c9b32ac4e8105dec255e849e0d66e27d7c34d184364fb93e469db08f690" +dependencies = [ + "drm-sys", + "rustix 1.1.5", +] + +[[package]] +name = "drm-fourcc" +version = "2.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0aafbcdb8afc29c1a7ee5fbe53b5d62f4565b35a042a662ca9fecd0b54dae6f4" + +[[package]] +name = "drm-sys" +version = "0.8.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ecc8e1361066d91f5ffccff060a3c3be9c3ecde15be2959c1937595f7a82a9f8" +dependencies = [ + "libc", + "linux-raw-sys 0.9.4", +] + +[[package]] +name = "dtor" +version = "0.8.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "edf234dd1594d6dd434a8fb8cada51ddbbc593e40e4a01556a0b31c62da2775b" + +[[package]] +name = "either" +version = "1.19.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0e9c71c2167ca323c882b99918929403426e2373ea17242ff5653e0d5e1058be" + +[[package]] +name = "endi" +version = "1.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "66b7e2430c6dff6a955451e2cfc438f09cea1965a9d6f87f7e3b90decc014099" + +[[package]] +name = "enumflags2" +version = "0.7.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1027f7680c853e056ebcec683615fb6fbbc07dbaa13b4d5d9442b146ded4ecef" +dependencies = [ + "enumflags2_derive", + "serde", +] + +[[package]] +name = "enumflags2_derive" +version = "0.7.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "67c78a4d8fdf9953a5c9d458f9efe940fd97a0cab0941c075a813ac594733827" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.119", +] + +[[package]] +name = "env_filter" +version = "2.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "900d271a03799a1ee8d1ca9b19893b48ca674a9284fefcfb85f05e74ed314217" +dependencies = [ + "log", + "regex", +] + +[[package]] +name = "env_logger" +version = "0.11.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "de671bd27a75a797dc9ae289ba1e77276e75e2026408aab65185384e2d5cd3f6" +dependencies = [ + "anstream", + "anstyle", + "env_filter", + "jiff", + "log", +] + +[[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.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "00d174d5400e5e8fd687ad1049e2f578285fa914201b1af7e8b112a4546bd826" + +[[package]] +name = "errno" +version = "0.3.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "39cab71617ae0d63f51a36d69f866391735b51691dbda63cf6f96d042b63efeb" +dependencies = [ + "libc", + "windows-sys 0.61.2", +] + +[[package]] +name = "error-code" +version = "3.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0b5343afd4a8365a643ac588dab4cf234a190c7f6c88c9f6dd6ffe00837661b7" + +[[package]] +name = "euclid" +version = "0.22.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f1a05365e3b1c6d1650318537c7460c6923f1abdd272ad6842baa2b509957a06" +dependencies = [ + "num-traits", +] + +[[package]] +name = "event-listener" +version = "5.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5a23add41df1562121a9393cb065eab5146a1242410f23a644851e90cfd669d2" +dependencies = [ + "parking", + "pin-project-lite", +] + +[[package]] +name = "event-listener-strategy" +version = "0.5.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8be9f3dfaaffdae2972880079a491a1a8bb7cbed0b8dd7a347f668b4150a3b93" +dependencies = [ + "event-listener", + "pin-project-lite", +] + +[[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 0.8.9", + "num-complex", + "pulp", + "smallvec", + "zune-inflate", +] + +[[package]] +name = "fastrand" +version = "2.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "da7c62ceae207dd37ea5b845da6a0696c799f85e97da1ab5b7910be3c1c80223" + +[[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" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1e6853b52649d4ac5c0bd02320cddc5ba956bdb407c4b75a2c6b75bf51500f8c" +dependencies = [ + "simd-adler32", +] + +[[package]] +name = "femtovg" +version = "0.27.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "31eebf3ab1b76359ccd5f850c07a7c6b2722c64d9127c40e02358e83f3ff9b1a" +dependencies = [ + "bitflags 2.13.2", + "bytemuck", + "fnv", + "glow 0.18.0", + "imgref", + "itertools 0.15.0", + "log", + "rgb", + "slotmap", + "swash", + "wasm-bindgen", + "web-sys", +] + +[[package]] +name = "field-offset" +version = "0.3.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "38e2275cc4e4fc009b0669731a1e5ab7ebf11f469eaede2bab9309a5b4d6057f" +dependencies = [ + "memoffset", + "rustc_version", +] + +[[package]] +name = "filetime" +version = "0.2.29" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5c287a33c7f0a620c38e641e7f60827713987b3c0f26e8ddc9462cc69cf75759" +dependencies = [ + "cfg-if", + "libc", +] + +[[package]] +name = "find-msvc-tools" +version = "0.1.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1c66915cc5391097de7a2b0b972e8505aa33c0df401fd3a6811dbdb32881ba48" + +[[package]] +name = "fixed_decimal" +version = "0.7.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2214fb00f669ee96bee5bb29dfb1ddabe058b2bc426817efc79afa03c9bc55ae" +dependencies = [ + "displaydoc", + "smallvec", + "writeable", +] + +[[package]] +name = "fixedbitset" +version = "0.5.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1d674e81391d1e1ab681a28d99df07927c6d4aa5b027d7da16ba32d1d21ecd99" + +[[package]] +name = "flate2" +version = "1.1.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6e634e2e0ebac1ee034020da1ca582e17ffe4e0f5e985823721e168928136dcb" +dependencies = [ + "crc32fast", + "miniz_oxide 0.9.1", + "zlib-rs", +] + +[[package]] +name = "float-cmp" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "98de4bbd547a563b716d8dfa9aad1cb19bfab00f4fa09a6a4ed21dbcf44ce9c4" + +[[package]] +name = "fnv" +version = "1.0.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1" + +[[package]] +name = "foldhash" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d9c4f5dac5e15c24eb999c26181a6ca40b39fe946cbe4c263c7209467bc83af2" + +[[package]] +name = "foldhash" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "77ce24cb58228fbb8aa041425bb1050850ac19177686ea6e0f41a70416f56fdb" + +[[package]] +name = "font-types" +version = "0.12.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "835ae9d781464a79026cde387f9cbc650c9a4909d7cf7e658b127e3c35d2f35d" +dependencies = [ + "bytemuck", +] + +[[package]] +name = "fontdb" +version = "0.24.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2660c5e9157bf76d2db1294e4a9feba604ef610819a3b591088d0d8392a3290f" +dependencies = [ + "log", + "slotmap", + "tinyvec", +] + +[[package]] +name = "fontique" +version = "0.11.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6688bc1294fe7117d788937b6c53480169b29c566954af490830d4c09da9516a" +dependencies = [ + "hashbrown 0.17.1", + "linebender_resource_handle", + "memmap2", + "objc2 0.6.5", + "objc2-core-foundation", + "objc2-core-text", + "objc2-foundation 0.3.2", + "parlance", + "read-fonts", + "roxmltree", + "smallvec", + "windows", + "windows-core", + "yeslogic-fontconfig-sys", +] + +[[package]] +name = "foreign-types" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d737d9aa519fb7b749cbc3b962edcf310a8dd1f4b67c91c4f83975dbdd17d965" +dependencies = [ + "foreign-types-macros", + "foreign-types-shared", +] + +[[package]] +name = "foreign-types-macros" +version = "0.2.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ea5190182e6915eb873ddbc16e23b711b6eb1f9c00a0d0a3a91b5f6228475225" +dependencies = [ + "proc-macro2", + "quote", + "syn 3.0.9", +] + +[[package]] +name = "foreign-types-shared" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "aa9a19cbb55df58761df49b23516a86d432839add4af60fc256da840f66ed35b" + +[[package]] +name = "form_urlencoded" +version = "1.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cb4cb245038516f5f85277875cdaa4f7d2c9a0fa0468de06ed190163b1581fcf" +dependencies = [ + "percent-encoding", +] + +[[package]] +name = "futures" +version = "0.3.34" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9a31d2a3fbaaeb2af2368bbdd904aa8e812d3c04a1ee10d3171f52d556e5d0a3" +dependencies = [ + "futures-channel", + "futures-core", + "futures-executor", + "futures-io", + "futures-sink", + "futures-task", + "futures-util", +] + +[[package]] +name = "futures-channel" +version = "0.3.34" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b1f9e3d69d39e4862ffed03ed071a76f9a13ba1d9109d355b0f0aa6b15e393c4" +dependencies = [ + "futures-core", + "futures-sink", +] + +[[package]] +name = "futures-core" +version = "0.3.34" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "92d699e522242e69e3003b94ecc1f960f3a5e015aa7c5d7486e65ad01dd94f5e" + +[[package]] +name = "futures-executor" +version = "0.3.34" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "031b47cf1a3c6cc8bc2fc76cd437f521619387907d469316e7c0bc278f1f5432" +dependencies = [ + "futures-core", + "futures-task", + "futures-util", +] + +[[package]] +name = "futures-io" +version = "0.3.34" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "53c0fa8157de1303bfffdaa1cc2a673bfffb60102f76b0ef4441659124373fed" + +[[package]] +name = "futures-lite" +version = "2.6.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f78e10609fe0e0b3f4157ffab1876319b5b0db102a2c60dc4626306dc46b44ad" +dependencies = [ + "fastrand", + "futures-core", + "futures-io", + "parking", + "pin-project-lite", +] + +[[package]] +name = "futures-macro" +version = "0.3.34" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9fb9654ba8355388abeb8dcb4fc62f511300867002afc858860463bdd9fe0c44" +dependencies = [ + "proc-macro2", + "quote", + "syn 3.0.9", +] + +[[package]] +name = "futures-sink" +version = "0.3.34" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1944426bf7d03f1d14f708785e4b33efd750b36d48a157b836b3efc15ede8e1d" + +[[package]] +name = "futures-task" +version = "0.3.34" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cd417de3d1d015fc3bfd2b1ea46dfc7bab72ef86f1cc7cc9c78e728b34a6d1fd" + +[[package]] +name = "futures-util" +version = "0.3.34" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0d50a92467f8ba5dd6e3ee5d4bd04d73ab2e4e1c44474a0674821dfce14b79bc" +dependencies = [ + "futures-channel", + "futures-core", + "futures-io", + "futures-macro", + "futures-sink", + "futures-task", + "memchr", + "pin-project-lite", + "slab", +] + +[[package]] +name = "gbm" +version = "0.18.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ce852e998d3ca5e4a97014fb31c940dc5ef344ec7d364984525fd11e8a547e6a" +dependencies = [ + "bitflags 2.13.2", + "drm", + "drm-fourcc", + "gbm-sys", + "libc", +] + +[[package]] +name = "gbm-sys" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c13a5f2acc785d8fb6bf6b7ab6bfb0ef5dad4f4d97e8e70bb8e470722312f76f" +dependencies = [ + "libc", +] + +[[package]] +name = "gethostname" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1bd49230192a3797a9a4d6abe9b3eed6f7fa4c8a8a4947977c6f80025f92cbd8" +dependencies = [ + "rustix 1.1.5", + "windows-link", +] + +[[package]] +name = "getrandom" +version = "0.2.17" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ff2abc00be7fca6ebc474524697ae276ad847ad0a6b3faa4bcb027e9a4614ad0" +dependencies = [ + "cfg-if", + "libc", + "wasi", +] + +[[package]] +name = "getrandom" +version = "0.3.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "899def5c37c4fd7b2664648c28120ecec138e4d395b459e5ca34f9cce2dd77fd" +dependencies = [ + "cfg-if", + "libc", + "r-efi 5.3.0", + "wasip2", +] + +[[package]] +name = "getrandom" +version = "0.4.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "300e883d756b2e4ec94e02791f39b04b522276138852cfc41d9fb7e904106099" +dependencies = [ + "cfg-if", + "libc", + "r-efi 6.0.0", +] + +[[package]] +name = "gif" +version = "0.14.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ee8cfcc411d9adbbaba82fb72661cc1bcca13e8bba98b364e62b2dba8f960159" +dependencies = [ + "color_quant", + "weezl", +] + +[[package]] +name = "gio-sys" +version = "0.22.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6c28739f914c15b87a9856000bed9cbd5b3a8afbca5e982d9a299e1601422cb5" +dependencies = [ + "glib-sys", + "gobject-sys", + "libc", + "system-deps", + "windows-sys 0.61.2", +] + +[[package]] +name = "gl_generator" +version = "0.14.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1a95dfc23a2b4a9a2f5ab41d194f8bfda3cabec42af4e39f08c339eb2a0c124d" +dependencies = [ + "khronos_api", + "log", + "xml-rs", +] + +[[package]] +name = "glib" +version = "0.22.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e4cf9e5bd8713f1990a92c422998826e0fb34824277b46bc59757373483c6694" +dependencies = [ + "bitflags 2.13.2", + "futures-channel", + "futures-core", + "futures-executor", + "futures-task", + "futures-util", + "gio-sys", + "glib-macros", + "glib-sys", + "gobject-sys", + "libc", + "memchr", + "smallvec", +] + +[[package]] +name = "glib-macros" +version = "0.22.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c9597c68fa7bdf4154a3079642cd21c4dccac0b0bdd2897d82861523bf91e7b9" +dependencies = [ + "heck", + "proc-macro2", + "quote", + "syn 3.0.9", +] + +[[package]] +name = "glib-sys" +version = "0.22.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "99b38907e67e40dec9b60f858bcada952598719cb512a13eb13d6cdcd16f8295" +dependencies = [ + "libc", + "system-deps", +] + +[[package]] +name = "glob" +version = "0.3.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e4eba85ea1d0a966a983acd07deee566e67395d2d96b6fb39e62b5a833f1eb0b" + +[[package]] +name = "glow" +version = "0.16.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c5e5ea60d70410161c8bf5da3fdfeaa1c72ed2c15f8bbb9d19fe3a4fad085f08" +dependencies = [ + "js-sys", + "slotmap", + "wasm-bindgen", + "web-sys", +] + +[[package]] +name = "glow" +version = "0.18.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "263218b0ba2b0715c3370fb04674f5f8aa331594b521c94ff0a8e4a8472d1386" +dependencies = [ + "js-sys", + "slotmap", + "wasm-bindgen", + "web-sys", +] + +[[package]] +name = "glutin" +version = "0.32.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "12124de845cacfebedff80e877bb37b5b75c34c5a4c89e47e1cdd67fb6041325" +dependencies = [ + "bitflags 2.13.2", + "cfg_aliases", + "cgl", + "dispatch2", + "glutin_egl_sys", + "glutin_glx_sys", + "glutin_wgl_sys", + "libloading", + "objc2 0.6.5", + "objc2-app-kit 0.3.2", + "objc2-core-foundation", + "objc2-foundation 0.3.2", + "once_cell", + "raw-window-handle", + "wayland-sys", + "windows-sys 0.52.0", + "x11-dl", +] + +[[package]] +name = "glutin-winit" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "85edca7075f8fc728f28cb8fbb111a96c3b89e930574369e3e9c27eb75d3788f" +dependencies = [ + "cfg_aliases", + "glutin", + "raw-window-handle", + "winit", +] + +[[package]] +name = "glutin_egl_sys" +version = "0.7.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4c4680ba6195f424febdc3ba46e7a42a0e58743f2edb115297b86d7f8ecc02d2" +dependencies = [ + "gl_generator", + "windows-sys 0.52.0", +] + +[[package]] +name = "glutin_glx_sys" +version = "0.6.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8a7bb2938045a88b612499fbcba375a77198e01306f52272e692f8c1f3751185" +dependencies = [ + "gl_generator", + "x11-dl", +] + +[[package]] +name = "glutin_wgl_sys" +version = "0.6.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2c4ee00b289aba7a9e5306d57c2d05499b2e5dc427f84ac708bd2c090212cf3e" +dependencies = [ + "gl_generator", +] + +[[package]] +name = "gobject-sys" +version = "0.22.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "07595c9ba696bd9819cb6a8df39f08078f3dd679508fe052dd558492c2053834" +dependencies = [ + "glib-sys", + "libc", + "system-deps", +] + +[[package]] +name = "gpu-allocator" +version = "0.28.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "51255ea7cfaadb6c5f1528d43e92a82acb2b96c43365989a28b2d44ee38f8795" +dependencies = [ + "ash", + "hashbrown 0.16.1", + "log", + "presser", + "thiserror 2.0.21", + "windows", +] + +[[package]] +name = "grid" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b40ca9252762c466af32d0b1002e91e4e1bc5398f77455e55474deb466355ff5" + +[[package]] +name = "gstreamer" +version = "0.25.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f4237e2066a25ecb7e54be6c066409e30615920265b9799b8d560ef8ac9857c6" +dependencies = [ + "cfg-if", + "futures-channel", + "futures-core", + "futures-util", + "glib", + "gstreamer-sys", + "itertools 0.15.0", + "kstring", + "libc", + "muldiv", + "num-integer", + "num-rational", + "option-operations", + "pastey 0.2.3", + "pin-project-lite", + "smallvec", + "thiserror 2.0.21", +] + +[[package]] +name = "gstreamer-app" +version = "0.25.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "97f8ae9238c2352398dcc084de28df3f7099af216ac6c160b52318d23f25c010" +dependencies = [ + "futures-core", + "futures-sink", + "glib", + "gstreamer", + "gstreamer-app-sys", + "gstreamer-base", + "libc", +] + +[[package]] +name = "gstreamer-app-sys" +version = "0.25.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0798b8aef6694341d40bb81edc759f8979b896b59f9f0f45d8cfa3bb7bf2e743" +dependencies = [ + "glib-sys", + "gstreamer-base-sys", + "gstreamer-sys", + "libc", + "system-deps", +] + +[[package]] +name = "gstreamer-base" +version = "0.25.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "17cbd8f59586a369c40d4b0d2f3a61cf9e9287b3cf5503cdcd8e7c5faa99265e" +dependencies = [ + "atomic_refcell", + "cfg-if", + "glib", + "gstreamer", + "gstreamer-base-sys", + "libc", +] + +[[package]] +name = "gstreamer-base-sys" +version = "0.25.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3b05f77bfd76b5afee6b29c27dae19eaf5018b5cf8d0d17520f3de44c6385c32" +dependencies = [ + "glib-sys", + "gobject-sys", + "gstreamer-sys", + "libc", + "system-deps", +] + +[[package]] +name = "gstreamer-sys" +version = "0.25.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "436d9532847489a8285d57b8c3670762c12a18f777fdc2ab159b52e0e6f521b9" +dependencies = [ + "cfg-if", + "glib-sys", + "gobject-sys", + "libc", + "system-deps", +] + +[[package]] +name = "gstreamer-video" +version = "0.25.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ffe4d77b2a5e679973d9c6b6c052da8cda86b83f5c268872f8691fde693fde84" +dependencies = [ + "cfg-if", + "futures-channel", + "glib", + "gstreamer", + "gstreamer-base", + "gstreamer-video-sys", + "libc", + "thiserror 2.0.21", +] + +[[package]] +name = "gstreamer-video-sys" +version = "0.25.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ef455da22edca97ac9299d682b868227f3d9217b303748ce0161b31ae82dc106" +dependencies = [ + "glib-sys", + "gobject-sys", + "gstreamer-base-sys", + "gstreamer-sys", + "libc", + "system-deps", +] + +[[package]] +name = "half" +version = "2.7.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6ea2d84b969582b4b1864a92dc5d27cd2b77b622a8d79306834f1be5ba20d84b" +dependencies = [ + "cfg-if", + "crunchy", + "num-traits", + "zerocopy", +] + +[[package]] +name = "harfrust" +version = "0.12.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c03d949a14aa089bbb282f7dd76a498a7f684428e4257202efc119ec010376f9" +dependencies = [ + "bitflags 2.13.2", + "bytemuck", + "read-fonts", + "smallvec", +] + +[[package]] +name = "hashbrown" +version = "0.14.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e5274423e17b7c9fc20b6e7e208532f9b19825d82dfd615708b70edd83df41f1" + +[[package]] +name = "hashbrown" +version = "0.15.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9229cfe53dfd69f0609a49f65461bd93001ea1ef889cd5529dd176593f5338a1" +dependencies = [ + "foldhash 0.1.5", +] + +[[package]] +name = "hashbrown" +version = "0.16.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "841d1cc9bed7f9236f321df977030373f4a4163ae1a7dbfe1a51a2c1a51d9100" +dependencies = [ + "allocator-api2", + "equivalent", + "foldhash 0.2.0", +] + +[[package]] +name = "hashbrown" +version = "0.17.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ed5909b6e89a2db4456e54cd5f673791d7eca6732202bbf2a9cc504fe2f9b84a" +dependencies = [ + "foldhash 0.2.0", +] + +[[package]] +name = "heck" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2304e00983f87ffb38b55b444b5e3b60a884b5d30c0fca7d82fe33449bbe55ea" + +[[package]] +name = "hermit-abi" +version = "0.3.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d231dfb89cfffdbc30e7fc41579ed6066ad03abda9e567ccafae602b97ec5024" + +[[package]] +name = "hermit-abi" +version = "0.5.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e17592d60ebacc7d5e169f4663c5f84f9161cc90328abcfe8456f41e4dfcb284" + +[[package]] +name = "hex" +version = "0.4.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7f24254aa9a54b5c858eaee2f5bccdb46aaf0e486a595ed5fd8f86ba55232a70" + +[[package]] +name = "htmlparser" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "48ce8546b993eaf241d69ded33b1be6d205dd9857ec879d9d18bd05d3676e144" + +[[package]] +name = "http" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "918d3568bebf352712bc2ef3d46a8bcf1a75b373be6539de198e9105cbbf9ce0" +dependencies = [ + "bytes", + "itoa", +] + +[[package]] +name = "httparse" +version = "1.10.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6dbf3de79e51f3d586ab4cb9d5c3e2c14aa28ed23d180cf89b4df0454a69cc87" + +[[package]] +name = "i-slint-backend-linuxkms" +version = "1.18.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0f519a8611a4982921e46e391015e5e40ceac5cc63813333ef91ada77df180d8" +dependencies = [ + "bytemuck", + "calloop 0.14.5", + "cfg_aliases", + "drm", + "gbm", + "glutin", + "i-slint-common", + "i-slint-core", + "i-slint-renderer-femtovg", + "i-slint-renderer-software", + "input", + "libseat", + "memmap2", + "nix", + "raw-window-handle", + "xkbcommon", +] + +[[package]] +name = "i-slint-backend-selector" +version = "1.18.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fb974705d61ba56034f6129ff61f3e6282a2c0c07752f25e6cb417d81c0f0958" +dependencies = [ + "cfg-if", + "cfg_aliases", + "i-slint-backend-linuxkms", + "i-slint-backend-testing", + "i-slint-backend-winit", + "i-slint-common", + "i-slint-core", + "i-slint-core-macros", + "i-slint-renderer-femtovg", +] + +[[package]] +name = "i-slint-backend-testing" +version = "1.18.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "01943d6c5ea5bc913d497bdaa423c309e7627afff47a6794bfd13be5c564209f" +dependencies = [ + "cfg_aliases", + "i-slint-common", + "i-slint-core", + "i-slint-renderer-software", + "vtable", +] + +[[package]] +name = "i-slint-backend-winit" +version = "1.18.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dae4fcf1b19e9cb109984d2af87d2b9485388c619265bff71dd523133888bee2" +dependencies = [ + "accesskit", + "accesskit_winit", + "arboard", + "block2 0.6.2", + "bytemuck", + "cfg-if", + "cfg_aliases", + "futures", + "glutin", + "glutin-winit", + "i-slint-common", + "i-slint-core", + "i-slint-core-macros", + "i-slint-renderer-femtovg", + "i-slint-renderer-skia", + "i-slint-renderer-software", + "imgref", + "lyon_path", + "muda", + "objc2 0.6.5", + "objc2-app-kit 0.3.2", + "objc2-foundation 0.3.2", + "objc2-quartz-core 0.3.2", + "objc2-ui-kit 0.3.2", + "pin-weak", + "raw-window-handle", + "rgb", + "scoped-tls-hkt", + "scopeguard", + "softbuffer", + "strum", + "vtable", + "wasm-bindgen", + "web-sys", + "webbrowser", + "windows", + "winit", + "zbus", +] + +[[package]] +name = "i-slint-common" +version = "1.18.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "68a578f3e4b681b2b9cbd326d3be19716e2fac51d00a8a5b00c0ef4ae923b5e6" +dependencies = [ + "derive_more", + "fontique", + "htmlparser", + "icu_decimal", + "icu_locale_core", + "icu_provider", + "pulldown-cmark", + "resvg", + "skrifa", +] + +[[package]] +name = "i-slint-compiler" +version = "1.18.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f55d48ebef05e2bf09ba5a1fc67bcb11033b9e12a2a50ed3105c7d25e2b539d0" +dependencies = [ + "annotate-snippets", + "by_address", + "data-url", + "derive_more", + "i-slint-common", + "icu_normalizer", + "icu_properties", + "image", + "indexmap", + "itertools 0.15.0", + "lyon_extra", + "lyon_path", + "num_enum", + "proc-macro2", + "quote", + "rayon", + "resvg", + "rowan", + "rspolib", + "skrifa", + "smol_str 0.3.7", + "strum", + "swash", + "typed-index-collections", + "unicode-segmentation", + "url", +] + +[[package]] +name = "i-slint-core" +version = "1.18.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ed2ea15059d70bc31b1a8b1eb4c34f2c5df04cb7e53f36179b43c0261231d646" +dependencies = [ + "accesskit", + "async-channel", + "bitflags 2.13.2", + "cfg-if", + "chrono", + "clru", + "const-field-offset", + "derive_more", + "euclid", + "i-slint-common", + "i-slint-core-macros", + "icu_normalizer", + "image", + "js-sys", + "ksni", + "lyon_algorithms", + "lyon_extra", + "lyon_geom", + "lyon_path", + "num-traits", + "objc2 0.6.5", + "objc2-app-kit 0.3.2", + "objc2-foundation 0.3.2", + "once_cell", + "parley", + "pin-project", + "pin-weak", + "portable-atomic", + "raw-window-handle", + "resvg", + "rgb", + "scopeguard", + "skrifa", + "slab", + "strum", + "swash", + "sys-locale", + "taffy", + "unicode-linebreak", + "unicode-script", + "unicode-segmentation", + "vtable", + "wasm-bindgen", + "web-sys", + "web-time", + "wgpu", + "windows", +] + +[[package]] +name = "i-slint-core-macros" +version = "1.18.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "73f5a8a076de52f53be80caa826599ed2107b54c9d4a421e66dc06cf893a984c" +dependencies = [ + "quote", + "serde_json", + "syn 3.0.9", +] + +[[package]] +name = "i-slint-renderer-femtovg" +version = "1.18.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "eb0de504d57cdadf80c2abf7bcb8b7135a3716aee1f41b6ebb90ea93e3649d7c" +dependencies = [ + "cfg-if", + "const-field-offset", + "femtovg", + "glow 0.18.0", + "i-slint-common", + "i-slint-core", + "i-slint-core-macros", + "imgref", + "lyon_path", + "pin-weak", + "rgb", + "wasm-bindgen", + "web-sys", +] + +[[package]] +name = "i-slint-renderer-skia" +version = "1.18.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dc9c1cf02385f1d26fc1f423544e52390a8e5c2d89420a8042aa94b4fe109d1f" +dependencies = [ + "bytemuck", + "cfg-if", + "cfg_aliases", + "clru", + "const-field-offset", + "glow 0.18.0", + "glutin", + "i-slint-common", + "i-slint-core", + "i-slint-core-macros", + "lyon_path", + "objc2 0.6.5", + "objc2-app-kit 0.3.2", + "objc2-core-foundation", + "objc2-foundation 0.3.2", + "objc2-metal 0.3.2", + "objc2-quartz-core 0.3.2", + "pin-weak", + "raw-window-handle", + "read-fonts", + "scoped-tls-hkt", + "skia-safe", + "softbuffer", + "spin_on", + "unicode-segmentation", + "vtable", + "wgpu", + "wgpu-hal", + "windows", + "windows-core", + "write-fonts", +] + +[[package]] +name = "i-slint-renderer-software" +version = "1.18.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2f8c641e138a2cc96537cac4481f5c7c8bb8dcc66d09acaed269329c8738628a" +dependencies = [ + "bytemuck", + "clru", + "derive_more", + "euclid", + "i-slint-common", + "i-slint-core", + "lyon_path", + "num-traits", + "skrifa", + "swash", + "zeno", +] + +[[package]] +name = "iana-time-zone" +version = "0.1.65" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e31bc9ad994ba00e440a8aa5c9ef0ec67d5cb5e5cb0cc7f8b744a35b389cc470" +dependencies = [ + "android_system_properties", + "core-foundation-sys", + "iana-time-zone-haiku", + "js-sys", + "log", + "wasm-bindgen", + "windows-core", +] + +[[package]] +name = "iana-time-zone-haiku" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f31827a206f56af32e590ba56d5d2d085f558508192593743f16b2306495269f" +dependencies = [ + "cc", +] + +[[package]] +name = "icu_collections" +version = "2.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fe090a42a0d3140fed8c63263ed1fecc02422cb2f4bfe55cd8de2de1b8e105dd" +dependencies = [ + "displaydoc", + "potential_utf", + "utf8_iter", + "yoke", + "zerofrom", + "zerovec", +] + +[[package]] +name = "icu_decimal" +version = "2.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1150ad5e272740670464934ee76facda43ef2e11f85c27b7ba76ccb33edf2d05" +dependencies = [ + "displaydoc", + "fixed_decimal", + "icu_decimal_data", + "icu_locale_core", + "icu_locale_fallback", + "icu_plurals", + "icu_provider", + "writeable", + "zerovec", +] + +[[package]] +name = "icu_decimal_data" +version = "2.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5595ab78370d48abd24a062f3db115d5108dd0b65634352036cae532aebb0df8" + +[[package]] +name = "icu_locale_core" +version = "2.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "25d29b57c17c6528d0dc4c2141cfa2d08200465acb537a3909c8b9b8a4a984c0" +dependencies = [ + "displaydoc", + "litemap", + "serde", + "tinystr", + "writeable", + "zerovec", +] + +[[package]] +name = "icu_locale_fallback" +version = "2.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "406e9ae5b95d8aa37db6293405931b766a6172d1848daee22d70eb44aa78a43c" +dependencies = [ + "icu_locale_core", + "icu_locale_fallback_data", + "icu_provider", + "potential_utf", + "tinystr", + "zerovec", +] + +[[package]] +name = "icu_locale_fallback_data" +version = "2.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3632ebbd0c5c3637ba1a40bdf8288f2cb9d2268e73441a69d5fc73d7cfbaa87c" + +[[package]] +name = "icu_normalizer" +version = "2.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "404a3b8c486f205c87fe7f23ab6894d84a4ad76d6e4671ae1981ba7def87c599" +dependencies = [ + "icu_collections", + "icu_normalizer_data", + "icu_properties", + "icu_provider", + "smallvec", + "zerovec", +] + +[[package]] +name = "icu_normalizer_data" +version = "2.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "20f0088bfb7441f7a37fa0c9e20cb1e9cba1cac6b9ce8cd2a6dc44294f8e8cbc" + +[[package]] +name = "icu_plurals" +version = "2.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2ef046647b445acf95ce0f8083fa292467d3df649959fa9a20f3f8abfd957c5d" +dependencies = [ + "fixed_decimal", + "icu_locale_fallback", + "icu_plurals_data", + "icu_provider", + "zerovec", +] + +[[package]] +name = "icu_plurals_data" +version = "2.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d43ff7df2c1a1d41588a6ddcba354d513d4a3e10eec22c06fe56d13c12a848ea" + +[[package]] +name = "icu_properties" +version = "2.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2ea83d991c56158f7cf898bf86436c1dfe7c07ee82fe88951f2695c9f37a379f" +dependencies = [ + "displaydoc", + "icu_collections", + "icu_locale_core", + "icu_properties_data", + "icu_provider", + "zerotrie", + "zerovec", +] + +[[package]] +name = "icu_properties_data" +version = "2.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b98f29af82d02b163fe50161388350e743bb3107cc8e8c2f7314cb505faddfcf" + +[[package]] +name = "icu_provider" +version = "2.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "413099315636c588ee8f011190b329b971a09a8fae9d157e01dcae8379468514" +dependencies = [ + "displaydoc", + "icu_locale_core", + "serde", + "stable_deref_trait", + "writeable", + "yoke", + "zerofrom", + "zerotrie", + "zerovec", +] + +[[package]] +name = "icu_segmenter" +version = "2.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "61b195dc605f81aa181bec9b3bd14e26cc71b903e4644f6af578ca9772c7a710" +dependencies = [ + "icu_collections", + "icu_locale_fallback", + "icu_provider", + "icu_segmenter_data", + "potential_utf", + "smallvec", + "utf8_iter", + "zerotrie", + "zerovec", +] + +[[package]] +name = "icu_segmenter_data" +version = "2.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "913a7d294ad056474749152107309fdee3ec17d2482d1ab70fdc61a81c64b9a3" + +[[package]] +name = "idna" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3b0875f23caa03898994f6ddc501886a45c7d3d62d04d2d90788d47be1b1e4de" +dependencies = [ + "idna_adapter", + "smallvec", + "utf8_iter", +] + +[[package]] +name = "idna_adapter" +version = "1.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cb68373c0d6620ef8105e855e7745e18b0d00d3bdb07fb532e434244cdb9a714" +dependencies = [ + "icu_normalizer", + "icu_properties", +] + +[[package]] +name = "image" +version = "0.25.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "85ab80394333c02fe689eaf900ab500fbd0c2213da414687ebf995a65d5a6104" +dependencies = [ + "bytemuck", + "byteorder-lite", + "color_quant", + "exr", + "gif", + "image-webp", + "moxcms", + "num-traits", + "png", + "qoi", + "ravif", + "rgb", + "tiff", + "zune-core", + "zune-jpeg", +] + +[[package]] +name = "image-webp" +version = "0.2.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "525e9ff3e1a4be2fbea1fdf0e98686a6d98b4d8f937e1bf7402245af1909e8c3" +dependencies = [ + "byteorder-lite", + "quick-error", +] + +[[package]] +name = "imagesize" +version = "0.15.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "65b27460c2c92b037f3f94c538ed9a3342f3fdf923606781629ccb35f82d042a" + +[[package]] +name = "imgref" +version = "1.12.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6e44b0a4eaa4c82f441d50a963f2d5f05a787240aeee097597033e72accfd22f" + +[[package]] +name = "indexmap" +version = "2.14.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cc4e190f5d26ca7051642629da2c52fc03bde85a03197c99408dcd291734c855" +dependencies = [ + "equivalent", + "hashbrown 0.17.1", +] + +[[package]] +name = "input" +version = "0.10.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f9793345a65d71317763a33066b5d8351f8760dde8d4930fe9e39b5f14a7959d" +dependencies = [ + "bitflags 2.13.2", + "input-sys", + "libc", + "log", + "udev", +] + +[[package]] +name = "input-sys" +version = "1.19.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "36eee07d8e02bd95bf52b2e642cf13d33701b94c6e4b04fbf1d1fb07e9cb19e7" + +[[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 = "io-lifetimes" +version = "1.0.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "eae7b9aee968036d54dce06cebaefd919e4472e753296daccd6d344e3e2df0c2" +dependencies = [ + "hermit-abi 0.3.9", + "libc", + "windows-sys 0.48.0", +] + +[[package]] +name = "is_terminal_polyfill" +version = "1.70.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a6cb138bb79a146c1bd460005623e142ef0181e3d0219cb493e02f7d08a35695" + +[[package]] +name = "itertools" +version = "0.13.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "413ee7dfc52ee1a4949ceeb7dbc8a33f2d6c088194d9f922fb8318faf1f01186" +dependencies = [ + "either", +] + +[[package]] +name = "itertools" +version = "0.14.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2b192c782037fadd9cfa75548310488aabdbf3d2da73885b31bd0abd03351285" +dependencies = [ + "either", +] + +[[package]] +name = "itertools" +version = "0.15.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8b4baf93f58d4425749ca49a51c50ebab072c5df6994d08fed93541c331481dc" +dependencies = [ + "either", +] + +[[package]] +name = "itoa" +version = "1.0.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8f42a60cbdf9a97f5d2305f08a87dc4e09308d1276d28c869c684d7777685682" + +[[package]] +name = "jiff" +version = "0.2.38" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b2b005715dcbeb0089a3c0dab99f2ff1cc3b2525323552703d648585d342a383" +dependencies = [ + "defmt", + "jiff-core", + "jiff-static", + "log", + "portable-atomic", + "portable-atomic-util", + "serde_core", +] + +[[package]] +name = "jiff-core" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5e52fe76043ccecc9005d2305ebaadf7d7fc0cc89ca6baa10a94d6bc68c7128c" +dependencies = [ + "defmt", + "log", +] + +[[package]] +name = "jiff-static" +version = "0.2.38" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2cc9817253cf7c7ee4684451bd327e88d6f3658014e54a29198625590650695c" +dependencies = [ + "jiff-core", + "proc-macro2", + "quote", + "syn 2.0.119", +] + +[[package]] +name = "jni" +version = "0.22.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5efd9a482cf3a427f00d6b35f14332adc7902ce91efb778580e180ff90fa3498" +dependencies = [ + "cfg-if", + "combine", + "jni-macros", + "jni-sys 0.4.1", + "log", + "simd_cesu8", + "thiserror 2.0.21", + "walkdir", + "windows-link", +] + +[[package]] +name = "jni-macros" +version = "0.22.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a00109accc170f0bdb141fed3e393c565b6f5e072365c3bd58f5b062591560a3" +dependencies = [ + "proc-macro2", + "quote", + "rustc_version", + "simd_cesu8", + "syn 2.0.119", +] + +[[package]] +name = "jni-sys" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "41a652e1f9b6e0275df1f15b32661cf0d4b78d4d87ddec5e0c3c20f097433258" +dependencies = [ + "jni-sys 0.4.1", +] + +[[package]] +name = "jni-sys" +version = "0.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c6377a88cb3910bee9b0fa88d4f42e1d2da8e79915598f65fb0c7ee14c878af2" +dependencies = [ + "jni-sys-macros", +] + +[[package]] +name = "jni-sys-macros" +version = "0.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "38c0b942f458fe50cdac086d2f946512305e5631e720728f2a61aabcd47a6264" +dependencies = [ + "quote", + "syn 2.0.119", +] + +[[package]] +name = "jobserver" +version = "0.1.35" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1c00acbd29eabad4a2392fa0e921c874934dbbf4194312ad20f04a0ed67a3cb3" +dependencies = [ + "getrandom 0.4.3", + "libc", +] + +[[package]] +name = "js-sys" +version = "0.3.106" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7883d941dae510fb2d978fc3fe018c71c9e2892fd38854de3e8b92c2e5ad9cc5" +dependencies = [ + "cfg-if", + "futures-util", + "wasm-bindgen", +] + +[[package]] +name = "keyboard-types" +version = "0.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b750dcadc39a09dbadd74e118f6dd6598df77fa01df0cfcdc52c28dece74528a" +dependencies = [ + "bitflags 2.13.2", + "serde", + "unicode-segmentation", +] + +[[package]] +name = "khronos_api" +version = "3.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e2db585e1d738fc771bf08a151420d3ed193d9d895a36df7f6f8a9456b911ddc" + +[[package]] +name = "ksni" +version = "0.3.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1bcc1cb43797140f74b711f1c4a49f48a7a7429f211c5fb78264e7bcd1e99caf" +dependencies = [ + "arc-swap", + "async-executor", + "async-io", + "async-lock", + "crossbeam-queue", + "futures-channel", + "futures-lite", + "futures-util", + "pastey 0.2.3", + "serde", + "task-local", + "zbus", +] + +[[package]] +name = "kstring" +version = "2.0.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7a09b82a7f771ed02dc0dd9b27130a0fa5499fa15ed3027116c1e5e4e591bd9e" +dependencies = [ + "static_assertions", +] + +[[package]] +name = "kurbo" +version = "0.13.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4b60dfc32f652b926df6192e55525b16d186c69d47876c3ead4da5cc9f8450e2" +dependencies = [ + "arrayvec", + "euclid", + "polycool", + "smallvec", +] + +[[package]] +name = "lazy_static" +version = "1.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "20870f649af7073d53e38067b2a84312175d56ea15217e1b15bc83506ec50afb" + +[[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.191" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "65cd87c9a6d60536580b316ad985726104730a5151c99845f2490428ef91240a" + +[[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 = "libloading" +version = "0.8.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d7c4b02199fee7c5d21a5ae7d8cfa79a6ef5bb2fc834d6e9058e89c825efdc55" +dependencies = [ + "cfg-if", + "windows-link", +] + +[[package]] +name = "libm" +version = "0.2.16" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b6d2cec3eae94f9f509c767b45932f1ada8350c4bdb85af2fcab4a3c14807981" + +[[package]] +name = "libredox" +version = "0.1.25" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "61ff90caf6077a803a240f62fdbe88645a890bbca49ef8174c3cb0404362171d" +dependencies = [ + "bitflags 2.13.2", + "libc", + "plain", + "redox_syscall 0.9.5", +] + +[[package]] +name = "libseat" +version = "0.2.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6656c69b6e0366ffb83faa232f3e4fda5fc91161722d140f2c95ce2e90b1ef31" +dependencies = [ + "errno", + "libseat-sys", + "log", +] + +[[package]] +name = "libseat-sys" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e8a484fa48be5f62a8d3ffed767779d0ab808cfead91de98ef4362d469097dfb" +dependencies = [ + "pkg-config", +] + +[[package]] +name = "libudev-sys" +version = "0.1.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3c8469b4a23b962c1396b9b451dda50ef5b283e8dd309d69033475fa9b334324" +dependencies = [ + "libc", + "pkg-config", +] + +[[package]] +name = "linebender_resource_handle" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d4a5ff6bcca6c4867b1c4fd4ef63e4db7436ef363e0ad7531d1558856bae64f4" + +[[package]] +name = "linux-raw-sys" +version = "0.4.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d26c52dbd32dccf2d10cac7725f8eae5296885fb5703b261f7d0a0739ec807ab" + +[[package]] +name = "linux-raw-sys" +version = "0.9.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cd945864f07fe9f5371a27ad7b52a172b4b499999f1d97574c9fa68373937e12" + +[[package]] +name = "linux-raw-sys" +version = "0.12.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "32a66949e030da00e8c7d4434b251670a91556f4144941d37452769c25d58a53" + +[[package]] +name = "litemap" +version = "0.8.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "47d9d19d1d6efa0109d2f65ff4c85cddd50bd572e5a00127ab10987290bcefae" + +[[package]] +name = "litrs" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4744e383959f0db86ede514b809b1c53251889093803c05267acc7d4e7030d70" + +[[package]] +name = "lock_api" +version = "0.4.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "224399e74b87b5f3557511d98dff8b14089b3dadafcab6bb93eab67d3aace965" +dependencies = [ + "scopeguard", +] + +[[package]] +name = "log" +version = "0.4.34" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f9f8bd3e56ce4dfc153cf470fffbfa98c7620958b312ca5c3a4b8d5181fd13c6" + +[[package]] +name = "loop9" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0fae87c125b03c1d2c0150c90365d7d6bcc53fb73a9acaef207d2d065860f062" +dependencies = [ + "imgref", +] + +[[package]] +name = "lyon_algorithms" +version = "1.0.22" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f3a6b9d4e8b48acd531fbf1241ad9b270df6e60b6b92bdea1469f4f40899d805" +dependencies = [ + "lyon_path", + "num-traits", +] + +[[package]] +name = "lyon_extra" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7755f08423275157ad1680aaecc9ccb7e0cc633da3240fea2d1522935cc15c72" +dependencies = [ + "lyon_path", + "thiserror 2.0.21", +] + +[[package]] +name = "lyon_geom" +version = "1.0.20" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d82dd26aa4dc0b5b70b9115de59824842bcb43cf4a28e1b1e6d0ad148c93f93e" +dependencies = [ + "arrayvec", + "euclid", + "num-traits", +] + +[[package]] +name = "lyon_path" +version = "1.0.19" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5c463f9c428b7fc5ec885dcd39ce4aa61e29111d0e33483f6f98c74e89d8621e" +dependencies = [ + "lyon_geom", + "num-traits", +] + +[[package]] +name = "maybe-rayon" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8ea1f30cedd69f0a2954655f7188c6a834246d2bcf1e315e2ac40c4b24dc9519" +dependencies = [ + "cfg-if", +] + +[[package]] +name = "memchr" +version = "2.8.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cf8baf1c55e62ffcace7a9f06f4bd9cd3f0c4beb022d3b367256b91b87513d98" + +[[package]] +name = "memmap2" +version = "0.9.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6b0ca1155a9ecc25aa12e8313a119f32edf0255fea2f44839c4ac0a12b2ac157" +dependencies = [ + "libc", +] + +[[package]] +name = "memoffset" +version = "0.9.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "488016bfae457b036d996092f6cb448677611ce4449e970ceaf42695203f218a" +dependencies = [ + "autocfg", +] + +[[package]] +name = "minimal-lexical" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "68354c5c6bd36d73ff3feceb05efa59b6acb7626617f4962be322a825e61f79a" + +[[package]] +name = "miniz_oxide" +version = "0.8.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1fa76a2c86f704bdb222d66965fb3d63269ce38518b83cb0575fca855ebb6316" +dependencies = [ + "adler2", + "simd-adler32", +] + +[[package]] +name = "miniz_oxide" +version = "0.9.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b63fbc4a50860e98e7b2aa7804ded1db5cbc3aff9193adaff57a6931bf7c4b4c" +dependencies = [ + "adler2", + "simd-adler32", +] + +[[package]] +name = "moxcms" +version = "0.8.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bb85c154ba489f01b25c0d36ae69a87e4a1c73a72631fc6c0eb6dde34a73e44b" +dependencies = [ + "num-traits", + "pxfm", +] + +[[package]] +name = "muda" +version = "0.19.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1dd04e60bc0b07438a6771710ee1698f98f6ebbc7f89b61264af1563b8aeb878" +dependencies = [ + "crossbeam-channel", + "dpi", + "keyboard-types", + "objc2 0.6.5", + "objc2-app-kit 0.3.2", + "objc2-core-foundation", + "objc2-foundation 0.3.2", + "once_cell", + "png", + "thiserror 2.0.21", + "windows-sys 0.61.2", +] + +[[package]] +name = "muldiv" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "956787520e75e9bd233246045d19f42fb73242759cc57fba9611d940ae96d4b0" + +[[package]] +name = "naga" +version = "30.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a616d2fb8c89516ac2723a581f69d6c18576046bed761bd6b305e5618e6ae130" +dependencies = [ + "arrayvec", + "bit-set", + "bitflags 2.13.2", + "cfg-if", + "cfg_aliases", + "codespan-reporting", + "half", + "hashbrown 0.17.1", + "indexmap", + "libm", + "log", + "naga-types", + "num-traits", + "once_cell", + "rustc-hash 1.1.0", + "spirv", + "thiserror 2.0.21", + "unicode-ident", +] + +[[package]] +name = "naga-types" +version = "30.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "590afbf58a6f4f62873cd5cff4468061844bafa1cdf399cc954537c22d768d49" +dependencies = [ + "hashbrown 0.17.1", + "indexmap", + "rustc-hash 1.1.0", + "thiserror 2.0.21", +] + +[[package]] +name = "natord" +version = "1.0.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "308d96db8debc727c3fd9744aac51751243420e46edf401010908da7f8d5e57c" + +[[package]] +name = "ndk" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c3f42e7bbe13d351b6bead8286a43aac9534b82bd3cc43e47037f012ebfd62d4" +dependencies = [ + "bitflags 2.13.2", + "jni-sys 0.3.1", + "log", + "ndk-sys", + "num_enum", + "raw-window-handle", + "thiserror 1.0.69", +] + +[[package]] +name = "ndk-context" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "27b02d87554356db9e9a873add8782d4ea6e3e58ea071a9adb9a2e8ddb884a8b" + +[[package]] +name = "ndk-sys" +version = "0.6.0+11769913" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ee6cda3051665f1fb8d9e08fc35c96d5a244fb1be711a03b71118828afc9a873" +dependencies = [ + "jni-sys 0.3.1", +] + +[[package]] +name = "netflex-tv" +version = "0.1.0" +dependencies = [ + "anyhow", + "env_logger", + "log", + "serde", + "serde_json", + "sf-ui", + "slint", + "slint-build", + "toml 0.9.12+spec-1.1.0", + "ureq", +] + +[[package]] +name = "new_debug_unreachable" +version = "1.0.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "650eef8c711430f1a879fdd01d4745a7deea475becfb90269c06775983bbf086" + +[[package]] +name = "nix" +version = "0.31.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cf20d2fde8ff38632c426f1165ed7436270b44f199fc55284c38276f9db47c3d" +dependencies = [ + "bitflags 2.13.2", + "cfg-if", + "cfg_aliases", + "libc", +] + +[[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" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d273983c5a657a70a3e8f2a01329822f3b8c8172b73826411a55751e404a0a4a" +dependencies = [ + "memchr", + "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" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "521739c6d2bac4aa25192232afe6841231376b2b26d4d9fae5ecf8ca5772e441" + +[[package]] +name = "num-derive" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ed3955f1a9c7c0c15e092f9c887db08b1fc683305fdf6eb6684f22555355e202" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.119", +] + +[[package]] +name = "num-integer" +version = "0.1.47" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7ce2d95d4b3734dc35aa2f45e1aa22cd416814592a4f9d9205e11affd5b8e10b" +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" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "071dfc062690e90b734c0b2273ce72ad0ffa95f0c74596bc250dcfd960262841" +dependencies = [ + "autocfg", + "libm", +] + +[[package]] +name = "num_enum" +version = "0.7.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5d0bca838442ec211fa11de3a8b0e0e8f3a4522575b5c4c06ed722e005036f26" +dependencies = [ + "num_enum_derive", + "rustversion", +] + +[[package]] +name = "num_enum_derive" +version = "0.7.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "680998035259dcfcafe653688bf2aa6d3e2dc05e98be6ab46afb089dc84f1df8" +dependencies = [ + "proc-macro-crate", + "proc-macro2", + "quote", + "syn 2.0.119", +] + +[[package]] +name = "objc-sys" +version = "0.3.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cdb91bdd390c7ce1a8607f35f3ca7151b65afc0ff5ff3b34fa350f7d7c7e4310" + +[[package]] +name = "objc2" +version = "0.5.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "19d5490aaf8f1d7cf7688dfa9b0ce07900e168852c45cd2c03f534dfd27cfd0b" +dependencies = [ + "objc-sys", + "objc2-encode", +] + +[[package]] +name = "objc2" +version = "0.6.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "08849bbd4767dfae9457696856ae1c84fe4e0281bbe4a7abff2d0e06fb7981f8" +dependencies = [ + "objc2-encode", +] + +[[package]] +name = "objc2-app-kit" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e4e89ad9e3d7d297152b17d39ed92cd50ca8063a89a9fa569046d41568891eff" +dependencies = [ + "bitflags 2.13.2", + "block2 0.5.1", + "libc", + "objc2 0.5.3", + "objc2-core-data", + "objc2-core-image", + "objc2-foundation 0.2.2", + "objc2-quartz-core 0.2.2", +] + +[[package]] +name = "objc2-app-kit" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d49e936b501e5c5bf01fda3a9452ff86dc3ea98ad5f283e1455153142d97518c" +dependencies = [ + "bitflags 2.13.2", + "objc2 0.6.5", + "objc2-core-foundation", + "objc2-core-graphics", + "objc2-foundation 0.3.2", + "objc2-quartz-core 0.3.2", +] + +[[package]] +name = "objc2-cloud-kit" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "74dd3b56391c7a0596a295029734d3c1c5e7e510a4cb30245f8221ccea96b009" +dependencies = [ + "bitflags 2.13.2", + "block2 0.5.1", + "objc2 0.5.3", + "objc2-core-location", + "objc2-foundation 0.2.2", +] + +[[package]] +name = "objc2-contacts" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a5ff520e9c33812fd374d8deecef01d4a840e7b41862d849513de77e44aa4889" +dependencies = [ + "block2 0.5.1", + "objc2 0.5.3", + "objc2-foundation 0.2.2", +] + +[[package]] +name = "objc2-core-data" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "617fbf49e071c178c0b24c080767db52958f716d9eabdf0890523aeae54773ef" +dependencies = [ + "bitflags 2.13.2", + "block2 0.5.1", + "objc2 0.5.3", + "objc2-foundation 0.2.2", +] + +[[package]] +name = "objc2-core-foundation" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2a180dd8642fa45cdb7dd721cd4c11b1cadd4929ce112ebd8b9f5803cc79d536" +dependencies = [ + "bitflags 2.13.2", + "dispatch2", + "objc2 0.6.5", +] + +[[package]] +name = "objc2-core-graphics" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e022c9d066895efa1345f8e33e584b9f958da2fd4cd116792e15e07e4720a807" +dependencies = [ + "bitflags 2.13.2", + "dispatch2", + "objc2 0.6.5", + "objc2-core-foundation", + "objc2-io-surface", +] + +[[package]] +name = "objc2-core-image" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "55260963a527c99f1819c4f8e3b47fe04f9650694ef348ffd2227e8196d34c80" +dependencies = [ + "block2 0.5.1", + "objc2 0.5.3", + "objc2-foundation 0.2.2", + "objc2-metal 0.2.2", +] + +[[package]] +name = "objc2-core-location" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "000cfee34e683244f284252ee206a27953279d370e309649dc3ee317b37e5781" +dependencies = [ + "block2 0.5.1", + "objc2 0.5.3", + "objc2-contacts", + "objc2-foundation 0.2.2", +] + +[[package]] +name = "objc2-core-text" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0cde0dfb48d25d2b4862161a4d5fcc0e3c24367869ad306b0c9ec0073bfed92d" +dependencies = [ + "bitflags 2.13.2", + "objc2-core-foundation", +] + +[[package]] +name = "objc2-encode" +version = "4.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ef25abbcd74fb2609453eb695bd2f860d389e457f67dc17cafc8b8cbc89d0c33" + +[[package]] +name = "objc2-foundation" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0ee638a5da3799329310ad4cfa62fbf045d5f56e3ef5ba4149e7452dcf89d5a8" +dependencies = [ + "bitflags 2.13.2", + "block2 0.5.1", + "dispatch", + "libc", + "objc2 0.5.3", +] + +[[package]] +name = "objc2-foundation" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e3e0adef53c21f888deb4fa59fc59f7eb17404926ee8a6f59f5df0fd7f9f3272" +dependencies = [ + "bitflags 2.13.2", + "block2 0.6.2", + "objc2 0.6.5", + "objc2-core-foundation", +] + +[[package]] +name = "objc2-io-surface" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "180788110936d59bab6bd83b6060ffdfffb3b922ba1396b312ae795e1de9d81d" +dependencies = [ + "bitflags 2.13.2", + "objc2 0.6.5", + "objc2-core-foundation", +] + +[[package]] +name = "objc2-link-presentation" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a1a1ae721c5e35be65f01a03b6d2ac13a54cb4fa70d8a5da293d7b0020261398" +dependencies = [ + "block2 0.5.1", + "objc2 0.5.3", + "objc2-app-kit 0.2.2", + "objc2-foundation 0.2.2", +] + +[[package]] +name = "objc2-metal" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dd0cba1276f6023976a406a14ffa85e1fdd19df6b0f737b063b95f6c8c7aadd6" +dependencies = [ + "bitflags 2.13.2", + "block2 0.5.1", + "objc2 0.5.3", + "objc2-foundation 0.2.2", +] + +[[package]] +name = "objc2-metal" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a0125f776a10d00af4152d74616409f0d4a2053a6f57fa5b7d6aa2854ac04794" +dependencies = [ + "bitflags 2.13.2", + "block2 0.6.2", + "objc2 0.6.5", + "objc2-foundation 0.3.2", +] + +[[package]] +name = "objc2-quartz-core" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e42bee7bff906b14b167da2bac5efe6b6a07e6f7c0a21a7308d40c960242dc7a" +dependencies = [ + "bitflags 2.13.2", + "block2 0.5.1", + "objc2 0.5.3", + "objc2-foundation 0.2.2", + "objc2-metal 0.2.2", +] + +[[package]] +name = "objc2-quartz-core" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "96c1358452b371bf9f104e21ec536d37a650eb10f7ee379fff67d2e08d537f1f" +dependencies = [ + "bitflags 2.13.2", + "objc2 0.6.5", + "objc2-core-foundation", + "objc2-core-graphics", + "objc2-foundation 0.3.2", + "objc2-metal 0.3.2", +] + +[[package]] +name = "objc2-symbols" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0a684efe3dec1b305badae1a28f6555f6ddd3bb2c2267896782858d5a78404dc" +dependencies = [ + "objc2 0.5.3", + "objc2-foundation 0.2.2", +] + +[[package]] +name = "objc2-ui-kit" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b8bb46798b20cd6b91cbd113524c490f1686f4c4e8f49502431415f3512e2b6f" +dependencies = [ + "bitflags 2.13.2", + "block2 0.5.1", + "objc2 0.5.3", + "objc2-cloud-kit", + "objc2-core-data", + "objc2-core-image", + "objc2-core-location", + "objc2-foundation 0.2.2", + "objc2-link-presentation", + "objc2-quartz-core 0.2.2", + "objc2-symbols", + "objc2-uniform-type-identifiers", + "objc2-user-notifications", +] + +[[package]] +name = "objc2-ui-kit" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d87d638e33c06f577498cbcc50491496a3ed4246998a7fbba7ccb98b1e7eab22" +dependencies = [ + "bitflags 2.13.2", + "block2 0.6.2", + "objc2 0.6.5", + "objc2-core-foundation", + "objc2-foundation 0.3.2", + "objc2-quartz-core 0.3.2", +] + +[[package]] +name = "objc2-uniform-type-identifiers" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "44fa5f9748dbfe1ca6c0b79ad20725a11eca7c2218bceb4b005cb1be26273bfe" +dependencies = [ + "block2 0.5.1", + "objc2 0.5.3", + "objc2-foundation 0.2.2", +] + +[[package]] +name = "objc2-user-notifications" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "76cfcbf642358e8689af64cee815d139339f3ed8ad05103ed5eaf73db8d84cb3" +dependencies = [ + "bitflags 2.13.2", + "block2 0.5.1", + "objc2 0.5.3", + "objc2-core-location", + "objc2-foundation 0.2.2", +] + +[[package]] +name = "once_cell" +version = "1.21.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9f7c3e4beb33f85d45ae3e3a1792185706c8e16d043238c593331cc7cd313b50" +dependencies = [ + "critical-section", + "portable-atomic", +] + +[[package]] +name = "once_cell_polyfill" +version = "1.70.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "384b8ab6d37215f3c5301a95a4accb5d64aa607f1fcb26a11b5303878451b4fe" + +[[package]] +name = "option-operations" +version = "0.6.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "aca39cf52b03268400c16eeb9b56382ea3c3353409309b63f5c8f0b1faf42754" +dependencies = [ + "pastey 0.2.3", +] + +[[package]] +name = "orbclient" +version = "0.3.55" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5df339f526ea9a60e371768d50efc2f2508c7203290731565d1f7a6f71d21747" +dependencies = [ + "libc", + "libredox", +] + +[[package]] +name = "ordered-float" +version = "5.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8c7c9e0d9b23589f26070720bac724174bfec1083e82f7854cdd0267518343c0" +dependencies = [ + "num-traits", +] + +[[package]] +name = "ordered-stream" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9aa2b01e1d916879f73a53d01d1d6cee68adbb31d6d9177a8cfce093cced1d50" +dependencies = [ + "futures-core", + "pin-project-lite", +] + +[[package]] +name = "os_pipe" +version = "1.2.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7d8fae84b431384b68627d0f9b3b1245fcf9f46f6c0e3dc902e9dce64edd1967" +dependencies = [ + "libc", + "windows-sys 0.61.2", +] + +[[package]] +name = "owned_ttf_parser" +version = "0.25.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "36820e9051aca1014ddc75770aab4d68bc1e9e632f0f5627c4086bc216fb583b" +dependencies = [ + "ttf-parser", +] + +[[package]] +name = "parking" +version = "2.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f38d5652c16fde515bb1ecef450ab0f6a219d619a7274976324d5e377f7dceba" + +[[package]] +name = "parking_lot" +version = "0.12.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "93857453250e3077bd71ff98b6a65ea6621a19bb0f559a85248955ac12c45a1a" +dependencies = [ + "lock_api", + "parking_lot_core", +] + +[[package]] +name = "parking_lot_core" +version = "0.9.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2621685985a2ebf1c516881c026032ac7deafcda1a2c9b7850dc81e3dfcb64c1" +dependencies = [ + "cfg-if", + "libc", + "redox_syscall 0.5.18", + "smallvec", + "windows-link", +] + +[[package]] +name = "parlance" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "73072a9470554c8e794778acece2312661218aaabb635600957d952cf01c716e" + +[[package]] +name = "parley" +version = "0.11.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "22d2ff88bd3f7d68d1d9b09c7e6209f9a8e8c05088295140a2bcf2e9b17038c5" +dependencies = [ + "accesskit", + "fontique", + "harfrust", + "hashbrown 0.17.1", + "icu_normalizer", + "icu_properties", + "icu_segmenter", + "linebender_resource_handle", + "parlance", + "parley_data", + "skrifa", +] + +[[package]] +name = "parley_data" +version = "0.11.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1567535334d6ba2d3cde19221ba9a7bd0fabb3cbd99046ddfb10ae061cfcc889" +dependencies = [ + "icu_properties", +] + +[[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 = "pastey" +version = "0.2.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2ee67f1008b1ba2321834326597b8e186293b049a023cdef258527550b9935b4" + +[[package]] +name = "percent-encoding" +version = "2.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9b4f627cb1b25917193a259e49bdad08f671f8d9708acfd5fe0a8c1455d87220" + +[[package]] +name = "petgraph" +version = "0.8.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8701b58ea97060d5e5b155d383a69952a60943f0e6dfe30b04c287beb0b27455" +dependencies = [ + "fixedbitset", + "hashbrown 0.15.5", + "indexmap", +] + +[[package]] +name = "phf" +version = "0.13.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c1562dc717473dbaa4c1f85a36410e03c047b2e7df7f45ee938fbef64ae7fadf" +dependencies = [ + "phf_macros", + "phf_shared", + "serde", +] + +[[package]] +name = "phf_generator" +version = "0.13.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "135ace3a761e564ec88c03a77317a7c6b80bb7f7135ef2544dbe054243b89737" +dependencies = [ + "fastrand", + "phf_shared", +] + +[[package]] +name = "phf_macros" +version = "0.13.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "812f032b54b1e759ccd5f8b6677695d5268c588701effba24601f6932f8269ef" +dependencies = [ + "phf_generator", + "phf_shared", + "proc-macro2", + "quote", + "syn 2.0.119", +] + +[[package]] +name = "phf_shared" +version = "0.13.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e57fef6bc5981e38c2ce2d63bfa546861309f875b8a75f092d1d54ae2d64f266" +dependencies = [ + "siphasher", +] + +[[package]] +name = "pico-args" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5be167a7af36ee22fe3115051bc51f6e6c7054c9348e28deb4f49bd6f705a315" + +[[package]] +name = "pin-project" +version = "1.1.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2466b2336ed02bcdca6b294417127b90ec92038d1d5c4fbeac971a922e0e0924" +dependencies = [ + "pin-project-internal", +] + +[[package]] +name = "pin-project-internal" +version = "1.1.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c96395f0a926bc13b1c17622aaddda1ecb55d49c8f1bf9777e4d877800a43f8b" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.119", +] + +[[package]] +name = "pin-project-lite" +version = "0.2.17" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a89322df9ebe1c1578d689c92318e070967d1042b512afbe49518723f4e6d5cd" + +[[package]] +name = "pin-utils" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "13bee6c73da26345c729282832b60b0363cf3dd9f4bfd81d8551b7a1c889a113" + +[[package]] +name = "pin-weak" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b330c9d1b92dfe68442ca20b009c717d5f0b1e3cf4965e62f704c3c6e95a1305" + +[[package]] +name = "piper" +version = "0.2.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c835479a4443ded371d6c535cbfd8d31ad92c5d23ae9770a61bc155e4992a3c1" +dependencies = [ + "atomic-waker", + "fastrand", + "futures-io", +] + +[[package]] +name = "pkg-config" +version = "0.3.34" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f6b464fbc74e149a392436b17d523f769e057cb6877f6a5c4618bc6f11800548" + +[[package]] +name = "plain" +version = "0.2.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b4596b6d070b27117e987119b4dac604f3c58cfb0b191112e24771b2faeac1a6" + +[[package]] +name = "png" +version = "0.18.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "60769b8b31b2a9f263dae2776c37b1b28ae246943cf719eb6946a1db05128a61" +dependencies = [ + "bitflags 2.13.2", + "crc32fast", + "fdeflate", + "flate2", + "miniz_oxide 0.8.9", +] + +[[package]] +name = "polling" +version = "3.11.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5d0e4f59085d47d8241c88ead0f274e8a0cb551f3625263c05eb8dd897c34218" +dependencies = [ + "cfg-if", + "concurrent-queue", + "hermit-abi 0.5.3", + "pin-project-lite", + "rustix 1.1.5", + "windows-sys 0.61.2", +] + +[[package]] +name = "polycool" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "50596ddc09eb5ad5f75cacd40209568e66df71baf86e1499a0e99c4cff12a5a6" +dependencies = [ + "arrayvec", +] + +[[package]] +name = "portable-atomic" +version = "1.15.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "05c8b63e8d9609db387f0324918f81d68fe27748f084ef092fb35954d0539a85" +dependencies = [ + "critical-section", +] + +[[package]] +name = "portable-atomic-util" +version = "0.2.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "10ab3eb7f3becc3a1cbc4f2c6f20267996cfc1a6467a873763411b136a122715" +dependencies = [ + "portable-atomic", +] + +[[package]] +name = "potential_utf" +version = "0.1.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d83eb9bc6d8e5cf568e7a1101d60ee05e81ed50ea106026f3d18deeb046d7661" +dependencies = [ + "serde_core", + "writeable", + "zerovec", +] + +[[package]] +name = "powerfmt" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4a6394b9e965e73d0a289ee54f589087e2c676aedf60885baf52c76b771e4958" + +[[package]] +name = "ppv-lite86" +version = "0.2.21" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "85eae3c4ed2f50dcfe72643da4befc30deadb458a9b590d720cde2f2b1e97da9" +dependencies = [ + "zerocopy", +] + +[[package]] +name = "presser" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e8cf8e6a8aa66ce33f63993ffc4ea4271eb5b0530a9002db8455ea6050c77bfa" + +[[package]] +name = "prettyplease" +version = "0.2.37" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "479ca8adacdd7ce8f1fb39ce9ecccbfe93a3f1344b3d0d97f20bc0196208f62b" +dependencies = [ + "proc-macro2", + "syn 2.0.119", +] + +[[package]] +name = "proc-macro-crate" +version = "3.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e67ba7e9b2b56446f1d419b1d807906278ffa1a658a8a5d8a39dcb1f5a78614f" +dependencies = [ + "toml_edit", +] + +[[package]] +name = "proc-macro2" +version = "1.0.107" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "985e7ec9bb745e6ce6535b544d84d6cd6f7ad8bd711c398938ae983b91a766d9" +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 = "pulldown-cmark" +version = "0.13.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "278e9268c93b9e498a2da46c34d90ba93a3255eb99009646398f34bc73ab36eb" +dependencies = [ + "bitflags 2.13.2", + "memchr", + "unicase", +] + +[[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 = "quick-error" +version = "2.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a993555f31e5a609f617c12db6250dedcac1b0a85076912c436e6fc9b2c8e6a3" + +[[package]] +name = "quick-xml" +version = "0.41.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e660451e55124f798a69a5af3f49ccfbefbd41910eefd25caf2393e1f3473ec1" +dependencies = [ + "memchr", +] + +[[package]] +name = "quote" +version = "1.0.47" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1fbf4db142a473a8d80c26bbf18454ed458bf8d26c8219c331daecfdbd079001" +dependencies = [ + "proc-macro2", +] + +[[package]] +name = "r-efi" +version = "5.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "69cdb34c158ceb288df11e18b4bd39de994f6657d83847bdffdbd7f346754b0f" + +[[package]] +name = "r-efi" +version = "6.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f8dcc9c7d52a811697d2151c701e0d08956f92b0e24136cf4cf27b57a6a0d9bf" + +[[package]] +name = "rand" +version = "0.9.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b9ef1d0d795eb7d84685bca4f72f3649f064e6641543d3a8c415898726a57b41" +dependencies = [ + "rand_chacha", + "rand_core", +] + +[[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", +] + +[[package]] +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 = "range-alloc" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ca45419789ae5a7899559e9512e58ca889e41f04f1f2445e9f4b290ceccd1d08" + +[[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 0.14.0", + "libc", + "libfuzzer-sys", + "log", + "maybe-rayon", + "new_debug_unreachable", + "noop_proc_macro", + "num-derive", + "num-traits", + "paste", + "profiling", + "rand", + "rand_chacha", + "simd_helpers", + "thiserror 2.0.21", + "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", + "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.2", +] + +[[package]] +name = "raw-window-handle" +version = "0.6.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "20675572f6f24e9e76ef639bc5552774ed45f1c30e2951e1e99c59888861c539" + +[[package]] +name = "raw-window-metal" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "40d213455a5f1dc59214213c7330e074ddf8114c9a42411eb890c767357ce135" +dependencies = [ + "objc2 0.6.5", + "objc2-core-foundation", + "objc2-foundation 0.3.2", + "objc2-quartz-core 0.3.2", +] + +[[package]] +name = "rayon" +version = "1.12.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fb39b166781f92d482534ef4b4b1b2568f42613b53e5b6c160e24cfbfa30926d" +dependencies = [ + "either", + "rayon-core", +] + +[[package]] +name = "rayon-core" +version = "1.13.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "22e18b0f0062d30d4230b2e85ff77fdfe4326feb054b9783a3460d8435c8ab91" +dependencies = [ + "crossbeam-deque", + "crossbeam-utils", +] + +[[package]] +name = "read-fonts" +version = "0.41.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "046a7d674daf459825b32f5062056d6882db0d2f5a479fbd76ccfc870ac18709" +dependencies = [ + "bytemuck", + "font-types", + "once_cell", +] + +[[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.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4722d768eff46b75989dd134e5c353f0d6296e5aaa3132e776cbdb56be7731aa" +dependencies = [ + "bitflags 1.3.2", +] + +[[package]] +name = "redox_syscall" +version = "0.5.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ed2bf2547551a7053d6fdfafda3f938979645c44812fbfcda098faae3f1a362d" +dependencies = [ + "bitflags 2.13.2", +] + +[[package]] +name = "redox_syscall" +version = "0.9.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "580c875845b41ecb1564ad1ae4703044cef774145e3d7a94dc2b3fa7c97868fd" +dependencies = [ + "bitflags 2.13.2", +] + +[[package]] +name = "regex" +version = "1.13.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f020237b6c8eed93db2e2cb53c00c60a8e1bc73da7d073199a1180401450218d" +dependencies = [ + "aho-corasick", + "memchr", + "regex-automata", + "regex-syntax", +] + +[[package]] +name = "regex-automata" +version = "0.4.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ad8553b9b26413251cbf30e620595c7a41b3887f03da04579c0e6b0d6a06b4b2" +dependencies = [ + "aho-corasick", + "memchr", + "regex-syntax", +] + +[[package]] +name = "regex-syntax" +version = "0.8.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d6f6ff9a378485b298a5286656da665ba74413d36db0979633275d2e708145d4" + +[[package]] +name = "renderdoc-sys" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "19b30a45b0cd0bcca8037f3d0dc3421eaf95327a17cad11964fb8179b4fc4832" + +[[package]] +name = "resvg" +version = "0.48.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "67e3803f97b999e80cbf7c6ecdd07a8102204d92e1633cf48783720c521196bd" +dependencies = [ + "bytemuck", + "gif", + "image-webp", + "log", + "pico-args", + "rgb", + "svgtypes", + "tiny-skia 0.12.0", + "usvg", + "zune-jpeg", +] + +[[package]] +name = "rgb" +version = "0.8.53" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "47b34b781b31e5d73e9fbc8689c70551fd1ade9a19e3e28cfec8580a79290cc4" +dependencies = [ + "bytemuck", +] + +[[package]] +name = "ring" +version = "0.17.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a4689e6c2294d81e88dc6261c768b63bc4fcdb852be6d1352498b114f61383b7" +dependencies = [ + "cc", + "cfg-if", + "getrandom 0.2.17", + "libc", + "untrusted", + "windows-sys 0.52.0", +] + +[[package]] +name = "rowan" +version = "0.17.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "14b574c58582fa59fa43a2feb6608b8744184659f08a2e0117e4b8224d95ed61" +dependencies = [ + "countme", + "hashbrown 0.14.5", + "memoffset", + "rustc-hash 1.1.0", + "text-size", +] + +[[package]] +name = "roxmltree" +version = "0.21.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9da7f59328b09405b181fee1018925fad50f157afb43c0c0f5c522c256dd5907" +dependencies = [ + "memchr", +] + +[[package]] +name = "rspolib" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4fda9a7796aff63a7b1b39ccc93fffaaf65e20042984b4843041a49ca4677535" +dependencies = [ + "lazy_static", + "natord", + "snafu", + "unicode-linebreak", + "unicode-width", +] + +[[package]] +name = "rustc-hash" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "08d43f7aa6b08d49f382cde6a7982047c3426db949b1424bc4b7ec9ae12c6ce2" + +[[package]] +name = "rustc-hash" +version = "2.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6b1e7f9a428571be2dc5bc0505c13fb6bf936822b894ec87abf8a08a4e51742d" + +[[package]] +name = "rustc_version" +version = "0.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cfcb3a22ef46e85b45de6ee7e79d063319ebb6594faafcf1c225ea92ab6e9b92" +dependencies = [ + "semver", +] + +[[package]] +name = "rustix" +version = "0.38.44" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fdb5bc1ae2baa591800df16c9ca78619bf65c0488b41b96ccec5d11220d8c154" +dependencies = [ + "bitflags 2.13.2", + "errno", + "libc", + "linux-raw-sys 0.4.15", + "windows-sys 0.59.0", +] + +[[package]] +name = "rustix" +version = "1.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "891efababe418670775f199f0d233d84843c227a0949a883ce15b37c78d6629d" +dependencies = [ + "bitflags 2.13.2", + "errno", + "libc", + "linux-raw-sys 0.12.1", + "windows-sys 0.61.2", +] + +[[package]] +name = "rustls" +version = "0.23.46" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "48e13bd8c0e9365c43cfa5c9e8f9ad49d3c8444926c9aac819e0e4dc503c8fdf" +dependencies = [ + "log", + "once_cell", + "ring", + "rustls-pki-types", + "rustls-webpki", + "subtle", + "zeroize", +] + +[[package]] +name = "rustls-pki-types" +version = "1.15.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2f4925028c7eb5d1fcdaf196971378ed9d2c1c4efc7dc5d011256f76c99c0a96" +dependencies = [ + "zeroize", +] + +[[package]] +name = "rustls-webpki" +version = "0.103.16" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4443b1b6d39d7c663139942cc4558262562d2c84123bb6282ef177009ca8b281" +dependencies = [ + "ring", + "rustls-pki-types", + "untrusted", +] + +[[package]] +name = "rustversion" +version = "1.0.23" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cf54715a573b99ac80df0bc206da022bcd442c974952c7b9720069370852e21f" + +[[package]] +name = "same-file" +version = "1.0.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "93fc1dc3aaa9bfed95e02e6eadabb4baf7e3078b0bd1b4d7b6b0b68378900502" +dependencies = [ + "winapi-util", +] + +[[package]] +name = "scoped-tls" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e1cf6437eb19a8f4a6cc0f7dca544973b0b78843adbfeb3683d1a94a0024a294" + +[[package]] +name = "scoped-tls-hkt" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e9603871ffe5df3ac39cb624790c296dbd47a400d202f56bf3e414045099524d" + +[[package]] +name = "scopeguard" +version = "1.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "94143f37725109f92c262ed2cf5e59bce7498c01bcc1502d7b9afe439a4e9f49" + +[[package]] +name = "sctk-adwaita" +version = "0.10.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b6277f0217056f77f1d8f49f2950ac6c278c0d607c45f5ee99328d792ede24ec" +dependencies = [ + "ab_glyph", + "log", + "memmap2", + "smithay-client-toolkit", + "tiny-skia 0.11.4", +] + +[[package]] +name = "semver" +version = "1.0.28" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8a7852d02fc848982e0c167ef163aaff9cd91dc640ba85e263cb1ce46fae51cd" + +[[package]] +name = "serde" +version = "1.0.229" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4148590afebada386688f18773da617792bf2ef03ffc1e4cbd2b1d45b023e0ba" +dependencies = [ + "serde_core", + "serde_derive", +] + +[[package]] +name = "serde_core" +version = "1.0.229" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "67dca2c9c51e58a4791a4b1ed58308b39c64224d349a935ab5039aa360942a48" +dependencies = [ + "serde_derive", +] + +[[package]] +name = "serde_derive" +version = "1.0.229" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e7a5d71263a5a7d47b41f6b3f06ba276f10cc18b0931f1799f710578e2309348" +dependencies = [ + "proc-macro2", + "quote", + "syn 3.0.9", +] + +[[package]] +name = "serde_json" +version = "1.0.154" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e7e9cc8b1b85264074fbcc02a88680c4096b1e47df8f739dceb03bf482f04bd6" +dependencies = [ + "itoa", + "memchr", + "serde", + "serde_core", + "zmij", +] + +[[package]] +name = "serde_repr" +version = "0.1.21" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8d3b1629de253c70a0508c3899572da79ca359fdab27c7920ff00406df418906" +dependencies = [ + "proc-macro2", + "quote", + "syn 3.0.9", +] + +[[package]] +name = "serde_spanned" +version = "1.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4e7523beb55eece201a2356bee0bbca0d1ab466c14c07703b2e0ee6d42cb0c2c" +dependencies = [ + "serde_core", +] + +[[package]] +name = "sf-ui" +version = "0.2.0" +dependencies = [ + "anyhow", + "glow 0.16.0", + "gstreamer", + "gstreamer-app", + "gstreamer-video", + "image", + "log", + "png", + "slint", + "ureq", +] + +[[package]] +name = "shlex" +version = "1.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0fda2ff0d084019ba4d7c6f371c95d8fd75ce3524c3cb8fb653a3023f6323e64" + +[[package]] +name = "shlex" +version = "2.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f8fadd59c855ef2080decdef8ff161eb6661b86933c9d82e5ba29dc602a55aba" + +[[package]] +name = "signal-hook-registry" +version = "1.4.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c4db69cba1110affc0e9f7bcd48bbf87b3f4fc7c61fc9155afd4c469eb3d6c1b" +dependencies = [ + "errno", + "libc", +] + +[[package]] +name = "simd-adler32" +version = "0.3.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3a219298ac11a56ea9a6d2120044824d6f01aeb034955e7af7bc16858527deea" + +[[package]] +name = "simd_cesu8" +version = "1.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "11031e251abf8611c80f460e19dbdeb54a66db918e49c65a7065b46ac7aec520" +dependencies = [ + "rustc_version", + "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" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e3a9fe34e3e7a50316060351f37187a3f546bce95496156754b601a5fa71b76e" + +[[package]] +name = "simplecss" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7a9c6883ca9c3c7c90e888de77b7a5c849c779d25d74a1269b0218b14e8b136c" +dependencies = [ + "log", +] + +[[package]] +name = "siphasher" +version = "1.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "33f4fe9184a62d842c9ef383018f3306d8ba224fd9d836f56d7288308847c256" + +[[package]] +name = "skia-bindings" +version = "0.153.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "eb325787c91b3f6c34a7c6f2b8a2297b20292d733ca53a08c233e5028aec49af" +dependencies = [ + "bindgen", + "cc", + "flate2", + "heck", + "pkg-config", + "regex", + "serde_json", + "tar", + "toml 1.1.8+spec-1.1.0", +] + +[[package]] +name = "skia-safe" +version = "0.153.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c61cb643dac43067f3eb76c866635a74377ac0abca0ff2590674e1e295514c3d" +dependencies = [ + "bitflags 2.13.2", + "skia-bindings", + "windows", +] + +[[package]] +name = "skrifa" +version = "0.44.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "819ab7d62b1d3e72d9d9dea5650bac30424f9111364bb94928dbf5ecad1baa68" +dependencies = [ + "bytemuck", + "read-fonts", +] + +[[package]] +name = "slab" +version = "0.4.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0c790de23124f9ab44544d7ac05d60440adc586479ce501c1d6d7da3cd8c9cf5" + +[[package]] +name = "slint" +version = "1.18.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "15e477d5ff6fec20909100ff8f7062432ebfbda7a62a0f37d0252aa126f38c83" +dependencies = [ + "const-field-offset", + "i-slint-backend-linuxkms", + "i-slint-backend-selector", + "i-slint-common", + "i-slint-core", + "i-slint-core-macros", + "i-slint-renderer-femtovg", + "i-slint-renderer-software", + "num-traits", + "once_cell", + "pin-weak", + "slint-macros", + "unicode-segmentation", + "vtable", +] + +[[package]] +name = "slint-build" +version = "1.18.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3ea28d4e1ad47d829b91e227f17037fac07a8001668a93fee47ac04f88718ebc" +dependencies = [ + "derive_more", + "fontique", + "i-slint-compiler", + "spin_on", + "toml_edit", +] + +[[package]] +name = "slint-macros" +version = "1.18.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "35e74b13d20884dc480ce37d0fabbf02cb4bc0df2a595434feac96ca7c2a0f15" +dependencies = [ + "i-slint-compiler", + "proc-macro2", + "quote", + "spin_on", +] + +[[package]] +name = "slotmap" +version = "1.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bdd58c3c93c3d278ca835519292445cb4b0d4dc59ccfdf7ceadaab3f8aeb4038" +dependencies = [ + "version_check", +] + +[[package]] +name = "smallvec" +version = "1.16.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d0d5d4b1981b8bbbb7aed204cae5726d683d5d6ac7e74ec54122ea28f315e7c8" + +[[package]] +name = "smithay-client-toolkit" +version = "0.19.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3457dea1f0eb631b4034d61d4d8c32074caa6cd1ab2d59f2327bd8461e2c0016" +dependencies = [ + "bitflags 2.13.2", + "calloop 0.13.0", + "calloop-wayland-source", + "cursor-icon", + "libc", + "log", + "memmap2", + "rustix 0.38.44", + "thiserror 1.0.69", + "wayland-backend", + "wayland-client", + "wayland-csd-frame", + "wayland-cursor", + "wayland-protocols", + "wayland-protocols-wlr", + "wayland-scanner", + "xkeysym", +] + +[[package]] +name = "smol_str" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dd538fb6910ac1099850255cf94a94df6551fbdd602454387d0adb2d1ca6dead" +dependencies = [ + "serde", +] + +[[package]] +name = "smol_str" +version = "0.3.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "eeb7109d23f319619d4cc0de5464613c8b7b1a09db2774a58101459cf6be2f10" +dependencies = [ + "borsh", + "serde_core", +] + +[[package]] +name = "snafu" +version = "0.8.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6e84b3f4eacbf3a1ce05eac6763b4d629d60cbc94d632e4092c54ade71f1e1a2" +dependencies = [ + "snafu-derive", +] + +[[package]] +name = "snafu-derive" +version = "0.8.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c1c97747dbf44bb1ca44a561ece23508e99cb592e862f22222dcf42f51d1e451" +dependencies = [ + "heck", + "proc-macro2", + "quote", + "syn 2.0.119", +] + +[[package]] +name = "softbuffer" +version = "0.4.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "aac18da81ebbf05109ab275b157c22a653bb3c12cf884450179942f81bcbf6c3" +dependencies = [ + "as-raw-xcb-connection", + "bytemuck", + "fastrand", + "js-sys", + "memmap2", + "ndk", + "objc2 0.6.5", + "objc2-core-foundation", + "objc2-core-graphics", + "objc2-foundation 0.3.2", + "objc2-quartz-core 0.3.2", + "raw-window-handle", + "redox_syscall 0.5.18", + "rustix 1.1.5", + "tiny-xlib", + "tracing", + "wasm-bindgen", + "wayland-backend", + "wayland-client", + "wayland-sys", + "web-sys", + "windows-sys 0.61.2", + "x11rb", +] + +[[package]] +name = "spin_on" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "076e103ed41b9864aa838287efe5f4e3a7a0362dd00671ae62a212e5e4612da2" +dependencies = [ + "pin-utils", +] + +[[package]] +name = "spirv" +version = "0.4.0+sdk-1.4.341.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d9571ea910ebd84c86af4b3ed27f9dbdc6ad06f17c5f96146b2b671e2976744f" +dependencies = [ + "bitflags 2.13.2", +] + +[[package]] +name = "stable_deref_trait" +version = "1.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6ce2be8dc25455e1f91df71bfa12ad37d7af1092ae736f3a6cd0e37bc7810596" + +[[package]] +name = "static_assertions" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a2eb9349b6444b326872e140eb1cf5e7c522154d69e7a0ffb0fb81c06b37543f" + +[[package]] +name = "strict-num" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6637bab7722d379c8b41ba849228d680cc12d0a45ba1fa2b48f2a30577a06731" +dependencies = [ + "float-cmp", +] + +[[package]] +name = "strum" +version = "0.28.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9628de9b8791db39ceda2b119bbe13134770b56c138ec1d3af810d045c04f9bd" +dependencies = [ + "strum_macros", +] + +[[package]] +name = "strum_macros" +version = "0.28.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ab85eea0270ee17587ed4156089e10b9e6880ee688791d45a905f5b1ca36f664" +dependencies = [ + "heck", + "proc-macro2", + "quote", + "syn 2.0.119", +] + +[[package]] +name = "subtle" +version = "2.6.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "13c2bddecc57b384dee18652358fb23172facb8a2c51ccc10d74c157bdea3292" + +[[package]] +name = "svgtypes" +version = "0.16.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "695b5790b3131dafa99b3bbfd25a216edb3d216dad9ca208d4657bfb8f2abc3d" +dependencies = [ + "kurbo", + "siphasher", +] + +[[package]] +name = "swash" +version = "0.2.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6c2499c2d826531388872b2268718aed907a39bd785ab0dcfe57fab26283f92e" +dependencies = [ + "skrifa", + "yazi", + "zeno", +] + +[[package]] +name = "syn" +version = "2.0.119" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "872831b642d1a07999a962a351ed35b955ea2cfc8f3862091e2a240a84f17297" +dependencies = [ + "proc-macro2", + "quote", + "unicode-ident", +] + +[[package]] +name = "syn" +version = "3.0.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d78c8dee4c7bf0e14673097256fed6142ce9d3b85a408189d07482442145823b" +dependencies = [ + "proc-macro2", + "quote", + "unicode-ident", +] + +[[package]] +name = "synstructure" +version = "0.14.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "901704edd0dfe137f1987838ee4f259e4e063c31371bdb423f7ae38ec6f77f02" +dependencies = [ + "proc-macro2", + "quote", + "syn 3.0.9", +] + +[[package]] +name = "sys-locale" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8eab9a99a024a169fe8a903cf9d4a3b3601109bcc13bd9e3c6fff259138626c4" +dependencies = [ + "js-sys", + "libc", + "wasm-bindgen", + "web-sys", +] + +[[package]] +name = "system-deps" +version = "9.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "db551ad38aac61d5e0343e0eeeb0163be3115c4e23b6a025959570ee0c03c67d" +dependencies = [ + "cfg-expr", + "heck", + "pkg-config", + "toml 1.1.8+spec-1.1.0", + "version-compare", +] + +[[package]] +name = "taffy" +version = "0.10.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "aea22054047c16c3f34d3ac473a2170be1424b1115b2a3adcf28cfb067c88859" +dependencies = [ + "arrayvec", + "grid", + "serde", + "slotmap", +] + +[[package]] +name = "tar" +version = "0.4.46" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3f6221d9a6003c78398e3b239969f352578258df48c8eb051caadae0015bc840" +dependencies = [ + "filetime", + "libc", + "xattr", +] + +[[package]] +name = "target-lexicon" +version = "0.13.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "adb6935a6f5c20170eeceb1a3835a49e12e19d792f6dd344ccc76a985ca5a6ca" + +[[package]] +name = "task-local" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2972044a9e5e448a506a7ff6f0d03b566d8ef4cd6918a58fc59835a0f8666626" +dependencies = [ + "pin-project-lite", +] + +[[package]] +name = "tempfile" +version = "3.27.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "32497e9a4c7b38532efcdebeef879707aa9f794296a4f0244f6f69e9bc8574bd" +dependencies = [ + "fastrand", + "getrandom 0.4.3", + "once_cell", + "rustix 1.1.5", + "windows-sys 0.61.2", +] + +[[package]] +name = "text-size" +version = "1.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f18aa187839b2bdb1ad2fa35ead8c4c2976b64e4363c386d45ac0f7ee85c9233" + +[[package]] +name = "thiserror" +version = "1.0.69" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b6aaf5339b578ea85b50e080feb250a3e8ae8cfcdff9a461c9ec2904bc923f52" +dependencies = [ + "thiserror-impl 1.0.69", +] + +[[package]] +name = "thiserror" +version = "2.0.21" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "09e52cb86a36cede5cb101bf8908837b3e4c6e5e59fe7fd85c23fb56200d189e" +dependencies = [ + "thiserror-impl 2.0.21", +] + +[[package]] +name = "thiserror-impl" +version = "1.0.69" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4fee6c4efc90059e10f81e6d42c60a18f76588c3d74cb83a0b242a2b6c7504c1" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.119", +] + +[[package]] +name = "thiserror-impl" +version = "2.0.21" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fe5197923287db20a58125f0bc85c062f7f2c892de97b18c356f9efb14b28524" +dependencies = [ + "proc-macro2", + "quote", + "syn 3.0.9", +] + +[[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.55" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cdb87b95ec50ddfa440816d227a17b2ccbdda963a316a727fda0fc4334f7d134" +dependencies = [ + "deranged", + "num-conv", + "powerfmt", + "serde_core", + "time-core", + "time-macros", +] + +[[package]] +name = "time-core" +version = "0.1.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9e1c906769ad99c88eaa54e728060edef082f8e358ff32030cb7c7d315e81109" + +[[package]] +name = "time-macros" +version = "0.2.32" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7e689342a48d2ea927c87ea50cabf8594854bf940e9310208848d680d668ed85" +dependencies = [ + "num-conv", + "time-core", +] + +[[package]] +name = "tiny-skia" +version = "0.11.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "83d13394d44dae3207b52a326c0c85a8bf87f1541f23b0d143811088497b09ab" +dependencies = [ + "arrayref", + "arrayvec", + "bytemuck", + "cfg-if", + "log", + "tiny-skia-path 0.11.4", +] + +[[package]] +name = "tiny-skia" +version = "0.12.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "47ffee5eaaf5527f630fb0e356b90ebdec84d5d18d937c5e440350f88c5a91ea" +dependencies = [ + "arrayref", + "arrayvec", + "bytemuck", + "cfg-if", + "log", + "png", + "tiny-skia-path 0.12.0", +] + +[[package]] +name = "tiny-skia-path" +version = "0.11.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9c9e7fc0c2e86a30b117d0462aa261b72b7a99b7ebd7deb3a14ceda95c5bdc93" +dependencies = [ + "arrayref", + "bytemuck", + "strict-num", +] + +[[package]] +name = "tiny-skia-path" +version = "0.12.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "edca365c3faccca67d06593c5980fa6c57687de727a03131735bb85f01fdeeb9" +dependencies = [ + "arrayref", + "bytemuck", + "strict-num", +] + +[[package]] +name = "tiny-xlib" +version = "0.2.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a90a0ca3ee6a69f2ad28fd11621a4c3f03b371f366be500b64df260c4ffbafb4" +dependencies = [ + "as-raw-xcb-connection", + "ctor", + "libloading", + "pkg-config", + "tracing", +] + +[[package]] +name = "tinystr" +version = "0.8.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "abc840c238154d58f9e86b2792261edfde565a17696e1cda1a449de27979801a" +dependencies = [ + "displaydoc", + "serde_core", + "zerovec", +] + +[[package]] +name = "tinyvec" +version = "1.13.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fd3ca314f692efd6c868f8408f53fe444634a845f96c028b97d35f6a1f79f0ee" + +[[package]] +name = "tokio" +version = "1.54.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b52fd3255258d26fac7264ab5a76b53c13367136dc011d3d6ad4f8ed070396a3" +dependencies = [ + "pin-project-lite", +] + +[[package]] +name = "toml" +version = "0.9.12+spec-1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cf92845e79fc2e2def6a5d828f0801e29a2f8acc037becc5ab08595c7d5e9863" +dependencies = [ + "indexmap", + "serde_core", + "serde_spanned", + "toml_datetime 0.7.5+spec-1.1.0", + "toml_parser", + "toml_writer", + "winnow 0.7.15", +] + +[[package]] +name = "toml" +version = "1.1.8+spec-1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "20489e00e4d8741d6be680764cc12e270655e375a20d1011e844a9c3379e678d" +dependencies = [ + "indexmap", + "serde_core", + "serde_spanned", + "toml_datetime 1.1.2+spec-1.1.0", + "toml_parser", + "toml_writer", + "winnow 1.0.4", +] + +[[package]] +name = "toml_datetime" +version = "0.7.5+spec-1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "92e1cfed4a3038bc5a127e35a2d360f145e1f4b971b551a2ba5fd7aedf7e1347" +dependencies = [ + "serde_core", +] + +[[package]] +name = "toml_datetime" +version = "1.1.2+spec-1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2b86d767906c6c42421dcba507eb9d203e779497710a47782a224bb871653053" +dependencies = [ + "serde_core", +] + +[[package]] +name = "toml_edit" +version = "0.25.17+spec-1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e3641d5bbb5349a79e1020a242d251efbc546ad8048d133958323ce9c40a9c9c" +dependencies = [ + "indexmap", + "toml_datetime 1.1.2+spec-1.1.0", + "toml_parser", + "toml_writer", + "winnow 1.0.4", +] + +[[package]] +name = "toml_parser" +version = "1.1.5+spec-1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "baa693a8032d7e1cada7d0041e96126df243179ff061456783ac7f12bda4744c" +dependencies = [ + "winnow 1.0.4", +] + +[[package]] +name = "toml_writer" +version = "1.1.3+spec-1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "06bdbd8cfc056b8d2e2e85f29b56a3bdbecb527cef81eb39e3e7b98af4652770" + +[[package]] +name = "tracing" +version = "0.1.44" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "63e71662fa4b2a2c3a26f570f037eb95bb1f85397f3cd8076caed2f026a6d100" +dependencies = [ + "log", + "pin-project-lite", + "tracing-attributes", + "tracing-core", +] + +[[package]] +name = "tracing-attributes" +version = "0.1.31" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7490cfa5ec963746568740651ac6781f701c9c5ea257c58e057f3ba8cf69e8da" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.119", +] + +[[package]] +name = "tracing-core" +version = "0.1.36" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "db97caf9d906fbde555dd62fa95ddba9eecfd14cb388e4f491a66d74cd5fb79a" +dependencies = [ + "once_cell", +] + +[[package]] +name = "tree_magic_mini" +version = "3.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b8765b90061cba6c22b5831f675da109ae5561588290f9fa2317adab2714d5a6" +dependencies = [ + "memchr", + "nom 8.0.0", + "petgraph", +] + +[[package]] +name = "ttf-parser" +version = "0.25.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d2df906b07856748fa3f6e0ad0cbaa047052d4a7dd609e231c4f72cee8c36f31" + +[[package]] +name = "typed-index-collections" +version = "3.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "898160f1dfd383b4e92e17f0512a7d62f3c51c44937b23b6ffc3a1614a8eaccd" +dependencies = [ + "bincode", + "serde", +] + +[[package]] +name = "udev" +version = "0.9.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "af4e37e9ea4401fc841ff54b9ddfc9be1079b1e89434c1a6a865dd68980f7e9f" +dependencies = [ + "io-lifetimes", + "libc", + "libudev-sys", + "pkg-config", +] + +[[package]] +name = "uds_windows" +version = "1.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f2f6fb2847f6742cd76af783a2a2c49e9375d0a111c7bef6f71cd9e738c72d6e" +dependencies = [ + "memoffset", + "tempfile", + "windows-sys 0.61.2", +] + +[[package]] +name = "unicase" +version = "2.10.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "357cc3acc6a036009fd6c973ed009037c732d60d0b4f6c673e9041497482a28f" + +[[package]] +name = "unicode-bidi" +version = "0.3.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5c1cb5db39152898a79168971543b1cb5020dff7fe43c8dc468b0885f5e29df5" + +[[package]] +name = "unicode-ident" +version = "1.0.27" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a2c754d6c33795a1c324727428e5a7dedb5b06195f9890bdbcba760d3e246563" + +[[package]] +name = "unicode-linebreak" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3b09c83c3c29d37506a3e260c08c03743a6bb66a9cd432c6934ab501a190571f" + +[[package]] +name = "unicode-script" +version = "0.5.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "383ad40bb927465ec0ce7720e033cb4ca06912855fc35db31b5755d0de75b1ee" + +[[package]] +name = "unicode-segmentation" +version = "1.13.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c6f5d3c3b1bf09027a88a6bc961fc00497d651009560b5463668dc81b0fa87a8" + +[[package]] +name = "unicode-vo" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b1d386ff53b415b7fe27b50bb44679e2cc4660272694b7b6f3326d8480823a94" + +[[package]] +name = "unicode-width" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b4ac048d71ede7ee76d585517add45da530660ef4390e49b098733c6e897f254" + +[[package]] +name = "unicode-xid" +version = "0.2.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ebc1c04c71510c7f702b52b7c350734c9ff1295c464a03335b00bb84fc54f853" + +[[package]] +name = "untrusted" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8ecb6da28b8a351d773b68d5825ac39017e680750f980f3a1a85cd8dd28a47c1" + +[[package]] +name = "unty" +version = "0.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6d49784317cd0d1ee7ec5c716dd598ec5b4483ea832a2dced265471cc0f690ae" + +[[package]] +name = "ureq" +version = "3.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cde93ff05758a36a851a398a772b0b79a82fbe3c186a46f2696baaeaf84c966b" +dependencies = [ + "base64", + "cookie_store", + "flate2", + "log", + "percent-encoding", + "rustls", + "rustls-pki-types", + "serde", + "serde_json", + "ureq-proto", + "utf8-zero", + "webpki-roots", +] + +[[package]] +name = "ureq-proto" +version = "0.6.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "841583fc36089d7d59419568ae157f43a5a03a2e5a81ba87c77d1596ef46e922" +dependencies = [ + "base64", + "http", + "httparse", + "log", +] + +[[package]] +name = "url" +version = "2.5.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ff67a8a4397373c3ef660812acab3268222035010ab8680ec4215f38ba3d0eed" +dependencies = [ + "form_urlencoded", + "idna", + "percent-encoding", + "serde", +] + +[[package]] +name = "usvg" +version = "0.48.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "977d0a4abdef933f424a99fe09f95576e089b90aebc6f016a3bc813762493e91" +dependencies = [ + "base64", + "data-url", + "flate2", + "fontdb", + "harfrust", + "imagesize", + "kurbo", + "log", + "pico-args", + "roxmltree", + "simplecss", + "siphasher", + "skrifa", + "strict-num", + "svgtypes", + "tiny-skia-path 0.12.0", + "unicode-bidi", + "unicode-script", + "unicode-vo", + "xmlwriter", +] + +[[package]] +name = "utf8-zero" +version = "0.8.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b8c0a043c9540bae7c578c88f91dda8bd82e59ae27c21baca69c8b191aaf5a6e" + +[[package]] +name = "utf8_iter" +version = "1.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b6c140620e7ffbb22c2dee59cafe6084a59b5ffc27a8859a5f0d494b5d52b6be" + +[[package]] +name = "utf8parse" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "06abde3611657adf66d383f00b093d7faecc7fa57071cce2578660c9f1010821" + +[[package]] +name = "uuid" +version = "1.29.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4a0e2d11620c50695fe12bbbfde96b3477fe606e7284c22d505c12ce51214514" +dependencies = [ + "js-sys", + "serde_core", + "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-compare" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "03c2856837ef78f57382f06b2b8563a2f512f7185d732608fd9176cb3b8edf0e" + +[[package]] +name = "version_check" +version = "0.9.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0b928f33d975fc6ad9f86c8f283853ad26bdd5b10b7f1542aa2fa15e2289105a" + +[[package]] +name = "vtable" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "515a4b5b1399cc46fb0dc4081436cb40a3852a2d3e94fd1fa50bb68a334896eb" +dependencies = [ + "const-field-offset", + "portable-atomic", + "stable_deref_trait", + "vtable-macro", +] + +[[package]] +name = "vtable-macro" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8191d73ececf73fc94e65809bf0e667525a0bcff9aeeb8d042a4173a508332a1" +dependencies = [ + "proc-macro2", + "quote", + "syn 3.0.9", +] + +[[package]] +name = "walkdir" +version = "2.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "29790946404f91d9c5d06f9874efddea1dc06c5efe94541a7d6863108e3a5e4b" +dependencies = [ + "same-file", + "winapi-util", +] + +[[package]] +name = "wasi" +version = "0.11.1+wasi-snapshot-preview1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ccf3ec651a847eb01de73ccad15eb7d99f80485de043efb2f370cd654f4ea44b" + +[[package]] +name = "wasip2" +version = "1.0.4+wasi-0.2.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b67efb37e106e55ce722a510d6b5f9c17f083e5fc79afc2badeb12cc313d9487" +dependencies = [ + "wit-bindgen", +] + +[[package]] +name = "wasm-bindgen" +version = "0.2.129" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9bb54f33acc68fd454578d9820b0bde1a1a3d17aa17bb7b6595806d02886d409" +dependencies = [ + "cfg-if", + "once_cell", + "rustversion", + "wasm-bindgen-macro", + "wasm-bindgen-shared", +] + +[[package]] +name = "wasm-bindgen-futures" +version = "0.4.79" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3cbab34de2d982e9b48e18d216d04c4a6f641066ff19ffb699980f591ee3610e" +dependencies = [ + "js-sys", + "tokio", + "wasm-bindgen", +] + +[[package]] +name = "wasm-bindgen-macro" +version = "0.2.129" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2e29d0c35b16e224a7eeb5cd2d25e3e1968fbd65604117b44d3b789d00ee8535" +dependencies = [ + "quote", + "wasm-bindgen-macro-support", +] + +[[package]] +name = "wasm-bindgen-macro-support" +version = "0.2.129" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6f501a8bc3719dba86ef8ae4728879c08001bea749eb1333ac5b91e040e2a6b7" +dependencies = [ + "bumpalo", + "proc-macro2", + "quote", + "syn 3.0.9", + "wasm-bindgen-shared", +] + +[[package]] +name = "wasm-bindgen-shared" +version = "0.2.129" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "23f0c9c52aa7cd7d77769a4cfe2a9adb1b331f489a41d912ce14513d5ab995c6" +dependencies = [ + "unicode-ident", +] + +[[package]] +name = "wayland-backend" +version = "0.3.17" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "38a91b4eaddff87b1cd1074985e3713da4af2c49742d1b356b2c01670a67a078" +dependencies = [ + "cc", + "downcast-rs", + "rustix 1.1.5", + "scoped-tls", + "smallvec", + "wayland-sys", +] + +[[package]] +name = "wayland-client" +version = "0.31.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e3c36a0f861ad76d0901f2800b46321410d9f73f2ea88aac0650d86c32688073" +dependencies = [ + "bitflags 2.13.2", + "rustix 1.1.5", + "wayland-backend", + "wayland-scanner", +] + +[[package]] +name = "wayland-csd-frame" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "625c5029dbd43d25e6aa9615e88b829a5cad13b2819c4ae129fdbb7c31ab4c7e" +dependencies = [ + "bitflags 2.13.2", + "cursor-icon", + "wayland-backend", +] + +[[package]] +name = "wayland-cursor" +version = "0.31.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4a52d18780be9b1314328a3de5f930b73d2200112e3849ca6cb11822793fb34d" +dependencies = [ + "rustix 1.1.5", + "wayland-client", + "xcursor", +] + +[[package]] +name = "wayland-protocols" +version = "0.32.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "23d0c813de3daa2ed6520af85a3bd49b0e722a3078506899aa9686fea58dc4b6" +dependencies = [ + "bitflags 2.13.2", + "wayland-backend", + "wayland-client", + "wayland-scanner", +] + +[[package]] +name = "wayland-protocols-plasma" +version = "0.3.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2b6d8cf1eb2c1c31ed1f5643c88a6e53538129d4af80030c8cabd1f9fa884d91" +dependencies = [ + "bitflags 2.13.2", + "wayland-backend", + "wayland-client", + "wayland-protocols", + "wayland-scanner", +] + +[[package]] +name = "wayland-protocols-wlr" +version = "0.3.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "eb04e52f7836d7c7976c78ca0250d61e33873c34156a2a1fc9474828ec268234" +dependencies = [ + "bitflags 2.13.2", + "wayland-backend", + "wayland-client", + "wayland-protocols", + "wayland-scanner", +] + +[[package]] +name = "wayland-scanner" +version = "0.31.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "338e30461b3a2b67d70eb30a6d89f8e0c93a833e07d2ae89085cd070c4a00ac0" +dependencies = [ + "proc-macro2", + "quick-xml", + "quote", +] + +[[package]] +name = "wayland-sys" +version = "0.31.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d8eab23fefc9e41f8e841df4a9c707e8a8c4ed26e944ef69297184de2785e3be" +dependencies = [ + "dlib", + "log", + "once_cell", + "pkg-config", +] + +[[package]] +name = "web-sys" +version = "0.3.106" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "88261b9deccee56594c11a3460c462c41f58d148598fe70ad77070126a68aba4" +dependencies = [ + "js-sys", + "wasm-bindgen", +] + +[[package]] +name = "web-time" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5a6580f308b1fad9207618087a65c04e7a10bc77e02c8e84e9b00dd4b12fa0bb" +dependencies = [ + "js-sys", + "wasm-bindgen", +] + +[[package]] +name = "webbrowser" +version = "1.2.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d2c8ddfbbf66e501434657400268cefe51b95140a0266236415cda7627732df7" +dependencies = [ + "jni", + "log", + "ndk-context", + "objc2 0.6.5", + "objc2-app-kit 0.3.2", + "objc2-foundation 0.3.2", + "url", + "web-sys", +] + +[[package]] +name = "webpki-roots" +version = "1.0.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f5f280bbb2b287bc8e7de7e3852945a0ff50d1bbcb5ed42b6c7a568c546df171" +dependencies = [ + "rustls-pki-types", +] + +[[package]] +name = "weezl" +version = "0.1.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a28ac98ddc8b9274cb41bb4d9d4d5c425b6020c50c46f25559911905610b4a88" + +[[package]] +name = "wgpu" +version = "30.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "527ccdf43dd5b2e8676eed9984ce00e2bbb0a1b85b70c1969dcb6cd2eb55ab9e" +dependencies = [ + "arrayvec", + "bitflags 2.13.2", + "bytemuck", + "cfg-if", + "cfg_aliases", + "document-features", + "hashbrown 0.17.1", + "log", + "portable-atomic", + "profiling", + "raw-window-handle", + "smallvec", + "static_assertions", + "wgpu-core", + "wgpu-hal", + "wgpu-types", +] + +[[package]] +name = "wgpu-core" +version = "30.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "14c018fce9b6270aa203c2fdd56f3cce996713534bd757e4ea58c8560b121f14" +dependencies = [ + "arrayvec", + "bit-set", + "bit-vec", + "bitflags 2.13.2", + "bytemuck", + "cfg_aliases", + "document-features", + "hashbrown 0.17.1", + "indexmap", + "log", + "naga", + "naga-types", + "once_cell", + "parking_lot", + "portable-atomic", + "profiling", + "raw-window-handle", + "rustc-hash 1.1.0", + "smallvec", + "thiserror 2.0.21", + "wgpu-core-deps-apple", + "wgpu-core-deps-windows-linux-android", + "wgpu-hal", + "wgpu-naga-bridge", + "wgpu-types", +] + +[[package]] +name = "wgpu-core-deps-apple" +version = "30.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "061f3d319a40d39d00b1ecc2c33b89fe21d4e6fe01859df3500a3a8ecccd6b68" +dependencies = [ + "wgpu-hal", +] + +[[package]] +name = "wgpu-core-deps-windows-linux-android" +version = "30.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7586165fd5f6d881cb9ce4bb71f40d6caab2c0f1837e3fc1d9788a197fb6004f" +dependencies = [ + "wgpu-hal", +] + +[[package]] +name = "wgpu-hal" +version = "30.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b6b7fb58561a792bc237628ba0792e332de418fefe145f13b5ed8201e6d52f58" +dependencies = [ + "android_system_properties", + "arrayvec", + "ash", + "bit-set", + "bitflags 2.13.2", + "block2 0.6.2", + "bytemuck", + "cfg-if", + "cfg_aliases", + "gpu-allocator", + "hashbrown 0.17.1", + "libc", + "libloading", + "log", + "naga", + "naga-types", + "objc2 0.6.5", + "objc2-core-foundation", + "objc2-core-graphics", + "objc2-foundation 0.3.2", + "objc2-metal 0.3.2", + "objc2-quartz-core 0.3.2", + "once_cell", + "ordered-float", + "parking_lot", + "portable-atomic", + "portable-atomic-util", + "profiling", + "range-alloc", + "raw-window-handle", + "raw-window-metal", + "renderdoc-sys", + "smallvec", + "static_assertions", + "thiserror 2.0.21", + "wgpu-naga-bridge", + "wgpu-types", + "windows", + "windows-core", +] + +[[package]] +name = "wgpu-naga-bridge" +version = "30.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d2f62e73117bb7a62bfd9c5a5841438a823f6566c6442a808ee269d2d055c081" +dependencies = [ + "naga", + "wgpu-types", +] + +[[package]] +name = "wgpu-types" +version = "30.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "99dad6f1fbdbbdb4c278a6508b059d44688f5cebddf78d005a46a31340269286" +dependencies = [ + "bitflags 2.13.2", + "bytemuck", + "log", + "naga-types", + "raw-window-handle", + "static_assertions", +] + +[[package]] +name = "winapi-util" +version = "0.1.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c2a7b1c03c876122aa43f3020e6c3c3ee5c05081c9a00739faf7503aeba10d22" +dependencies = [ + "windows-sys 0.61.2", +] + +[[package]] +name = "windows" +version = "0.62.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "527fadee13e0c05939a6a05d5bd6eec6cd2e3dbd648b9f8e447c6518133d8580" +dependencies = [ + "windows-collections", + "windows-core", + "windows-future", + "windows-numerics", +] + +[[package]] +name = "windows-collections" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "23b2d95af1a8a14a3c7367e1ed4fc9c20e0a26e79551b1454d72583c97cc6610" +dependencies = [ + "windows-core", +] + +[[package]] +name = "windows-core" +version = "0.62.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b8e83a14d34d0623b51dce9581199302a221863196a1dde71a7663a4c2be9deb" +dependencies = [ + "windows-implement", + "windows-interface", + "windows-link", + "windows-result", + "windows-strings", +] + +[[package]] +name = "windows-future" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e1d6f90251fe18a279739e78025bd6ddc52a7e22f921070ccdc67dde84c605cb" +dependencies = [ + "windows-core", + "windows-link", + "windows-threading", +] + +[[package]] +name = "windows-implement" +version = "0.60.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "053e2e040ab57b9dc951b72c264860db7eb3b0200ba345b4e4c3b14f67855ddf" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.119", +] + +[[package]] +name = "windows-interface" +version = "0.59.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3f316c4a2570ba26bbec722032c4099d8c8bc095efccdc15688708623367e358" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.119", +] + +[[package]] +name = "windows-link" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f0805222e57f7521d6a62e36fa9163bc891acd422f971defe97d64e70d0a4fe5" + +[[package]] +name = "windows-numerics" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6e2e40844ac143cdb44aead537bbf727de9b044e107a0f1220392177d15b0f26" +dependencies = [ + "windows-core", + "windows-link", +] + +[[package]] +name = "windows-result" +version = "0.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7781fa89eaf60850ac3d2da7af8e5242a5ea78d1a11c49bf2910bb5a73853eb5" +dependencies = [ + "windows-link", +] + +[[package]] +name = "windows-strings" +version = "0.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7837d08f69c77cf6b07689544538e017c1bfcf57e34b4c0ff58e6c2cd3b37091" +dependencies = [ + "windows-link", +] + +[[package]] +name = "windows-sys" +version = "0.48.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "677d2418bec65e3338edb076e806bc1ec15693c5d0104683f2efe857f61056a9" +dependencies = [ + "windows-targets 0.48.5", +] + +[[package]] +name = "windows-sys" +version = "0.52.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "282be5f36a8ce781fad8c8ae18fa3f9beff57ec1b52cb3de0789201425d9a33d" +dependencies = [ + "windows-targets 0.52.6", +] + +[[package]] +name = "windows-sys" +version = "0.59.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1e38bc4d79ed67fd075bcc251a1c39b32a1776bbe92e5bef1f0bf1f8c531853b" +dependencies = [ + "windows-targets 0.52.6", +] + +[[package]] +name = "windows-sys" +version = "0.61.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ae137229bcbd6cdf0f7b80a31df61766145077ddf49416a728b02cb3921ff3fc" +dependencies = [ + "windows-link", +] + +[[package]] +name = "windows-targets" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9a2fa6e2155d7247be68c096456083145c183cbbbc2764150dda45a87197940c" +dependencies = [ + "windows_aarch64_gnullvm 0.48.5", + "windows_aarch64_msvc 0.48.5", + "windows_i686_gnu 0.48.5", + "windows_i686_msvc 0.48.5", + "windows_x86_64_gnu 0.48.5", + "windows_x86_64_gnullvm 0.48.5", + "windows_x86_64_msvc 0.48.5", +] + +[[package]] +name = "windows-targets" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9b724f72796e036ab90c1021d4780d4d3d648aca59e491e6b98e725b84e99973" +dependencies = [ + "windows_aarch64_gnullvm 0.52.6", + "windows_aarch64_msvc 0.52.6", + "windows_i686_gnu 0.52.6", + "windows_i686_gnullvm", + "windows_i686_msvc 0.52.6", + "windows_x86_64_gnu 0.52.6", + "windows_x86_64_gnullvm 0.52.6", + "windows_x86_64_msvc 0.52.6", +] + +[[package]] +name = "windows-threading" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3949bd5b99cafdf1c7ca86b43ca564028dfe27d66958f2470940f73d86d75b37" +dependencies = [ + "windows-link", +] + +[[package]] +name = "windows_aarch64_gnullvm" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2b38e32f0abccf9987a4e3079dfb67dcd799fb61361e53e2882c3cbaf0d905d8" + +[[package]] +name = "windows_aarch64_gnullvm" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "32a4622180e7a0ec044bb555404c800bc9fd9ec262ec147edd5989ccd0c02cd3" + +[[package]] +name = "windows_aarch64_msvc" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dc35310971f3b2dbbf3f0690a219f40e2d9afcf64f9ab7cc1be722937c26b4bc" + +[[package]] +name = "windows_aarch64_msvc" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "09ec2a7bb152e2252b53fa7803150007879548bc709c039df7627cabbd05d469" + +[[package]] +name = "windows_i686_gnu" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a75915e7def60c94dcef72200b9a8e58e5091744960da64ec734a6c6e9b3743e" + +[[package]] +name = "windows_i686_gnu" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8e9b5ad5ab802e97eb8e295ac6720e509ee4c243f69d781394014ebfe8bbfa0b" + +[[package]] +name = "windows_i686_gnullvm" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0eee52d38c090b3caa76c563b86c3a4bd71ef1a819287c19d586d7334ae8ed66" + +[[package]] +name = "windows_i686_msvc" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8f55c233f70c4b27f66c523580f78f1004e8b5a8b659e05a4eb49d4166cca406" + +[[package]] +name = "windows_i686_msvc" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "240948bc05c5e7c6dabba28bf89d89ffce3e303022809e73deaefe4f6ec56c66" + +[[package]] +name = "windows_x86_64_gnu" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "53d40abd2583d23e4718fddf1ebec84dbff8381c07cae67ff7768bbf19c6718e" + +[[package]] +name = "windows_x86_64_gnu" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "147a5c80aabfbf0c7d901cb5895d1de30ef2907eb21fbbab29ca94c5b08b1a78" + +[[package]] +name = "windows_x86_64_gnullvm" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0b7b52767868a23d5bab768e390dc5f5c55825b6d30b86c844ff2dc7414044cc" + +[[package]] +name = "windows_x86_64_gnullvm" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "24d5b23dc417412679681396f2b49f3de8c1473deb516bd34410872eff51ed0d" + +[[package]] +name = "windows_x86_64_msvc" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ed94fce61571a4006852b7389a063ab983c02eb1bb37b47f8272ce92d06d9538" + +[[package]] +name = "windows_x86_64_msvc" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "589f6da84c646204747d1270a2a5661ea66ed1cced2631d546fdfb155959f9ec" + +[[package]] +name = "winit" +version = "0.30.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a6755fa58a9f8350bd1e472d4c3fcc25f824ec358933bba33306d0b63df5978d" +dependencies = [ + "ahash", + "android-activity", + "atomic-waker", + "bitflags 2.13.2", + "block2 0.5.1", + "bytemuck", + "calloop 0.13.0", + "cfg_aliases", + "concurrent-queue", + "core-foundation", + "core-graphics", + "cursor-icon", + "dpi", + "js-sys", + "libc", + "memmap2", + "ndk", + "objc2 0.5.3", + "objc2-app-kit 0.2.2", + "objc2-foundation 0.2.2", + "objc2-ui-kit 0.2.2", + "orbclient", + "percent-encoding", + "pin-project", + "raw-window-handle", + "redox_syscall 0.4.1", + "rustix 0.38.44", + "sctk-adwaita", + "smithay-client-toolkit", + "smol_str 0.2.2", + "tracing", + "unicode-segmentation", + "wasm-bindgen", + "wasm-bindgen-futures", + "wayland-backend", + "wayland-client", + "wayland-protocols", + "wayland-protocols-plasma", + "web-sys", + "web-time", + "windows-sys 0.52.0", + "x11-dl", + "x11rb", + "xkbcommon-dl", +] + +[[package]] +name = "winnow" +version = "0.7.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "df79d97927682d2fd8adb29682d1140b343be4ac0f08fd68b7765d9c059d3945" + +[[package]] +name = "winnow" +version = "1.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "23b97319f7b8343df12cc98938e5c3eb436064524c8d2b4e30a1d3a36eecdf81" +dependencies = [ + "memchr", +] + +[[package]] +name = "wit-bindgen" +version = "0.57.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1ebf944e87a7c253233ad6766e082e3cd714b5d03812acc24c318f549614536e" + +[[package]] +name = "wl-clipboard-rs" +version = "0.9.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4d7888ccd4896447b2d14d3a9350a85df2aeb6f181e2e7a31349d104ac46cac1" +dependencies = [ + "libc", + "log", + "os_pipe", + "rustix 1.1.5", + "thiserror 2.0.21", + "tree_magic_mini", + "wayland-backend", + "wayland-client", + "wayland-protocols", + "wayland-protocols-wlr", +] + +[[package]] +name = "write-fonts" +version = "0.50.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cae90d1d9f6d1d36ef116b0b1e651a6d7c12ba925439d4d06ff9adc94662a3d8" +dependencies = [ + "font-types", + "indexmap", + "kurbo", + "log", + "read-fonts", +] + +[[package]] +name = "writeable" +version = "0.6.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3ad82d2a33cdc9674dc7465672f271e096168fcdbe0f799d9e6db8c5892679dc" + +[[package]] +name = "x11-dl" +version = "2.21.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "38735924fedd5314a6e548792904ed8c6de6636285cb9fec04d5b1db85c1516f" +dependencies = [ + "libc", + "once_cell", + "pkg-config", +] + +[[package]] +name = "x11rb" +version = "0.13.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9993aa5be5a26815fe2c3eacfc1fde061fc1a1f094bf1ad2a18bf9c495dd7414" +dependencies = [ + "as-raw-xcb-connection", + "gethostname", + "libc", + "libloading", + "once_cell", + "rustix 1.1.5", + "x11rb-protocol", +] + +[[package]] +name = "x11rb-protocol" +version = "0.13.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ea6fc2961e4ef194dcbfe56bb845534d0dc8098940c7e5c012a258bfec6701bd" + +[[package]] +name = "xattr" +version = "1.6.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "32e45ad4206f6d2479085147f02bc2ef834ac85886624a23575ae137c8aa8156" +dependencies = [ + "libc", + "rustix 1.1.5", +] + +[[package]] +name = "xcursor" +version = "0.3.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "163b33ed8786455e2fa5d72f554057ce3f3182425434f756cd39c99839d88e23" + +[[package]] +name = "xkbcommon" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a7a974f48060a14e95705c01f24ad9c3345022f4d97441b8a36beb7ed5c4a02d" +dependencies = [ + "libc", + "memmap2", + "xkeysym", +] + +[[package]] +name = "xkbcommon-dl" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d039de8032a9a8856a6be89cea3e5d12fdd82306ab7c94d74e6deab2460651c5" +dependencies = [ + "bitflags 2.13.2", + "dlib", + "log", + "once_cell", + "xkeysym", +] + +[[package]] +name = "xkeysym" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b9cc00251562a284751c9973bace760d86c0276c471b4be569fe6b068ee97a56" + +[[package]] +name = "xml-rs" +version = "0.8.29" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e450f9b2ed1dff33c94c12589a87338689467b9c4f5d8a5710bd09a847d2c8a7" + +[[package]] +name = "xmlwriter" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ec7a2a501ed189703dba8b08142f057e887dfc4b2cc4db2d343ac6376ba3e0b9" + +[[package]] +name = "y4m" +version = "0.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7a5a4b21e1a62b67a2970e6831bc091d7b87e119e7f9791aef9702e3bef04448" + +[[package]] +name = "yazi" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e01738255b5a16e78bbb83e7fbba0a1e7dd506905cfc53f4622d89015a03fbb5" + +[[package]] +name = "yeslogic-fontconfig-sys" +version = "6.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1d8b8abf912b9a29ff112e1671c97c33636903d13a69712037190e6805af4f76" +dependencies = [ + "dlib", + "once_cell", + "pkg-config", +] + +[[package]] +name = "yoke" +version = "0.8.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "417ef3fcf6c300b7dbd25c85531a746931c02ad536f3cf4786ed1e88223340b3" +dependencies = [ + "stable_deref_trait", + "yoke-derive", + "zerofrom", +] + +[[package]] +name = "yoke-derive" +version = "0.8.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ec8ebde2db3681e8c9980cc27822030e68752690ddfa9473e739aeb4dbde6d71" +dependencies = [ + "proc-macro2", + "quote", + "syn 3.0.9", + "synstructure", +] + +[[package]] +name = "zbus" +version = "5.19.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5db4be7c075cb421e4b7ee645541604239bd243ba7c357511f4ff3a74b555907" +dependencies = [ + "async-broadcast", + "async-executor", + "async-io", + "async-lock", + "async-process", + "async-recursion", + "async-task", + "async-trait", + "blocking", + "enumflags2", + "event-listener", + "futures-core", + "futures-lite", + "hex", + "libc", + "ordered-stream", + "rustix 1.1.5", + "serde", + "serde_repr", + "tracing", + "uds_windows", + "uuid", + "windows-sys 0.61.2", + "winnow 1.0.4", + "zbus_macros", + "zbus_names", + "zvariant", +] + +[[package]] +name = "zbus-lockstep" +version = "0.5.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6998de05217a084b7578728a9443d04ea4cd80f2a0839b8d78770b76ccd45863" +dependencies = [ + "zbus_xml", + "zvariant", +] + +[[package]] +name = "zbus-lockstep-macros" +version = "0.5.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "10da05367f3a7b7553c8cdf8fa91aee6b64afebe32b51c95177957efc47ca3a0" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.119", + "zbus-lockstep", + "zbus_xml", + "zvariant", +] + +[[package]] +name = "zbus_macros" +version = "5.19.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2990635d09ade6df1868f72f8cac69a876a90981e8bd3c40b1be413f8dc88f40" +dependencies = [ + "proc-macro-crate", + "proc-macro2", + "quote", + "syn 3.0.9", + "zbus_names", + "zvariant", + "zvariant_utils", +] + +[[package]] +name = "zbus_names" +version = "4.3.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "812a12be4ead7a59e18ea8f047d08add0066b73bc62fc1467066a2472ae088dd" +dependencies = [ + "serde", + "winnow 1.0.4", + "zvariant", +] + +[[package]] +name = "zbus_xml" +version = "5.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d1586c021a01ca0a9216dcd874e546382e156a5cbab5fab6cb5f10087e22682a" +dependencies = [ + "serde", + "winnow 1.0.4", + "zbus_names", + "zvariant", +] + +[[package]] +name = "zcheapstr" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d1afec51604565183aeb5c54c20aeab286120d4e4460f7f76e3e8bb8c0d99473" +dependencies = [ + "serde", +] + +[[package]] +name = "zeno" +version = "0.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6df3dc4292935e51816d896edcd52aa30bc297907c26167fec31e2b0c6a32524" + +[[package]] +name = "zerocopy" +version = "0.8.63" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e5fe1f8f1b06191a00962174c61aa5005e0bb391a6d80d07e24d115c01a92ed8" +dependencies = [ + "zerocopy-derive", +] + +[[package]] +name = "zerocopy-derive" +version = "0.8.63" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "863ad3ac83293fb4d740aedbfdc9240dd8d1a50c1099acd76ce80ce7c7230c7f" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.119", +] + +[[package]] +name = "zerofrom" +version = "0.1.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0ec05a11813ea801ff6d75110ad09cd0824ddba17dfe17128ea0d5f68e6c5272" +dependencies = [ + "zerofrom-derive", +] + +[[package]] +name = "zerofrom-derive" +version = "0.1.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f75b4683f6c7f45248d4d64056a24298c6281e0993356d7d1b4a1a962ef10d4a" +dependencies = [ + "proc-macro2", + "quote", + "syn 3.0.9", + "synstructure", +] + +[[package]] +name = "zeroize" +version = "1.9.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e13084392c5e4bc371903e2935a5eaeed24905a7511356b883835e18a78f6879" + +[[package]] +name = "zerotrie" +version = "0.2.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4ea269c3bd32f0a32c321907a2ae912ba6f4649bb0fc764a15627e99a7095a3f" +dependencies = [ + "displaydoc", + "yoke", + "zerofrom", + "zerovec", +] + +[[package]] +name = "zerovec" +version = "0.11.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f58a2799cfe9a1670c7ea8edbd52ef8edb93cb37a7f83bf31ba9e35d9dae6a40" +dependencies = [ + "serde", + "yoke", + "zerofrom", + "zerovec-derive", +] + +[[package]] +name = "zerovec-derive" +version = "0.11.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c3743ddbf47738d929cd1ae2e199d40d0162979dfe31aef8ae646d2bf00bf97a" +dependencies = [ + "proc-macro2", + "quote", + "syn 3.0.9", +] + +[[package]] +name = "zlib-rs" +version = "0.6.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b268e58e7c693d7c271f93ffc4ba3b380412554231c85bf61ca7af91042a4112" + +[[package]] +name = "zmij" +version = "1.0.23" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "29666d0abbfad1e3dc4dcf6144730dd3a3ab225bbbdac83319345b1b44ccfc1b" + +[[package]] +name = "zune-core" +version = "0.5.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d56377fd46368984a170bc5aac5567e52ca5da874caa60bea39fcbca78fb658b" + +[[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" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "27bc9d5b815bc103f142aa054f561d9187d191692ec7c2d1e2b4737f8dbd7296" +dependencies = [ + "zune-core", +] + +[[package]] +name = "zvariant" +version = "5.15.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "80bf6d6cd6a4b601acb64cfb8284cdc643fcfa75ef26ae3c46ec8aa4e8a1fbb7" +dependencies = [ + "endi", + "enumflags2", + "serde", + "winnow 1.0.4", + "zcheapstr", + "zvariant_derive", + "zvariant_utils", +] + +[[package]] +name = "zvariant_derive" +version = "5.15.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ef2672456ba1cb54b5eaec136e63135b3c7495fb938e53b28a62e633496d486d" +dependencies = [ + "proc-macro-crate", + "proc-macro2", + "quote", + "syn 3.0.9", + "zvariant_utils", +] + +[[package]] +name = "zvariant_utils" +version = "4.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bad0294361a320b694a328460dc73add56c306150f5cb6bfafc44446120008a3" +dependencies = [ + "proc-macro2", + "quote", + "serde", + "syn 3.0.9", + "winnow 1.0.4", +] diff --git a/Cargo.toml b/Cargo.toml new file mode 100644 index 0000000..8b7ef96 --- /dev/null +++ b/Cargo.toml @@ -0,0 +1,37 @@ +[package] +name = "netflex-tv" +description = "Netflex for SmartFox: native TV client with Liquid Glass and hardware video playback" +version = "0.1.0" +edition = "2024" +# sf-ui (and Slint) are GPL-3.0 on a TV box. +license = "GPL-3.0-only" +publish = false + +[dependencies] +# The SmartFox UI kit: Liquid Glass, TV components, images. This repository +# is built inside a SmartFox checkout, at apps/netflex-tv (the release CI +# clones SmartFox and puts it there). With a public sf-ui this can become +# a git dependency: sf-ui = { git = "" }. +sf-ui = { path = "../../crates/sf-ui" } +slint = "1.18" +anyhow = "1" +log = "0.4" +env_logger = "0.11" +serde = { version = "1", features = ["derive"] } +serde_json = "1" +toml = "0.9" +ureq = { version = "3", features = ["json"] } + +# Video playback (GStreamer) only on Linux, the TV. +[target.'cfg(target_os = "linux")'.dependencies] +sf-ui = { path = "../../crates/sf-ui", features = ["video"] } + +[build-dependencies] +slint-build = "1.18" + +[profile.release] +lto = "thin" +strip = true + +# Not part of the SmartFox workspace: this is its own repository. +[workspace] diff --git a/README.md b/README.md new file mode 100644 index 0000000..4b19150 --- /dev/null +++ b/README.md @@ -0,0 +1,36 @@ +# Netflex TV + +Natív Netflex kliens Fennec OS-re (store app, `support.bluefox.netflex`). + +- **Felület:** Rust + Slint az sf-ui Liquid Glass-ával, ugyanazzal, mint a launcher. +- **Képernyők:** kezdőlap (Folytatás és a szerver sorai), Filmek és Sorozatok műfaji sorokkal, Listám, Keresés képernyő-billentyűzettel, adatlap évadokkal és epizódokkal, lejátszás. +- **Lejátszás:** GStreamer, hardveres dekódolással (VA-API). A szerver nyers fájlját streameli (`/api/stream`, Range-kérésekkel), miközben a torrent töltődik. Az MKV minden hang- és feliratsávja választható; a hangkésés állítható és a szerveren megmarad. A haladás 15 másodpercenként mentődik, a sorozatoknál jön a következő rész. +- **Bejelentkezés:** a szerver címe, felhasználónév, jelszó; a token a `$HOME/.config/netflex/config.toml`-ban marad. + +## Fejlesztés + +A repó a Fennec OS checkout `apps/netflex-tv` mappájában él (az sf-ui path-függőség: `../../crates/sf-ui`). + +```sh +# Mock szerver: valódi Cinemeta katalógus, jelszó: netflex +python3 tools/mock_server.py --port 7880 --video teszt.mkv +NETFLEX_SERVER=http://127.0.0.1:7880 NETFLEX_WINDOWED=1 cargo run +``` + +- **Windowson:** a felület fejleszthető, de videó nincs (a GStreamer csak Linuxon van bekötve). +- **Linuxon** (Debian trixie / WSL) kell még: `libgstreamer1.0-dev libgstreamer-plugins-base1.0-dev gstreamer1.0-plugins-bad gstreamer1.0-libav gstreamer1.0-pipewire`. +- **Pillanatkép ember nélkül:** `SF_UI_SIZE=1920x1080 SF_UI_KEYS="wait wait down enter" SF_UI_SNAPSHOT=out.png cargo run` (lásd `../../docs/sf-ui.md`, 11. fejezet). + +## Kiadás + +1. Emeld a `version` értékét az `app.toml`-ban és a `Cargo.toml`-ban. +2. `git tag v0.1.1 && git push --tags`. +3. A Gitea CI (`.gitea/workflows/release.yml`) a Fennec OS checkouton belül épít, aláír, és release-t csinál a három store-fájllal. + +CI secretek: +- `SF_SIGNING_KEY` = `base64 -w0 key.pem`. A `key.pem` csak helyben van: őrizd meg, és sose commitold. +- `SMARTFOX_TOKEN`: olvasási jog a `bluefox/fox-in-the-box` repóhoz. + +Helyben: `SF_SIGNING_KEY_FILE=key.pem ./package.sh`. + +A TV-n: Store → Források → a repó címe. diff --git a/app.toml b/app.toml new file mode 100644 index 0000000..abe2128 --- /dev/null +++ b/app.toml @@ -0,0 +1,24 @@ +# SmartFox store app manifest (docs/store-app-guide.md in the SmartFox repo). +id = "support.bluefox.netflex" +name = "Netflex" +# Release versions only (1.2.3). Bump it (and Cargo.toml) for every release. +version = "0.1.0" +kind = "exec" +category = "Saját streaming" +description = "Filmek és sorozatok a saját Netflex szerveredről, natívan: azonnal indul, miközben töltődik, hardveres videódekódolással." +author = "Bluefox" +license = "GPL-3.0-only" +homepage = "https://gitea.bluefox.support/fennec/netflex" +exec = ["bin/netflex-tv"] +icon = "icon.png" +accent = "#E50914" +palette = ["#ff4a3d", "#8c0b14", "#120305"] + +# Signing key's public half (sf-pack keygen). Every release must be signed +# with the same key (CI secret SF_SIGNING_KEY), or TVs won't update. +public_key = "NmaJZJOe61vIokabSvkW7hl1Cp6a4NUsOw9IDtm/ZB4=" + +[sandbox] +# network: the Netflex server; gpu: glass and hardware video decoding; +# audio: sound. +permissions = ["network", "gpu", "audio"] diff --git a/build.rs b/build.rs new file mode 100644 index 0000000..36ca78c --- /dev/null +++ b/build.rs @@ -0,0 +1,7 @@ +fn main() { + // sf-ui's build script publishes where its Slint library is ("@sf-ui"). + let sf_ui = std::env::var("DEP_SF_UI_UI_DIR").expect("sf-ui must be a direct dependency"); + let config = slint_build::CompilerConfiguration::new() + .with_library_paths(std::collections::HashMap::from([("sf-ui".to_string(), sf_ui.into())])); + slint_build::compile_with_config("ui/app.slint", config).expect("compiling ui/app.slint"); +} diff --git a/icon.png b/icon.png new file mode 100644 index 0000000000000000000000000000000000000000..5bc74947036f7be160ffea60cc98b06d491cb6ff GIT binary patch literal 19722 zcmc$G`9Dm+JUZ@kpZmJ5=k>gv*L8bz(ae~aOOy+OAl`Fl4K70v zEBGfXw37q;MY;Qv20^Ah=M2tVy_>x>YW?KUK*Sss)3mx~`|H}TU;d3yoXF()C`fMC zZl&EjA3y*lDlIWbshFW!HCLN<2knudUrPrB3qzZlnh#-z`!FC~#H(H3H7T0f=P zz3+c{=rOCyheJ{S?)Z1dBe6$qBVmdWZ#{CSw%l^weOUe=(auw)BLB7y|8Q3a569$- zPjA*RTu3J-%iQAs|34Z&v*Vbo&lBwdWeb_g9WC5sEPNH^gj^Dr+3yB#@d(z?w-0E3 z{wd@pWXO;iP*I_UrW=~te)w?upA#+1aEO<|MDv#lH~s@}h*Q}cQjyQ7uxpw@O>&yM zZG>~j3aa$(@)*oAGLm4QK8EtUe@T0TdLJG8OyRpa)7WmRFe&fUZdl5o7W&W37e6$> zj%?pq)W7l)r}K~0`w5d;Tf^^7QaP{Ba|dTHUaK42^CIFO%zIO={$ergms0k|g31#}R)ncW)Rt}Er zI|WNFt4q@c3za@?^Pm3}1|K>a;nJw}8vf55$#Q>ICNqXS6B!gGV|w|}5uFI}C#u*y zX6Tyac(;~Hpc4!Y68XvV)%NzbC~@~ZI@LQlb-}q!eyp)d>SGejZxe0z;_<^8&+JOi zY|XDC8DJ4e`2u_W=*0Yw53Kc%Gs@1A&sgiMIv4gjdra0GrwzAUUNp2*_4P|0L~eM7 z--V_-?iWUmQi9JLgr?SIeWnLX<=DSh(+O-hdY}8ySx`pnM$WN^$pZ*#i9kZowK0o{UpHH;y+eoVHo%u48MMhU49Vc%Vd8FiO?NFrJz6XZ?a5{)4 zq6bFbLL^?ybpFwQwC@gdN6Q2GFxYF_ep|808Q!Ua z+a%PDmmP|#dERzgn4#k99CFCXDH(16=m#; z3xM-#wzg7A3Nw~*v8|>?cB>_x851g^W;LA>%tt-ZYJCH~*co_8g(78IR#3r59 zu$#@XIT(&oQX^BMAYwwrO&x(Cm*7vHcPZYJ<9Jod+*A*19!|3pfxl93e&ty>S%nQ5 zfmgpJXAU6$H<>4w5kPSP#}L4MC-m=BD< z$m~YUJ&zja;kYm8!G7Y5{A5DbHH0Fa(uGNSC+()O?wwhalBXINR#+-{{ z7eBBQXBaHPhYp=Ii?k*s9j3_ghn}H?VD_@3gj_l`VAKCThycDfl|Fg&;zwuQ+!~H^ zAw|c)_p{Y%!~v_@*ms^)2sW__6@dI7Fy9sk%RTr>uuXba9*aK3+sLk|mkUODSA7sa zuLqORIbM0N-0gL|BBCyP2jw2cXi6685(C}%w_{o+`YGF`nFHb32I!dMj}tGT46Sz% zq;Z70xKWsTAANWyyb63~WHpw+uo`(*^+lVCzXHO8?rryeQ`Z(ME7w5I6V5ctzYazg$r*Ib|RUHUvaPqwZOw5E#3@m&<1(nBfj!P zFnQ0mm>#^JNRPBO(}UY3vUd3T2)SLT32z9TzPq+4xt=H}4$;4CllSk@JSsJME*e%# z0pKxp%-KY!HZD*JQi>=`CcyKd=l1x-mc%3Mz#y9s##YGqrzzSJwDpTuLp(dQa*;WK z_LYEgSyMj&Tl?f8@dpF*`Nbz)Jd)f_)8vpA&3C2xAbAgg= z{D|&y(vM!ZMI~09htSv(H8u$QqCDs3MC$5F^Dy72z0NuOht1_8^fW#hCmP`LRoLnU zy;&IeFnM;>Pp$xM)FPOd>A^RWaz7Uit9@^dA!oPi!(%=rHRCkDqmM~w2@`j-lFQbr zD8y{lEm>Y<+n{Le{;Q6qaP24_Jvg2Zoj*TBGSY1uwD)X~0I5;Hr>OYMdo?* zVV%3`AZQ<;HUVaJBEd6Pi=M_KC+U_CE_Db>f^+oRBoTM*(bSnI5sy&Z@=&YOqPitd z8)k9N(_NE^0SW0hRTj}ocV}_tHUfzS`7rR<-pQQTo&lIBSU4UTU9rpcKdmYFEF}wP zC>+FeT$ND*2Rd@9h;FVAqp>%pR05p?qz^tS6{ z9Le02iZ`KR2L{sDC#SEQP?KseK~O~xIZjLF05U8=yAtX7ODlmfqa~yNdr3=r%`G}n zy!85cr@QFCr+s;L*C#A1Rm+bsWMk2v)_AS`hVKQ*PH9+a6604MPHDSN+vd%oF7#gQ z#T>SZF*28A8k)3}O*bcXQEUz^q3Q20a9|`~Q#H&{2?X_rSbl0sbyH;Bdq7~8nEv9| z{`7|J9$R#7EOma+UfO%h(#|iUa`aCRt_rphOM;-9)Bx%2J$owe%=HlNM?^UCu80P=9KU~r>wa{l#d*sJ@l z8*}e-T9cg<`RLN?9{`zgJV?ma@_&^2=hV)%+LRDd*W=)|gfp@t3}<5m=W~bo1C0-i zA5<}LgWEYwcvaJRt1?%yI$gSL?u{-?PVb0@eb|6;7Z2P1!HIxVLL!3!{D|to*@?)E z*5RoVkRfJ@IYwRn*gyD+t6=eDRj5LEwwe;MkTeUTEjf!~50YR6FH)o!@yg3HAhQF` z?B%{JBn?XhPiM!?H0MA5t}~@RU6!)jQ2z_x_zh#sYfo~67ANM(j}&RYafUN#>E_g8 zV~lTpTvA1xZi0(iFa*i!#xl1t=Hf&$f7XrH)`#oFs3}vhY<_Qz#D&IcU4WOx%kVh> ztjb$%3Y6D+By+nwoYdOJ8RO^uXWN9E(8-t*PN?3Fy&n08R(^U+p&$>3+33Rx06!j} zHNw>C#tJ2}{4?WGTpL!g2Vh7>KvGf6D2A+(AFX!d`JWv%|FCa6i(5h4H&E`FTAEhYL;yf0G;sQj10=A@y^3y*^p_m%|UMXtLVO?TWqNED&W zxD-7Nf8;%!m$~P<*yAKts9r--4FU1>_5a9*lFrE$T37?z-f>Xt=JB;=gm+#8Tczq7U5m241k;cE-Z1^wJ5A zyG9l-pRfSjDhfDkUkwv1NL|fsCz;8fPG5W>zofh=bXOhNJD$uK$itN{Y17n!SDcir zV`h19f*|v1a z{b~t|dK@bhbwBK!v;yY6fR=*{Le>@mX?%Flo}B82o!TrvLrsbRCOe2oRH%fs*Eri} z#-QH;D6FgSItNN0q<5ZBgaRtDp$d8Lin{F24f${YcDEdCv%+TzCIb{<#mlZ<@XzsowO$ILwq`vIWos-O%cP( zLaA+o#B&sKJ#WFFB@47N-Wm2|vm3vb>H%`we%kt6wAtEvzM9jNS%fCLETM zl?lYm3K01(GscO-|NRnNbv-58rFn|V3~=9WlQc9-9BI%2d3yFrsLFsFHf;1GNe}+6 zrej-l`WH1u3vNouY;&46r`@rlD(*rYSNJ!@l6<1Jb!fpSJZ}o0WII{X6I1a^Ni_|} zM51tU>*Lz=t_nIVAGBr>{XzWrr4tOdVZI9vk{?;2cJdr*x5s^Xq;1e-Gsk3ps_@Ug z2H2s3?2<#1y2ACO&R^2a~$=a=P&&Y1n&hm0N9^Lb640wW|sn z{XVdc()`Zt>ZTaz!cIhP6o3N>^%tfuWNT}YWK^I;Wx?Rr* z@AT$Rf;a%v`|(V6;4@u40JBnQYUztEqcqBDVVbm9g^LhWs&sn!wLdmG2G+Z75wMMK zuC}tvU_ZX*I+9N23vC_8>#I$U;7*)jf!dpU2vbsiF4`O3*1!f!MeePc`0C{Nrj`ME z)~7$VDKraiw#Emb1vi8wZLs%T%g?n^AJ4v2?Qu4`#XB2k=R3hyk zD6X)5ONPh+M4IAuN)NtnqtHcBFO)LkGfvBtXc0&P>)~j@er|v4L9nfVX>v1h%!_jC z9NG_EbDqJL-nWGawH+%v)Yc>;^k^aK9rFNMV_3(5+de+4bqs3Khs^*2EesOpIPUbY zE`B`O8X0wGO60ZpgY&DGp!SxtH)LXF)~kfZb^PZ#m+kdoniPVS)G;!v21zL&x0M#S z^TklKW*|*{Qe&PGxNdLrB8%`6I#MT9ON2%SX9-#c(>{ZYaxIFi6h)TUjZc`?oBv6; zQ<`}%p1GNY+>(EE0RyuvpmT%NVBMeQBnA8LLPFfTP4wV^l_WECYBoum`REWr+#7>Y znmDj{Jy_zXg@kn=Knh>qfFf)jb@fZ84BFeq6u}Bb(jLGbuBA{#*j5F+u!sR3IKMKN zIQ+01pREV0uFMVlDp~E)*v}jG@lKnnt`R^VSA}b!Ue`QXR}`*InUez2Was9u!!25gj^fvbIalerhTb$c~FS>fK zbmchC6PH24seEu06trhu6~(0C-eJ=wR8dqqcF|{D(gbVa2DoO8pBWDHw$h;Exc(-s zTMD?)qeqEl6SkgPi*92GL6ACQjU*}v%NxG~?Cc|5GQ?@$L1q2cPf~tx#WtA>3Gs7W zeN;CrtaY^|tfqB1EBd34S-1K>mbJ%oIz-V59i;Li^|8JFL0d=1NAWAhl( zG@;@%3)c1~$0?=}NM8y)>h4c?mVaI7b`(Rf5@P@O3t8~Tted-#eKeH=&air|NiJgS zRB-d1YQi}#l~cE-698`U^51_LqAo$(m-GPDXhLU|HwS+BBZ)PF`~`bCumVA`C+b{~ z1INpmhH-q)UoKhrBj2KS{W_0Fm*#ymyjGnDDH3ZKmoydRf?jOl?E$fRV2lof68jk7 zoNs=_CzE-r)?O{hW?=zy1jU|i#Q6sBqDF7kz?H5e%u3t*5g<%%Cvc-4aYl;Q41+Oa zKwYi^LqC>_cp4u2P@Jy~n{tLvQs%CR()#wz@q~4rn9`$SlP~0nkE-*R;bBi#2QD9; zkEE1J#SrZ9EMs56>*aO-uDcl{Adx+g9jKu;33DOwBF@v9ky^VDchV5-96OZ}CHGB; z?c(BBT(kZk{E#4RA5+R0B&tu<)%+yOXkio20oDFry0iF};Fi!k zqO{U~yf(NuX3TRRpD%x3p)pIcZ&JYwrzw^s^9D<+{uxYUv5bLmw~PTafCAh5 zbhx)1FXFgv-=Bw*2NXVZsbKei50im6&dnyd1Ai1CuZMB=t~_40H)%rGhB|w%lah?k-_ueDO81yx z8Mg%>-BqAA9#Dde0F%)Naa#|T9NnS@X`ih^^_yh6+>HR#$T8m=yK5A?^#BIn1SA%v zOC)rIWG_%=oBJ?k6sO#w!43($rsJff%I`=roR?xMmX-R`Bylcx=2?v~KN6b2xIjqd z!Fu-8n>77+sl3J62ZWs$8q2)AuRXaDIevZk!>NQEkS=xda9OSCMcmPF?_=H!SFpn~ zy*GguqlqPi9HoJz$Uk@gN1+g}HT`Dv_FS<%L|eq?!x=%^tk5g#-vm4+A#ZEOgua)-+j}!f6!?gb2ygSaHBC+#sxm#(J6ZUks`}I%+zLnPkwrN^k-|ud1g6VaN7V2G;zoz2uq9{WY~=xdWVYAs>io<)A{k5HHUA01`WXQ58_9fJhng z?&Lzs5Oy69@mjLdG40S_&7#{{qTKPGRq*LG>gya{xh%(x!0*2cb~{jUj~@bjs|!mQ z8zf7By8CZ#i;L@MwpKgZxVH>1T^je&878QcWE$WfCjjS*OBmcv`o{bK?{(raDL>U? z5KvI|n`vKtqf_=r{BIo=pq`@Cp<#+xzn~l6^X2*YSK;!2b*azk%@{G3=~?Q0u$exr zSars;5l|%G>0%Bv{5A2ybyf=1i`N*NbzCGLTHhjSdw>dH{tue;u;tEt4`B&toaP@w z<`Vu{Q(upBR$U8r7NF%nf}b;*XK?}|fM3kNEQ0fwbqvrl98r6%<+%0jz{W8B^=F_& zH_4+95UV?GB%*mMU{$%_Zu|d*Q&fj8k&<}xa0=D4ewU=ATRX9U#o{2eiuDB@vg9yM z27*T4y5`Si!v4*SI}gyG{J79JS3&Z6-Hq>C)vf#G(dJY!kN>D<_0o|``f(yF)Pm=x z`>Jjznc>m_Q+N}D9vberrQyF5=_!IkQG2~JFRB3pILvC-WiGp(V7b`klFMU^-4&0vst2s{z-PK7P;C_y0rUbHF<6+EZ-QRRU^MTLX$MYx z5L?FXyZ$H`{cH2iD@^q~2IY~4zt9IVu_~4)Gw|QXU}}OSGR%cop{Ap|LB&T(@?wN( zNgV1zejRUHJlwt?EJa+lXM?>C{4Mx?2!aZe7qK$egFn-~MdUB&Qbk+jjbw3|AMTb!iqmmL@fzB9n+)rbXZTwZNl^zQ;O|7h!7DvS56Og6wO5f@Kr7~f9)`8kpCE?T^ zOdmPdg#LM;>FW9E>W^{Bc2NlyNb^F5U~+YnG|ZI1f5{GjgUsIL4CCiN$Trq1bLu9c z$G1339|6v$9GJuY)tykw zbZt84h4EnSo z1$%$#sf}_X>X-)Hb;u`g=;sW4=fu)=QrBb-8LS7Gtd~{@&+a($M09>!@)hdXzq<2( z!m|h7bfpsQfMo&byKFNlGk`bk=l4;YHDAx>O^$Jgd3Gz)DlAa*0JXqNYW`6=!A)B3 zHJfO~&VleN{%mq;U}KAQO2qUJN0VaF@E0Im)6&7|St{c1R@i`y*wu~ijLC3WpIM5S{37}jVB>+o45JA{$C z9RJ4Id~10Xs7B9NzSO)eor^dxf8=~YqBtJrS9o3WG3bAOOQ8a=6*Z?stQBO+ryG;Z z%a4h5p6k0YADV1^=cxco>vp>Wrf1mfcWwe48(nGCI0(2eP#)L2ImyR>viYulW-qO8 z?8%!%+D5CcjOPBx&JM}-7}o!D2HY8-hXBz&O#%@EV3!6WYQ*OgNIdzQRW^QX?lC2V zQ(MOBPzo)0>MpilG7O4}&dbBKUd?>pji1dS%RM85=4Ai|#5hlxB$n_N+n@RHJf3A1 zki(Azie2x{HfGO7V;7?N^gdd#n>~I}@uAmNUjqD^^R(5IiE+sTwEPCp_Bmb*AR586 zM~mb;tM>Q^&`Jk^PV|F2$!?x&N7%8oOM`rg{Z*Ix z$C;sI4S>428&CEibvejW+%B2=ZNlMu4=Q_u#Uoalt?`A!4bo9x0d?U5VtNevdBAvB zabv*v{e>Xibp?*~cvfhT6E8ewVtN+w2W;I7#1im4JK1gU(b390B;jZnN@QWBPY^`S zp4I}_URY4Xz;PD>q1PKL5!yqnbeAIU$2EIJ~WX!s$3UefxzhAwIm-FA=aa>s1o@kSL zp&ZCEC$9f-8f0(+-=|-JY{Yfw1FfGv$Xo~gE~U?jKu~igbqyoCY0jXC=-%a#dJRfM zSr%E2XdAK2(SIxPh?yLq_@B_eF7W_m1QY^7Wj0Xg^q$e-YW=(OT*L2aQ&)Y{PpnUL zxazAL&_|Qf+|XU2=S_cV4ZYC|d#s8dKLssN__hRXJgn^*XMe5#9%`1UH(JHxFDKDr z|9Rl%KLMCx07mONi?GFj6Azw93FdZOBRYVhb#B3(Wd2*ON9pF7*NpiKSW^Fh%VCK_ z$%IhHfC20uu+QO-dpSn#2iOzWqtOFWewN%(pB{E@lf#2bLgvC=p5KWaKgIuWK%=yT zV5F8K2|(GAB`v$_^QFr>0Not~$z)`Q^yJ3un!XVJJgfv7H?j#0|4^F!39Y9n%`x5h zNb{p7#5dlyp~j0Vb5I#LLv{b}rUoBEWxY?`VKf>$$=*kA?LK${sIz8ub(PP>S$-0K z&0q~pGNsr#gslw7c3!>gLT&ZD=1-r!KLm8>J3#kh=)v#82?NRM^jepl7jFoVMqsFV zwH5MuQnrybd9#r|U6HA?XVB*Z_1@aIN0RcOGL4SL1IKFoHbo$-nIWVhcQtw*Dp(A(7FE@WdHmxrr&0bG&S)W$TXy+T8d zmBMjFqJPIym(qdA>AP~bZGAi4_d`mzWBP>O$DkBFQdj@D2t&8 zL)HS88C}N|5g{W}gSv2uEX*@y>$Rb7Rpz@%sN3i7 zY=vu!wa@aU_dtdG}CPx4O)7n1IJjK z`7t%)dnzqv3X|4qDMDd6-pC80ZBgd5=%ESIa-%)baMS`Q1#O~t&9wxs+0z{7LzKvJ zN-dmk1LwCUl675-&F$Z54Qvzpl`!IA=Xcb|4EEjs!T=C#B!TxFsKVmL4wquh=@{VUzC6gR*#W z0p)8#KhF(SO5{b|!(?&SZJ%D5Iq%06#cviwiN{_ZpIthGjR+NIhgB(D4wmvIJ_71d zBHDwnsV9<;JA7NiW=g)|8i*=udAIe&M`6AiYt?@30kXFLQ013TgD&LD7TMzE{ZFm7 zIRC!Ps2YjPpnC&%9BZZTf76;YF=+477`OG{WxO56XMK2f@9cd_@b}U%lgXh4hgC{Z6|Sb{!}n1a`Mu5-wjL0Xwv8e@z-!LITCoc>*qoCIzqc2-bX7qYq@?k1kqn>=w?7q#A!&D9>_{7R+xXvN z#p#A`kO>WroUO1~_|BK>PS1tMUx9Gg5gLXQYd#le1!}>g)_J)3T*&3hlV=8t&*Q?d zwqJ3W&R)5MKnPgYQ}6E%ql@*#+E&CN~syBv>4l3)`?c zTZP({^*RmB6I@7-`+E53O*!}V+7`la4K22(-@V=7+_WGh~ph@8_>OsJfBIyIgAGBXP!&(h9ux*J=7@_ngGD~r05;=iDA zTPJ>K_C_ehJRN%`u|6DNrgPQ)Y5t7gn*W<=aXpw;+lSrWSR>x15{Ij{%MGVzc(7CT zrc>3t{vP2gNivxG$#+*~0{V!}sonS*EXH4yCT)c3haqq0Y~e3bd*`L^`6%nBqgsR? z)cqep$L-*H9jnjR%4xp*Q39acSKqf4t^FHNyUZ}Q%fnqS=oyZrBrQu08ix}cKUBj@ zj13Y#2-6v2bC}luQdLnvcbkLDgc_@#m&^{?0UfdEP9Sz_Ywj~Z*SNKtK`0xuPvp8vyX{v^C+1ms~9Zl>0Jxak>_oq~1Rs2z3 zaYMnF$Lb5J*jsr}GVrU@+4pQGDt6!h^~07q#9<8FCnbRKTxQB>;2(t|(* z(^K42Al%0B77da!v;5+KaJDBLc_+894i3&u?moJEJ8R%%PdEM-D19eX9g^3@5jMX4 zVUV&AWC@TO}qN=gVMe2lOLrRAop$|F<70`*zNjR5>JGDmT1h~q#pB-`?TM5B@=3xymX6CvR2{8vvJQaV5JY226 zeNBK2FY>5))4fhYjn&U8iVcKbW;!3eXW3qll(e5El;SPC-4-E(@5V3RB_$Ok^EkI* z*>q06-C*4tzc2qO!JS55FSPvz+I}kNOFAr>q$|e9q6KXjh$f-i|NV$!Yx*l^tZdX8 zx#fuE9PXQf@&A>lU~k{DjJTiRLrN}DWJfoOYrBcs7J}{xyy$#vD?E^JseZd>AXn@x z5H+GQ;Z4xBei!oVyQGvmnc>~l?&Wa++zue=tga7 zbNK`GNI&$68+ioC)$fICB^`m9JPMK%RB9}pk* z)26}*zJZ_@@Ea+-b7>a;{vPq?|hh1E3 z9`0uH4SUsOcS^x*m@~-pU^kG;IkFV;kx~2r0#0Gi59p19^{fY;m z;39cYeR~jAwQ8;orS*2>PXVP*tB|$6Q%imvjciwX+ zaxND!`L9FqQA?IH7!`2=Wu?kLIWqpO)zf?GKdPv%^(D;grbU|;$5KByz6*I(y81N# zH6}QUd$JFNb32f)H_PQfxn4l74X+tXVb6DllLJZSZAP=hwPt&1SN2;k#hFxNewH*) zLp)JYV|lsKdve-;Vozxh215J2+?`?-%<5*RG-Yl8%x1>(qakvP=dvogiIyz&rrLDk zllNb7H=yu>GEl)L=HZH)M?r9hQpoY0?x6Ml1a}>}cvmeR`E}rC=xe~vT4QhXx@%Qo z@8)l})yFZ0zsNi1;qqgZeL;Q5ER1#Y3O#AOmKW3 zar2`*r8(&UvougXd<43<)d7Q!jomG!tV@TI6xC8GxLm~T4j8z7_T|?lQdb##WX(30 z&ejJ8vX8uT?8UdRlT*~!Uiq)((Ne^L)|1|iZv@taY4-0w08lvlUtj;XWo$x{^NAK1 z_*!?y&7P}z6+WhAMQzB3PkPMkOPDD*;xLb+FO<9h^TEs#=bGnRFxs^6ZI)o6S6fzG z1cR{><5O)SjZM;!KRlAX)4483G}n8FH%5<@9XUg5;p&x zlNHzjLSSw(Gbays6tw@KS3JaLM_j1I(y&rY7NSg<+YN#{1`SXTjzNJsJnzFGzmkSo z#Cd?JeJEz1CT-S~H8<^;J$0DW_3Rl~XTGqvgs>>W_G-60bYw*AdU*;y*!R<3@Wtk; zY5F97-dUjAY<1h%xBxTM0-H^wVS)4Z<G5f>AHxt-Qt5{>KWsC3j_^ zb?Hk)uKEtppn7EoyybAVvNh2B)X&9vgMq1|)y-(GP;x0qb+07ZA+8bzVbW>-k@;Ua z2h6|KfX}Y=#{zCzkjx*K5OmLgDfcT__9aftMjVv)Ae*!42ESYvKhfX;c5#m9^5=l>hnvSR^d%h6YnD_xB~l&;6g=4xpo^66JV!G2@i)NRV6D;OlFvlV}t zSZnK#e@Dtco~7dZ28kOQ%UISg+rK`e9GpSsq8;cJN+wUQ2DACBAAyvgeWnj26Vhwb@5P`B zS7#dHOnNutkq*WU;jH^8qv;tp7~}$3be}6Gxiu~c(POVbD)n9CaMJZx@|}nO!JQ^g zOMh`Bbv+k56vpx-!Lmln<$XlnaL6iE?L*xSLHD3CNkBWlj!V9XIs$Q-y1nmr^AY&C zi$AqXOSS}vMu$dm&ales#x$=5EO@~JbQ6u7;SKuKOFsAZw{$n)29z&z9G5+{S?jNQ zq1B5{^RdgA^TthpyI_W^a$tM2*jA?;+=Ms=*>O$5R)C_#utHZF?^m~mkW(FTCYR1h z0IVs0n-`rP85|KPKvQ`okV_{BMt1bzUN~5Om8%Ni4d5s^HUmo8j>z8#W^m_R;xo{} zI7V^n)`&n!Dz6)bh0^%vPoCn<6CnFZwYV#ql?b#PnVYH(1ol%Co=-p zFRt-~8r{zRb~YvAT{7ktvGLXobe7`hRBF{Wn^^>S*r8Xq=LiyrH5ezOZLc(Lib{ZDa3 zi|jNXiVwhWecIng4^zAG9ZcBqi+_c(9MJ#^HD+B*N0c;WBaBI1S3w)1wnBws3~tky zNUgC|!7sKnI3A7^?Bm(^;P;OvZ7wyo4LES&?RW3!8C)l)y7Bsjmnj{ap&-2pYUymM zpQcemw?dY)up7?%9=eiLJsnpyWS9wq?e=`sO(s3r2%MSzlgT}=o_vmIpH=aTwW>xZ|EFZlG z*`h|=|KPn)ExV(#?9kul@Vf+H0mL~Owftj$NhlkN&x3S7XkkE-6(pxFW2;S{#O0se zJeWAcygg7A_5dZRC6t0uKfp;uKs4D9!>iT_Q`w(Euk8Aof5Q^a*+}a6TD6CT4A`Y% zeVi5c9uimBgbogT#Z_$s5+?x~8rl2WHYXQfp|?m$qrf|tP>XLXl0a3A0n{9f<|$QM zs^z4{fS5Y~+F3s9U5R^E0oSfPB}b7>xYg~3wYzY*0&h8y&X-Cc)dti6A0~sDitpX{ zfCoOd24kX#Jmkv34*AWa7PYB?a|KTE3V zIL|HRP3rq64D~OgxTxURChklx)Y{kg1QpAD@Fu)q?5UbMR#SzI5o|Qo!AYH7riub9 zfh#{z?PIq>JFzv8M-B&ywMNaJ023&$651D{?U+2PXd{>(tpw6s??-U!)nv&FS-FqPj^?!1N z-YuC-w5`r zY2^^J@8~l=id9k1{jrz7j~<%qxP`9oLWV3y*%%ltqgU$S&+CiPm}QUZx71B0sp5_fU;!l(`G$V;hwwW*0<+tjo|9q*@$zo z-QadyN8DQjwa_5{^~|=;_rDs;)XMnL9yd&0wCCdIWqWQ@z_gQBUUKrK!M`?cJl%Oj{JPiNZ*!myQT$SJC*YAmC*aZl{@lxx0#o!jw z)5h!c$tJDv+P^84Vn4A4t%G}K^dGV6*M{S49y(VB=K-aD42)@aEeq1}vj7Z-ogC_8 zZx`W$7PV?qZB|M=Pst|rgRG!Vd94Cc>Ov9_RiIg(W~hWLcvIaI)w%?91At0vJV@my zH&PNG8e$Twx_=1-Ao7(9+KgBy9-ebKoj5af0gRsQrl~~a;r4pbPHm=(;gnw=fj$;{ z%Z#3n>}>pGbF|gGKOMa4L2}DO#`5n%@VV~O&xsfX}YSLgHKQ|Frr zjEzObwr-%t|1PK3_7Otd!EpZ#s77=X0CB_i18A62H17k8$&ywgR5l|J+SW4Dj?jVbk8UkO48w zBOhj~A9)GY*9Bl%QfomY>5|r-Eu5e%k!^$kqE{*(2VqSMHd1*GRP-qFt;M!1(#yEi ze@gK;PGzg2pVKq}TnrF4!-JhjNxjW1#I~(s4u|uXfJ#TW7b@i!s{EvS{~JH}iy~0p z-MNu-)!4d}U)r*yE)C(Wp?}479@fHAyCr{P;Q;KHYV}~soD2vFU7(4ncicZYQ$BTX zddK`atkKYDeK9C!#uYM z-JplLD9NEY5mQ*|qW*0h-*uqM&`Zw3<)j43Pqp|KM@*k27*KMtUoImc9`bX!@?<{H ze6nb$gim8#Yq+RApk8VNl$k~dZfg7_@ND|EXj^X~z3bfUCX}rY zcT&RU>U_MI9{Ji!!1W2<{AifswQiYjNHUkGsrd9|wpfd4j$YRB!i&Wv zD*Ngc1)z!&UW=v{F<*NfFtqUjOxV+rFG@LZ*kw}E{VakG6_#f_&xfHPNB;VEp3yoE z?j|9PT0;~&ozYV#c#zdhMwfIg-&pkxpeNpSKDi6YTv@dD-sA>jcj^M$rPh#gFjs~9 zJ7_$n3M-$i%f9j74?3XCfcaekqfxdQ0<_e~S6UN`gvtH89Hh7)8)_+#TP-FnBVPfh z24ZZ&krVJhAGiq#STbNTVfqFiV%nIO4w(-N<*dA(L(Q+EvxVH=t`Ju`)^be`J~5NhLQFv-0bS`d<3f@_-c5N}qqzw#hirbAh8A066^2ZF z6>f^PP9^9YptIi&N&YN;XA8>9#c{pk*eT$$HcB88rg{jHe6+Q%jZ8+yhit!Z+xNGQ z959%kS@EcXAu`Ce6|>{`x2HA-GF(==4(8|S3s>{m6?g)j6VPKCcpm7c-kpuWf#@-U z&>}M1T|)Sc45UwYK6oB5nW1h9W<%9ZxN(4?k|x0RRs&{LH@s)nQI-0a|5d$pqtZ>iA{Xv-ghrLl^-;US+JKS}te*XE|_T7W!*Z0Rb!?p^0!Z0xT@u*mY zmMVdS85(e`hf|V(@>#ce1kC(=M0g$JYcz#hfG$wzC@n%d6W}6A>l;>~xIOIxJ;K(S zF$PPG7C0fbP3ot(!u`*tkN>ril?XR7By#})ej6xy98!-nh6Y1bfKn&fGW9;+&j}3l zVfP#BqUXLO1YZyvA_s#Feq8`CB`y|Ytzb?e!(bk35Tg~ zJYg^qQXTkQLkHZ{V!f(6Mi_j$Z{{(jX09IxQl8ET#a@iA35^IyupF$63#c_uanY#- zqnBPFS+rQF7lZtpD$!f98;nWabY7Q?$}(b6o=Z7-(|LL$(p{H$QI+RoS~w54N=LoZSHK zp1ZKj1gzQOXgG3rF} z>-?y`uekI{OVOFfHG~`BZZ+_cAaN?ZuvW=TK9`T(FT}1TqIWtJIOSG~AN z8a8!Ld+3xx+}~__1q=YH5w~gA{7*A{GO=im=yb_b$VufHGJ;X%=n!1l)9U zpkBCIQ9a8qEJsf&-`LTDRfhTkEn^i#>V5mtZT|W?aAce{7|%c_S`LM;jJn@iQTg8`YFm)5ppeM*TfZsh} zeW2W9neez7;L+bl_bj1G{4_tJ)0O4-iszdfTU}LM8Xi$kie;7}K-wBr$3RKxp40ce z2M2LJV0AFt@+kqbU$YokY#GV4zYi4bq0T12xq!_t$;2Z!2XIkrV3J8wg#BF(`b#5i z_-$awt>e515V*k2CZIt3?gMkhZfh?eX6MskH=tAU6D1m(fvwNZqGHL{$kWd6r7wdE z_qP`!5ao`C9?ZC9D!!1rOI7Ih`6}@Dr@K@N zwCeJ|lvXL>2W_HGFyy%00V{%L>Q|ga!(0kC`?xN+3-oo6=vQ<|(o2CK&ust5Mbv^u zh)_%(E(ovzzoKumxW*32`g{3MhGVjb1VZmIGVzkPC@?3PzZ&`Y|BAW#Z?^6*ezCS{ z48_4|4bcqM#oAD_(yJIEbnAwxR??cq%qm`nqTHNnY0s+OT4}wWtg>{a-a1rtrL9A? zUdrmNB|(u;6Yr@+a`$Ba#D2Wz+;hLrx!>>eJfH9L`8GM-$|0OcRO6-q1SlTXQc!l_5A}QT_!~$#{MHU}sOMqj zo4X0gF?C%d!ZD~xM$uhXJ5=r)QDaXKcF81~$Q)abaarF=!+xcI=!~s3tVdKuoznlR zbHH(dOS;Y4APhg@;Xl}RaY+qjSCLtD5yMw=qrjpM#1N)M^7g|WkBvb%(!A)5B#?$dP) z8CZ_3H`N;jvEJLGl3@}J63)4=J*HFreo)V~)?%4*yzwstT^j4e$k+MpB(trIDv+mx z6rlw?mOtM}A}}w}-sv8u|+!El~k%(ua6H}fL!P~#U*dpzQ($(Eye=T?W?vhynTHLFxY~D*?UUSugBn1lNw)B7I12>I3nF-QY^VM&| zm{$)JdE{h>(%|*V3?+!;Jqd#wwQ^}HxNj*QYr}8$ktdk_qPwu;)@xKG7$_19 znRmmA91kS6#ozFA)<608lyA45XwkKK{ zm#{ID$j$8Y=QoqmJMqY4K8G0$rE(--~)IA&EN literal 0 HcmV?d00001 diff --git a/package.sh b/package.sh new file mode 100755 index 0000000..a73a28b --- /dev/null +++ b/package.sh @@ -0,0 +1,28 @@ +#!/usr/bin/env bash +# Builds the three store release assets into dist/: app.toml, +# support.bluefox.netflex-.tar.zst and its .sig. +# +# SF_SIGNING_KEY= ./package.sh (CI) +# SF_SIGNING_KEY_FILE=key.pem ./package.sh (by hand) +# +# Runs inside a SmartFox checkout (this repo at apps/netflex-tv), on Debian +# trixie or older (the TV's glibc), with the GStreamer dev packages: +# libgstreamer1.0-dev libgstreamer-plugins-base1.0-dev +set -euo pipefail +cd "$(dirname "$0")" + +cargo build --release --locked +target="${CARGO_TARGET_DIR:-target}" +rm -rf pkg dist +mkdir -p pkg/bin +cp app.toml icon.png pkg/ +install -m755 "$target/release/netflex-tv" pkg/bin/netflex-tv + +# sf-pack from PATH, else the one in the SmartFox checkout around us. +if command -v sf-pack >/dev/null; then + pack=(sf-pack) +else + pack=(cargo run -q --release --manifest-path ../../Cargo.toml -p sf-pack --) +fi +"${pack[@]}" build pkg dist +"${pack[@]}" verify dist diff --git a/src/api.rs b/src/api.rs new file mode 100644 index 0000000..214fc7f --- /dev/null +++ b/src/api.rs @@ -0,0 +1,1693 @@ +//! The Netflex server's HTTP API, all of it: catalog, lists, playback, +//! anime, account, users and the admin's server settings. Mirrors +//! netflex/packages/client/src/{api,lists,anime,prefs}.ts. +//! +//! Every call blocks: run them off the UI thread (`task::spawn`). +//! The types mirror the server's; not every field is on screen. +#![allow(dead_code)] + +use std::io::Read; +use std::time::Duration; + +use anyhow::{Context, Result, bail}; +use serde::de::DeserializeOwned; +use serde::{Deserialize, Serialize}; +use serde_json::{Value, json}; + +// ---------------------------------------------------------------------------- catalog types + +#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, Serialize, Deserialize)] +#[serde(rename_all = "lowercase")] +pub enum MediaType { + Movie, + Tv, +} + +impl MediaType { + pub fn key(self) -> &'static str { + match self { + MediaType::Movie => "movie", + MediaType::Tv => "tv", + } + } + pub fn label(self) -> &'static str { + match self { + MediaType::Movie => "Film", + MediaType::Tv => "Sorozat", + } + } +} + +#[derive(Debug, Clone, Copy, Default, PartialEq, Eq, Deserialize)] +pub struct HuAvailability { + #[serde(default)] + pub dub: bool, + #[serde(default)] + pub sub: bool, +} + +/// A card: one movie or series. `id` is the IMDb id. +#[derive(Debug, Clone, Deserialize)] +#[serde(rename_all = "camelCase")] +pub struct TitleSummary { + #[serde(rename = "type")] + pub kind: MediaType, + pub id: String, + pub title: String, + #[serde(default)] + pub original_title: Option, + #[serde(default)] + pub overview: Option, + #[serde(default)] + pub poster: Option, + #[serde(default)] + pub backdrop: Option, + #[serde(default)] + pub logo: Option, + #[serde(default)] + pub year: Option, + #[serde(default)] + pub year_label: Option, + #[serde(default)] + pub rating: Option, + #[serde(default)] + pub genres: Vec, + #[serde(default)] + pub hu: Option, +} + +#[derive(Debug, Clone, Deserialize)] +pub struct HomeRow { + pub id: String, + pub title: String, + pub items: Vec, +} + +#[derive(Debug, Clone, Deserialize)] +pub struct ContinueItem { + pub title: TitleSummary, + #[serde(default)] + pub season: Option, + #[serde(default)] + pub episode: Option, + #[serde(default)] + pub position: f64, + #[serde(default)] + pub duration: Option, +} + +#[derive(Debug, Clone, Deserialize)] +#[serde(rename_all = "camelCase")] +pub struct HomeData { + pub rows: Vec, + #[serde(default)] + pub continue_watching: Vec, +} + +#[derive(Debug, Clone, Deserialize)] +#[serde(rename_all = "camelCase")] +pub struct Page { + #[serde(default)] + pub page: u32, + #[serde(default)] + pub has_more: bool, + pub items: Vec, + #[serde(default)] + pub cursor: Option, +} + +#[derive(Debug, Clone, Deserialize)] +pub struct Genre { + pub id: String, + pub name: String, +} + +#[derive(Debug, Clone, Deserialize)] +#[serde(rename_all = "camelCase")] +pub struct SeasonSummary { + pub number: i32, + #[serde(default)] + pub name: String, + #[serde(default)] + pub episode_count: i32, + #[serde(default)] + pub aired_count: Option, + #[serde(default)] + pub air_date: Option, + #[serde(default)] + pub poster: Option, +} + +impl SeasonSummary { + pub fn aired(&self) -> i32 { + self.aired_count.unwrap_or(self.episode_count) + } + pub fn label(&self) -> String { + if self.name.is_empty() { format!("{}. évad", self.number) } else { self.name.clone() } + } +} + +#[derive(Debug, Clone, Deserialize)] +#[serde(rename_all = "camelCase")] +pub struct AirInfo { + pub season: i32, + pub episode: i32, + #[serde(default)] + pub air_date: Option, +} + +#[derive(Debug, Clone, Deserialize)] +#[serde(rename_all = "camelCase")] +pub struct TitleDetail { + #[serde(flatten)] + pub summary: TitleSummary, + #[serde(default)] + pub runtime: Option, + #[serde(default)] + pub tagline: Option, + #[serde(default)] + pub status: Option, + #[serde(default)] + pub cast: Vec, + #[serde(default)] + pub directors: Vec, + #[serde(default)] + pub seasons: Vec, + #[serde(default)] + pub number_of_seasons: Option, + #[serde(default)] + pub next_episode_to_air: Option, +} + +#[derive(Debug, Clone, Deserialize)] +#[serde(rename_all = "camelCase")] +pub struct EpisodeInfo { + pub season: i32, + pub episode: i32, + #[serde(default)] + pub name: Option, + #[serde(default)] + pub overview: Option, + #[serde(default)] + pub air_date: Option, + #[serde(default)] + pub runtime: Option, + #[serde(default)] + pub still: Option, +} + +#[derive(Debug, Clone, Deserialize)] +pub struct SeasonDetail { + #[serde(default)] + pub episodes: Vec, +} + +// ---------------------------------------------------------------------------- sources + +#[derive(Debug, Clone, Deserialize)] +#[serde(rename_all = "camelCase")] +pub struct NcoreTorrent { + pub id: i64, + pub name: String, + #[serde(default)] + pub size: f64, + #[serde(default)] + pub seeders: i64, + #[serde(default)] + pub uploaded_at: Option, + #[serde(default)] + pub freeleech: bool, +} + +#[derive(Debug, Clone, Default, Deserialize)] +#[serde(rename_all = "camelCase")] +pub struct ParsedRelease { + #[serde(default)] + pub resolution: Option, + #[serde(default)] + pub hdr: bool, + #[serde(default)] + pub hungarian_audio: bool, + #[serde(default)] + pub hungarian_subs: bool, +} + +#[derive(Debug, Clone, Deserialize)] +pub struct SourceCandidate { + pub torrent: NcoreTorrent, + #[serde(default)] + pub parsed: ParsedRelease, + #[serde(default)] + pub pack: bool, + /// "seeding", "downloading", "eligible"... when already on the server. + #[serde(default)] + pub local: Option, +} + +#[derive(Debug, Clone, Deserialize)] +#[serde(rename_all = "camelCase")] +pub struct SourcesResult { + #[serde(default)] + pub candidates: Vec, + #[serde(default)] + pub searched_by: Option, +} + +#[derive(Debug, Clone, Default, Deserialize)] +pub struct ReleaseLanguages { + #[serde(default)] + pub audio: Vec, + #[serde(default)] + pub subs: Vec, + #[serde(default)] + pub found: bool, +} + +#[derive(Debug, Clone, Deserialize)] +#[serde(rename_all = "camelCase")] +pub struct Started { + pub info_hash: String, + pub file_index: i64, + #[serde(default)] + pub file_name: String, +} + +#[derive(Debug, Clone, Deserialize)] +#[serde(rename_all = "camelCase")] +pub struct MediaTrack { + pub index: i64, + #[serde(rename = "type")] + pub kind: String, + #[serde(default)] + pub codec: String, + #[serde(default)] + pub language: Option, + #[serde(default)] + pub title: Option, + #[serde(default)] + pub is_default: bool, + #[serde(default)] + pub is_forced: bool, + #[serde(default)] + pub channels: Option, + #[serde(default)] + pub height: Option, +} + +#[derive(Debug, Clone, Default, Deserialize)] +#[serde(rename_all = "camelCase")] +pub struct ProbeInfo { + #[serde(default)] + pub duration_sec: Option, + #[serde(default)] + pub tracks: Vec, + #[serde(default)] + pub audio_delay_ms: Option, + #[serde(default)] + pub local: Option, +} + +#[derive(Debug, Clone, Default, Deserialize)] +#[serde(rename_all = "camelCase")] +pub struct TorrentStatus { + #[serde(default)] + pub file_progress: Option, + #[serde(default)] + pub download_speed: Option, + #[serde(default)] + pub peers: Option, + #[serde(default)] + pub paused_for_vpn: Option, +} + +// ---------------------------------------------------------------------------- progress and lists + +#[derive(Debug, Clone, Deserialize)] +pub struct ProgressRow { + pub season: i32, + pub episode: i32, + #[serde(default)] + pub position: f64, + #[serde(default)] + pub duration: Option, + #[serde(default)] + pub completed: bool, +} + +#[derive(Debug, Clone, Deserialize)] +#[serde(rename_all = "camelCase")] +pub struct ListItem { + pub title: TitleSummary, + #[serde(default)] + pub added_at: Option, + #[serde(default)] + pub last_watched_at: Option, + #[serde(default)] + pub watched_episodes: i32, +} + +#[derive(Debug, Clone, Default, Deserialize)] +#[serde(rename_all = "camelCase")] +pub struct TitleState { + #[serde(default)] + pub listed: bool, + #[serde(default)] + pub watched_episodes: i32, + #[serde(default)] + pub watched: bool, +} + +/// Player preferences, per user (on the server). +#[derive(Debug, Clone, Deserialize, Serialize)] +#[serde(rename_all = "camelCase")] +pub struct UserSettings { + #[serde(default = "default_transcode")] + pub transcode: String, + #[serde(default = "default_sub")] + pub subtitle_lang: String, + #[serde(default = "yes")] + pub auto_next: bool, + #[serde(default)] + pub auto_skip_intro: bool, +} + +fn default_transcode() -> String { + "auto".into() +} +fn default_sub() -> String { + "hu".into() +} +fn yes() -> bool { + true +} + +impl Default for UserSettings { + fn default() -> Self { + UserSettings { transcode: default_transcode(), subtitle_lang: default_sub(), auto_next: true, auto_skip_intro: false } + } +} + +// ---------------------------------------------------------------------------- account + +#[derive(Debug, Clone, Default, Deserialize)] +#[serde(rename_all = "camelCase")] +pub struct User { + #[serde(default)] + pub id: i64, + #[serde(default)] + pub name: String, + #[serde(default)] + pub username: String, + #[serde(default)] + pub is_admin: bool, +} + +#[derive(Debug, Clone, Deserialize)] +pub struct AuthStatus { + #[serde(default)] + pub user: Option, +} + +#[derive(Debug, Clone, Deserialize)] +pub struct SignedIn { + pub token: String, + pub user: User, +} + +#[derive(Debug, Clone, Deserialize)] +#[serde(rename_all = "camelCase")] +pub struct SessionInfo { + pub id: i64, + #[serde(default)] + pub device: Option, + #[serde(default)] + pub ip: Option, + #[serde(default)] + pub created_at: Option, + #[serde(default)] + pub last_seen_at: Option, + #[serde(default)] + pub current: bool, +} + +#[derive(Debug, Clone, Deserialize)] +#[serde(rename_all = "camelCase")] +pub struct UserRow { + pub id: i64, + #[serde(default)] + pub username: String, + #[serde(default)] + pub name: String, + #[serde(default)] + pub is_admin: bool, + #[serde(default)] + pub sessions: i64, + #[serde(default)] + pub last_seen_at: Option, +} + +// ---------------------------------------------------------------------------- admin + +#[derive(Debug, Clone, Default, Deserialize, Serialize)] +#[serde(rename_all = "camelCase")] +pub struct SeedRules { + #[serde(default)] + pub min_seed_hours: f64, + #[serde(default)] + pub min_ratio: f64, + #[serde(default)] + pub margin_hours: f64, + #[serde(default)] + pub margin_ratio: f64, + #[serde(default)] + pub require_ncore_confirmation: bool, + #[serde(default, rename = "maxDiskGB")] + pub max_disk_gb: f64, + #[serde(default)] + pub season_pack_mode: String, + #[serde(default)] + pub max_active_downloads: f64, +} + +#[derive(Debug, Clone, Default, Deserialize, Serialize)] +#[serde(rename_all = "camelCase")] +pub struct SourcePrefs { + #[serde(default)] + pub language: String, + #[serde(default)] + pub max_resolution: i64, + #[serde(default)] + pub max_size: f64, + #[serde(default)] + pub allow_hdr: bool, +} + +#[derive(Debug, Clone, Default, Deserialize)] +pub struct Crawl { + #[serde(default)] + pub latest: bool, +} + +#[derive(Debug, Clone, Default, Deserialize)] +#[serde(rename_all = "camelCase")] +pub struct ServerConfig { + #[serde(default)] + pub seed_rules: SeedRules, + #[serde(default)] + pub seed_rule_defaults: SeedRules, + #[serde(default)] + pub source_prefs: SourcePrefs, + #[serde(default)] + pub crawl: Crawl, + #[serde(default)] + pub tmdb_configured: bool, +} + +#[derive(Debug, Clone, Default, Deserialize)] +#[serde(rename_all = "camelCase")] +pub struct Circuit { + #[serde(default)] + pub state: String, + #[serde(default)] + pub reason: Option, + #[serde(default)] + pub message: Option, + #[serde(default)] + pub at: Option, +} + +#[derive(Debug, Clone, Default, Deserialize)] +#[serde(rename_all = "camelCase")] +pub struct LatestCrawl { + #[serde(default)] + pub last_run: Option, + #[serde(default)] + pub last_error: Option, +} + +#[derive(Debug, Clone, Default, Deserialize)] +#[serde(rename_all = "camelCase")] +pub struct NcoreStatus { + #[serde(default)] + pub configured: bool, + #[serde(default)] + pub username: Option, + #[serde(default)] + pub logged_in: bool, + #[serde(default)] + pub has_passkey: bool, + #[serde(default)] + pub circuit: Circuit, + #[serde(default)] + pub paused_until: Option, + #[serde(default)] + pub pause_reason: Option, + #[serde(default)] + pub min_interval_ms: f64, + #[serde(default)] + pub last_request_at: Option, + #[serde(default)] + pub latest_crawl: LatestCrawl, +} + +#[derive(Debug, Clone, Default, Deserialize)] +#[serde(rename_all = "camelCase")] +pub struct VpnProfile { + #[serde(default)] + pub name: String, + #[serde(default)] + pub imported_at: Option, + #[serde(default)] + pub server: String, + #[serde(default)] + pub addresses: Vec, +} + +#[derive(Debug, Clone, Default, Deserialize)] +pub struct PublicIp { + #[serde(default)] + pub ip: String, + #[serde(default)] + pub country: Option, + #[serde(default)] + pub city: Option, + #[serde(default)] + pub org: Option, +} + +#[derive(Debug, Clone, Default, Deserialize)] +#[serde(rename_all = "camelCase")] +pub struct VpnCheck { + #[serde(default)] + pub ok: bool, + #[serde(default)] + pub checked_at: Option, + #[serde(default)] + pub public_ip: Option, + #[serde(default)] + pub real_ip: Option, + #[serde(default)] + pub ip_changed: Option, + #[serde(default)] + pub route_device: Option, + #[serde(default)] + pub dns_servers: Vec, + #[serde(default)] + pub dns_through_tunnel: bool, + #[serde(default)] + pub error: Option, +} + +#[derive(Debug, Clone, Default, Deserialize)] +pub struct Transfer { + #[serde(default)] + pub rx: f64, + #[serde(default)] + pub tx: f64, +} + +#[derive(Debug, Clone, Default, Deserialize)] +#[serde(rename_all = "camelCase")] +pub struct Tunnel { + #[serde(default)] + pub interface: String, + #[serde(default)] + pub last_handshake: Option, + #[serde(default)] + pub transfer: Option, +} + +#[derive(Debug, Clone, Default, Deserialize)] +pub struct Traffic { + #[serde(default)] + pub path: String, + #[serde(default)] + pub reason: Option, +} + +#[derive(Debug, Clone, Default, Deserialize)] +#[serde(rename_all = "camelCase")] +pub struct PortForwarding { + #[serde(default)] + pub enabled: bool, + #[serde(default)] + pub port: Option, + #[serde(default)] + pub gateway: String, + #[serde(default)] + pub last_renewal: Option, + #[serde(default)] + pub error: Option, +} + +#[derive(Debug, Clone, Default, Deserialize)] +pub struct VpnSettings { + #[serde(default)] + pub enabled: bool, +} + +#[derive(Debug, Clone, Default, Deserialize)] +#[serde(rename_all = "camelCase")] +pub struct VpnStatus { + #[serde(default)] + pub supported: bool, + #[serde(default)] + pub unsupported_reason: Option, + #[serde(default)] + pub settings: VpnSettings, + #[serde(default)] + pub state: String, + #[serde(default)] + pub error: Option, + #[serde(default)] + pub connected_since: Option, + #[serde(default)] + pub profile: Option, + #[serde(default)] + pub check: Option, + #[serde(default)] + pub tunnel: Option, + #[serde(default)] + pub traffic: Traffic, + #[serde(default)] + pub port_forwarding: PortForwarding, +} + +#[derive(Debug, Clone, Default, Deserialize)] +#[serde(rename_all = "camelCase")] +pub struct LiveTorrent { + #[serde(default)] + pub progress: f64, + #[serde(default)] + pub download_speed: f64, + #[serde(default)] + pub upload_speed: f64, +} + +#[derive(Debug, Clone, Default, Deserialize)] +#[serde(rename_all = "camelCase")] +pub struct TorrentJob { + pub info_hash: String, + #[serde(default)] + pub name: String, + #[serde(default)] + pub size: Option, + #[serde(default)] + pub state: String, + #[serde(default)] + pub keep: bool, + #[serde(default)] + pub completed_at: Option, + #[serde(default)] + pub seeding_seconds: f64, + #[serde(default)] + pub ratio: f64, + #[serde(default)] + pub eligible_at: Option, + #[serde(default)] + pub reason: Option, + #[serde(default)] + pub ncore_checked_at: Option, + #[serde(default)] + pub ncore_found: Option, + #[serde(default)] + pub ncore_remaining_seconds: Option, + #[serde(default)] + pub ncore_hnr: Option, + #[serde(default)] + pub removed_at: Option, + #[serde(default)] + pub live: Option, + #[serde(default)] + pub in_use: bool, + #[serde(default)] + pub paused_for_playback: bool, +} + +#[derive(Debug, Clone, Default, Deserialize)] +#[serde(rename_all = "camelCase")] +pub struct Engine { + #[serde(default)] + pub ready: bool, + #[serde(default)] + pub last_error: Option, + #[serde(default)] + pub paused_for_vpn: bool, +} + +#[derive(Debug, Clone, Default, Deserialize)] +#[serde(rename_all = "camelCase")] +pub struct SeedKeeper { + #[serde(default)] + pub last_activity_at: Option, +} + +#[derive(Debug, Clone, Default, Deserialize)] +#[serde(rename_all = "camelCase")] +pub struct TorrentsOverview { + #[serde(default)] + pub rules: SeedRules, + #[serde(default)] + pub engine: Engine, + #[serde(default)] + pub seed_keeper: SeedKeeper, + #[serde(default)] + pub disk_used: f64, + #[serde(default)] + pub items: Vec, +} + +#[derive(Debug, Clone, Default, Deserialize)] +pub struct Health { + #[serde(default)] + pub ok: bool, + #[serde(default)] + pub vpn: String, +} + +// ---------------------------------------------------------------------------- anime + +#[derive(Debug, Clone, Default, Deserialize)] +pub struct AnimeTitle { + #[serde(default)] + pub romaji: Option, + #[serde(default)] + pub english: Option, + #[serde(default)] + pub native: Option, +} + +impl AnimeTitle { + /// English when there is one, else romaji. + pub fn name(&self) -> String { + self.english.clone().or_else(|| self.romaji.clone()).or_else(|| self.native.clone()).unwrap_or_default() + } + /// The other title (romaji under English), when different. + pub fn alt(&self) -> Option { + let main = self.name(); + self.romaji.clone().filter(|r| *r != main).or_else(|| self.native.clone().filter(|n| *n != main)) + } +} + +#[derive(Debug, Clone, Deserialize)] +#[serde(rename_all = "camelCase")] +pub struct AnimeSummary { + pub id: i64, + #[serde(default)] + pub id_mal: Option, + #[serde(default)] + pub title: AnimeTitle, + #[serde(default)] + pub cover_image: Option, + #[serde(default)] + pub cover_color: Option, + #[serde(default)] + pub banner_image: Option, + #[serde(default)] + pub format: Option, + #[serde(default)] + pub status: Option, + #[serde(default)] + pub episodes: Option, + #[serde(default)] + pub season: Option, + #[serde(default)] + pub season_year: Option, + #[serde(default)] + pub average_score: Option, + #[serde(default)] + pub genres: Vec, +} + +#[derive(Debug, Clone, Deserialize)] +#[serde(rename_all = "camelCase")] +pub struct NextAiring { + pub episode: i32, + pub airing_at: i64, +} + +#[derive(Debug, Clone, Deserialize)] +#[serde(rename_all = "camelCase")] +pub struct MalScore { + #[serde(default)] + pub score: Option, + #[serde(default)] + pub scored_by: Option, + #[serde(default)] + pub rank: Option, +} + +#[derive(Debug, Clone, Deserialize)] +#[serde(rename_all = "camelCase")] +pub struct AnimeDetail { + #[serde(flatten)] + pub summary: AnimeSummary, + #[serde(default)] + pub description: Option, + #[serde(default)] + pub duration: Option, + #[serde(default)] + pub studios: Vec, + #[serde(default)] + pub next_airing_episode: Option, + #[serde(default)] + pub mal: Option, + #[serde(default)] + pub source: Option, +} + +#[derive(Debug, Clone, Deserialize)] +pub struct AnimeRow { + pub id: String, + pub title: String, + pub items: Vec, +} + +#[derive(Debug, Clone, Deserialize)] +pub struct AnimeContinue { + pub anime: AnimeSummary, + pub episode: i32, + #[serde(default)] + pub position: f64, + #[serde(default)] + pub duration: Option, +} + +#[derive(Debug, Clone, Deserialize)] +pub struct AnimeSeason { + pub season: String, + pub year: i32, +} + +#[derive(Debug, Clone, Deserialize)] +#[serde(rename_all = "camelCase")] +pub struct AnimeHome { + pub rows: Vec, + #[serde(default)] + pub continue_watching: Vec, + pub season: AnimeSeason, + #[serde(default)] + pub source: Option, +} + +#[derive(Debug, Clone, Deserialize)] +#[serde(rename_all = "camelCase")] +pub struct AnimeFallback { + #[serde(default)] + pub ignored: Vec, +} + +#[derive(Debug, Clone, Deserialize)] +#[serde(rename_all = "camelCase")] +pub struct AnimePage { + pub items: Vec, + #[serde(default)] + pub page: u32, + #[serde(default)] + pub has_next_page: bool, + #[serde(default)] + pub total: Option, + #[serde(default)] + pub fallback: Option, +} + +#[derive(Debug, Clone, Deserialize)] +#[serde(rename_all = "camelCase")] +pub struct AnimeTag { + pub name: String, + #[serde(default)] + pub category: String, + #[serde(default)] + pub description: String, + #[serde(default)] + pub is_adult: bool, +} + +#[derive(Debug, Clone, Default, Deserialize)] +pub struct Taxonomy { + #[serde(default)] + pub genres: Vec, + #[serde(default)] + pub tags: Vec, +} + +#[derive(Debug, Clone, Deserialize)] +#[serde(rename_all = "camelCase")] +pub struct FranchiseEntry { + pub id: i64, + #[serde(default)] + pub title: AnimeTitle, + #[serde(default)] + pub format: Option, + #[serde(default)] + pub episodes: Option, + #[serde(default)] + pub season_year: Option, + #[serde(default)] + pub cover_image: Option, + #[serde(default)] + pub season_number: Option, + #[serde(default)] + pub part: Option, + #[serde(default)] + pub part_end: Option, +} + +#[derive(Debug, Clone, Deserialize)] +#[serde(rename_all = "camelCase")] +pub struct AnimeEpisodeMeta { + pub number: i32, + #[serde(default)] + pub title: Option, + #[serde(default)] + pub overview: Option, + #[serde(default)] + pub air_date: Option, + #[serde(default)] + pub runtime: Option, + #[serde(default)] + pub image: Option, +} + +#[derive(Debug, Clone, Default, Deserialize)] +pub struct AnimeEpisodes { + #[serde(default)] + pub aired: i32, + #[serde(default)] + pub total: Option, + #[serde(default)] + pub episodes: Vec, +} + +#[derive(Debug, Clone, Deserialize)] +#[serde(rename_all = "camelCase")] +pub struct AnimeSource { + pub info_hash: String, + pub nyaa_id: i64, + #[serde(default)] + pub torrent_title: String, + #[serde(default)] + pub group: Option, + #[serde(default)] + pub resolution: Option, + #[serde(default)] + pub seeders: i64, + #[serde(default)] + pub is_batch: bool, + #[serde(default)] + pub size_bytes: Option, +} + +impl AnimeSource { + /// Same key as the server's release groups ("SubsPlease|1080"). + pub fn group_key(&self) -> String { + format!("{}|{}", self.group.clone().unwrap_or_else(|| "Ismeretlen".into()), self.resolution.map(|r| r.to_string()).unwrap_or_else(|| "?".into())) + } +} + +#[derive(Debug, Clone, Default, Deserialize)] +#[serde(rename_all = "camelCase")] +pub struct LangInfo { + #[serde(default)] + pub english_dub: bool, +} + +#[derive(Debug, Clone, Deserialize)] +#[serde(rename_all = "camelCase")] +pub struct ReleaseGroup { + pub key: String, + #[serde(default)] + pub episodes: Vec, + #[serde(default)] + pub lang: LangInfo, +} + +#[derive(Debug, Clone, Deserialize)] +pub struct AnimeEpisodeEntry { + pub number: i32, + #[serde(default)] + pub sources: Vec, +} + +#[derive(Debug, Clone, Default, Deserialize)] +#[serde(rename_all = "camelCase")] +pub struct ReleaseResolution { + #[serde(default)] + pub queries: Vec, + #[serde(default)] + pub groups: Vec, + #[serde(default)] + pub selected_group: Option, + #[serde(default)] + pub episodes: Vec, +} + +#[derive(Debug, Clone, Deserialize)] +#[serde(rename_all = "camelCase")] +pub struct SkipTime { + #[serde(rename = "type")] + pub kind: String, + pub start: f64, + pub end: f64, + #[serde(default)] + pub episode_length: f64, +} + +#[derive(Debug, Clone, Deserialize)] +pub struct AnimeProgressRow { + pub episode: i32, + #[serde(default)] + pub position: f64, + #[serde(default)] + pub duration: Option, + #[serde(default)] + pub completed: bool, +} + +#[derive(Debug, Clone, Deserialize)] +#[serde(rename_all = "camelCase")] +pub struct AnimeLibraryItem { + pub anime: AnimeSummary, + #[serde(default)] + pub listed: bool, + #[serde(default)] + pub watched_episodes: i32, + #[serde(default)] + pub last_watched_at: Option, +} + +#[derive(Debug, Clone, Default, Deserialize, Serialize)] +#[serde(rename_all = "camelCase")] +pub struct AnimePrefs { + #[serde(default)] + pub preferred_resolution: i64, + #[serde(default)] + pub preferred_groups: Vec, + #[serde(default)] + pub prefer_dub: bool, + #[serde(default)] + pub subtitle_lang: String, +} + +#[derive(Debug, Clone, Deserialize)] +#[serde(rename_all = "camelCase")] +pub struct AnimeTorrent { + pub info_hash: String, + #[serde(default)] + pub name: String, + #[serde(default)] + pub size: Option, + #[serde(default)] + pub episode: Option, + #[serde(default)] + pub in_use: bool, + #[serde(default)] + pub last_used_at: Option, +} + +#[derive(Debug, Clone, Default, Deserialize)] +#[serde(rename_all = "camelCase")] +pub struct AnimeTorrents { + #[serde(default)] + pub grace_seconds: f64, + #[serde(default)] + pub items: Vec, +} + +/// Anime catalogue filters (query parameters; lists comma separated). +#[derive(Debug, Clone, Default, PartialEq)] +pub struct AnimeFilters { + pub search: String, + pub sort: Option, + pub genres: Vec, + pub exclude_genres: Vec, + pub tags: Vec, + pub exclude_tags: Vec, + pub min_tag_rank: Option, + pub formats: Vec, + pub status: Option, + pub season: Option, + pub season_year: Option, + pub year_from: Option, + pub year_to: Option, + pub min_score: Option, +} + +// ---------------------------------------------------------------------------- errors + +/// An error the server explained (`{ "error": "..." }`), or "not signed in". +#[derive(Debug)] +pub struct ApiError { + pub status: u16, + pub message: String, + pub unauthenticated: bool, + pub body: Value, +} + +impl std::fmt::Display for ApiError { + fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str(&self.message) + } +} + +impl std::error::Error for ApiError {} + +/// Whether `e` means the session is gone (sign in again). +pub fn is_unauthenticated(e: &anyhow::Error) -> bool { + e.downcast_ref::().is_some_and(|a| a.unauthenticated) +} + +/// The HTTP status, if the server answered. +pub fn status_of(e: &anyhow::Error) -> Option { + e.downcast_ref::().map(|a| a.status) +} + +/// A short Hungarian message for the screen. +pub fn describe(e: &anyhow::Error) -> String { + if let Some(a) = e.downcast_ref::() { + return a.message.clone(); + } + for cause in e.chain() { + if let Some(u) = cause.downcast_ref::() { + return match u { + ureq::Error::Timeout(_) => "A szerver nem válaszolt időben.".into(), + ureq::Error::Io(_) | ureq::Error::ConnectionFailed | ureq::Error::HostNotFound => { + "A szerver nem érhető el. Ellenőrizd a hálózatot és a szerver címét.".into() + } + other => format!("Hálózati hiba: {other}"), + }; + } + } + format!("{e:#}") +} + +// ---------------------------------------------------------------------------- client + +/// Client for one server and session. Cheap to clone; usable from any thread. +#[derive(Clone)] +pub struct Api { + base: String, + token: String, + agent: ureq::Agent, +} + +const DEVICE: &str = "Fennec OS TV"; + +impl Api { + pub fn new(base: &str, token: &str) -> Api { + let agent: ureq::Agent = ureq::Agent::config_builder() + .timeout_global(Some(Duration::from_secs(60))) + .timeout_connect(Some(Duration::from_secs(8))) + .http_status_as_error(false) + .user_agent(concat!("NetflexTV/", env!("CARGO_PKG_VERSION"), " SMART-TV FennecOS")) + .build() + .into(); + Api { base: normalize_base(base), token: token.to_string(), agent } + } + + pub fn base(&self) -> &str { + &self.base + } + + pub fn with_token(&self, token: &str) -> Api { + Api { base: self.base.clone(), token: token.to_string(), agent: self.agent.clone() } + } + + /// `path` + query, with the token in the query (for media and images). + pub fn url(&self, path: &str, params: &[(&str, String)]) -> String { + let mut q: Vec = params.iter().filter(|(_, v)| !v.is_empty()).map(|(k, v)| format!("{}={}", enc(k), enc(v))).collect(); + if !self.token.is_empty() { + q.push(format!("token={}", enc(&self.token))); + } + let base = format!("{}{}", self.base, path); + if q.is_empty() { base } else { format!("{base}{}{}", if base.contains('?') { '&' } else { '?' }, q.join("&")) } + } + + /// Artwork through the server's image cache (the TV never contacts the CDNs). + pub fn image(&self, url: Option<&str>, large: bool) -> String { + match url.filter(|u| !u.is_empty()) { + Some(u) => { + let u = if large { u.replace("/poster/small/", "/poster/medium/") } else { u.to_string() }; + self.url("/api/img", &[("u", u)]) + } + None => String::new(), + } + } + + pub fn stream_url(&self, hash: &str, file: i64) -> String { + self.url(&format!("/api/stream/{hash}/{file}"), &[]) + } + + fn call(&self, method: &str, path: &str, params: &[(&str, String)], body: Option) -> Result { + let url = self.url(path, params); + let auth = format!("Bearer {}", self.token); + let resp = match method { + "GET" => { + let mut r = self.agent.get(&url); + if !self.token.is_empty() { + r = r.header("Authorization", &auth); + } + r.call() + } + m => { + let mut r = match m { + "POST" => self.agent.post(&url), + "PUT" => self.agent.put(&url), + _ => self.agent.delete(&url).force_send_body(), + }; + if !self.token.is_empty() { + r = r.header("Authorization", &auth); + } + r.send_json(body.unwrap_or_else(|| json!({}))) + } + } + .with_context(|| format!("{method} {path}"))?; + let status = resp.status().as_u16(); + let mut text = String::new(); + resp.into_body().into_reader().take(16 << 20).read_to_string(&mut text)?; + if !(200..300).contains(&status) { + let v: Value = serde_json::from_str(&text).unwrap_or_default(); + let message = v["error"].as_str().map(str::to_string).unwrap_or_else(|| match status { + 401 => "Bejelentkezés szükséges".into(), + 403 => "Ehhez admin jog kell".into(), + 404 => "Nem található".into(), + 503 => "A szerver most nem elérhető".into(), + s => format!("A szerver hibát jelzett ({s})"), + }); + let unauthenticated = status == 401 && v["code"].as_str() == Some("unauthenticated"); + return Err(ApiError { status, message, unauthenticated, body: v }.into()); + } + if text.trim().is_empty() { + text = "null".into(); + } + serde_json::from_str(&text).with_context(|| format!("{method} {path}: unexpected answer")) + } + + fn get(&self, path: &str, params: &[(&str, String)]) -> Result { + self.call("GET", path, params, None) + } + + fn send(&self, method: &str, path: &str, body: Value) -> Result<()> { + let _: Value = self.call(method, path, &[], Some(body))?; + Ok(()) + } + + // ---- account ---- + + pub fn auth_status(&self) -> Result { + self.get("/api/auth/status", &[]) + } + pub fn login(&self, username: &str, password: &str) -> Result { + self.call("POST", "/api/auth/login", &[], Some(json!({ "username": username, "password": password, "device": DEVICE }))) + } + pub fn logout(&self) -> Result<()> { + self.send("POST", "/api/auth/logout", json!({})) + } + pub fn sessions(&self) -> Result> { + self.get("/api/auth/sessions", &[]) + } + pub fn revoke_session(&self, id: i64) -> Result<()> { + self.send("DELETE", &format!("/api/auth/sessions/{id}"), json!({})) + } + pub fn users(&self) -> Result> { + self.get("/api/users", &[]) + } + pub fn create_user(&self, username: &str, name: &str, password: &str) -> Result<()> { + let mut b = json!({ "username": username, "password": password }); + if !name.trim().is_empty() { + b["name"] = name.trim().into(); + } + self.send("POST", "/api/users", b) + } + pub fn set_user_password(&self, id: i64, password: &str) -> Result<()> { + self.send("PUT", &format!("/api/users/{id}/password"), json!({ "password": password })) + } + pub fn delete_user(&self, id: i64) -> Result<()> { + self.send("DELETE", &format!("/api/users/{id}"), json!({})) + } + pub fn health(&self) -> Result { + self.get("/api/health", &[]) + } + + // ---- player settings ---- + + pub fn settings(&self) -> Result { + self.get("/api/settings", &[]) + } + pub fn save_settings(&self, patch: Value) -> Result<()> { + self.send("PUT", "/api/settings", patch) + } + + // ---- catalog ---- + + pub fn home(&self) -> Result { + self.get("/api/home", &[]) + } + + #[allow(clippy::too_many_arguments)] + pub fn browse( + &self, + kind: MediaType, + sort: &str, + genre: Option<&str>, + year: Option, + year_range: (Option, Option), + rating: (Option, Option), + page: u32, + cursor: Option<&str>, + ) -> Result> { + let mut p = vec![("type", kind.key().to_string()), ("sort", sort.to_string()), ("page", page.max(1).to_string())]; + let opt = |v: Option| v.unwrap_or_default(); + p.push(("genre", opt(genre.map(str::to_string)))); + p.push(("year", opt(year.map(|y| y.to_string())))); + p.push(("yearFrom", opt(year_range.0.map(|y| y.to_string())))); + p.push(("yearTo", opt(year_range.1.map(|y| y.to_string())))); + p.push(("ratingFrom", opt(rating.0.map(|r| r.to_string())))); + p.push(("ratingTo", opt(rating.1.map(|r| r.to_string())))); + p.push(("cursor", opt(cursor.map(str::to_string)))); + self.get("/api/browse", &p) + } + + pub fn genres(&self, kind: MediaType) -> Result> { + self.get("/api/genres", &[("type", kind.key().to_string())]) + } + pub fn search(&self, q: &str) -> Result> { + self.get("/api/search", &[("q", q.to_string())]) + } + pub fn title(&self, kind: MediaType, id: &str) -> Result { + self.get(&format!("/api/title/{}/{}", kind.key(), enc(id)), &[]) + } + pub fn season(&self, id: &str, n: i32) -> Result { + self.get(&format!("/api/title/tv/{}/season/{n}", enc(id)), &[]) + } + /// Hungarian dub / subtitles on nCore, from cached searches. + pub fn hungarian(&self, titles: &[(MediaType, String)]) -> Result>> { + let list: Vec = titles.iter().map(|(k, id)| json!({ "type": k.key(), "id": id })).collect(); + self.call("POST", "/api/hu", &[], Some(json!({ "titles": list }))) + } + + // ---- lists ---- + + pub fn my_list(&self) -> Result> { + self.get("/api/lists/mine", &[]) + } + pub fn history(&self) -> Result> { + self.get("/api/history", &[]) + } + pub fn continue_watching(&self) -> Result> { + self.get("/api/continue", &[]) + } + pub fn list_status(&self) -> Result> { + self.get("/api/lists/status", &[]) + } + pub fn set_listed(&self, kind: MediaType, id: &str, on: bool) -> Result<()> { + self.send(if on { "PUT" } else { "DELETE" }, &format!("/api/lists/mine/{}/{}", kind.key(), enc(id)), json!({})) + } + pub fn mark_watched(&self, kind: MediaType, id: &str, items: &[(i32, i32)], watched: bool) -> Result<()> { + let items: Vec = items.iter().map(|(s, e)| json!({ "season": s, "episode": e })).collect(); + self.send("PUT", &format!("/api/progress/{}/{}/watched", kind.key(), enc(id)), json!({ "items": items, "watched": watched })) + } + + // ---- playback ---- + + pub fn sources(&self, kind: MediaType, id: &str, ep: Option<(i32, i32)>) -> Result { + let mut p = Vec::new(); + if let Some((s, e)) = ep { + p.push(("season", s.to_string())); + p.push(("episode", e.to_string())); + } + self.get(&format!("/api/sources/{}/{}", kind.key(), enc(id)), &p) + } + pub fn release_languages(&self, ncore_id: i64) -> Result { + self.get(&format!("/api/ncore/torrents/{ncore_id}/languages"), &[]) + } + pub fn start_play(&self, kind: MediaType, id: &str, ncore_id: i64, ep: Option<(i32, i32)>) -> Result { + let mut body = json!({ "type": kind.key(), "titleId": id, "ncoreId": ncore_id }); + if let Some((s, e)) = ep { + body["season"] = s.into(); + body["episode"] = e.into(); + } + self.call("POST", "/api/play/start", &[], Some(body)) + } + pub fn probe(&self, hash: &str, file: i64) -> Result { + self.get(&format!("/api/media/{hash}/{file}/probe"), &[]) + } + pub fn status(&self, hash: &str, file: i64) -> Result { + self.get(&format!("/api/torrent/{hash}/status"), &[("file", file.to_string())]) + } + pub fn set_audio_delay(&self, hash: &str, file: i64, ms: i64) -> Result<()> { + self.send("PUT", &format!("/api/media/{hash}/{file}/audio-delay"), json!({ "ms": ms })) + } + pub fn progress(&self, kind: MediaType, id: &str) -> Result> { + self.get(&format!("/api/progress/{}/{}", kind.key(), enc(id)), &[]) + } + #[allow(clippy::too_many_arguments)] + pub fn save_progress(&self, kind: MediaType, id: &str, ep: Option<(i32, i32)>, position: f64, duration: Option, hash: &str, file: i64) -> Result<()> { + let mut body = json!({ "type": kind.key(), "titleId": id, "position": position, "duration": duration, "infoHash": hash, "fileIndex": file }); + if let Some((s, e)) = ep { + body["season"] = s.into(); + body["episode"] = e.into(); + } + self.send("PUT", "/api/progress", body) + } + + // ---- anime ---- + + pub fn anime_home(&self) -> Result { + self.get("/api/anime/home", &[]) + } + pub fn anime_browse(&self, f: &AnimeFilters, page: u32) -> Result { + let list = |v: &Vec| v.join(","); + let o = |v: Option| v.map(|x| x.to_string()).unwrap_or_default(); + let sort = f.sort.clone().unwrap_or_else(|| if f.search.is_empty() { "popularity".into() } else { "relevance".into() }); + let p = vec![ + ("search", f.search.clone()), + ("sort", sort), + ("genres", list(&f.genres)), + ("excludeGenres", list(&f.exclude_genres)), + ("tags", list(&f.tags)), + ("excludeTags", list(&f.exclude_tags)), + ("minTagRank", o(f.min_tag_rank)), + ("formats", list(&f.formats)), + ("status", f.status.clone().unwrap_or_default()), + ("season", f.season.clone().unwrap_or_default()), + ("seasonYear", o(f.season_year)), + ("yearFrom", o(f.year_from)), + ("yearTo", o(f.year_to)), + ("minScore", o(f.min_score)), + ("page", page.max(1).to_string()), + ]; + self.get("/api/anime/browse", &p) + } + pub fn anime_taxonomy(&self) -> Result { + self.get("/api/anime/taxonomy", &[]) + } + pub fn anime_detail(&self, id: i64) -> Result { + self.get(&format!("/api/anime/{id}"), &[]) + } + pub fn anime_franchise(&self, id: i64) -> Result> { + self.get(&format!("/api/anime/{id}/franchise"), &[]) + } + pub fn anime_episodes(&self, id: i64) -> Result { + self.get(&format!("/api/anime/{id}/episodes"), &[]) + } + pub fn anime_releases(&self, id: i64, refresh: bool) -> Result { + self.get(&format!("/api/anime/{id}/releases"), &[("refresh", if refresh { "1".into() } else { String::new() })]) + } + pub fn anime_skip(&self, id: i64, episode: i32, duration: f64) -> Result> { + self.get(&format!("/api/anime/{id}/episodes/{episode}/skip"), &[("duration", (duration.round() as i64).to_string())]) + } + pub fn anime_start(&self, id: i64, episode: i32, nyaa_id: i64, title: &str) -> Result { + self.call("POST", "/api/anime/play/start", &[], Some(json!({ "animeId": id, "episode": episode, "nyaaId": nyaa_id, "torrentTitle": title }))) + } + pub fn anime_keepalive(&self, hash: &str) -> Result<()> { + self.send("POST", &format!("/api/anime/torrents/{hash}/keepalive"), json!({})) + } + pub fn anime_torrents(&self) -> Result { + self.get("/api/anime/torrents", &[]) + } + pub fn anime_prefs(&self) -> Result { + self.get("/api/anime/prefs", &[]) + } + pub fn save_anime_prefs(&self, patch: Value) -> Result { + self.call("PUT", "/api/anime/prefs", &[], Some(patch)) + } + pub fn anime_progress(&self, id: i64) -> Result> { + self.get(&format!("/api/anime/{id}/progress"), &[]) + } + pub fn save_anime_progress(&self, id: i64, episode: i32, position: f64, duration: Option, hash: &str, file: i64) -> Result<()> { + self.send("PUT", "/api/anime/progress", json!({ "animeId": id, "episode": episode, "position": position, "duration": duration, "infoHash": hash, "fileIndex": file })) + } + pub fn anime_mark_watched(&self, id: i64, episodes: &[i32], watched: bool) -> Result<()> { + self.send("PUT", &format!("/api/anime/{id}/watched"), json!({ "episodes": episodes, "watched": watched })) + } + pub fn anime_library(&self) -> Result> { + self.get("/api/anime/library", &[]) + } + pub fn anime_set_listed(&self, id: i64, on: bool) -> Result<()> { + self.send(if on { "PUT" } else { "DELETE" }, &format!("/api/anime/{id}/list"), json!({})) + } + + // ---- admin: server settings ---- + + pub fn config(&self) -> Result { + self.get("/api/config", &[]) + } + pub fn save_seed_rules(&self, patch: Value) -> Result<()> { + self.send("PUT", "/api/config/seed-rules", patch) + } + pub fn save_source_prefs(&self, patch: Value) -> Result<()> { + self.send("PUT", "/api/config/source-prefs", patch) + } + pub fn save_crawl(&self, latest: bool) -> Result<()> { + self.send("PUT", "/api/config/crawl", json!({ "latest": latest })) + } + pub fn save_tmdb_key(&self, key: &str) -> Result<()> { + self.send("PUT", "/api/config/tmdb-key", json!({ "key": key })) + } + pub fn ncore(&self) -> Result { + self.get("/api/ncore", &[]) + } + pub fn save_ncore(&self, username: &str, password: &str, two_factor: &str) -> Result { + let mut b = json!({ "username": username, "password": password }); + if !two_factor.trim().is_empty() { + b["twoFactor"] = two_factor.trim().into(); + } + self.call("PUT", "/api/ncore/credentials", &[], Some(b)) + } + pub fn retry_ncore(&self, two_factor: &str) -> Result { + let b = if two_factor.trim().is_empty() { json!({}) } else { json!({ "twoFactor": two_factor.trim() }) }; + self.call("POST", "/api/ncore/retry", &[], Some(b)) + } + pub fn forget_ncore(&self) -> Result { + self.call("DELETE", "/api/ncore/credentials", &[], Some(json!({}))) + } + pub fn torrents(&self) -> Result { + self.get("/api/torrents", &[]) + } + pub fn keep_torrent(&self, hash: &str, keep: bool) -> Result<()> { + self.send("PUT", &format!("/api/torrents/{hash}/keep"), json!({ "keep": keep })) + } + pub fn remove_torrent(&self, hash: &str, accept_hit_and_run: bool) -> Result<()> { + self.send("DELETE", &format!("/api/torrents/{hash}"), json!({ "acceptHitAndRun": accept_hit_and_run })) + } + pub fn check_torrents(&self) -> Result<()> { + self.send("POST", "/api/torrents/check", json!({})) + } + pub fn vpn(&self) -> Result { + self.get("/api/vpn", &[]) + } + pub fn save_vpn(&self, patch: Value) -> Result { + self.call("PUT", "/api/vpn/settings", &[], Some(patch)) + } + pub fn import_vpn_profile(&self, name: &str, content: &str) -> Result { + self.call("POST", "/api/vpn/profile", &[], Some(json!({ "name": name, "content": content }))) + } + pub fn remove_vpn_profile(&self) -> Result { + self.call("DELETE", "/api/vpn/profile", &[], Some(json!({}))) + } + pub fn reconnect_vpn(&self) -> Result { + self.call("POST", "/api/vpn/reconnect", &[], Some(json!({}))) + } + pub fn check_vpn(&self) -> Result { + self.call("POST", "/api/vpn/check", &[], Some(json!({}))) + } +} + +/// "netflex.example.com" -> "https://netflex.example.com" (no trailing slash). +pub fn normalize_base(s: &str) -> String { + let s = s.trim().trim_end_matches('/'); + if s.is_empty() { + return String::new(); + } + if s.starts_with("http://") || s.starts_with("https://") { s.to_string() } else { format!("https://{s}") } +} + +pub fn enc(s: &str) -> String { + let mut out = String::with_capacity(s.len()); + for b in s.bytes() { + match b { + b'A'..=b'Z' | b'a'..=b'z' | b'0'..=b'9' | b'-' | b'_' | b'.' | b'~' => out.push(b as char), + _ => out.push_str(&format!("%{b:02X}")), + } + } + out +} + +/// Probes the file until it can be read: the server's reads wait for the +/// pieces they need. `stage` reports progress text. +pub fn probe_while_downloading(api: &Api, hash: &str, file: i64, stage: &dyn Fn(String), cancelled: &dyn Fn() -> bool) -> Result { + let deadline = std::time::Instant::now() + Duration::from_secs(600); + loop { + if cancelled() { + bail!("cancelled"); + } + match api.probe(hash, file) { + Ok(p) => return Ok(p), + Err(e) => { + if status_of(&e).is_some_and(|s| s < 500) { + return Err(e); + } + if std::time::Instant::now() >= deadline { + bail!("A fájl eleje nem töltődött le 10 perc alatt. Ellenőrizd a torrent sebességét és a seedereket a Beállításokban."); + } + if let Ok(s) = api.status(hash, file) { + let pct = (s.file_progress.unwrap_or(0.0) * 100.0).round(); + let speed = s.download_speed.filter(|v| *v > 0.0).map(|v| format!(" · {}/s", format_bytes(v))).unwrap_or_default(); + stage(format!("A fájl elejének letöltése és elemzése… {pct}% kész{speed}")); + } + std::thread::sleep(Duration::from_secs(3)); + } + } + } +} + +pub fn format_bytes(n: f64) -> String { + if n <= 0.0 { + return String::new(); + } + let units = ["B", "KB", "MB", "GB", "TB"]; + let mut v = n; + let mut i = 0; + while v >= 1024.0 && i < units.len() - 1 { + v /= 1024.0; + i += 1; + } + if v < 10.0 && i > 0 { format!("{v:.1} {}", units[i]) } else { format!("{v:.0} {}", units[i]) } +} + +#[cfg(test)] +mod tests { + use super::*; + + #[test] + fn urls() { + let api = Api::new("netflex.example.com/", "a b"); + assert_eq!(api.base(), "https://netflex.example.com"); + assert_eq!(api.url("/api/x", &[("q", "Dűne 2".into()), ("e", String::new())]), "https://netflex.example.com/api/x?q=D%C5%B1ne%202&token=a%20b"); + assert_eq!(api.image(None, false), ""); + assert_eq!(normalize_base("http://10.0.0.5:7880"), "http://10.0.0.5:7880"); + } + + #[test] + fn parses_types() { + let h: HomeData = serde_json::from_str(r#"{"rows":[{"id":"popular-movie","title":"Népszerű filmek","items":[{"type":"movie","id":"tt1","title":"A","hu":{"dub":true,"sub":false},"genres":["Drama"]}]}], + "continueWatching":[{"title":{"type":"tv","id":"tt2","title":"B","genres":[]},"season":1,"episode":2,"position":61.5,"duration":1500}]}"#).unwrap(); + assert_eq!(h.rows[0].items[0].hu, Some(HuAvailability { dub: true, sub: false })); + let d: TitleDetail = serde_json::from_str(r#"{"type":"tv","id":"tt2","title":"B","genres":[],"seasons":[{"number":1,"name":"1. évad","episodeCount":8,"airedCount":7}],"nextEpisodeToAir":{"season":1,"episode":8,"airDate":"2026-11-01"}}"#).unwrap(); + assert_eq!(d.seasons[0].aired(), 7); + let a: AnimeDetail = serde_json::from_str(r#"{"id":5,"title":{"romaji":"Shingeki","english":"Attack on Titan"},"genres":[],"studios":["WIT"],"nextAiringEpisode":{"episode":3,"airingAt":1700000000}}"#).unwrap(); + assert_eq!(a.summary.title.name(), "Attack on Titan"); + assert_eq!(a.summary.title.alt().as_deref(), Some("Shingeki")); + let s: SeedRules = serde_json::from_str(r#"{"minSeedHours":48,"minRatio":1,"maxDiskGB":500,"seasonPackMode":"whole"}"#).unwrap(); + assert_eq!(s.max_disk_gb, 500.0); + let src: AnimeSource = serde_json::from_str(r#"{"infoHash":"a","nyaaId":1,"group":"SubsPlease","resolution":1080}"#).unwrap(); + assert_eq!(src.group_key(), "SubsPlease|1080"); + } + + #[test] + fn bytes() { + assert_eq!(format_bytes(1536.0), "1.5 KB"); + assert_eq!(format_bytes(0.0), ""); + } +} diff --git a/src/app.rs b/src/app.rs new file mode 100644 index 0000000..81ae4eb --- /dev/null +++ b/src/app.rs @@ -0,0 +1,1293 @@ +//! The controller: the screen stack, keys, overlays (text input, picker, +//! toast), the backdrop, start-up and sign-in. +//! +//! Browsing screens implement `Screen`: they describe their page as lines +//! (`spec`) and react to activation. While one of their methods runs it is +//! taken out of the stack, so methods may freely start tasks and request +//! effects (push, pop, play, input...), which run when the method returns. + +use std::any::Any; +use std::cell::RefCell; +use std::collections::HashMap; +use std::rc::Rc; +use std::time::Duration; + +use slint::platform::Key; +use slint::{ComponentHandle, ModelRc, SharedString, VecModel}; + +use crate::api::{self, Api, User, UserSettings}; +use crate::config::{self, Config}; +use crate::page::{Focus, Kind, Spec, View}; +use crate::{App, MenuItem, player, screens, task}; + +/// A remote / keyboard key, as screens see it. +#[derive(Debug, Clone, Copy, PartialEq, Eq)] +pub enum Action { + Up, + Down, + Left, + Right, + Ok, + Back, + PlayPause, +} + +fn action(text: &str) -> Option { + let is = |k: Key| text == SharedString::from(k).as_str(); + Some(if is(Key::UpArrow) { + Action::Up + } else if is(Key::DownArrow) { + Action::Down + } else if is(Key::LeftArrow) { + Action::Left + } else if is(Key::RightArrow) { + Action::Right + } else if is(Key::Return) { + Action::Ok + } else if is(Key::Escape) || is(Key::Backspace) || is(Key::Back) { + Action::Back + } else if text == " " { + Action::PlayPause + } else { + return None; + }) +} + +/// Top navigation sections. +pub const SECTIONS: [&str; 7] = ["Kezdőlap", "Filmek", "Sorozatok", "Anime", "Listám", "Keresés", "Beállítások"]; + +/// A browsing screen. +pub trait Screen: Any { + /// The page: lines and frame. + fn spec(&mut self, cx: &Cx) -> Spec; + /// OK on an element of a line. + fn activate(&mut self, cx: &Cx, line: &str, item: &str); + /// The focus moved (hero texts, backdrop...). + fn focus(&mut self, _cx: &Cx, _line: &str, _item: &str) {} + /// Back; true = handled (the screen stays). + fn back(&mut self, _cx: &Cx) -> bool { + false + } + /// The focus is near the end of list `list`. + fn more(&mut self, _cx: &Cx, _list: &str) {} + /// On top again (back from a child or the player). + fn shown(&mut self, _cx: &Cx) {} + /// Settings side list: tab `i`. + fn side(&mut self, _cx: &Cx, _i: usize) {} + /// The search keyboard's text changed (`submit`: the search chip). + fn query(&mut self, _cx: &Cx, _text: &str, _submit: bool) {} + /// Every second while on top. + fn tick(&mut self, _cx: &Cx) {} + fn as_any(&mut self) -> &mut dyn Any; +} + +/// A text field request (the input overlay). +pub struct Input { + pub title: String, + pub subtitle: String, + pub placeholder: String, + pub value: String, + pub secret: bool, + pub submit: String, + pub min: i32, + /// Stays open (busy) until the callback calls `input_done`/`input_failed`. + pub keep_open: bool, +} + +impl Input { + pub fn new(title: &str, placeholder: &str, value: &str) -> Input { + Input { + title: title.into(), + subtitle: String::new(), + placeholder: placeholder.into(), + value: value.into(), + secret: false, + submit: "Kész".into(), + min: 0, + keep_open: false, + } + } +} + +/// Called with the submitted text; `keep_open` inputs may be submitted again after a failure. +type InputDone = Rc; +type SelectDone = Box; + +enum Effect { + Push(Box), + Pop, + Refresh, + Section(usize), + Play(player::Request), +} + +struct Entry { + id: u64, + screen: Option>, + view: View, +} + +pub struct State { + pub cfg: Config, + pub api: Api, + pub user: User, + pub settings: UserSettings, + stack: Vec, + next_id: u64, + /// "message", "page", "player" + pub screen: &'static str, + message_retry: bool, + message_action: i32, + input_done: Option, + input_cancel: Option>, + select: Option<(usize, usize, SelectDone)>, + pub player: Option, + pub vpn_ok: Option, +} + +pub struct Inner { + pub ui: slint::Weak, + pub glass: sf_ui::Glass, + pub images: sf_ui::images::Images, + pub state: RefCell, + effects: RefCell>, + toast_timer: slint::Timer, + backdrop_timer: slint::Timer, + backdrop_key: RefCell, + pub colours: Rc>>, + tick: slint::Timer, + health: slint::Timer, + search_timer: slint::Timer, +} + +/// Cheap to clone; every callback holds one. +#[derive(Clone)] +pub struct Controller(pub Rc); + +impl std::ops::Deref for Controller { + type Target = Inner; + fn deref(&self) -> &Inner { + &self.0 + } +} + +/// What a screen's methods get: the controller and the screen's own id. +pub struct Cx<'a> { + pub c: &'a Controller, + pub id: u64, +} + +/// How the backdrop picture shows. +#[derive(Debug, Clone, Copy, PartialEq, Eq)] +pub enum Look { + /// Details pages: sharp, dark towards the left and bottom. + Sharp, + /// Browsing: blurred and dim behind the rows. + Soft, +} + +impl<'a> Cx<'a> { + pub fn api(&self) -> Api { + self.c.api() + } + pub fn api_base_image(&self, url: Option<&str>) -> String { + self.c.state.borrow().api.image(url, false) + } + pub fn user(&self) -> User { + self.c.state.borrow().user.clone() + } + pub fn settings(&self) -> UserSettings { + self.c.state.borrow().settings.clone() + } + pub fn set_settings(&self, s: UserSettings) { + self.c.state.borrow_mut().settings = s; + } + + /// Runs `work` on a thread; `done` gets this screen back (if it still + /// exists) on the UI thread. The page is rebuilt afterwards. + pub fn spawn(&self, work: impl FnOnce() -> R + Send + 'static, done: impl FnOnce(&mut T, &Cx, R) + 'static) { + let c = self.c.clone(); + let id = self.id; + task::spawn(work, move |r| c.with::(id, move |s, cx| done(s, cx, r))); + } + + /// Fire and forget, then rebuild this screen's page (and run `then`). + pub fn call(&self, what: &'static str, work: impl FnOnce() -> anyhow::Result<()> + Send + 'static, then: impl FnOnce(&mut T, &Cx) + 'static) { + self.spawn::(work, move |s, cx, r| { + if let Err(e) = r { + cx.error(what, &e); + } + then(s, cx); + }); + } + + /// Shows an API error (or signs out). + pub fn error(&self, what: &str, e: &anyhow::Error) { + if api::is_unauthenticated(e) { + let c = self.c.clone(); + slint::Timer::single_shot(Duration::from_millis(1), move || c.signed_out()); + return; + } + log::warn!("{what}: {e:#}"); + self.c.toast(&api::describe(e), true); + } + + pub fn push(&self, s: Box) { + self.c.effects.borrow_mut().push(Effect::Push(s)); + } + pub fn pop(&self) { + self.c.effects.borrow_mut().push(Effect::Pop); + } + pub fn refresh(&self) { + self.c.effects.borrow_mut().push(Effect::Refresh); + } + pub fn section(&self, n: usize) { + self.c.effects.borrow_mut().push(Effect::Section(n)); + } + pub fn play(&self, r: player::Request) { + self.c.effects.borrow_mut().push(Effect::Play(r)); + } + pub fn toast(&self, text: &str) { + self.c.toast(text, false); + } + pub fn toast_bad(&self, text: &str) { + self.c.toast(text, true); + } + pub fn backdrop(&self, url: &str, look: Look, key: &str) { + self.c.backdrop(url, look, key); + } + /// A text field; `done` gets the text (this screen back first). + pub fn input(&self, req: Input, done: impl FnOnce(&mut T, &Cx, String) + 'static) { + let id = self.id; + let once = RefCell::new(Some(done)); + self.c.open_input( + req, + Rc::new(move |c: &Controller, text: String| { + if let Some(done) = once.borrow_mut().take() { + c.with::(id, move |s, cx| done(s, cx, text)); + } + }), + None, + ); + } + /// A picker over `items` (label, detail, checked). + pub fn select(&self, title: &str, items: Vec<(String, String, bool)>, done: impl FnOnce(&mut T, &Cx, usize) + 'static) { + let id = self.id; + self.c.open_select(title, items, Box::new(move |c: &Controller, i: usize| c.with::(id, move |s, cx| done(s, cx, i)))); + } + /// The focus target (line id, item id) of this screen's page. + pub fn focus_on(&self, line: &str, col: usize) { + let mut st = self.c.state.borrow_mut(); + if let Some(e) = st.stack.iter_mut().find(|e| e.id == self.id) { + e.view.focus_on(line, col); + } + } + /// Physical pixels per design pixel. + pub fn px(&self) -> f32 { + self.c.px() + } +} + +impl Controller { + pub fn new(ui: &App, glass: sf_ui::Glass, images: sf_ui::images::Images) -> Controller { + let cfg = Config::load(); + let api = Api::new(&cfg.server, &cfg.token); + let state = State { + api, + user: User::default(), + settings: UserSettings::default(), + stack: Vec::new(), + next_id: 1, + screen: "message", + message_retry: false, + message_action: 0, + input_done: None, + input_cancel: None, + select: None, + player: None, + vpn_ok: None, + cfg, + }; + let c = Controller(Rc::new(Inner { + ui: ui.as_weak(), + glass, + images, + state: RefCell::new(state), + effects: RefCell::default(), + toast_timer: slint::Timer::default(), + backdrop_timer: slint::Timer::default(), + backdrop_key: RefCell::default(), + colours: Rc::default(), + tick: slint::Timer::default(), + health: slint::Timer::default(), + search_timer: slint::Timer::default(), + })); + crate::config::apply_look(&c.glass, &crate::config::Local::load().glass); + + let k = c.clone(); + ui.on_key(move |text, repeat| match action(&text) { + Some(a) => { + k.key(a, repeat); + true + } + None => false, + }); + let k = c.clone(); + ui.on_input_submitted(move |t| k.input_submitted(t.to_string())); + let k = c.clone(); + ui.on_input_cancelled(move || k.input_cancelled()); + let k = c.clone(); + ui.on_search_submitted(move |t| k.search(t.to_string(), true)); + let k = c.clone(); + ui.on_search_changed(move |t| k.search(t.to_string(), false)); + let k = c.clone(); + ui.on_search_exit_down(move || k.leave_keyboard(true)); + let k = c.clone(); + ui.on_search_exit_up(move || k.leave_keyboard(false)); + let k = c.clone(); + ui.on_search_cancelled(move || k.leave_keyboard(false)); + ui.set_page_nav_items(ModelRc::new(VecModel::from(SECTIONS.iter().map(|s| SharedString::from(*s)).collect::>()))); + + let k = c.clone(); + c.tick.start(slint::TimerMode::Repeated, Duration::from_secs(1), move || k.tick()); + c + } + + pub fn ui(&self) -> Option { + self.ui.upgrade() + } + + pub fn px(&self) -> f32 { + self.ui() + .map(|ui| { + let s = ui.window().size(); + (s.width as f32 / 1920.0).min(s.height as f32 / 1080.0).max(0.5) + }) + .unwrap_or(1.0) + } + + pub fn api(&self) -> Api { + self.state.borrow().api.clone() + } + + pub fn is_admin(&self) -> bool { + self.state.borrow().user.is_admin + } + + fn show(&self, screen: &'static str) { + self.state.borrow_mut().screen = screen; + if let Some(ui) = self.ui() { + ui.set_screen(screen.into()); + } + } + + // ---- start-up and sign-in ---- + + pub fn start(&self) { + if self.state.borrow().cfg.server.is_empty() { + return self.sign_in_server(""); + } + self.message(false, "Kapcsolódás…", ""); + let api = self.api(); + let c = self.clone(); + task::spawn( + move || api.auth_status().map(|s| (s.user, api.settings().unwrap_or_default())), + move |r| match r { + Ok((Some(user), settings)) => { + { + let mut st = c.state.borrow_mut(); + st.user = user; + st.settings = settings; + } + c.watch_health(); + c.section_now(0); + } + Ok((None, _)) => c.sign_in_user(""), + Err(e) => { + log::warn!("start: {e:#}"); + c.message(true, "A szerver nem érhető el", &api::describe(&e)); + } + }, + ); + } + + pub fn shutdown(&self) { + player::stop(self, false); + } + + fn message(&self, retry: bool, title: &str, text: &str) { + { + let mut st = self.state.borrow_mut(); + st.message_retry = retry; + st.message_action = 0; + } + if let Some(ui) = self.ui() { + ui.set_message_busy(!retry); + ui.set_message_title(title.into()); + ui.set_message_text(text.into()); + ui.set_message_action_a(if retry { "Újra".into() } else { "".into() }); + ui.set_message_action_b(if retry { "Szerver módosítása".into() } else { "".into() }); + ui.set_message_action(0); + } + self.glass.set_backdrop(None); + self.show("message"); + } + + fn message_key(&self, a: Action) { + let (retry, mut sel) = { + let st = self.state.borrow(); + (st.message_retry, st.message_action) + }; + match a { + Action::Back => { + let _ = slint::quit_event_loop(); + } + _ if !retry => {} + Action::Left => sel = 0, + Action::Right => sel = 1, + Action::Ok if sel == 0 => return self.start(), + Action::Ok => { + let server = self.state.borrow().cfg.server.clone(); + return self.sign_in_server(&server); + } + _ => {} + } + self.state.borrow_mut().message_action = sel; + if let Some(ui) = self.ui() { + ui.set_message_action(sel); + } + } + + /// Asks for the server's address (prefilled). + pub fn sign_in_server(&self, current: &str) { + self.message(false, "", ""); + if let Some(ui) = self.ui() { + ui.set_message_busy(false); + } + let host = if current.is_empty() { config::DEFAULT_SERVER.to_string() } else { current.to_string() }; + let req = Input { + title: "Netflex szerver".into(), + subtitle: "A szerver címe, ahová a Netflex telepítve van".into(), + placeholder: "netflex.pelda.hu".into(), + value: host.trim_start_matches("https://").into(), + secret: false, + submit: "Tovább".into(), + min: 3, + keep_open: true, + }; + let had = !self.state.borrow().cfg.token.is_empty(); + self.open_input( + req, + Rc::new(|c: &Controller, text: String| { + let base = api::normalize_base(&text); + let probe = Api::new(&base, ""); + let c2 = c.clone(); + task::spawn( + move || probe.auth_status().map(|_| ()), + move |r| match r { + Ok(()) => { + { + let mut st = c2.state.borrow_mut(); + st.cfg.server = base.clone(); + st.cfg.token.clear(); + st.cfg.save(); + st.api = Api::new(&base, ""); + } + c2.input_done(); + c2.sign_in_user(""); + } + Err(e) => c2.input_failed(&format!("Nem érhető el: {}", api::describe(&e))), + }, + ); + }), + Some(Box::new(move |c: &Controller| { + if had { + c.start() + } else { + let _ = slint::quit_event_loop(); + } + })), + ); + self.set_input_footer(""); + } + + pub fn sign_in_user(&self, note: &str) { + self.message(false, "", ""); + if let Some(ui) = self.ui() { + ui.set_message_busy(false); + } + let (server, username) = { + let st = self.state.borrow(); + (st.cfg.server.clone(), st.cfg.username.clone()) + }; + let req = Input { + title: "Bejelentkezés".into(), + subtitle: if note.is_empty() { "A Netflex felhasználóneved".into() } else { note.into() }, + placeholder: "Felhasználónév".into(), + value: username, + secret: false, + submit: "Tovább".into(), + min: 2, + keep_open: false, + }; + self.open_input( + req, + Rc::new(|c: &Controller, user: String| c.sign_in_password(user.trim().to_lowercase())), + Some(Box::new(move |c: &Controller| { + let server = c.state.borrow().cfg.server.clone(); + c.sign_in_server(&server) + })), + ); + self.set_input_footer(&format!("Szerver: {server} · Vissza: másik szerver")); + } + + fn sign_in_password(&self, username: String) { + let server = self.state.borrow().cfg.server.clone(); + let req = Input { + title: "Jelszó".into(), + subtitle: format!("{username} jelszava"), + placeholder: "Jelszó".into(), + value: String::new(), + secret: true, + submit: "Belépés".into(), + min: 1, + keep_open: true, + }; + let user2 = username.clone(); + self.open_input( + req, + Rc::new(move |c: &Controller, password: String| { + let username = username.clone(); + let api = c.api(); + let c2 = c.clone(); + task::spawn( + move || { + let signed = api.login(&username, &password)?; + let settings = api.with_token(&signed.token).settings().unwrap_or_default(); + Ok::<_, anyhow::Error>((signed, settings)) + }, + move |r| match r { + Ok((signed, settings)) => { + { + let mut st = c2.state.borrow_mut(); + st.cfg.token = signed.token.clone(); + st.cfg.username = signed.user.username.clone(); + st.cfg.save(); + st.api = st.api.with_token(&signed.token); + st.user = signed.user; + st.settings = settings; + } + c2.input_done(); + c2.watch_health(); + c2.section_now(0); + } + Err(e) => c2.input_failed(&api::describe(&e)), + }, + ); + }), + Some(Box::new(move |c: &Controller| { + c.state.borrow_mut().cfg.username = user2.clone(); + c.sign_in_user("") + })), + ); + self.set_input_footer(&format!("Szerver: {server}")); + } + + /// The session ended on the server: sign in again. + pub fn signed_out(&self) { + { + let mut st = self.state.borrow_mut(); + st.cfg.token.clear(); + st.cfg.save(); + st.api = st.api.with_token(""); + st.stack.clear(); + } + player::stop(self, false); + self.sign_in_user("A munkamenet lejárt, jelentkezz be újra."); + } + + /// Signs out of this device (Settings → Fiók). + pub fn sign_out(&self) { + let api = self.api(); + let c = self.clone(); + task::spawn(move || api.logout(), move |_| c.signed_out()); + } + + // ---- input overlay ---- + + pub fn open_input(&self, req: Input, done: InputDone, cancel: Option>) { + { + let mut st = self.state.borrow_mut(); + st.input_done = Some(done); + st.input_cancel = cancel; + } + let Some(ui) = self.ui() else { return }; + ui.invoke_input_reset(); + ui.set_input_title(req.title.into()); + ui.set_input_subtitle(req.subtitle.into()); + ui.set_input_placeholder(req.placeholder.into()); + ui.set_input_secret(req.secret); + ui.set_input_submit_label(req.submit.into()); + ui.set_input_min_length(req.min); + ui.set_input_text(req.value.into()); + ui.set_input_error("".into()); + ui.set_input_busy(false); + ui.set_input_footer("".into()); + ui.set_input_open(true); + INPUT_KEEP.with(|k| k.set(req.keep_open)); + } + + fn set_input_footer(&self, text: &str) { + if let Some(ui) = self.ui() { + ui.set_input_footer(text.into()); + } + } + + fn input_submitted(&self, text: String) { + let keep = INPUT_KEEP.with(|k| k.get()); + let done = if keep { self.state.borrow().input_done.clone() } else { self.state.borrow_mut().input_done.take() }; + let Some(done) = done else { return }; + if keep { + if let Some(ui) = self.ui() { + ui.set_input_busy(true); + } + } else { + self.close_input(); + } + done(self, text); + } + + fn input_cancelled(&self) { + let cancel = { + let mut st = self.state.borrow_mut(); + st.input_done = None; + st.input_cancel.take() + }; + self.close_input(); + if let Some(cb) = cancel { + cb(self); + } + } + + fn close_input(&self) { + if let Some(ui) = self.ui() { + ui.set_input_open(false); + ui.set_input_busy(false); + } + } + + /// A `keep_open` input succeeded. + pub fn input_done(&self) { + { + let mut st = self.state.borrow_mut(); + st.input_cancel = None; + st.input_done = None; + } + self.close_input(); + } + + /// A `keep_open` input failed: stays open with the error. + pub fn input_failed(&self, msg: &str) { + let Some(ui) = self.ui() else { return }; + ui.set_input_busy(false); + ui.set_input_error(msg.into()); + } + + // ---- picker ---- + + pub fn open_select(&self, title: &str, items: Vec<(String, String, bool)>, done: SelectDone) { + let focus = items.iter().position(|i| i.2).unwrap_or(0); + let n = items.len(); + self.state.borrow_mut().select = Some((focus, n, done)); + let Some(ui) = self.ui() else { return }; + let model: Vec = items + .into_iter() + .map(|(l, d, c)| MenuItem { text: l.into(), detail: d.into(), checked: c }) + .collect(); + ui.set_select_title(title.into()); + ui.set_select_items(ModelRc::new(VecModel::from(model))); + ui.set_select_focus(focus as i32); + ui.set_select_open(true); + } + + fn select_key(&self, a: Action) { + let mut st = self.state.borrow_mut(); + let Some((focus, n, _)) = st.select.as_mut() else { return }; + match a { + Action::Up => *focus = focus.saturating_sub(1), + Action::Down => *focus = (*focus + 1).min(n.saturating_sub(1)), + Action::Ok => { + let (i, _, done) = st.select.take().unwrap(); + drop(st); + if let Some(ui) = self.ui() { + ui.set_select_open(false); + } + done(self, i); + self.run_effects(); + return; + } + Action::Back | Action::Left | Action::Right => { + st.select = None; + drop(st); + if let Some(ui) = self.ui() { + ui.set_select_open(false); + } + return; + } + _ => {} + } + let f = *focus as i32; + drop(st); + if let Some(ui) = self.ui() { + ui.set_select_focus(f); + } + } + + // ---- toast ---- + + pub fn toast(&self, text: &str, bad: bool) { + let Some(ui) = self.ui() else { return }; + ui.set_toast_text(text.into()); + ui.set_toast_bad(bad); + let w = self.ui.clone(); + self.toast_timer.start(slint::TimerMode::SingleShot, Duration::from_millis(if bad { 5000 } else { 2600 }), move || { + if let Some(ui) = w.upgrade() { + ui.set_toast_text("".into()); + } + }); + } + + // ---- backdrop ---- + + /// The backdrop picture `url` (after the focus settles), or the gradient. + pub fn backdrop(&self, url: &str, look: Look, key: &str) { + if *self.backdrop_key.borrow() == key && !key.is_empty() { + return; + } + *self.backdrop_key.borrow_mut() = key.to_string(); + if let Some(col) = self.colours.borrow().get(key).copied() { + self.glass.set_palette(sf_ui::Palette::from_color(col)); + } + if url.is_empty() { + self.backdrop_timer.stop(); + self.glass.set_backdrop(None); + return; + } + let (c, url, key) = (self.clone(), url.to_string(), key.to_string()); + self.backdrop_timer.start(slint::TimerMode::SingleShot, Duration::from_millis(300), move || { + let px = c.px(); + let size = if look == Look::Soft { ((960.0 * px) as u32, (540.0 * px) as u32) } else { ((1920.0 * px) as u32, (1080.0 * px) as u32) }; + let c2 = c.clone(); + let key2 = key.clone(); + c.images.load_pixels(&url, size, move |pixels| { + if *c2.backdrop_key.borrow() != key2 || c2.state.borrow().screen == "player" { + return; + } + let b = sf_ui::Backdrop::new(pixels.clone()); + let b = match look { + Look::Sharp => b.dim(0.25).fade_left(1.0).fade_bottom(0.9).align(0.6, 0.2), + Look::Soft => b.dim(0.55).fade_left(0.6).fade_bottom(0.8).soft(), + }; + c2.glass.set_backdrop(Some(b)); + }); + }); + } + + pub fn clear_backdrop(&self) { + self.backdrop_key.borrow_mut().clear(); + self.backdrop_timer.stop(); + self.glass.set_backdrop(None); + } + + // ---- health (VPN state in the nav) ---- + + fn watch_health(&self) { + let c = self.clone(); + let check = move || { + let api = c.api(); + let c2 = c.clone(); + task::spawn( + move || api.health(), + move |r| { + let ok = r.ok().map(|h| h.vpn == "vpn"); + c2.state.borrow_mut().vpn_ok = ok; + if let Some(ui) = c2.ui() { + ui.set_page_vpn_label(match ok { + Some(true) => "VPN aktív".into(), + Some(false) => "VPN leállt".into(), + None => "Szerver nem érhető el".into(), + }); + ui.set_page_vpn_ok(ok == Some(true)); + } + }, + ); + }; + check(); + self.health.start(slint::TimerMode::Repeated, Duration::from_secs(15), check); + } + + // ---- the screen stack ---- + + /// Runs `f` on screen `id` (if it still exists), then the effects and a + /// rebuild of the top page. + pub fn with(&self, id: u64, f: impl FnOnce(&mut T, &Cx)) { + let taken = { + let mut st = self.state.borrow_mut(); + st.stack.iter_mut().find(|e| e.id == id).and_then(|e| e.screen.take()) + }; + let Some(mut screen) = taken else { return }; + { + let cx = Cx { c: self, id }; + if let Some(s) = screen.as_any().downcast_mut::() { + f(s, &cx); + } + } + { + let mut st = self.state.borrow_mut(); + if let Some(e) = st.stack.iter_mut().find(|e| e.id == id) { + e.screen = Some(screen); + } + } + let top = self.state.borrow().stack.last().map(|e| e.id); + if top == Some(id) { + self.effects.borrow_mut().push(Effect::Refresh); + } + self.run_effects(); + } + + /// Runs a `Screen` method on the top screen. + fn top(&self, f: impl FnOnce(&mut dyn Screen, &Cx) -> R) -> Option { + let (id, taken) = { + let mut st = self.state.borrow_mut(); + let e = st.stack.last_mut()?; + (e.id, e.screen.take()) + }; + let mut screen = taken?; + let r = { + let cx = Cx { c: self, id }; + f(screen.as_mut(), &cx) + }; + { + let mut st = self.state.borrow_mut(); + if let Some(e) = st.stack.iter_mut().find(|e| e.id == id) { + e.screen = Some(screen); + } + } + Some(r) + } + + fn run_effects(&self) { + loop { + let effects: Vec = std::mem::take(&mut *self.effects.borrow_mut()); + if effects.is_empty() { + break; + } + let mut refresh = false; + for e in effects { + match e { + Effect::Push(s) => self.push_now(s), + Effect::Pop => self.pop_now(), + Effect::Refresh => refresh = true, + Effect::Section(n) => self.section_now(n), + Effect::Play(r) => player::play(self, r), + } + } + if refresh { + self.rebuild(); + } + } + } + + fn push_now(&self, s: Box) { + { + let mut st = self.state.borrow_mut(); + let id = st.next_id; + st.next_id += 1; + st.stack.push(Entry { id, screen: Some(s), view: View::default() }); + } + self.clear_backdrop(); + self.attach(); + self.rebuild(); + self.after_focus(); + } + + fn pop_now(&self) { + let left = { + let mut st = self.state.borrow_mut(); + if st.stack.len() > 1 { + st.stack.pop(); + } + st.stack.len() + }; + let _ = left; + self.clear_backdrop(); + self.attach(); + self.top(|s, cx| s.shown(cx)); + self.rebuild(); + self.after_focus(); + } + + /// Replaces the stack with a section's screen. + pub fn section_now(&self, n: usize) { + let keep_nav = self.state.borrow().stack.last().is_some_and(|e| e.view.focus == Focus::Nav); + { + self.state.borrow_mut().stack.clear(); + } + let screen = screens::section(n); + { + let mut st = self.state.borrow_mut(); + let id = st.next_id; + st.next_id += 1; + let mut view = View::default(); + view.nav_index = n; + if keep_nav { + view.focus = Focus::Nav; + } + st.stack.push(Entry { id, screen: Some(screen), view }); + } + self.clear_backdrop(); + self.glass.set_palette(sf_ui::Palette::from_hex(["#ff4a3d", "#8c0b14", "#120305"])); + self.attach(); + self.rebuild(); + self.after_focus(); + } + + /// Settings on tab `tab` ("vpn", "ncore"...). + pub fn open_settings(&self, tab: &str) { + let tab = tab.to_string(); + let c = self.clone(); + slint::Timer::single_shot(Duration::from_millis(1), move || { + c.section_now(6); + let id = c.state.borrow().stack.last().map(|e| e.id).unwrap_or(0); + c.with::(id, |s, cx| s.open_tab(cx, &tab)); + }); + } + + /// Points Slint at the top view's model and shows the page. + fn attach(&self) { + let model = self.state.borrow().stack.last().map(|e| e.view.model()); + if let (Some(ui), Some(m)) = (self.ui(), model) { + ui.set_page_lines(m); + } + if self.state.borrow().screen != "player" { + self.show("page"); + } + } + + /// Rebuilds the top page from its screen. + pub fn rebuild(&self) { + let spec = self.top(|s, cx| s.spec(cx)); + let Some(spec) = spec else { return }; + let px = self.px(); + { + let mut st = self.state.borrow_mut(); + if let Some(e) = st.stack.last_mut() { + e.view.set(spec, &self.images, px); + } + } + self.sync(); + } + + /// Focus, scroll and frame to Slint; pictures around the focus. + fn sync(&self) { + let Some(ui) = self.ui() else { return }; + let px = self.px(); + let mut st = self.state.borrow_mut(); + let Some(e) = st.stack.last_mut() else { return }; + let v = &mut e.view; + v.sync_cols(); + ui.set_page_focus(if v.focus == Focus::Line { v.line as i32 } else { -1 }); + ui.set_page_scroll(v.scroll); + ui.set_page_show_nav(v.frame.nav.is_some()); + ui.set_page_nav_index(v.frame.nav.unwrap_or(0) as i32); + ui.set_page_nav_focused(v.focus == Focus::Nav); + match &v.frame.side { + Some((title, items, cur)) => { + ui.set_page_side_title(title.clone().into()); + ui.set_page_side_items(ModelRc::new(VecModel::from(items.iter().map(|s| SharedString::from(s.as_str())).collect::>()))); + ui.set_page_side_index(*cur as i32); + ui.set_page_side_focus(if v.focus == Focus::Side { v.side_focus as i32 } else { -1 }); + } + None => { + ui.set_page_side_items(ModelRc::default()); + ui.set_page_side_focus(-1); + } + } + let kb_line = v.lines.iter().position(|l| l.kind == Kind::Keyboard); + match (kb_line, &v.frame.keyboard) { + (Some(i), Some(ph)) => { + let y = v_line_y(v, i); + ui.set_page_kb_y(y); + ui.set_page_kb_placeholder(ph.clone().into()); + ui.set_page_kb_focused(v.focus == Focus::Line && v.line == i); + } + _ => { + ui.set_page_kb_y(-1.0); + ui.set_page_kb_focused(false); + } + } + v.load_images(&self.images, px); + } + + fn after_focus(&self) { + let target = { + let st = self.state.borrow(); + st.stack.last().map(|e| (e.view.target(), e.view.near_end(), e.view.focus.clone())) + }; + let Some(((line, item), near, focus)) = target else { return }; + if focus == Focus::Line { + self.top(|s, cx| s.focus(cx, &line, &item)); + if let Some(list) = near { + self.top(|s, cx| s.more(cx, &list)); + } + } + self.run_effects(); + } + + // ---- keys ---- + + fn key(&self, a: Action, repeat: bool) { + if self.state.borrow().select.is_some() { + return self.select_key(a); + } + match self.state.borrow().screen { + "message" => return self.message_key(a), + "player" => return player::key(self, a, repeat), + _ => {} + } + self.page_key(a); + } + + fn page_key(&self, a: Action) { + enum Then { + Moved, + Activate(String, String), + Back, + Section(usize), + Side(usize), + Nothing, + Quit, + } + let then = { + let mut st = self.state.borrow_mut(); + let Some(e) = st.stack.last_mut() else { return }; + let v = &mut e.view; + let has_side = v.frame.side.is_some(); + let has_nav = v.frame.nav.is_some(); + match v.focus { + Focus::Nav => match a { + Action::Left if v.frame.nav.unwrap_or(0) > 0 => Then::Section(v.frame.nav.unwrap() - 1), + Action::Right if v.frame.nav.unwrap_or(0) + 1 < SECTIONS.len() => Then::Section(v.frame.nav.unwrap() + 1), + Action::Down | Action::Ok => { + if v.has_lines() && v.lines.iter().any(|l| matches!(l.kind, Kind::Chips | Kind::Cards | Kind::Item | Kind::Hero | Kind::Keyboard)) { + v.focus = if has_side { Focus::Side } else { Focus::Line }; + v.clamp_scroll(); + Then::Moved + } else { + Then::Nothing + } + } + Action::Back if v.frame.nav.unwrap_or(0) != 0 => Then::Section(0), + Action::Back => Then::Quit, + _ => Then::Nothing, + }, + Focus::Side => { + let n = v.frame.side.as_ref().map(|s| s.1.len()).unwrap_or(0); + match a { + Action::Up if v.side_focus > 0 => { + v.side_focus -= 1; + Then::Side(v.side_focus) + } + Action::Up if has_nav => { + v.focus = Focus::Nav; + Then::Moved + } + Action::Down if v.side_focus + 1 < n => { + v.side_focus += 1; + Then::Side(v.side_focus) + } + Action::Right | Action::Ok => { + if v.lines.iter().any(|l| matches!(l.kind, Kind::Chips | Kind::Cards | Kind::Item | Kind::Hero)) { + v.focus = Focus::Line; + v.clamp_scroll(); + } + Then::Moved + } + Action::Back => Then::Back, + _ => Then::Nothing, + } + } + Focus::Line => match a { + Action::Up => { + if !v.vertical(false) { + if has_side { + v.focus = Focus::Side; + } else if has_nav { + v.focus = Focus::Nav; + v.scroll = 0.0; + } + } + Then::Moved + } + Action::Down => { + v.vertical(true); + Then::Moved + } + Action::Left => { + if !v.horizontal(false) && has_side { + v.focus = Focus::Side; + } + Then::Moved + } + Action::Right => { + v.horizontal(true); + Then::Moved + } + Action::Ok | Action::PlayPause => { + let (l, i) = v.target(); + Then::Activate(l, i) + } + Action::Back => Then::Back, + }, + } + }; + match then { + Then::Nothing => {} + Then::Quit => { + let _ = slint::quit_event_loop(); + } + Then::Moved => { + self.sync(); + self.after_focus(); + } + Then::Section(n) => self.section_now(n), + Then::Side(i) => { + self.top(|s, cx| s.side(cx, i)); + self.rebuild(); + self.run_effects(); + } + Then::Activate(l, i) => { + self.top(|s, cx| s.activate(cx, &l, &i)); + self.effects.borrow_mut().push(Effect::Refresh); + self.run_effects(); + self.after_focus(); + } + Then::Back => { + let handled = self.top(|s, cx| s.back(cx)).unwrap_or(false); + if handled { + self.effects.borrow_mut().push(Effect::Refresh); + self.run_effects(); + return; + } + let depth = self.state.borrow().stack.len(); + if depth > 1 { + self.pop_now(); + } else { + let mut st = self.state.borrow_mut(); + if let Some(e) = st.stack.last_mut() { + if e.view.frame.nav.is_some() { + e.view.focus = Focus::Nav; + e.view.scroll = 0.0; + } else if e.view.frame.side.is_some() { + e.view.focus = Focus::Side; + } + } + drop(st); + self.sync(); + } + } + } + } + + // ---- search keyboard ---- + + fn search(&self, text: String, submit: bool) { + if submit { + self.search_timer.stop(); + self.top(|s, cx| s.query(cx, &text, true)); + self.run_effects(); + return; + } + let c = self.clone(); + self.search_timer.start(slint::TimerMode::SingleShot, Duration::from_millis(450), move || { + c.top(|s, cx| s.query(cx, &text, false)); + c.run_effects(); + }); + } + + fn leave_keyboard(&self, down: bool) { + { + let mut st = self.state.borrow_mut(); + let Some(e) = st.stack.last_mut() else { return }; + let v = &mut e.view; + if !v.vertical(down) && !down && v.frame.nav.is_some() { + v.focus = Focus::Nav; + } + } + self.sync(); + self.after_focus(); + } + + fn tick(&self) { + if self.state.borrow().screen != "page" { + return; + } + self.top(|s, cx| s.tick(cx)); + self.run_effects(); + } + + /// Back from the player. + pub fn player_closed(&self) { + self.clear_backdrop(); + self.attach(); + self.top(|s, cx| s.shown(cx)); + self.rebuild(); + self.after_focus(); + } +} + +fn v_line_y(v: &View, i: usize) -> f32 { + v.line_y(i) +} + +/// Cx helper for screens that need a keep-open input (async validation). +impl Cx<'_> { + /// A text field that stays open while `check` runs; `check` returns an + /// error message to show, or None to close. + pub fn input_checked( + &self, + req: Input, + work: impl Fn(String) -> R + Send + Sync + 'static, + done: impl Fn(&mut T, &Cx, R) -> Option + 'static, + ) { + let id = self.id; + let work = std::sync::Arc::new(work); + let done = Rc::new(done); + let mut req = req; + req.keep_open = true; + self.c.open_input( + req, + Rc::new(move |c: &Controller, text: String| { + let work = work.clone(); + let done = done.clone(); + let c2 = c.clone(); + task::spawn( + move || work(text), + move |r| { + let mut err: Option = None; + c2.with::(id, |s, cx| err = done(s, cx, r)); + match err { + Some(e) => c2.input_failed(&e), + None => c2.input_done(), + } + }, + ); + }), + None, + ); + } +} + +thread_local! { + static INPUT_KEEP: std::cell::Cell = const { std::cell::Cell::new(false) }; +} diff --git a/src/config.rs b/src/config.rs new file mode 100644 index 0000000..c2bef7b --- /dev/null +++ b/src/config.rs @@ -0,0 +1,98 @@ +//! What the app remembers: the server and the session token. Lives in +//! `$HOME/.config/netflex/config.toml` (on the TV, $HOME is the app's own +//! data folder inside the sandbox). + +use std::path::PathBuf; + +use serde::{Deserialize, Serialize}; + +/// The household's server, offered on the first start. +pub const DEFAULT_SERVER: &str = "https://netflex.furbidden.cloud"; + +#[derive(Debug, Clone, Default, Serialize, Deserialize)] +pub struct Config { + #[serde(default)] + pub server: String, + #[serde(default)] + pub token: String, + #[serde(default)] + pub username: String, +} + +fn path() -> PathBuf { + let home = std::env::var_os("HOME") + .or_else(|| std::env::var_os("APPDATA")) + .map(PathBuf::from) + .unwrap_or_else(|| PathBuf::from(".")); + home.join(".config").join("netflex").join("config.toml") +} + +impl Config { + pub fn load() -> Config { + let mut c: Config = std::fs::read_to_string(path()).ok().and_then(|t| toml::from_str(&t).ok()).unwrap_or_default(); + if let Ok(s) = std::env::var("NETFLEX_SERVER") { + c.server = s; + } + c + } + + pub fn save(&self) { + let p = path(); + let result = (|| -> anyhow::Result<()> { + std::fs::create_dir_all(p.parent().unwrap())?; + let tmp = p.with_extension("tmp"); + std::fs::write(&tmp, toml::to_string(self)?)?; + std::fs::rename(&tmp, &p)?; + Ok(()) + })(); + if let Err(e) = result { + log::warn!("saving {}: {e:#}", p.display()); + } + } +} + +/// Settings of this TV only (Beállítások → Megjelenés), like the web app's +/// per-device look: `$HOME/.config/netflex/device.toml`. +#[derive(Debug, Clone, Serialize, Deserialize)] +pub struct Local { + /// "auto" | "full" | "light" | "off" + #[serde(default = "auto")] + pub glass: String, +} + +fn auto() -> String { + "auto".into() +} + +impl Default for Local { + fn default() -> Self { + Local { glass: auto() } + } +} + +fn local_path() -> PathBuf { + path().with_file_name("device.toml") +} + +impl Local { + pub fn load() -> Local { + std::fs::read_to_string(local_path()).ok().and_then(|t| toml::from_str(&t).ok()).unwrap_or_default() + } + + pub fn save(&self) { + let p = local_path(); + let _ = std::fs::create_dir_all(p.parent().unwrap()); + if let Err(e) = std::fs::write(&p, toml::to_string(self).unwrap_or_default()) { + log::warn!("saving {}: {e:#}", p.display()); + } + } +} + +/// Applies the glass look ("auto" = full: the TV's GPU handles it). +pub fn apply_look(glass: &sf_ui::Glass, look: &str) { + glass.set_quality(match look { + "light" => sf_ui::Quality::Light, + "off" => sf_ui::Quality::Flat, + _ => sf_ui::Quality::Full, + }); +} diff --git a/src/detail.rs b/src/detail.rs new file mode 100644 index 0000000..a2291a8 --- /dev/null +++ b/src/detail.rs @@ -0,0 +1,572 @@ +//! A title's page: facts, Play / Continue / Next, My List, seasons and +//! episodes. The title's artwork is the glass backdrop. + +use std::rc::Rc; + +use slint::{Model, ModelRc, VecModel}; + +use crate::api::{self, EpisodeInfo, MediaType, ProgressRow, SeasonSummary, TitleDetail}; +use crate::app::{Action, Controller, Screen}; +use crate::home::Item; +use crate::{Episode, MenuItem, format, player, task}; + +pub struct Detail { + item: Item, + data: Option, + progress: Vec, + listed: bool, + /// The season whose episodes are shown. + season: i32, + episodes: Vec, + ep_model: Rc>, + /// 0 = buttons, 1 = episodes, 2 = season menu. + area: i32, + button: i32, + episode: usize, + season_focus: usize, + generation: u64, +} + +fn seasons_of(d: &Detail) -> &[SeasonSummary] { + d.data.as_ref().map(|t| t.seasons.as_slice()).unwrap_or(&[]) +} + +/// Where Play goes, its label and the resume position (web: resumeTarget). +fn target(d: &Detail) -> (Option<(i32, i32)>, String, f64) { + let resume = |p: &ProgressRow| (p.position - 3.0).max(0.0); + let unfinished = |p: &ProgressRow| !p.completed && p.position > 60.0 && p.duration.is_none_or(|dur| p.position / dur < 0.95); + if d.item.kind == MediaType::Movie { + return match d.progress.iter().find(|p| p.season == 0 && p.episode == 0) { + Some(p) if unfinished(p) => (None, "Folytatás".into(), resume(p)), + _ => (None, "Lejátszás".into(), 0.0), + }; + } + let seasons = seasons_of(d); + let first = seasons.iter().map(|s| s.number).find(|n| *n > 0).unwrap_or(1); + let latest = d.progress.iter().filter(|p| p.season > 0).max_by_key(|p| (p.season, p.episode)); + let Some(latest) = latest else { return (Some((first, 1)), "Lejátszás".into(), 0.0) }; + let (s, e) = (latest.season, latest.episode); + if !latest.completed { + return (Some((s, e)), format!("Folytatás · {}", format::episode_code(s, e)), if unfinished(latest) { resume(latest) } else { 0.0 }); + } + match next_episode(seasons, &d.episodes, d.season, s, e) { + Some((ns, ne)) => (Some((ns, ne)), format!("Következő · {}", format::episode_code(ns, ne)), 0.0), + None => (Some((s, e)), "Újra".into(), 0.0), + } +} + +/// The episode after `s`/`e`: the next aired one in the season, or the +/// first of the next season. `episodes` are those of season `shown`. +fn next_episode(seasons: &[SeasonSummary], episodes: &[EpisodeInfo], shown: i32, s: i32, e: i32) -> Option<(i32, i32)> { + let today = chrono_today(); + let aired = |ep: &EpisodeInfo| ep.air_date.as_deref().is_none_or(|d| d <= today.as_str()); + let in_season = if shown == s && !episodes.is_empty() { + episodes.iter().any(|ep| ep.episode == e + 1 && aired(ep)) + } else { + seasons.iter().find(|x| x.number == s).is_some_and(|x| e < x.aired_count.unwrap_or(x.episode_count)) + }; + if in_season { + return Some((s, e + 1)); + } + seasons.iter().find(|x| x.number == s + 1 && x.aired_count.unwrap_or(x.episode_count) > 0).map(|x| (x.number, 1)) +} + +fn chrono_today() -> String { + // YYYY-MM-DD without a date crate: days since the epoch -> civil date. + let days = std::time::SystemTime::now().duration_since(std::time::UNIX_EPOCH).map(|d| d.as_secs() / 86400).unwrap_or(0) as i64; + let z = days + 719_468; + let era = z.div_euclid(146_097); + let doe = z - era * 146_097; + let yoe = (doe - doe / 1460 + doe / 36_524 - doe / 146_096) / 365; + let doy = doe - (365 * yoe + yoe / 4 - yoe / 100); + let mp = (5 * doy + 2) / 153; + let d = doy - (153 * mp + 2) / 5 + 1; + let m = if mp < 10 { mp + 3 } else { mp - 9 }; + let y = yoe + era * 400 + if m <= 2 { 1 } else { 0 }; + format!("{y:04}-{m:02}-{d:02}") +} + +/// The season to show first: where the viewer is, else the first one. +fn current_season(d: &Detail) -> i32 { + let seasons = seasons_of(d); + let first = seasons.iter().map(|s| s.number).find(|n| *n > 0).or_else(|| seasons.first().map(|s| s.number)).unwrap_or(1); + let last = d.progress.iter().filter(|p| p.season > 0).map(|p| p.season).max(); + let Some(last) = last else { return first }; + let Some(s) = seasons.iter().find(|x| x.number == last) else { return first }; + let watched = d.progress.iter().filter(|p| p.season == last && p.completed).count() as i32; + if watched < s.aired_count.unwrap_or(s.episode_count) { + return last; + } + seasons.iter().find(|x| x.number > last && x.aired_count.unwrap_or(x.episode_count) > 0).map(|x| x.number).unwrap_or(last) +} + +pub fn open(c: &Controller, item: &Item) { + let generation = { + let mut st = c.state.borrow_mut(); + let generation = st.detail.as_ref().map(|d| d.generation + 1).unwrap_or(1); + st.detail = Some(Detail { + item: item.clone(), + data: None, + progress: Vec::new(), + listed: false, + season: 1, + episodes: Vec::new(), + ep_model: Rc::new(VecModel::default()), + area: 0, + button: 0, + episode: 0, + season_focus: 0, + generation, + }); + generation + }; + if let Some(ui) = c.ui() { + ui.set_detail_title(item.title.clone().into()); + ui.set_detail_meta(item.meta.clone().into()); + ui.set_detail_overview(item.overview.clone().into()); + ui.set_detail_logo(Default::default()); + ui.set_detail_is_series(item.kind == MediaType::Tv); + ui.set_detail_play_label("Lejátszás".into()); + ui.set_detail_listed(false); + ui.set_detail_season_label("".into()); + ui.set_detail_episodes(ModelRc::from(c.state.borrow().detail.as_ref().unwrap().ep_model.clone())); + ui.set_detail_seasons(ModelRc::default()); + ui.set_detail_status("".into()); + ui.set_detail_busy(true); + } + sync(c); + show_backdrop(c, item); + let px = c.px(); + if !item.logo.is_empty() { + let k = c.clone(); + c.images.load(&item.logo, ((620.0 * px) as u32, (190.0 * px) as u32), move |img| { + if k.state.borrow().detail.as_ref().is_some_and(|d| d.generation == generation) { + if let Some(ui) = k.ui() { + ui.set_detail_logo(img); + } + } + }); + } + c.push(Screen::Detail); + load(c, generation); +} + +fn show_backdrop(c: &Controller, item: &Item) { + if item.backdrop.is_empty() { + c.glass.set_backdrop(None); + return; + } + let k = c.clone(); + let key = item.key(); + let px = c.px(); + c.images.load_pixels(&item.backdrop, ((1920.0 * px) as u32, (1080.0 * px) as u32), move |pixels| { + let st = k.state.borrow(); + if st.screen == Screen::Detail && st.detail.as_ref().is_some_and(|d| d.item.key() == key) { + k.glass.set_backdrop(Some(sf_ui::Backdrop::new(pixels.clone()).dim(0.25).fade_left(1.0).fade_bottom(0.9).align(0.6, 0.2))); + } + }); +} + +fn load(c: &Controller, generation: u64) { + let Some((kind, id)) = c.state.borrow().detail.as_ref().map(|d| (d.item.kind, d.item.id.clone())) else { return }; + let api = c.api(); + let k = c.clone(); + task::spawn( + move || -> anyhow::Result<_> { + let data = api.title(kind, &id)?; + let progress = api.progress(kind, &id).unwrap_or_default(); + let listed = api.list_status().ok().and_then(|m| m.get(&format!("{}:{}", kind.key(), id)).map(|s| s.listed)).unwrap_or(false); + Ok((data, progress, listed)) + }, + move |r| { + let ok = { + let mut st = k.state.borrow_mut(); + let Some(d) = st.detail.as_mut().filter(|d| d.generation == generation) else { return }; + match r { + Ok((data, progress, listed)) => { + d.data = Some(data); + d.progress = progress; + d.listed = listed; + d.season = current_season(d); + Ok(()) + } + Err(e) => Err(e), + } + }; + match ok { + Ok(()) => { + refresh(&k); + let series = k.state.borrow().detail.as_ref().is_some_and(|d| d.item.kind == MediaType::Tv); + if series { + load_season(&k, generation); + } else if let Some(ui) = k.ui() { + ui.set_detail_busy(false); + } + } + Err(e) if api::is_unauthenticated(&e) => k.signed_out(), + Err(e) => { + if let Some(ui) = k.ui() { + ui.set_detail_busy(false); + ui.set_detail_status(api::describe(&e).into()); + } + } + } + }, + ); +} + +fn load_season(c: &Controller, generation: u64) { + let Some((id, season)) = c.state.borrow().detail.as_ref().map(|d| (d.item.id.clone(), d.season)) else { return }; + if let Some(ui) = c.ui() { + ui.set_detail_busy(true); + ui.set_detail_status("".into()); + } + let api = c.api(); + let k = c.clone(); + task::spawn( + move || api.season(&id, season), + move |r| { + let Some(ui) = k.ui() else { return }; + ui.set_detail_busy(false); + match r { + Ok(s) => { + { + let mut st = k.state.borrow_mut(); + let Some(d) = st.detail.as_mut().filter(|d| d.generation == generation && d.season == season) else { return }; + d.episodes = s.episodes; + d.episode = first_unwatched(d); + } + refresh(&k); + load_stills(&k); + } + Err(e) => ui.set_detail_status(api::describe(&e).into()), + } + }, + ); +} + +fn first_unwatched(d: &Detail) -> usize { + d.episodes + .iter() + .position(|e| !d.progress.iter().any(|p| p.season == e.season && p.episode == e.episode && p.completed)) + .unwrap_or(0) +} + +/// Labels, the episodes model and focus, from the state. +fn refresh(c: &Controller) { + let Some(ui) = c.ui() else { return }; + let st = c.state.borrow(); + let Some(d) = st.detail.as_ref() else { return }; + let (_, label, _) = target(d); + ui.set_detail_play_label(label.into()); + ui.set_detail_listed(d.listed); + if let Some(data) = &d.data { + let extra = if d.item.kind == MediaType::Tv { + let n = data.seasons.iter().filter(|s| s.number > 0).count(); + if n > 0 { format!("{n} évad") } else { String::new() } + } else { + format::runtime(data.runtime) + }; + ui.set_detail_meta(format::meta(&data.summary, &extra).into()); + let season = data.seasons.iter().find(|s| s.number == d.season); + ui.set_detail_season_label(season.map(|s| if s.name.is_empty() { format!("{}. évad", s.number) } else { s.name.clone() }).unwrap_or_default().into()); + let items: Vec = data + .seasons + .iter() + .map(|s| MenuItem { + text: if s.name.is_empty() { format!("{}. évad", s.number) } else { s.name.clone() }.into(), + detail: format!("{} rész", s.aired_count.unwrap_or(s.episode_count)).into(), + checked: s.number == d.season, + }) + .collect(); + ui.set_detail_seasons(ModelRc::new(VecModel::from(items))); + } + // Episodes: keep pictures already loaded. + let old: Vec = d.ep_model.iter().collect(); + let eps: Vec = d + .episodes + .iter() + .enumerate() + .map(|(i, e)| { + let p = d.progress.iter().find(|p| p.season == e.season && p.episode == e.episode); + let watched = p.is_some_and(|p| p.completed); + let progress = match p { + Some(p) if !p.completed => p.duration.filter(|x| *x > 0.0).map(|x| (p.position / x) as f32).unwrap_or(-1.0), + _ => -1.0, + }; + let mut detail = format::runtime(e.runtime); + if let Some(date) = e.air_date.as_deref().filter(|d| d.len() >= 10) { + if !detail.is_empty() { + detail.push_str(" · "); + } + detail.push_str(&date[..10].replace('-', ". ")); + detail.push('.'); + } + Episode { + number: e.episode, + title: e.name.clone().unwrap_or_else(|| format!("{}. rész", e.episode)).into(), + detail: detail.into(), + image: old.get(i).filter(|o| o.number == e.episode).map(|o| o.image.clone()).unwrap_or_default(), + progress, + watched, + } + }) + .collect(); + d.ep_model.set_vec(eps); + drop(st); + sync(c); +} + +fn load_stills(c: &Controller) { + let px = c.px(); + let (wants, model) = { + let st = c.state.borrow(); + let Some(d) = st.detail.as_ref() else { return }; + let api = &st.api; + let wants: Vec<(usize, i32, String)> = d + .episodes + .iter() + .enumerate() + .filter_map(|(i, e)| e.still.as_deref().map(|s| (i, e.episode, api.image(Some(s), false)))) + .collect(); + (wants, d.ep_model.clone()) + }; + for (i, number, url) in wants { + let model = model.clone(); + c.images.load(&url, ((384.0 * px * 1.1) as u32, (216.0 * px * 1.1) as u32), move |img| { + if let Some(mut e) = model.row_data(i) { + if e.number == number { + e.image = img; + model.set_row_data(i, e); + } + } + }); + } +} + +/// Focus state to Slint; the overview follows the focused episode. +fn sync(c: &Controller) { + let Some(ui) = c.ui() else { return }; + let st = c.state.borrow(); + let Some(d) = st.detail.as_ref() else { return }; + ui.set_detail_area(d.area); + ui.set_detail_button(d.button); + ui.set_detail_episode(d.episode as i32); + ui.set_detail_season_focus(d.season_focus as i32); + let overview = d.data.as_ref().and_then(|t| t.summary.overview.clone()).unwrap_or_else(|| d.item.overview.clone()); + match (d.area, d.episodes.get(d.episode)) { + (1, Some(e)) => { + let name = e.name.clone().unwrap_or_default(); + ui.set_detail_overview(format!("{} {}\n{}", format::episode_code(e.season, e.episode), name, e.overview.clone().unwrap_or_default()).into()); + } + _ => ui.set_detail_overview(overview.into()), + } +} + +/// Back from the player: progress changed. +pub fn returned(c: &Controller) { + let Some((kind, id, generation, item)) = + c.state.borrow().detail.as_ref().map(|d| (d.item.kind, d.item.id.clone(), d.generation, d.item.clone())) + else { + return; + }; + show_backdrop(c, &item); + let api = c.api(); + let k = c.clone(); + task::spawn( + move || api.progress(kind, &id), + move |r| { + if let Ok(p) = r { + if let Some(d) = k.state.borrow_mut().detail.as_mut().filter(|d| d.generation == generation) { + d.progress = p; + } + refresh(&k); + } + }, + ); +} + +/// The episode after `ep` of the open series, if any (for the player). +pub fn next_after(c: &Controller, ep: (i32, i32)) -> Option<(i32, i32)> { + let st = c.state.borrow(); + let d = st.detail.as_ref()?; + next_episode(seasons_of(d), &d.episodes, d.season, ep.0, ep.1) +} + +/// The name of an episode of the shown season, if known. +pub fn episode_name(c: &Controller, ep: (i32, i32)) -> String { + let st = c.state.borrow(); + st.detail + .as_ref() + .and_then(|d| d.episodes.iter().find(|e| e.season == ep.0 && e.episode == ep.1)) + .and_then(|e| e.name.clone()) + .unwrap_or_default() +} + +fn play(c: &Controller, ep: Option<(i32, i32)>, resume: f64) { + let req = { + let st = c.state.borrow(); + let Some(d) = st.detail.as_ref() else { return }; + let next = ep.and_then(|e| next_episode(seasons_of(d), &d.episodes, d.season, e.0, e.1)); + player::Request { + kind: d.item.kind, + id: d.item.id.clone(), + title: d.item.title.clone(), + ep, + episode_name: String::new(), + resume, + backdrop: d.item.backdrop.clone(), + next, + } + }; + let req = player::Request { episode_name: ep.map(|e| episode_name(c, e)).unwrap_or_default(), ..req }; + player::play(c, req); +} + +pub fn key(c: &Controller, a: Action, _repeat: bool) { + enum Then { + Sync, + Pop, + Play(Option<(i32, i32)>, f64), + ToggleList, + Season(i32), + } + let then = { + let mut st = c.state.borrow_mut(); + let Some(d) = st.detail.as_mut() else { return }; + let series = d.item.kind == MediaType::Tv; + let buttons = if series && d.data.is_some() { 3 } else { 2 }; + match (d.area, a) { + (0, Action::Left) => { + d.button = (d.button - 1).max(0); + Then::Sync + } + (0, Action::Right) => { + d.button = (d.button + 1).min(buttons - 1); + Then::Sync + } + (0, Action::Down) if series && !d.episodes.is_empty() => { + d.area = 1; + Then::Sync + } + (0, Action::Ok | Action::PlayPause) => match d.button { + 0 if d.data.is_some() || d.item.kind == MediaType::Movie => { + let (ep, _, resume) = target(d); + Then::Play(ep, resume) + } + 1 => Then::ToggleList, + 2 => { + let seasons = seasons_of(d); + d.season_focus = seasons.iter().position(|s| s.number == d.season).unwrap_or(0); + d.area = 2; + Then::Sync + } + _ => Then::Sync, + }, + (0, Action::Back) => Then::Pop, + (1, Action::Left) => { + d.episode = d.episode.saturating_sub(1); + Then::Sync + } + (1, Action::Right) => { + d.episode = (d.episode + 1).min(d.episodes.len().saturating_sub(1)); + Then::Sync + } + (1, Action::Up | Action::Back) => { + d.area = 0; + Then::Sync + } + (1, Action::Ok | Action::PlayPause) => match d.episodes.get(d.episode) { + Some(e) => { + let p = d.progress.iter().find(|p| p.season == e.season && p.episode == e.episode); + let resume = p.filter(|p| !p.completed && p.position > 60.0).map(|p| (p.position - 3.0).max(0.0)).unwrap_or(0.0); + Then::Play(Some((e.season, e.episode)), resume) + } + None => Then::Sync, + }, + (2, Action::Up) => { + d.season_focus = d.season_focus.saturating_sub(1); + Then::Sync + } + (2, Action::Down) => { + d.season_focus = (d.season_focus + 1).min(seasons_of(d).len().saturating_sub(1)); + Then::Sync + } + (2, Action::Ok) => match seasons_of(d).get(d.season_focus).map(|s| s.number) { + Some(n) => { + d.area = 0; + Then::Season(n) + } + None => Then::Sync, + }, + (2, Action::Back | Action::Left | Action::Right) => { + d.area = 0; + Then::Sync + } + _ => Then::Sync, + } + }; + match then { + Then::Sync => sync(c), + Then::Pop => { + c.pop(); + } + Then::Play(ep, resume) => play(c, ep, resume), + Then::ToggleList => { + let (kind, id, on) = { + let mut st = c.state.borrow_mut(); + let Some(d) = st.detail.as_mut() else { return }; + d.listed = !d.listed; + (d.item.kind, d.item.id.clone(), d.listed) + }; + if let Some(ui) = c.ui() { + ui.set_detail_listed(on); + } + let api = c.api(); + task::background("my list", move || api.set_listed(kind, &id, on)); + } + Then::Season(n) => { + let generation = { + let mut st = c.state.borrow_mut(); + let Some(d) = st.detail.as_mut() else { return }; + if d.season == n { + 0 + } else { + d.season = n; + d.episodes.clear(); + d.episode = 0; + d.ep_model.set_vec(Vec::new()); + d.generation + } + }; + refresh(c); + if generation > 0 { + load_season(c, generation); + } + } + } +} + +#[cfg(test)] +mod tests { + use super::*; + + fn season(n: i32, count: i32) -> SeasonSummary { + SeasonSummary { number: n, name: String::new(), episode_count: count, aired_count: Some(count) } + } + + #[test] + fn next_episodes() { + let seasons = [season(1, 3), season(2, 2)]; + assert_eq!(next_episode(&seasons, &[], 1, 1, 2), Some((1, 3))); + assert_eq!(next_episode(&seasons, &[], 1, 1, 3), Some((2, 1))); + assert_eq!(next_episode(&seasons, &[], 1, 2, 2), None); + } + + #[test] + fn today_looks_like_a_date() { + let t = chrono_today(); + assert_eq!(t.len(), 10); + assert!(t.starts_with("20")); + } +} diff --git a/src/format.rs b/src/format.rs new file mode 100644 index 0000000..74406ef --- /dev/null +++ b/src/format.rs @@ -0,0 +1,399 @@ +//! Texts for the screen (Hungarian), as in the Netflex web app. + +use crate::api::TitleSummary; + +/// 3725 -> "1:02:05", 65 -> "1:05". +pub fn time(sec: f64) -> String { + let s = if sec.is_finite() && sec > 0.0 { sec as u64 } else { 0 }; + let (h, m, s) = (s / 3600, (s % 3600) / 60, s % 60); + if h > 0 { format!("{h}:{m:02}:{s:02}") } else { format!("{m}:{s:02}") } +} + +/// 135 -> "2 ó 15 p". +pub fn runtime(min: Option) -> String { + match min { + Some(m) if m > 0 => { + let (h, r) = (m / 60, m % 60); + match (h, r) { + (0, r) => format!("{r} p"), + (h, 0) => format!("{h} ó"), + (h, r) => format!("{h} ó {r} p"), + } + } + _ => String::new(), + } +} + +pub fn episode_code(season: i32, episode: i32) -> String { + format!("S{season:02}E{episode:02}") +} + +/// "Film · 2024 · IMDb 7.8 · Dráma, Krimi" +pub fn meta(t: &TitleSummary, extra: &str) -> String { + let mut parts: Vec = vec![t.kind.label().to_string()]; + if let Some(y) = t.year_label.clone().or_else(|| t.year.map(|y| y.to_string())) { + parts.push(y); + } + if !extra.is_empty() { + parts.push(extra.to_string()); + } + if let Some(r) = t.rating.filter(|r| *r > 0.0) { + parts.push(format!("IMDb {r:.1}")); + } + if !t.genres.is_empty() { + parts.push(t.genres.iter().take(3).map(|g| genre(g)).collect::>().join(", ")); + } + parts.join(" · ") +} + +/// Cinemeta's English genre names in Hungarian. +pub fn genre(g: &str) -> String { + match g { + "Action" => "Akció", + "Adventure" => "Kaland", + "Animation" => "Animáció", + "Biography" => "Életrajzi", + "Comedy" => "Vígjáték", + "Crime" => "Krimi", + "Documentary" => "Dokumentum", + "Drama" => "Dráma", + "Family" => "Családi", + "Fantasy" => "Fantasy", + "History" => "Történelmi", + "Horror" => "Horror", + "Music" => "Zenés", + "Musical" => "Musical", + "Mystery" => "Rejtély", + "Romance" => "Romantikus", + "Sci-Fi" => "Sci-fi", + "Sport" => "Sport", + "Thriller" => "Thriller", + "War" => "Háborús", + "Western" => "Western", + "Reality-TV" => "Valóságshow", + "Talk-Show" => "Talk-show", + "Game-Show" => "Vetélkedő", + "News" => "Hírek", + other => other, + } + .to_string() +} + +/// ISO 639-1 / 639-2 code -> Hungarian name. +pub fn language(code: Option<&str>) -> String { + let c = code.unwrap_or("").to_lowercase(); + let name = match c.as_str() { + "hu" | "hun" => "Magyar", + "en" | "eng" => "Angol", + "de" | "ger" | "deu" => "Német", + "fr" | "fre" | "fra" => "Francia", + "es" | "spa" => "Spanyol", + "it" | "ita" => "Olasz", + "ja" | "jpn" => "Japán", + "ko" | "kor" => "Koreai", + "ru" | "rus" => "Orosz", + "pl" | "pol" => "Lengyel", + "cs" | "cze" | "ces" => "Cseh", + "sk" | "slo" | "slk" => "Szlovák", + "ro" | "rum" | "ron" => "Román", + "pt" | "por" => "Portugál", + "nl" | "dut" | "nld" => "Holland", + "sv" | "swe" => "Svéd", + "da" | "dan" => "Dán", + "no" | "nor" => "Norvég", + "fi" | "fin" => "Finn", + "tr" | "tur" => "Török", + "zh" | "chi" | "zho" => "Kínai", + "hi" | "hin" => "Hindi", + "ar" | "ara" => "Arab", + "uk" | "ukr" => "Ukrán", + "hr" | "hrv" => "Horvát", + "sr" | "srp" => "Szerb", + "el" | "gre" | "ell" => "Görög", + "he" | "heb" => "Héber", + "" | "und" => "Ismeretlen", + _ => return c.to_uppercase(), + }; + name.to_string() +} + +/// "hun" -> "hu" (GStreamer and ffprobe tag tracks either way). +pub fn lang_code(code: Option<&str>) -> Option { + let c = code?.trim().to_lowercase(); + let base = c.split(['-', '_']).next().unwrap_or("").to_string(); + let two = match base.as_str() { + "hun" => "hu", + "eng" => "en", + "ger" | "deu" => "de", + "fre" | "fra" => "fr", + "spa" => "es", + "ita" => "it", + "jpn" => "ja", + "kor" => "ko", + "rus" => "ru", + "pol" => "pl", + "por" => "pt", + "dut" | "nld" => "nl", + "chi" | "zho" => "zh", + "und" | "" => return None, + other if other.len() == 2 => other, + other => return Some(other.to_string()), + }; + Some(two.to_string()) +} + +/// "5.1", "Sztereó"... +pub fn channels(n: Option) -> String { + match n { + Some(1) => "Mono".into(), + Some(2) => "Sztereó".into(), + Some(6) => "5.1".into(), + Some(8) => "7.1".into(), + Some(n) if n > 0 => format!("{n} csat."), + _ => String::new(), + } +} + +/// "+300 ms", "−1200 ms", "0 ms". +pub fn delay(ms: i64) -> String { + match ms { + 0 => "0 ms".into(), + m if m > 0 => format!("+{m} ms"), + m => format!("−{} ms", -m), + } +} + +#[cfg(test)] +mod tests { + use super::*; + + #[test] + fn texts() { + assert_eq!(time(3725.0), "1:02:05"); + assert_eq!(time(65.4), "1:05"); + assert_eq!(runtime(Some(135)), "2 ó 15 p"); + assert_eq!(runtime(Some(60)), "1 ó"); + assert_eq!(episode_code(1, 3), "S01E03"); + assert_eq!(language(Some("hun")), "Magyar"); + assert_eq!(language(Some("xx")), "XX"); + assert_eq!(lang_code(Some("eng")).as_deref(), Some("en")); + assert_eq!(lang_code(Some("pt-BR")).as_deref(), Some("pt")); + assert_eq!(lang_code(Some("und")), None); + assert_eq!(delay(-1200), "−1200 ms"); + assert_eq!(anime_score(84.0), "8,4"); + assert_eq!(anime_season(Some("SPRING"), Some(2024)), "Tavasz 2024"); + assert_eq!(date(Some("2024-05-01")), "2024. máj. 1."); + assert_eq!(parse_iso("1970-01-02T00:00:00Z"), Some(86400)); + assert_eq!(duration(7200.0), "2 ó 0 p"); + assert_eq!(plain_text("A
B & C"), "A\nB & C"); + assert_eq!(today().len(), 10); + } +} + +/// IMDb rating with one decimal ("8.1"). +pub fn rating(r: f64) -> String { + format!("{r:.1}") +} + +/// AniList score 0..100 as "8,4". +pub fn anime_score(s: f64) -> String { + format!("{:.1}", s / 10.0).replace('.', ",") +} + +pub fn anime_format(f: Option<&str>) -> String { + match f.unwrap_or("") { + "TV" => "TV-sorozat", + "TV_SHORT" => "Rövid sorozat", + "MOVIE" => "Film", + "SPECIAL" => "Különkiadás", + "OVA" => "OVA", + "ONA" => "ONA", + "MUSIC" => "Zenei videó", + other => return other.to_string(), + } + .to_string() +} + +pub fn anime_status(s: Option<&str>) -> String { + match s.unwrap_or("") { + "RELEASING" => "Fut", + "FINISHED" => "Befejeződött", + "NOT_YET_RELEASED" => "Hamarosan", + "CANCELLED" => "Törölve", + "HIATUS" => "Szünetel", + other => return other.to_string(), + } + .to_string() +} + +pub fn anime_season_name(s: &str) -> &'static str { + match s { + "WINTER" => "Tél", + "SPRING" => "Tavasz", + "SUMMER" => "Nyár", + "FALL" => "Ősz", + _ => "", + } +} + +/// "Tavasz 2024" +pub fn anime_season(season: Option<&str>, year: Option) -> String { + [season.map(anime_season_name).unwrap_or("").to_string(), year.map(|y| y.to_string()).unwrap_or_default()] + .into_iter() + .filter(|s| !s.is_empty()) + .collect::>() + .join(" ") +} + +pub fn anime_genre(g: &str) -> String { + match g { + "Action" => "Akció", + "Adventure" => "Kaland", + "Comedy" => "Vígjáték", + "Drama" => "Dráma", + "Ecchi" => "Ecchi", + "Fantasy" => "Fantasy", + "Horror" => "Horror", + "Mahou Shoujo" => "Varázslólány", + "Mecha" => "Mecha", + "Music" => "Zenés", + "Mystery" => "Rejtély", + "Psychological" => "Pszichológiai", + "Romance" => "Romantikus", + "Sci-Fi" => "Sci-fi", + "Slice of Life" => "Hétköznapok", + "Sports" => "Sport", + "Supernatural" => "Természetfeletti", + "Thriller" => "Thriller", + other => other, + } + .to_string() +} + +/// Anime episode label ("5. rész"; 0 = prologue). +pub fn anime_episode(n: i32) -> String { + if n == 0 { "Előzmény (0. rész)".into() } else { format!("{n}. rész") } +} + +const MONTHS: [&str; 12] = ["jan.", "febr.", "márc.", "ápr.", "máj.", "jún.", "júl.", "aug.", "szept.", "okt.", "nov.", "dec."]; +const MONTHS_LONG: [&str; 12] = ["január", "február", "március", "április", "május", "június", "július", "augusztus", "szeptember", "október", "november", "december"]; + +/// "2024-05-01..." -> "2024. máj. 1." +pub fn date(iso: Option<&str>) -> String { + let Some(d) = iso.filter(|d| d.len() >= 10) else { return String::new() }; + let (y, m, day) = (&d[0..4], d[5..7].parse::().unwrap_or(1), d[8..10].parse::().unwrap_or(1)); + format!("{y}. {} {day}.", MONTHS[(m.max(1) - 1).min(11)]) +} + +/// "2024-11-03" -> "november 3." +pub fn date_long(iso: Option<&str>) -> String { + let Some(d) = iso.filter(|d| d.len() >= 10) else { return String::new() }; + let (m, day) = (d[5..7].parse::().unwrap_or(1), d[8..10].parse::().unwrap_or(1)); + format!("{} {day}.", MONTHS_LONG[(m.max(1) - 1).min(11)]) +} + +/// "2024-05-01T18:30:00Z" -> "2024. máj. 1. 18:30" +pub fn date_time(iso: Option<&str>) -> String { + let Some(d) = iso.filter(|d| d.len() >= 16) else { return date(iso) }; + format!("{} {}", date(Some(d)), &d[11..16]) +} + +/// Seconds since the epoch, now. +pub fn now_secs() -> i64 { + std::time::SystemTime::now().duration_since(std::time::UNIX_EPOCH).map(|d| d.as_secs() as i64).unwrap_or(0) +} + +/// ISO 8601 -> seconds since the epoch (as UTC). +pub fn parse_iso(iso: &str) -> Option { + let n = |r: std::ops::Range| iso.get(r)?.parse::().ok(); + let (y, m, d, hh, mm, ss) = (n(0..4)?, n(5..7)?, n(8..10)?, n(11..13)?, n(14..16)?, n(17..19)?); + // Days from the civil date (Howard Hinnant's algorithm). + let y2 = if m <= 2 { y - 1 } else { y }; + let era = y2.div_euclid(400); + let yoe = y2 - era * 400; + let doy = (153 * (if m > 2 { m - 3 } else { m + 9 }) + 2) / 5 + d - 1; + let doe = yoe * 365 + yoe / 4 - yoe / 100 + doy; + let days = era * 146_097 + doe - 719_468; + Some(days * 86400 + hh * 3600 + mm * 60 + ss) +} + +/// "5 perce", "3 órája", "2 nap múlva" (as the web app's settings say it). +pub fn ago(iso: Option<&str>) -> String { + let Some(t) = iso.and_then(parse_iso) else { return "–".into() }; + let s = now_secs() - t; + if s < 0 { + let f = -s; + return if f < 3600 { + format!("{} perc múlva", (f / 60).max(1)) + } else if f < 172_800 { + format!("{} óra múlva", f / 3600) + } else { + format!("{} nap múlva", f / 86400) + }; + } + if s < 60 { + format!("{s} mp-e") + } else if s < 3600 { + format!("{} perce", s / 60) + } else if s < 172_800 { + format!("{} órája", s / 3600) + } else { + format!("{} napja", s / 86400) + } +} + +/// 7200 s -> "2 ó 0 p", 90 s -> "2 p" +pub fn duration(sec: f64) -> String { + let s = sec.max(0.0) as i64; + if s >= 86400 { + format!("{} n {} ó", s / 86400, (s % 86400) / 3600) + } else if s >= 3600 { + format!("{} ó {} p", s / 3600, (s % 3600) / 60) + } else { + format!("{} p", ((s as f64) / 60.0).round().max(1.0) as i64) + } +} + +/// Today as "YYYY-MM-DD" (UTC). +pub fn today() -> String { + let days = now_secs() / 86400; + let z = days + 719_468; + let era = z.div_euclid(146_097); + let doe = z - era * 146_097; + let yoe = (doe - doe / 1460 + doe / 36_524 - doe / 146_096) / 365; + let doy = doe - (365 * yoe + yoe / 4 - yoe / 100); + let mp = (5 * doy + 2) / 153; + let d = doy - (153 * mp + 2) / 5 + 1; + let m = if mp < 10 { mp + 3 } else { mp - 9 }; + let y = yoe + era * 400 + if m <= 2 { 1 } else { 0 }; + format!("{y:04}-{m:02}-{d:02}") +} + +/// AniList descriptions carry a little HTML (
, ) and entities. +pub fn plain_text(html: &str) -> String { + let mut out = String::with_capacity(html.len()); + let mut tag = String::new(); + let mut in_tag = false; + for ch in html.chars() { + match ch { + '<' => { + in_tag = true; + tag.clear(); + } + '>' if in_tag => { + in_tag = false; + if tag.trim_start_matches('/').to_lowercase().starts_with("br") { + out.push('\n'); + } + } + c if in_tag => tag.push(c), + c => out.push(c), + } + } + let out = out.replace(""", "\"").replace("&", "&").replace("'", "'").replace("<", "<").replace(">", ">"); + let mut s = out.trim().to_string(); + while s.contains("\n\n\n") { + s = s.replace("\n\n\n", "\n\n"); + } + s +} diff --git a/src/home.rs b/src/home.rs new file mode 100644 index 0000000..95a77e5 --- /dev/null +++ b/src/home.rs @@ -0,0 +1,823 @@ +//! Home and its tabs: Kezdőlap, Filmek, Sorozatok, Listám, Keresés. +//! +//! Every tab is rows of cards under a hero that shows the focused title; its +//! artwork becomes the glass backdrop shortly after the focus settles. +//! Pictures load only around the focus. + +use std::cell::RefCell; +use std::collections::{HashMap, HashSet}; +use std::rc::Rc; +use std::time::Duration; + +use slint::{ComponentHandle, Model, ModelRc, VecModel}; + +use crate::api::{self, Api, MediaType, TitleSummary}; +use crate::app::{Action, Controller, Screen}; +use crate::{App, Card, Row, detail, format, player, task}; + +pub const TABS: usize = 5; +const SEARCH: usize = 4; +/// Cards per row in grids (Listám, Keresés). +const GRID: usize = 8; +/// Genre rows fetched at a time (Filmek, Sorozatok). +const GENRE_BATCH: usize = 3; + +/// Where a "continue watching" card starts. +#[derive(Debug, Clone, Copy)] +pub struct Resume { + pub ep: Option<(i32, i32)>, + pub position: f64, +} + +#[derive(Debug, Clone)] +pub struct Item { + pub kind: MediaType, + pub id: String, + pub title: String, + pub meta: String, + pub overview: String, + pub poster: String, + pub backdrop: String, + pub logo: String, + pub resume: Option, + /// 0..1 watched (Folytatás), negative = no bar. + pub progress: f32, +} + +impl Item { + pub fn key(&self) -> String { + format!("{}:{}", self.kind.key(), self.id) + } + + fn from_summary(api: &Api, t: TitleSummary) -> Item { + Item { + kind: t.kind, + id: t.id.clone(), + title: t.title.clone(), + meta: format::meta(&t, ""), + overview: t.overview.clone().unwrap_or_default(), + poster: api.image(t.poster.as_deref(), false), + backdrop: api.image(t.backdrop.as_deref(), false), + logo: api.image(t.logo.as_deref(), false), + resume: None, + progress: -1.0, + } + } + + fn card(&self) -> Card { + Card { key: self.key().into(), title: self.title.clone().into(), image: Default::default(), progress: self.progress, badge: "".into() } + } +} + +/// Continuation of a row (more pages on scroll). +#[derive(Debug, Clone)] +enum More { + No, + Browse { kind: MediaType, genre: Option, cursor: Option, page: u32 }, +} + +struct RowData { + title: String, + landscape: bool, + items: Vec, + model: Rc>, + col: usize, + requested: HashSet, + more: More, + loading_more: bool, +} + +impl RowData { + fn new(title: &str, landscape: bool, items: Vec, more: More) -> RowData { + let model = Rc::new(VecModel::from(items.iter().map(Item::card).collect::>())); + RowData { title: title.into(), landscape, items, model, col: 0, requested: HashSet::new(), more, loading_more: false } + } + + fn slint(&self) -> Row { + Row { title: self.title.clone().into(), landscape: self.landscape, col: self.col as i32, cards: ModelRc::from(self.model.clone()) } + } +} + +pub struct Home { + tab: usize, + nav: bool, + rows: Vec, + row: usize, + model: Rc>, + /// Bumped on every tab load: late answers for an old tab are dropped. + generation: u64, + genres: Vec, + next_genre: usize, + loading_genres: bool, + /// Search tab: the keyboard has the focus. + kb: bool, + query: String, + searched: String, + search_timer: slint::Timer, + hero_timer: slint::Timer, + /// Poster colours (for the backdrop palette when a title has no artwork). + colours: Rc>>, + /// The title whose artwork is the backdrop now. + backdrop_key: String, + /// Focus to put back when the reloaded rows arrive (row, column). + restore: Option<(usize, usize)>, +} + +impl Default for Home { + fn default() -> Self { + Home { + tab: 0, + nav: false, + rows: Vec::new(), + row: 0, + model: Rc::new(VecModel::default()), + generation: 0, + genres: Vec::new(), + next_genre: 0, + loading_genres: false, + kb: true, + query: String::new(), + searched: String::new(), + search_timer: slint::Timer::default(), + hero_timer: slint::Timer::default(), + colours: Rc::default(), + backdrop_key: String::new(), + restore: None, + } + } +} + +pub fn wire(c: &Controller, ui: &App) { + ui.set_home_rows(ModelRc::from(c.state.borrow().home.model.clone())); + let k = c.clone(); + ui.on_search_submitted(move |q| search_now(&k, q.to_string())); + let k = c.clone(); + ui.on_search_changed(move |q| search_soon(&k, q.to_string())); + let k = c.clone(); + ui.on_search_exit_down(move || { + let has = !k.state.borrow().home.rows.is_empty(); + if has { + set_kb(&k, false); + } + }); + let k = c.clone(); + ui.on_search_exit_up(move || { + set_kb(&k, false); + let mut st = k.state.borrow_mut(); + st.home.nav = true; + drop(st); + sync(&k); + }); + let k = c.clone(); + ui.on_search_cancelled(move || { + k.state.borrow_mut().home.nav = true; + set_kb(&k, false); + sync(&k); + }); +} + +/// Shows home with `tab` (clears the Back stack: home is the root). +pub fn open(c: &Controller, tab: usize) { + c.state.borrow_mut().back.clear(); + c.show(Screen::Home); + load_tab(c, tab); +} + +/// Back from a details page or the player: refresh what may have changed. +pub fn returned(c: &Controller) { + let tab = c.state.borrow().home.tab; + { + c.state.borrow_mut().home.backdrop_key.clear(); + } + if tab == 0 || tab == 3 { + reload_keeping_focus(c); + } else { + focus_changed(c, true); + } +} + +fn set_kb(c: &Controller, on: bool) { + c.state.borrow_mut().home.kb = on; + if let Some(ui) = c.ui() { + ui.set_home_kb_focused(on); + } + focus_changed(c, false); +} + +fn load_tab(c: &Controller, tab: usize) { + let (api, generation) = { + let mut st = c.state.borrow_mut(); + let h = &mut st.home; + h.tab = tab; + h.generation += 1; + h.rows.clear(); + h.row = 0; + h.model.set_vec(Vec::new()); + h.genres.clear(); + h.next_genre = 0; + h.loading_genres = false; + h.backdrop_key.clear(); + if tab == SEARCH { + h.kb = true; + h.nav = false; + } + let generation = h.generation; + (st.api.clone(), generation) + }; + c.images.cancel_pending(); + if let Some(ui) = c.ui() { + ui.set_home_tab(tab as i32); + ui.set_home_row(0); + ui.set_home_kb_focused(tab == SEARCH); + ui.set_home_status("".into()); + ui.set_home_busy(tab != SEARCH); + ui.set_home_hero_title("".into()); + ui.set_home_hero_meta("".into()); + ui.set_home_hero_overview("".into()); + ui.set_home_hero_logo(Default::default()); + if tab == SEARCH { + ui.invoke_home_kb_reset(); + ui.set_home_query("".into()); + } + } + if tab == SEARCH { + let mut st = c.state.borrow_mut(); + st.home.query.clear(); + st.home.searched.clear(); + drop(st); + c.glass.set_backdrop(None); + sync(c); + return; + } + let c2 = c.clone(); + match tab { + 0 => task::spawn( + move || api.home().map(|h| (api.clone(), h)), + move |r| match r { + Ok((api, h)) => { + let mut rows = Vec::new(); + if !h.continue_watching.is_empty() { + let items: Vec = h + .continue_watching + .into_iter() + .map(|ci| { + let mut it = Item::from_summary(&api, ci.title); + let ep = ci.season.zip(ci.episode).filter(|(s, _)| *s > 0); + if let Some((s, e)) = ep { + it.meta = format!("{} · {}", format::episode_code(s, e), it.meta); + } + // Landscape artwork: the backdrop. + it.poster = if it.backdrop.is_empty() { it.poster.clone() } else { it.backdrop.clone() }; + it.resume = Some(Resume { ep, position: ci.position }); + it.progress = ci.duration.filter(|d| *d > 0.0).map(|d| (ci.position / d) as f32).unwrap_or(-1.0); + it + }) + .collect(); + rows.push(RowData::new("Folytatás", true, items, More::No)); + } + for r in h.rows { + let items = r.items.into_iter().map(|t| Item::from_summary(&api, t)).collect(); + rows.push(RowData::new(&r.title, false, items, More::No)); + } + set_rows(&c2, generation, rows, ""); + } + Err(e) => failed(&c2, generation, e), + }, + ), + 1 | 2 => { + let kind = if tab == 1 { MediaType::Movie } else { MediaType::Tv }; + task::spawn( + move || -> anyhow::Result<_> { + let genres = api.genres(kind).unwrap_or_default(); + let popular = api.browse(kind, None, None, 1)?; + let first: Vec<_> = genres.iter().take(GENRE_BATCH).map(|g| (g.clone(), api.browse(kind, Some(&g.id), None, 1))).collect(); + Ok((api, genres, popular, first)) + }, + move |r| match r { + Ok((api, genres, popular, first)) => { + let mut rows = vec![RowData::new( + "Népszerű", + false, + popular.items.into_iter().map(|t| Item::from_summary(&api, t)).collect(), + More::Browse { kind, genre: None, cursor: popular.cursor, page: if popular.has_more { 2 } else { 0 } }, + )]; + for (g, page) in first { + if let Ok(p) = page { + if p.items.is_empty() { + continue; + } + rows.push(RowData::new( + &g.name, + false, + p.items.into_iter().map(|t| Item::from_summary(&api, t)).collect(), + More::Browse { kind, genre: Some(g.id.clone()), cursor: p.cursor, page: if p.has_more { 2 } else { 0 } }, + )); + } + } + { + let mut st = c2.state.borrow_mut(); + if st.home.generation == generation { + st.home.next_genre = GENRE_BATCH.min(genres.len()); + st.home.genres = genres; + } + } + set_rows(&c2, generation, rows, ""); + } + Err(e) => failed(&c2, generation, e), + }, + ); + } + _ => task::spawn( + move || api.my_list().map(|l| (api.clone(), l)), + move |r| match r { + Ok((api, list)) => { + let items: Vec = list.into_iter().map(|l| Item::from_summary(&api, l.title)).collect(); + let rows = grid_rows("Listám", items); + set_rows(&c2, generation, rows, "A listád üres. Egy film vagy sorozat adatlapján a Listám gombbal adhatsz hozzá."); + } + Err(e) => failed(&c2, generation, e), + }, + ), + } +} + +fn grid_rows(title: &str, items: Vec) -> Vec { + let mut rows = Vec::new(); + let mut it = items.into_iter().peekable(); + while it.peek().is_some() { + let chunk: Vec = it.by_ref().take(GRID).collect(); + rows.push(RowData::new(if rows.is_empty() { title } else { "" }, false, chunk, More::No)); + } + rows +} + +fn failed(c: &Controller, generation: u64, e: anyhow::Error) { + if api::is_unauthenticated(&e) { + return c.signed_out(); + } + if c.state.borrow().home.generation != generation { + return; + } + log::warn!("home: {e:#}"); + if let Some(ui) = c.ui() { + ui.set_home_busy(false); + ui.set_home_status(format!("{}\nOK: újra", api::describe(&e)).into()); + } +} + +/// Replaces the tab's rows (when the answer is for the current tab). +fn set_rows(c: &Controller, generation: u64, rows: Vec, empty: &str) { + { + let mut st = c.state.borrow_mut(); + let h = &mut st.home; + if h.generation != generation { + return; + } + let mut rows = rows; + if let Some((row, col)) = h.restore.take() { + if !rows.is_empty() { + h.row = row.min(rows.len() - 1); + let r = &mut rows[h.row]; + r.col = col.min(r.items.len().saturating_sub(1)); + } + } + h.model.set_vec(rows.iter().map(RowData::slint).collect::>()); + h.rows = rows; + h.row = h.row.min(h.rows.len().saturating_sub(1)); + } + let n = c.state.borrow().home.rows.len(); + if let Some(ui) = c.ui() { + ui.set_home_busy(false); + ui.set_home_status(if n == 0 { empty.into() } else { "".into() }); + } + focus_changed(c, true); +} + +fn reload_keeping_focus(c: &Controller) { + let (tab, pos) = { + let st = c.state.borrow(); + let h = &st.home; + (h.tab, (h.row, h.rows.get(h.row).map(|r| r.col).unwrap_or(0))) + }; + load_tab(c, tab); + c.state.borrow_mut().home.restore = Some(pos); +} + +// ---- search ---- + +fn search_soon(c: &Controller, q: String) { + let k = c.clone(); + let mut st = c.state.borrow_mut(); + st.home.query = q.clone(); + st.home.search_timer.start(slint::TimerMode::SingleShot, Duration::from_millis(650), move || search_now(&k, q.clone())); +} + +fn search_now(c: &Controller, q: String) { + let q = q.trim().to_string(); + let (api, generation) = { + let mut st = c.state.borrow_mut(); + if st.home.tab != SEARCH || q.chars().count() < 2 || q == st.home.searched { + return; + } + st.home.searched = q.clone(); + (st.api.clone(), st.home.generation) + }; + if let Some(ui) = c.ui() { + ui.set_home_busy(true); + ui.set_home_status("".into()); + } + let c2 = c.clone(); + task::spawn( + move || api.search(&q).map(|p| (api.clone(), p, q)), + move |r| match r { + Ok((api, page, q)) => { + if c2.state.borrow().home.searched != q { + return; + } + let items = page.items.into_iter().map(|t| Item::from_summary(&api, t)).collect(); + let rows = grid_rows("Találatok", items); + c2.state.borrow_mut().home.row = 0; + set_rows(&c2, generation, rows, "Nincs találat."); + } + Err(e) => failed(&c2, generation, e), + }, + ); +} + +// ---- keys ---- + +pub fn key(c: &Controller, a: Action, _repeat: bool) { + enum Then { + Nothing, + Tab(usize), + Open(Item), + Quit, + Keyboard, + Retry, + } + let then = { + let mut st = c.state.borrow_mut(); + let h = &mut st.home; + let n_rows = h.rows.len(); + if h.nav { + match a { + Action::Left if h.tab > 0 => Then::Tab(h.tab - 1), + Action::Right if h.tab + 1 < TABS => Then::Tab(h.tab + 1), + Action::Down | Action::Ok => { + if h.tab == SEARCH { + h.nav = false; + Then::Keyboard + } else if n_rows > 0 { + h.nav = false; + Then::Nothing + } else if a == Action::Ok { + Then::Retry + } else { + Then::Nothing + } + } + Action::Back if h.tab != 0 => Then::Tab(0), + Action::Back => Then::Quit, + _ => Then::Nothing, + } + } else if n_rows == 0 { + match a { + Action::Up | Action::Back => { + h.nav = true; + Then::Nothing + } + Action::Ok => Then::Retry, + _ => Then::Nothing, + } + } else { + let row = &mut h.rows[h.row]; + match a { + Action::Left => { + row.col = row.col.saturating_sub(1); + Then::Nothing + } + Action::Right => { + if row.col + 1 < row.items.len() { + row.col += 1; + } + Then::Nothing + } + Action::Up if h.row > 0 => { + h.row -= 1; + Then::Nothing + } + Action::Up if h.tab == SEARCH => Then::Keyboard, + Action::Up => { + h.nav = true; + Then::Nothing + } + Action::Down => { + if h.row + 1 < n_rows { + h.row += 1; + // Grids keep the column; other rows remember their own. + if h.tab >= 3 { + let col = h.rows[h.row - 1].col; + let next = &mut h.rows[h.row]; + next.col = col.min(next.items.len().saturating_sub(1)); + } + } + Then::Nothing + } + Action::Ok | Action::PlayPause => match row.items.get(row.col) { + Some(it) => Then::Open(it.clone()), + None => Then::Nothing, + }, + Action::Back => { + if h.tab == SEARCH { + Then::Keyboard + } else { + h.nav = true; + Then::Nothing + } + } + } + } + }; + match then { + Then::Nothing => focus_changed(c, false), + Then::Tab(t) => { + c.state.borrow_mut().home.nav = true; + load_tab(c, t); + } + Then::Keyboard => set_kb(c, true), + Then::Retry => { + let tab = c.state.borrow().home.tab; + load_tab(c, tab); + } + Then::Quit => { + let _ = slint::quit_event_loop(); + } + Then::Open(it) => match it.resume { + // "Folytatás" plays right away, where it stopped. + Some(r) => player::play( + c, + player::Request { + kind: it.kind, + id: it.id.clone(), + title: it.title.clone(), + ep: r.ep, + episode_name: String::new(), + resume: (r.position - 3.0).max(0.0), + backdrop: it.backdrop.clone(), + next: None, + }, + ), + None => detail::open(c, &it), + }, + } +} + +// ---- focus, hero, pictures ---- + +/// After any focus change: Slint state, hero texts, the backdrop (soon), +/// pictures around the focus, more rows / pages when near the end. +pub fn focus_changed(c: &Controller, now: bool) { + let Some(ui) = c.ui() else { return }; + let (focused, nav, kb, tab) = { + let st = c.state.borrow(); + let h = &st.home; + if h.row < h.rows.len() { + // The remembered column is part of the row struct. + let r = &h.rows[h.row]; + if let Some(mut row) = h.model.row_data(h.row) { + if row.col != r.col as i32 { + row.col = r.col as i32; + h.model.set_row_data(h.row, row); + } + } + } + ui.set_home_row(h.row as i32); + ui.set_home_nav_focused(h.nav); + let focused = h.rows.get(h.row).and_then(|r| r.items.get(r.col)).cloned(); + (focused, h.nav, h.kb, h.tab) + }; + let _ = (nav, kb); + + match &focused { + Some(it) if tab != SEARCH => { + ui.set_home_hero_title(it.title.clone().into()); + ui.set_home_hero_meta(it.meta.clone().into()); + ui.set_home_hero_overview(it.overview.clone().into()); + ui.set_home_hero_logo(Default::default()); + if !it.logo.is_empty() { + let w = ui.as_weak(); + let key = it.key(); + let k = c.clone(); + let px = c.px(); + c.images.load(&it.logo, ((620.0 * px) as u32, (190.0 * px) as u32), move |img| { + let still = { + let st = k.state.borrow(); + let h = &st.home; + h.rows.get(h.row).and_then(|r| r.items.get(r.col)).is_some_and(|f| f.key() == key) + }; + if let (true, Some(ui)) = (still, w.upgrade()) { + ui.set_home_hero_logo(img); + } + }); + } + } + _ => {} + } + + schedule_backdrop(c, if now { 60 } else { 320 }); + ensure_images(c); + maybe_load_more(c); +} + +fn schedule_backdrop(c: &Controller, ms: u64) { + let k = c.clone(); + let st = c.state.borrow(); + st.home.hero_timer.start(slint::TimerMode::SingleShot, Duration::from_millis(ms), move || apply_backdrop(&k)); +} + +fn apply_backdrop(c: &Controller) { + let (it, tab, colours) = { + let st = c.state.borrow(); + if st.screen != Screen::Home { + return; + } + let h = &st.home; + (h.rows.get(h.row).and_then(|r| r.items.get(r.col)).cloned(), h.tab, h.colours.clone()) + }; + let Some(it) = it.filter(|_| tab != SEARCH) else { + c.glass.set_backdrop(None); + return; + }; + let key = it.key(); + { + let mut st = c.state.borrow_mut(); + if st.home.backdrop_key == key { + return; + } + st.home.backdrop_key = key.clone(); + } + if let Some(col) = colours.borrow().get(&key).copied() { + c.glass.set_palette(sf_ui::Palette::from_color(col)); + } + if it.backdrop.is_empty() { + c.glass.set_backdrop(None); + return; + } + let k = c.clone(); + let px = c.px(); + c.images.load_pixels(&it.backdrop, ((1920.0 * px) as u32, (1080.0 * px) as u32), move |pixels| { + let still = k.state.borrow().home.backdrop_key == key && k.state.borrow().screen == Screen::Home; + if still { + k.glass.set_backdrop(Some(sf_ui::Backdrop::new(pixels.clone()).dim(0.3).fade_left(1.0).fade_bottom(1.0).align(0.6, 0.2))); + } + }); +} + +fn ensure_images(c: &Controller) { + let px = c.px(); + struct Want { + url: String, + size: (u32, u32), + model: Rc>, + index: usize, + key: String, + } + let (wants, colours) = { + let mut st = c.state.borrow_mut(); + let h = &mut st.home; + let mut wants = Vec::new(); + let lo = h.row.saturating_sub(1); + let hi = (h.row + 3).min(h.rows.len()); + for row in &mut h.rows[lo..hi] { + let (cw, ch) = if row.landscape { (400.0, 225.0) } else { (196.0, 294.0) }; + let size = ((cw * px * 1.1) as u32, (ch * px * 1.1) as u32); + let start = row.col.saturating_sub(3); + let end = (row.col + 11).min(row.items.len()); + for i in start..end { + if row.requested.insert(i) { + let it = &row.items[i]; + if !it.poster.is_empty() { + wants.push(Want { url: it.poster.clone(), size, model: row.model.clone(), index: i, key: it.key() }); + } + } + } + } + (wants, h.colours.clone()) + }; + // No state borrow here: a cached picture calls back at once. + for w in wants { + let model = w.model; + let colours = colours.clone(); + let (index, key) = (w.index, w.key); + c.images.load_pixels(&w.url, w.size, move |pixels| { + if let Some(mut card) = model.row_data(index) { + if card.key.as_str() == key { + card.image = slint::Image::from_rgba8(pixels.clone()); + model.set_row_data(index, card); + } + } + colours.borrow_mut().entry(key).or_insert_with(|| sf_ui::images::average_color(pixels)); + }); + } +} + +/// More genre rows near the bottom, the next page near the end of a row. +fn maybe_load_more(c: &Controller) { + let (api, generation) = (c.api(), c.state.borrow().home.generation); + // Genre rows. + let next = { + let mut st = c.state.borrow_mut(); + let h = &mut st.home; + if (h.tab == 1 || h.tab == 2) && !h.loading_genres && h.row + 3 >= h.rows.len() && h.next_genre < h.genres.len() { + h.loading_genres = true; + let batch: Vec = h.genres[h.next_genre..(h.next_genre + GENRE_BATCH).min(h.genres.len())].to_vec(); + h.next_genre += batch.len(); + Some((if h.tab == 1 { MediaType::Movie } else { MediaType::Tv }, batch)) + } else { + None + } + }; + if let Some((kind, batch)) = next { + let c2 = c.clone(); + let api2 = api.clone(); + task::spawn( + move || batch.into_iter().map(|g| { let p = api2.browse(kind, Some(&g.id), None, 1); (g, p) }).collect::>(), + move |pages| { + let mut st = c2.state.borrow_mut(); + let h = &mut st.home; + if h.generation != generation { + return; + } + h.loading_genres = false; + for (g, p) in pages { + let Ok(p) = p else { continue }; + if p.items.is_empty() { + continue; + } + let items = p.items.into_iter().map(|t| Item::from_summary(&api, t)).collect(); + let row = RowData::new(&g.name, false, items, More::Browse { kind, genre: Some(g.id), cursor: p.cursor, page: if p.has_more { 2 } else { 0 } }); + h.model.push(row.slint()); + h.rows.push(row); + } + }, + ); + } + + // Next page of the focused row. + let page = { + let mut st = c.state.borrow_mut(); + let h = &mut st.home; + let ri = h.row; + match h.rows.get_mut(ri) { + Some(r) if !r.loading_more && r.col + 6 >= r.items.len() => match &r.more { + More::Browse { kind, genre, cursor, page } if *page > 0 || cursor.is_some() => { + r.loading_more = true; + Some((ri, *kind, genre.clone(), cursor.clone(), *page)) + } + _ => None, + }, + _ => None, + } + }; + if let Some((ri, kind, genre, cursor, page)) = page { + let c2 = c.clone(); + let api2 = c.api(); + let g = genre.clone(); + task::spawn( + move || api2.browse(kind, g.as_deref(), cursor.as_deref(), page).map(|p| (api2, p)), + move |r| { + let mut st = c2.state.borrow_mut(); + let h = &mut st.home; + if h.generation != generation { + return; + } + let Some(row) = h.rows.get_mut(ri) else { return }; + row.loading_more = false; + match r { + Ok((api, p)) => { + let seen: HashSet = row.items.iter().map(Item::key).collect(); + for t in p.items { + let it = Item::from_summary(&api, t); + if seen.contains(&it.key()) { + continue; + } + row.model.push(it.card()); + row.items.push(it); + } + let next_page = if p.has_more { page + 1 } else { 0 }; + row.more = More::Browse { kind, genre: genre.clone(), cursor: p.cursor, page: next_page }; + } + Err(e) => { + log::warn!("more: {e:#}"); + row.more = More::No; + } + } + }, + ); + } +} + +/// Re-sends the focus state to Slint (after nav changes). +fn sync(c: &Controller) { + focus_changed(c, false); +} diff --git a/src/main.rs b/src/main.rs new file mode 100644 index 0000000..8c74246 --- /dev/null +++ b/src/main.rs @@ -0,0 +1,62 @@ +//! Netflex for SmartFox: a native TV client for a Netflex server. +//! +//! - UI: Slint (ui/*.slint) on sf-ui's Liquid Glass layer. +//! - State and focus: src/app.rs and the screen modules; every remote key +//! arrives in `App::key`. +//! - Playback: sf-ui's GStreamer player (Linux), streaming the file straight +//! from the server while the torrent downloads. + +// Without a player (Windows, for UI work) some playback code sits unused. +#![cfg_attr(not(target_os = "linux"), allow(dead_code, unused_imports))] + +mod api; +mod app; +mod config; +mod detail; +mod format; +mod home; +mod player; +mod task; + +use slint::{ComponentHandle, Model}; + +slint::include_modules!(); +sf_ui::glue!(App); + +fn main() -> anyhow::Result<()> { + env_logger::Builder::from_env(env_logger::Env::default().default_filter_or("info")).init(); + sf_ui::init()?; + #[cfg(target_os = "linux")] + if let Err(e) = sf_ui::video::init() { + log::error!("video: {e:#}"); + } + + let ui = App::new()?; + ui.sf_ui_setup(); + if std::env::var_os("SF_UI_SIZE").is_none() && std::env::var_os("NETFLEX_WINDOWED").is_none() { + ui.window().set_fullscreen(true); + } + + let glass = sf_ui::Glass::install(&ui, |ui, p| { + p.extend(ui.get_glass_message().iter()); + p.extend(ui.get_glass_signin().iter()); + p.extend(ui.get_glass_signin_keyboard().iter()); + p.extend(ui.get_glass_home().iter()); + p.extend(ui.get_glass_home_keyboard().iter()); + p.extend(ui.get_glass_detail().iter()); + p.extend(ui.get_glass_detail_menu().iter()); + p.extend(ui.get_glass_player().iter()); + p.extend(ui.get_glass_player_audio().iter()); + p.extend(ui.get_glass_player_subs().iter()); + p.extend(ui.get_glass_player_sync().iter()); + })?; + glass.set_palette(sf_ui::Palette::from_hex(["#ff4a3d", "#8c0b14", "#120305"])); + + let images = sf_ui::images::Images::new(384 << 20); + let app = app::Controller::new(&ui, glass, images); + app.start(); + + ui.run()?; + app.shutdown(); + Ok(()) +} diff --git a/src/page.rs b/src/page.rs new file mode 100644 index 0000000..91c7eec --- /dev/null +++ b/src/page.rs @@ -0,0 +1,963 @@ +//! The page engine. Every browsing screen describes itself as a list of +//! lines (`L`): hero, headings, texts, notices, chip rows, card rows, list +//! items, checks. This module lays them out on the 1920x1080 grid, owns the +//! focus and the scroll position, loads the pictures that are about to show, +//! and hands the result to ui/page.slint. +//! +//! Navigation is generic: up/down between focusable lines (and between the +//! rows of a wrapped chip line), left/right inside a line, the top nav above +//! the first line, the settings side list left of the content. + +use std::collections::{HashMap, HashSet}; +use std::rc::Rc; + +use slint::{Model, ModelRc, VecModel}; + +use crate::{Card, Check, Chip, Line}; + +/// Width of the content on a page without the side list (design px). +pub const CONTENT_W: f32 = 1728.0; +/// Content left edge and width with the settings side list. +pub const SIDE_X: f32 = 600.0; +pub const SIDE_W: f32 = 1224.0; + +#[derive(Debug, Clone, Copy, PartialEq, Eq)] +pub enum Kind { + Hero, + Heading, + Text, + Notice, + Chips, + Cards, + Item, + Checks, + Keyboard, + Gap, +} + +impl Kind { + fn name(self) -> &'static str { + match self { + Kind::Hero => "hero", + Kind::Heading => "heading", + Kind::Text => "text", + Kind::Notice => "notice", + Kind::Chips => "chips", + Kind::Cards => "cards", + Kind::Item => "item", + Kind::Checks => "checks", + Kind::Keyboard => "keyboard", + Kind::Gap => "gap", + } + } +} + +/// A chip (button, choice, text field). +#[derive(Debug, Clone, Default)] +pub struct Ch { + pub id: String, + pub text: String, + pub icon: String, + pub active: bool, + pub tone: &'static str, + pub enabled: bool, + /// Fixed width (design px); else from the text. + pub w: Option, +} + +impl Ch { + pub fn new(id: impl Into, text: impl Into) -> Ch { + Ch { id: id.into(), text: text.into(), enabled: true, ..Ch::default() } + } + pub fn icon(mut self, icon: &str) -> Ch { + self.icon = icon.into(); + self + } + pub fn active(mut self, on: bool) -> Ch { + self.active = on; + self + } + pub fn tone(mut self, tone: &'static str) -> Ch { + self.tone = tone; + self + } + pub fn enabled(mut self, on: bool) -> Ch { + self.enabled = on; + self + } + pub fn width(mut self, w: f32) -> Ch { + self.w = Some(w); + self + } + /// A text field: shows `value` (or the placeholder), opens the keyboard. + pub fn field(id: impl Into, value: &str, placeholder: &str, icon: &str) -> Ch { + let text = if value.is_empty() { placeholder.to_string() } else { value.to_string() }; + Ch { id: id.into(), text, icon: icon.into(), tone: "field", enabled: true, w: Some(900.0), ..Ch::default() } + } + + fn width_of(&self) -> f32 { + if let Some(w) = self.w { + return w; + } + // Onest 23/600: about 12.4 px per character; capitals are wider. + let chars: f32 = self.text.chars().map(|c| if c.is_uppercase() { 15.5 } else { 12.4 }).sum(); + if self.text.is_empty() { + return 64.0; + } + let icon = if self.icon.is_empty() { 0.0 } else { 38.0 }; + (chars + icon + if self.icon.is_empty() { 52.0 } else { 46.0 }).max(88.0) + } + + fn height_of(&self) -> f32 { + if self.tone == "field" { 80.0 } else { 64.0 } + } +} + +/// A card. +#[derive(Debug, Clone, Default)] +pub struct C { + pub id: String, + pub title: String, + pub caption: String, + pub detail: String, + pub image: String, + pub progress: f32, + pub badge: String, + pub badge_tone: &'static str, + pub mark: &'static str, + pub big: String, + pub current: bool, +} + +impl C { + pub fn new(id: impl Into, title: impl Into, image: impl Into) -> C { + C { id: id.into(), title: title.into(), image: image.into(), progress: -1.0, ..C::default() } + } +} + +/// One line of a page, as screens describe it. +#[derive(Debug, Clone)] +pub struct L { + pub id: String, + pub kind: Kind, + pub title: String, + pub subtitle: String, + pub meta: String, + pub extra: String, + pub text: String, + pub note: String, + pub style: String, + pub tone: String, + pub icon: String, + pub image: String, + pub logo: String, + pub progress: f32, + pub captions: bool, + /// Grids keep the column when moving between their lines. + pub grid: bool, + pub cards: Vec, + pub chips: Vec, + pub checks: Vec<(i32, String, String)>, + /// Fixed height (design px). + pub h: Option, + pub indent: f32, +} + +impl L { + pub fn new(id: impl Into, kind: Kind) -> L { + L { + id: id.into(), + kind, + title: String::new(), + subtitle: String::new(), + meta: String::new(), + extra: String::new(), + text: String::new(), + note: String::new(), + style: String::new(), + tone: String::new(), + icon: String::new(), + image: String::new(), + logo: String::new(), + progress: -1.0, + captions: false, + grid: false, + cards: Vec::new(), + chips: Vec::new(), + checks: Vec::new(), + h: None, + indent: 0.0, + } + } + pub fn heading(id: impl Into, title: impl Into) -> L { + let mut l = L::new(id, Kind::Heading); + l.title = title.into(); + l + } + /// A page title (56 px). + pub fn page_title(id: impl Into, title: impl Into, subtitle: impl Into) -> L { + let mut l = L::heading(id, title); + l.style = "big".into(); + l.subtitle = subtitle.into(); + l + } + pub fn text(id: impl Into, text: impl Into, style: &str) -> L { + let mut l = L::new(id, Kind::Text); + l.text = text.into(); + l.style = style.into(); + l + } + pub fn notice(id: impl Into, tone: &str, title: impl Into, text: impl Into) -> L { + let mut l = L::new(id, Kind::Notice); + l.tone = tone.into(); + l.title = title.into(); + l.text = text.into(); + l + } + pub fn chips(id: impl Into, label: impl Into, chips: Vec) -> L { + let mut l = L::new(id, Kind::Chips); + l.title = label.into(); + l.chips = chips; + l + } + pub fn cards(id: impl Into, title: impl Into, style: &str, cards: Vec) -> L { + let mut l = L::new(id, Kind::Cards); + l.title = title.into(); + l.style = style.into(); + l.cards = cards; + l + } + pub fn item(id: impl Into, title: impl Into, meta: impl Into, text: impl Into, chips: Vec) -> L { + let mut l = L::new(id, Kind::Item); + l.title = title.into(); + l.meta = meta.into(); + l.text = text.into(); + l.chips = chips; + l + } + pub fn checks(id: impl Into, checks: Vec<(i32, String, String)>) -> L { + let mut l = L::new(id, Kind::Checks); + l.checks = checks; + l + } + pub fn gap(h: f32) -> L { + let mut l = L::new(format!("gap{h}"), Kind::Gap); + l.h = Some(h); + l + } + pub fn sub(mut self, s: impl Into) -> L { + self.subtitle = s.into(); + self + } + pub fn image(mut self, url: impl Into) -> L { + self.image = url.into(); + self.style = "image".into(); + self + } + pub fn progress(mut self, p: f32) -> L { + self.progress = p; + self + } + pub fn tone(mut self, t: &str) -> L { + self.tone = t.into(); + self + } + pub fn captions(mut self) -> L { + self.captions = true; + self + } + pub fn grid(mut self) -> L { + self.grid = true; + self + } + + fn focusable(&self) -> bool { + match self.kind { + Kind::Chips | Kind::Item | Kind::Hero => self.chips.iter().any(|c| c.enabled) || (self.kind == Kind::Item && !self.chips.is_empty()), + Kind::Cards => !self.cards.is_empty(), + Kind::Keyboard => true, + _ => false, + } + } + + fn len(&self) -> usize { + if self.kind == Kind::Cards { self.cards.len() } else { self.chips.len() } + } +} + +/// Splits a list into grid lines of `n` cards. +pub fn grid_lines(id: &str, title: &str, style: &str, cards: Vec, n: usize) -> Vec { + let mut out = Vec::new(); + let mut it = cards.into_iter().peekable(); + let mut i = 0; + while it.peek().is_some() { + let chunk: Vec = it.by_ref().take(n).collect(); + out.push(L::cards(format!("{id}#{i}"), if i == 0 { title } else { "" }, style, chunk).captions().grid()); + i += 1; + } + out +} + +/// What a screen shows besides its lines. +#[derive(Debug, Clone, Default)] +pub struct Frame { + /// The top navigation with this section lit. + pub nav: Option, + /// Settings: (title, items, current). + pub side: Option<(String, Vec, usize)>, + /// The embedded search keyboard's placeholder (its line has kind Keyboard). + pub keyboard: Option, +} + +pub struct Spec { + pub lines: Vec, + pub frame: Frame, +} + +/// Where the focus is. +#[derive(Debug, Clone, PartialEq, Eq)] +pub enum Focus { + Nav, + Side, + Line, +} + +#[derive(Debug, Clone, Default)] +struct Laid { + y: f32, + h: f32, + x: f32, + w: f32, + /// Chips: (x, y, w, h, row). + chips: Vec<(f32, f32, f32, f32, usize)>, +} + +/// The page on screen: its lines laid out, the focus, the Slint models. +pub struct View { + pub lines: Vec, + laid: Vec, + pub frame: Frame, + pub focus: Focus, + pub line: usize, + cols: HashMap, + pub side_focus: usize, + pub nav_index: usize, + pub scroll: f32, + total: f32, + model: Rc>, + card_models: Vec>>>, + shown: HashSet, +} + +impl Default for View { + fn default() -> Self { + View { + lines: Vec::new(), + laid: Vec::new(), + frame: Frame::default(), + focus: Focus::Line, + line: 0, + cols: HashMap::new(), + side_focus: 0, + nav_index: 0, + scroll: 0.0, + total: 0.0, + model: Rc::new(VecModel::default()), + card_models: Vec::new(), + shown: HashSet::new(), + } + } +} + +/// Lines' heights and positions on the grid. +fn layout(lines: &[L], side: bool) -> (Vec, f32) { + let (x0, w) = if side { (0.0, SIDE_W) } else { (0.0, CONTENT_W) }; + let mut y = if side { 184.0 } else { 150.0 }; + let mut out = Vec::with_capacity(lines.len()); + let est = |text: &str, char_w: f32, width: f32, line_h: f32| -> f32 { + if text.is_empty() { + return 0.0; + } + let per_line = (width / char_w).max(10.0); + let n: f32 = text.split('\n').map(|p| (p.chars().count() as f32 / per_line).ceil().max(1.0)).sum(); + n * line_h + }; + for (i, l) in lines.iter().enumerate() { + let lw = w - l.indent; + let mut chips = Vec::new(); + let h = match l.kind { + Kind::Hero => { + for (ci, c) in l.chips.iter().enumerate() { + let cw = c.width_of(); + let cx = chips.last().map(|p: &(f32, f32, f32, f32, usize)| p.0 + p.2 + 20.0).unwrap_or(0.0); + let _ = ci; + chips.push((cx, 520.0, cw, 72.0, 0)); + } + l.h.unwrap_or(640.0) + } + Kind::Heading => { + if l.style == "big" { 96.0 + if l.subtitle.is_empty() { 0.0 } else { 34.0 } } else { 58.0 + if l.subtitle.is_empty() { 0.0 } else { 34.0 } } + } + Kind::Text => { + let (cw, lh) = match l.style.as_str() { + "caption" => (10.6, 30.0), + "label" => (11.8, 34.0), + _ => (12.6, 38.0), + }; + est(&l.text, cw, lw, lh) + 4.0 + } + Kind::Notice => 48.0 + est(&l.text, 11.2, lw - 56.0, 32.0), + Kind::Checks => ((l.checks.len() + 1) / 2) as f32 * 84.0, + Kind::Chips => { + let top = if l.title.is_empty() { 0.0 } else { 38.0 }; + let (mut cx, mut row, mut ry) = (0.0f32, 0usize, top); + let mut row_h = 0.0f32; + for c in &l.chips { + let (cw, ch) = (c.width_of().min(lw), c.height_of()); + if cx > 0.0 && cx + cw > lw { + cx = 0.0; + row += 1; + ry += row_h + 14.0; + row_h = 0.0; + } + chips.push((cx, ry, cw, ch, row)); + cx += cw + 14.0; + row_h = row_h.max(ch); + } + ry + row_h + } + Kind::Cards => { + let ch = match l.style.as_str() { + "landscape" => 225.0, + "season" => 252.0, + _ => 294.0, + }; + (if l.title.is_empty() { 0.0 } else { 56.0 }) + ch + if l.captions { 80.0 } else { 0.0 } + 10.0 + } + Kind::Item => { + let tx = if l.style == "image" { 288.0 } else { 0.0 }; + let mut ty = 6.0 + 36.0 + if l.meta.is_empty() { 0.0 } else { 32.0 }; + if !l.text.is_empty() { + ty += est(&l.text, 10.0, (lw - tx).min(1100.0), 29.0).min(58.0) + 6.0; + } + let mut cx = tx; + for c in &l.chips { + let cw = c.width_of(); + chips.push((cx, ty + 4.0, cw, 60.0, 0)); + cx += cw + 12.0; + } + let mut h = ty + if l.chips.is_empty() { 8.0 } else { 74.0 }; + if l.style == "image" { + h = h.max(162.0); + } + if l.progress >= 0.0 && l.style != "image" { + h += 14.0; + } + h + } + Kind::Keyboard => 540.0, + Kind::Gap => 0.0, + }; + let h = l.h.unwrap_or(h); + out.push(Laid { y, h, x: x0 + l.indent, w: lw, chips }); + let next = lines.get(i + 1).map(|n| n.kind); + let gap = match (l.kind, next) { + (Kind::Gap, _) => 0.0, + (Kind::Heading, _) => 14.0, + (Kind::Cards, Some(Kind::Cards)) if l.grid => 18.0, + (Kind::Item, Some(Kind::Item)) => 14.0, + (Kind::Hero, _) => 24.0, + (_, Some(Kind::Heading)) => 44.0, + _ => 28.0, + }; + y += h + gap; + } + (out, y) +} + +impl View { + pub fn model(&self) -> ModelRc { + ModelRc::from(self.model.clone()) + } + + /// Shows new lines, keeping the focus on the same line (by id) and item. + pub fn set(&mut self, spec: Spec, images: &sf_ui::images::Images, px: f32) { + let old_id = self.lines.get(self.line).map(|l| l.id.clone()); + if let Some(l) = self.lines.get(self.line) { + let c = self.col(); + self.cols.insert(l.id.clone(), c); + } + let side = spec.frame.side.is_some(); + self.lines = spec.lines; + self.frame = spec.frame; + let (laid, total) = layout(&self.lines, side); + self.laid = laid; + self.total = total; + self.line = match old_id.and_then(|id| self.lines.iter().position(|l| l.id == id)) { + Some(i) => i, + None => self.first_focusable().unwrap_or(0), + }; + if !self.lines.get(self.line).is_some_and(L::focusable) { + self.line = self.nearest_focusable(self.line).unwrap_or(0); + } + if let Some((_, items, cur)) = &self.frame.side { + if self.focus != Focus::Side { + self.side_focus = *cur; + } + self.side_focus = self.side_focus.min(items.len().saturating_sub(1)); + } + if self.focus == Focus::Nav && self.frame.nav.is_none() { + self.focus = Focus::Line; + } + if self.focus == Focus::Line && self.first_focusable().is_none() { + if self.frame.nav.is_some() { + self.focus = Focus::Nav; + } else if self.frame.side.is_some() { + self.focus = Focus::Side; + } + } + self.shown.clear(); + self.card_models = vec![None; self.lines.len()]; + let rows: Vec = (0..self.lines.len()).map(|i| self.slint_line(i, images, px)).collect(); + self.model.set_vec(rows); + self.clamp_scroll(); + } + + /// Line `i`'s top (design px). + pub fn line_y(&self, i: usize) -> f32 { + self.laid.get(i).map(|l| l.y).unwrap_or(0.0) + } + + pub fn has_lines(&self) -> bool { + !self.lines.is_empty() + } + + fn first_focusable(&self) -> Option { + self.lines.iter().position(L::focusable) + } + + fn nearest_focusable(&self, from: usize) -> Option { + (from..self.lines.len()).find(|&i| self.lines[i].focusable()).or_else(|| (0..from).rev().find(|&i| self.lines[i].focusable())) + } + + pub fn col(&self) -> usize { + let Some(l) = self.lines.get(self.line) else { return 0 }; + let c = self.cols.get(&l.id).copied().unwrap_or(0); + c.min(l.len().saturating_sub(1)) + } + + fn set_col(&mut self, c: usize) { + if let Some(l) = self.lines.get(self.line) { + self.cols.insert(l.id.clone(), c); + } + } + + /// Sets the focus on line `id` (and item index), if it exists. + pub fn focus_on(&mut self, id: &str, col: usize) { + if let Some(i) = self.lines.iter().position(|l| l.id == id) { + self.line = i; + self.focus = Focus::Line; + self.set_col(col); + self.clamp_scroll(); + } + } + + /// The focused line's id and item id ("" if none). + pub fn target(&self) -> (String, String) { + let Some(l) = self.lines.get(self.line) else { return (String::new(), String::new()) }; + let c = self.col(); + let item = match l.kind { + Kind::Cards => l.cards.get(c).map(|c| c.id.clone()), + _ => l.chips.get(c).map(|c| c.id.clone()), + }; + (l.id.clone(), item.unwrap_or_default()) + } + + pub fn focused_kind(&self) -> Option { + if self.focus != Focus::Line { + return None; + } + self.lines.get(self.line).map(|l| l.kind) + } + + /// Center x of the focused element (for spatial up/down). + fn focus_x(&self) -> f32 { + let Some(l) = self.lines.get(self.line) else { return 0.0 }; + let c = self.col(); + match l.kind { + Kind::Cards => { + let step = card_step(&l.style); + let fit = ((CONTENT_W + 32.0) / step).floor() as usize; + let scroll = c.saturating_sub(1).min(l.cards.len().saturating_sub(fit)); + (c - scroll) as f32 * step + step / 2.0 + } + _ => self.laid[self.line].chips.get(c).map(|p| p.0 + p.2 / 2.0).unwrap_or(0.0), + } + } + + fn nearest_in(&self, li: usize, x: f32, row: Option) -> usize { + let l = &self.lines[li]; + match l.kind { + Kind::Cards => { + let step = card_step(&l.style); + ((x / step).floor() as usize).min(l.cards.len().saturating_sub(1)) + } + _ => { + let chips = &self.laid[li].chips; + let mut best = (f32::MAX, 0usize); + for (i, p) in chips.iter().enumerate() { + if let Some(r) = row { + if p.4 != r { + continue; + } + } + if !l.chips[i].enabled { + continue; + } + let d = (p.0 + p.2 / 2.0 - x).abs(); + if d < best.0 { + best = (d, i); + } + } + best.1 + } + } + } + + /// Up/down. Returns false at the edges (the caller may move to the nav). + pub fn vertical(&mut self, down: bool) -> bool { + let Some(l) = self.lines.get(self.line) else { return false }; + let x = self.focus_x(); + // Inside a wrapped chip line first. + if l.kind == Kind::Chips { + let row = self.laid[self.line].chips.get(self.col()).map(|p| p.4).unwrap_or(0); + let rows = self.laid[self.line].chips.iter().map(|p| p.4).max().unwrap_or(0); + let next = if down { (row < rows).then_some(row + 1) } else { row.checked_sub(1) }; + if let Some(r) = next { + let c = self.nearest_in(self.line, x, Some(r)); + self.set_col(c); + self.clamp_scroll(); + return true; + } + } + let grid_col = if l.grid { Some(self.col()) } else { None }; + let mut i = self.line as isize; + loop { + i += if down { 1 } else { -1 }; + if i < 0 || i as usize >= self.lines.len() { + return false; + } + if self.lines[i as usize].focusable() { + break; + } + } + let prev = self.line; + self.line = i as usize; + let nl = &self.lines[self.line]; + match nl.kind { + Kind::Cards if nl.grid && grid_col.is_some() => self.set_col(grid_col.unwrap().min(nl.cards.len().saturating_sub(1))), + Kind::Cards => {} + Kind::Chips | Kind::Item | Kind::Hero => { + let rows = self.laid[self.line].chips.iter().map(|p| p.4).max().unwrap_or(0); + let row = if down { 0 } else { rows }; + let c = self.nearest_in(self.line, x, Some(row)); + self.set_col(c); + } + _ => {} + } + let _ = prev; + self.clamp_scroll(); + true + } + + /// Left/right inside the line. Returns false at the edges. + pub fn horizontal(&mut self, right: bool) -> bool { + let Some(l) = self.lines.get(self.line) else { return false }; + let n = l.len(); + let c = self.col(); + let mut next = c as isize; + loop { + next += if right { 1 } else { -1 }; + if next < 0 || next as usize >= n { + return false; + } + let ok = match l.kind { + Kind::Cards => true, + _ => l.chips[next as usize].enabled, + }; + if ok { + break; + } + } + self.set_col(next as usize); + true + } + + /// Scrolls so the focused line sits comfortably on screen. + pub fn clamp_scroll(&mut self) { + let Some(laid) = self.laid.get(self.line) else { + self.scroll = 0.0; + return; + }; + let top_margin = if self.frame.side.is_some() { 184.0 } else { 150.0 }; + let mut target = if self.line == 0 || laid.y - top_margin < 120.0 { + 0.0 + } else { + laid.y - 230.0 + }; + // Tall lines (the keyboard) and wrapped chip rows: keep the focused row visible. + if let Some(l) = self.lines.get(self.line) { + if l.kind == Kind::Chips { + if let Some(p) = laid.chips.get(self.col()) { + if laid.y + p.1 + p.3 - target > 1000.0 { + target = laid.y + p.1 + p.3 - 1000.0; + } + } + } + } + let max = (self.total - 1000.0).max(0.0); + self.scroll = target.clamp(0.0, max.max(0.0)).max(0.0); + if self.focus == Focus::Nav { + self.scroll = 0.0; + } + } + + /// Slint's struct for line `i`. + fn slint_line(&mut self, i: usize, images: &sf_ui::images::Images, px: f32) -> Line { + let l = &self.lines[i]; + let laid = &self.laid[i]; + let chips: Vec = l + .chips + .iter() + .zip(laid.chips.iter()) + .map(|(c, p)| Chip { + id: c.id.clone().into(), + text: c.text.clone().into(), + icon: c.icon.clone().into(), + x: p.0, + y: p.1, + w: p.2, + h: p.3, + active: c.active, + tone: c.tone.into(), + enabled: c.enabled, + }) + .collect(); + let (cw, ch) = card_size(&l.style); + let size = ((cw * px * 1.1) as u32, (ch * px * 1.1) as u32); + let cards: Vec = l + .cards + .iter() + .map(|c| Card { + id: c.id.clone().into(), + title: c.title.clone().into(), + caption: c.caption.clone().into(), + detail: c.detail.clone().into(), + image: images.cached(&c.image, size).unwrap_or_default(), + progress: c.progress, + badge: c.badge.clone().into(), + badge_tone: c.badge_tone.into(), + mark: c.mark.into(), + big: c.big.clone().into(), + current: c.current, + }) + .collect(); + let card_model = Rc::new(VecModel::from(cards)); + let checks: Vec = l.checks.iter().map(|(s, a, b)| Check { state: *s, label: a.clone().into(), detail: b.clone().into() }).collect(); + let logo_size = ((620.0 * px) as u32, (190.0 * px) as u32); + let item_size = ((256.0 * px * 1.1) as u32, (144.0 * px * 1.1) as u32); + let line = Line { + id: l.id.clone().into(), + kind: l.kind.name().into(), + y: laid.y, + h: laid.h, + x: laid.x, + w: laid.w, + title: l.title.clone().into(), + subtitle: l.subtitle.clone().into(), + meta: l.meta.clone().into(), + extra: l.extra.clone().into(), + text: l.text.clone().into(), + note: l.note.clone().into(), + style: l.style.clone().into(), + tone: l.tone.clone().into(), + icon: l.icon.clone().into(), + image: if l.image.is_empty() { Default::default() } else { images.cached(&l.image, item_size).unwrap_or_default() }, + logo: if l.logo.is_empty() { Default::default() } else { images.cached(&l.logo, logo_size).unwrap_or_default() }, + progress: l.progress, + col: self.cols.get(&l.id).copied().unwrap_or(0).min(l.len().saturating_sub(1)) as i32, + captions: l.captions, + cards: ModelRc::from(card_model.clone()), + chips: ModelRc::new(VecModel::from(chips)), + checks: ModelRc::new(VecModel::from(checks)), + }; + self.card_models[i] = Some(card_model); + line + } + + /// Sends the focus (column, line, scroll) to Slint's models. + pub fn sync_cols(&self) { + for (i, l) in self.lines.iter().enumerate() { + let want = self.cols.get(&l.id).copied().unwrap_or(0).min(l.len().saturating_sub(1)) as i32; + if let Some(mut row) = self.model.row_data(i) { + if row.col != want { + row.col = want; + self.model.set_row_data(i, row); + } + } + } + } + + /// Loads the pictures of the lines around the focus (cached ones were + /// set when building). + pub fn load_images(&mut self, images: &sf_ui::images::Images, px: f32) { + let view_top = self.scroll - 400.0; + let view_bottom = self.scroll + 1080.0 + 900.0; + for i in 0..self.lines.len() { + let laid = &self.laid[i]; + if laid.y + laid.h < view_top || laid.y > view_bottom { + continue; + } + let l = &self.lines[i]; + if !l.logo.is_empty() && self.shown.insert(format!("{}#logo", l.id)) { + let model = self.model.clone(); + let id = l.id.clone(); + images.load(&l.logo, ((620.0 * px) as u32, (190.0 * px) as u32), move |img| { + if let Some(idx) = (0..model.row_count()).find(|&k| model.row_data(k).is_some_and(|r| r.id == id)) { + let mut row = model.row_data(idx).unwrap(); + row.logo = img; + model.set_row_data(idx, row); + } + }); + } + if !l.image.is_empty() && self.shown.insert(format!("{}#image", l.id)) { + let model = self.model.clone(); + let id = l.id.clone(); + images.load(&l.image, ((256.0 * px * 1.1) as u32, (144.0 * px * 1.1) as u32), move |img| { + if let Some(idx) = (0..model.row_count()).find(|&k| model.row_data(k).is_some_and(|r| r.id == id)) { + let mut row = model.row_data(idx).unwrap(); + row.image = img; + model.set_row_data(idx, row); + } + }); + } + if l.kind != Kind::Cards || l.cards.is_empty() { + continue; + } + let col = self.cols.get(&l.id).copied().unwrap_or(0); + let step = card_step(&l.style); + let fit = ((CONTENT_W + 32.0) / step).floor() as usize; + let start = col.saturating_sub(2); + let end = (col + fit + 3).min(l.cards.len()); + let (cw, ch) = card_size(&l.style); + let size = ((cw * px * 1.1) as u32, (ch * px * 1.1) as u32); + let Some(Some(model)) = self.card_models.get(i).cloned() else { continue }; + for ci in start..end { + let c = &l.cards[ci]; + if c.image.is_empty() || !self.shown.insert(format!("{}#{}", l.id, c.id)) { + continue; + } + let model = model.clone(); + let card_id = c.id.clone(); + images.load(&c.image, size, move |img| { + if let Some(mut row) = model.row_data(ci) { + if row.id == card_id && row.image.size().width == 0 { + row.image = img; + model.set_row_data(ci, row); + } + } + }); + } + } + } + + /// Lines whose end is near the focus (infinite lists ask for more). + pub fn near_end(&self) -> Option { + let l = self.lines.get(self.line)?; + if l.grid { + // The last grid line of this list is close. + let prefix = l.id.split('#').next().unwrap_or(""); + let last = self.lines.iter().rposition(|x| x.id.starts_with(&format!("{prefix}#")))?; + if last <= self.line + 2 { + return Some(prefix.to_string()); + } + } else if l.kind == Kind::Cards && self.col() + 6 >= l.cards.len() { + return Some(l.id.clone()); + } + None + } + + /// Replaces one card's picture (a backdrop loaded elsewhere...). + pub fn line_index(&self, id: &str) -> Option { + self.lines.iter().position(|l| l.id == id) + } +} + +pub fn card_size(style: &str) -> (f32, f32) { + match style { + "landscape" => (400.0, 225.0), + "season" => (168.0, 252.0), + _ => (196.0, 294.0), + } +} + +fn card_step(style: &str) -> f32 { + card_size(style).0 + 32.0 +} + +/// Cards per grid line. +pub const GRID: usize = 8; + +#[cfg(test)] +mod tests { + use super::*; + + fn chips_line(n: usize) -> L { + L::chips("c", "Műfaj", (0..n).map(|i| Ch::new(format!("g{i}"), format!("Műfaj {i}"))).collect()) + } + + #[test] + fn wraps_chips_and_moves_by_rows() { + let lines = vec![chips_line(40), L::cards("r", "Sor", "poster", (0..20).map(|i| C::new(format!("{i}"), "x", "")).collect())]; + let (laid, _) = layout(&lines, false); + let rows = laid[0].chips.iter().map(|p| p.4).max().unwrap(); + assert!(rows >= 2, "40 chips wrap"); + assert!(laid[0].chips.iter().all(|p| p.0 + p.2 <= CONTENT_W + 0.1)); + let mut v = View { lines: lines.clone(), laid, ..View::default() }; + v.total = 2000.0; + assert!(v.vertical(true)); + assert_eq!(v.line, 0, "first down stays in the chip line (next row)"); + let row = v.laid[0].chips[v.col()].4; + assert_eq!(row, 1); + for _ in 0..rows { + v.vertical(true); + } + assert_eq!(v.line, 1, "then the cards"); + assert!(!v.vertical(true), "nothing below"); + } + + #[test] + fn grids_keep_the_column() { + let cards: Vec = (0..20).map(|i| C::new(format!("{i}"), "x", "")).collect(); + let lines = grid_lines("g", "Rács", "poster", cards, 8); + assert_eq!(lines.len(), 3); + let (laid, total) = layout(&lines, false); + let mut v = View { lines, laid, total, ..View::default() }; + v.set_col(5); + v.vertical(true); + assert_eq!((v.line, v.col()), (1, 5)); + v.vertical(true); + assert_eq!((v.line, v.col()), (2, 3), "clamped to the short last line"); + assert_eq!(v.near_end().as_deref(), Some("g")); + } + + #[test] + fn skips_disabled_chips() { + let line = L::chips("c", "", vec![Ch::new("a", "A"), Ch::new("b", "B").enabled(false), Ch::new("c", "C")]); + let (laid, total) = layout(std::slice::from_ref(&line), false); + let mut v = View { lines: vec![line], laid, total, ..View::default() }; + assert!(v.horizontal(true)); + assert_eq!(v.target().1, "c"); + assert!(!v.horizontal(true)); + } +} diff --git a/src/player.rs b/src/player.rs new file mode 100644 index 0000000..80cbcb5 --- /dev/null +++ b/src/player.rs @@ -0,0 +1,714 @@ +//! Playback: title (+ episode) -> an nCore source -> the torrent started on +//! the server -> the file probed -> GStreamer plays the server's raw stream +//! (`/api/stream`, range requests) while the torrent keeps downloading. +//! +//! The video is the glass backdrop, so the controls are glass over the film. +//! Remote: OK = play/pause, left/right = seek (held: faster), up = audio, +//! subtitles and sync, down = "next episode", Back = hide controls / leave. + +use std::sync::Arc; +use std::sync::atomic::{AtomicBool, Ordering}; +use std::time::{Duration, Instant}; + +use slint::{ModelRc, VecModel}; + +use crate::api::{self, MediaType, ProbeInfo}; +#[cfg(target_os = "linux")] +use crate::api::MediaTrack; +use crate::app::{Action, Controller, Screen}; +use crate::{MenuItem, detail, format, task}; + +/// What to play. +#[derive(Debug, Clone)] +pub struct Request { + pub kind: MediaType, + pub id: String, + pub title: String, + pub ep: Option<(i32, i32)>, + pub episode_name: String, + /// Start position, seconds. + pub resume: f64, + pub backdrop: String, + /// The episode after this one, if any. + pub next: Option<(i32, i32)>, +} + +#[derive(Debug, Clone, PartialEq, Eq)] +enum Stage { + Prep, + Play, + Error, +} + +struct Media { + hash: String, + file: i64, + probe: ProbeInfo, +} + +/// One track as shown in the menus (from GStreamer, with the server's +/// probe filling in flags when the counts match). +#[derive(Debug, Clone, Default)] +struct Track { + index: i32, + language: Option, + title: Option, + channels: Option, + default: bool, + forced: bool, +} + +const SYNC_STEPS: [i64; 13] = [-2000, -1000, -500, -300, -200, -100, 0, 100, 200, 300, 500, 1000, 2000]; +const OSD_SECONDS: u64 = 4; +const SAVE_EVERY: Duration = Duration::from_secs(15); +const COMMENTARY: [&str; 3] = ["commentary", "kommentár", "director"]; +const FORCED: [&str; 3] = ["forced", "kényszerített", "sign"]; + +pub struct Player { + req: Request, + generation: u64, + cancel: Arc, + stage: Stage, + media: Option, + #[cfg(target_os = "linux")] + video: Option, + timer: slint::Timer, + osd_until: Instant, + seek_target: Option, + seek_commit: Instant, + /// 0 = closed, 1 = audio, 2 = subtitles, 3 = sync. + panel: i32, + focus: [usize; 3], + audio: Vec, + subs: Vec, + audio_on: i32, + subs_on: Option, + delay_ms: i64, + position: f64, + duration: Option, + last_save: Instant, + next_focused: bool, + playing: bool, +} + +static GENERATION: std::sync::atomic::AtomicU64 = std::sync::atomic::AtomicU64::new(1); + +fn subtitle_line(req: &Request) -> String { + match req.ep { + Some((s, e)) if req.episode_name.is_empty() => format::episode_code(s, e), + Some((s, e)) => format!("{} · {}", format::episode_code(s, e), req.episode_name), + None => String::new(), + } +} + +/// Starts playing `req` (replacing whatever plays). +pub fn play(c: &Controller, req: Request) { + stop(c, true); + let generation = GENERATION.fetch_add(1, Ordering::Relaxed); + let cancel = Arc::new(AtomicBool::new(false)); + { + let mut st = c.state.borrow_mut(); + st.player = Some(Player { + req: req.clone(), + generation, + cancel: cancel.clone(), + stage: Stage::Prep, + media: None, + #[cfg(target_os = "linux")] + video: None, + timer: slint::Timer::default(), + osd_until: Instant::now(), + seek_target: None, + seek_commit: Instant::now(), + panel: 0, + focus: [0; 3], + audio: Vec::new(), + subs: Vec::new(), + audio_on: 0, + subs_on: None, + delay_ms: 0, + position: req.resume, + duration: None, + last_save: Instant::now(), + next_focused: false, + playing: false, + }); + } + if let Some(ui) = c.ui() { + ui.set_player_stage("prep".into()); + ui.set_player_title(req.title.clone().into()); + ui.set_player_subtitle(subtitle_line(&req).into()); + ui.set_player_stage_text("Forrás keresése az nCore-on…".into()); + ui.set_player_detail_text("".into()); + ui.set_player_error_text("".into()); + ui.set_player_osd(false); + ui.set_player_paused(false); + ui.set_player_buffering(false); + ui.set_player_progress(0.0); + ui.set_player_buffered(0.0); + ui.set_player_seeking(false); + ui.set_player_panel(0); + ui.set_player_next_label("".into()); + ui.set_player_next_focused(false); + } + // While preparing: the title's artwork, soft. + if !req.backdrop.is_empty() { + let k = c.clone(); + let px = c.px(); + c.images.load_pixels(&req.backdrop, ((960.0 * px) as u32, (540.0 * px) as u32), move |pixels| { + if k.state.borrow().player.as_ref().is_some_and(|p| p.generation == generation && p.stage == Stage::Prep) { + k.glass.set_backdrop(Some(sf_ui::Backdrop::new(pixels.clone()).dim(0.55).fade_left(0.0).fade_bottom(0.0).soft())); + } + }); + } + if c.state.borrow().screen == Screen::Player { + c.show(Screen::Player); + } else { + c.push(Screen::Player); + } + + let api = c.api(); + let weak = c.ui.clone(); + let stage = move |text: String| { + let w = weak.clone(); + let _ = w.upgrade_in_event_loop(move |ui| ui.set_player_stage_text(text.into())); + }; + let weak2 = c.ui.clone(); + let detail_text = move |text: String| { + let _ = weak2.upgrade_in_event_loop(move |ui| ui.set_player_detail_text(text.into())); + }; + let k = c.clone(); + let flag = cancel.clone(); + task::spawn( + move || -> anyhow::Result { + let sources = api.sources(req.kind, &req.id, req.ep)?; + anyhow::ensure!( + !sources.candidates.is_empty(), + match req.ep { + Some((s, e)) => format!("Nincs nCore torrent ehhez: {}.", format::episode_code(s, e)), + None => "Nincs nCore torrent ehhez a filmhez.".into(), + } + ); + let mut last: Option = None; + for cand in sources.candidates.iter().take(3) { + if flag.load(Ordering::Relaxed) { + anyhow::bail!("cancelled"); + } + let local = matches!(cand.local.as_deref(), Some("seeding" | "eligible")); + stage(if local { "Indítás a szerveren lévő fájlból…".into() } else { "Torrent indítása…".into() }); + detail_text(format!("{} · {} · {} seeder", cand.torrent.name, api::format_bytes(cand.torrent.size), cand.torrent.seeders)); + let started = match api.start_play(req.kind, &req.id, cand.torrent.id, req.ep) { + Ok(s) => s, + Err(e) => { + // VPN, disk quota or nCore trouble: another torrent fails the same way. + if let Some(a) = e.downcast_ref::() { + if matches!(a.status, 401 | 409 | 503 | 507) { + return Err(e); + } + } + last = Some(e); + continue; + } + }; + stage("A fájl elejének letöltése és elemzése…".into()); + let cancelled = || flag.load(Ordering::Relaxed); + match api::probe_while_downloading(&api, &started.info_hash, started.file_index, &stage, &cancelled) { + Ok(probe) => return Ok(Media { hash: started.info_hash, file: started.file_index, probe }), + Err(e) => last = Some(e), + } + } + Err(last.unwrap_or_else(|| anyhow::anyhow!("Nem sikerült elindítani"))) + }, + move |r| { + if cancel.load(Ordering::Relaxed) || !k.state.borrow().player.as_ref().is_some_and(|p| p.generation == generation) { + return; + } + match r { + Ok(media) => start(&k, media), + Err(e) if api::is_unauthenticated(&e) => k.signed_out(), + Err(e) => fail(&k, &api::describe(&e)), + } + }, + ); +} + +fn fail(c: &Controller, text: &str) { + if let Some(p) = c.state.borrow_mut().player.as_mut() { + p.stage = Stage::Error; + } + c.glass.set_video(None); + if let Some(ui) = c.ui() { + ui.set_player_stage("error".into()); + ui.set_player_error_text(text.into()); + } +} + +#[cfg(not(target_os = "linux"))] +fn start(c: &Controller, media: Media) { + if let Some(p) = c.state.borrow_mut().player.as_mut() { + p.media = Some(media); + } + fail(c, "Ezen a gépen nincs lejátszó: a videó a TV-n (Linux, GStreamer) játszik."); +} + +#[cfg(target_os = "linux")] +fn start(c: &Controller, media: Media) { + let (uri, opts, generation) = { + let st = c.state.borrow(); + let Some(p) = st.player.as_ref() else { return }; + let opts = sf_ui::video::PlayerOptions { + start: p.req.resume, + audio_offset_ms: media.probe.audio_delay_ms.unwrap_or(0), + subtitles: true, + user_agent: Some(concat!("NetflexTV/", env!("CARGO_PKG_VERSION"), " SmartFox").into()), + ..Default::default() + }; + (st.api.stream_url(&media.hash, media.file), opts, p.generation) + }; + let delay = opts.audio_offset_ms; + match sf_ui::video::Player::new(&uri, opts) { + Ok(v) => { + c.glass.set_backdrop(None); + c.glass.set_video(Some(v.video())); + { + let mut st = c.state.borrow_mut(); + let Some(p) = st.player.as_mut() else { return }; + p.duration = media.probe.duration_sec; + p.media = Some(media); + p.video = Some(v); + p.stage = Stage::Play; + p.delay_ms = delay; + p.osd_until = Instant::now() + Duration::from_secs(OSD_SECONDS); + p.last_save = Instant::now(); + let k = c.clone(); + p.timer.start(slint::TimerMode::Repeated, Duration::from_millis(100), move || tick(&k, generation)); + } + if let Some(ui) = c.ui() { + ui.set_player_stage("play".into()); + ui.set_player_buffering(true); + ui.set_player_osd(true); + } + } + Err(e) => fail(c, &format!("A lejátszó nem indult: {e:#}")), + } +} + +#[cfg(target_os = "linux")] +fn tick(c: &Controller, generation: u64) { + use sf_ui::video::Event; + enum End { + No, + Finished, + Failed(String), + } + let mut end = End::No; + let mut save: Option<(f64, Option)> = None; + { + let mut st = c.state.borrow_mut(); + let settings_sub = st.settings.subtitle_lang.clone().unwrap_or_else(|| "hu".into()); + let Some(p) = st.player.as_mut().filter(|p| p.generation == generation) else { return }; + let Some(v) = p.video.as_mut() else { return }; + let ui = c.ui(); + for ev in v.poll() { + match ev { + Event::Ready { duration } => { + if duration.is_some() { + p.duration = duration; + } + let probe = p.media.as_ref().map(|m| m.probe.tracks.clone()).unwrap_or_default(); + p.audio = merge(v.audio_tracks(), &probe, "audio"); + p.subs = merge(v.text_tracks(), &probe, "subtitle"); + p.audio_on = pick_audio(&p.audio).unwrap_or(v.current_audio().max(0)); + v.set_audio(p.audio_on); + let audio_lang = p.audio.iter().find(|t| t.index == p.audio_on).and_then(|t| t.language.clone()); + p.subs_on = pick_subtitle(&p.subs, audio_lang.as_deref(), &settings_sub); + v.set_text(p.subs_on); + p.playing = true; + } + Event::Buffering(pct) => { + if let Some(ui) = &ui { + ui.set_player_buffering(pct < 100); + } + } + Event::Playing(on) => { + p.playing = on || v.is_playing(); + if let Some(ui) = &ui { + ui.set_player_paused(!v.is_playing()); + if on { + ui.set_player_buffering(false); + } + } + } + Event::Seeked => {} + Event::Eos => end = End::Finished, + Event::Error(e) => end = End::Failed(e), + } + } + let now = Instant::now(); + if let Some(t) = p.seek_target { + if now >= p.seek_commit { + v.seek(t, false); + p.seek_target = None; + p.position = t; + } + } else if let Some(pos) = v.position() { + p.position = pos; + } + if let Some(d) = v.duration() { + p.duration = Some(d); + } + if v.is_playing() && now.duration_since(p.last_save) >= SAVE_EVERY && p.position > 5.0 { + p.last_save = now; + save = Some((p.position, p.duration)); + } + if let Some(ui) = &ui { + let shown = p.seek_target.unwrap_or(p.position); + let dur = p.duration.unwrap_or(0.0); + ui.set_player_progress(if dur > 0.0 { (shown / dur) as f32 } else { 0.0 }); + ui.set_player_time_text(format::time(shown).into()); + ui.set_player_remaining_text(if dur > 0.0 { format::time(dur).into() } else { "".into() }); + ui.set_player_seeking(p.seek_target.is_some()); + ui.set_player_buffering(v.is_buffering() && !matches!(end, End::Failed(_))); + ui.set_player_paused(!v.is_playing()); + let osd = p.panel > 0 || p.next_focused || !v.is_playing() || now < p.osd_until; + ui.set_player_osd(osd); + let near_end = dur > 0.0 && dur - shown < 45.0; + let label = match p.req.next { + Some((s, e)) if near_end || p.next_focused => format!("Következő rész · {}", format::episode_code(s, e)), + _ => String::new(), + }; + if label.is_empty() { + p.next_focused = false; + } + ui.set_player_next_label(label.into()); + ui.set_player_next_focused(p.next_focused); + } + } + if let Some((pos, dur)) = save { + save_progress(c, pos, dur); + } + match end { + End::No => {} + End::Finished => finished(c), + End::Failed(e) => fail(c, &format!("Lejátszási hiba: {e}")), + } +} + +/// GStreamer's tracks, with the server's probe flags when the counts match +/// (both list the file's tracks in order). +#[cfg(target_os = "linux")] +fn merge(tracks: Vec, probe: &[MediaTrack], kind: &str) -> Vec { + let probe: Vec<&MediaTrack> = probe.iter().filter(|t| t.kind == kind).collect(); + let same = probe.len() == tracks.len(); + tracks + .into_iter() + .enumerate() + .map(|(i, t)| { + let p = if same { probe.get(i).copied() } else { None }; + Track { + index: t.index, + language: p.and_then(|p| p.language.clone()).or_else(|| format::lang_code(t.language.as_deref())), + title: p.and_then(|p| p.title.clone()).or(t.title), + channels: p.and_then(|p| p.channels), + default: p.is_some_and(|p| p.is_default), + forced: p.is_some_and(|p| p.is_forced), + } + }) + .collect() +} + +fn has_any(s: &Option, words: &[&str]) -> bool { + s.as_deref().map(str::to_lowercase).is_some_and(|t| words.iter().any(|w| t.contains(w))) +} + +/// Hungarian audio when there is any, else the default track, else the first. +fn pick_audio(tracks: &[Track]) -> Option { + let usable: Vec<&Track> = tracks.iter().filter(|t| !has_any(&t.title, &COMMENTARY)).collect(); + usable + .iter() + .find(|t| t.language.as_deref() == Some("hu")) + .or_else(|| usable.iter().find(|t| t.default)) + .or_else(|| usable.first()) + .map(|t| t.index) + .or_else(|| tracks.first().map(|t| t.index)) +} + +/// With Hungarian audio: only a forced Hungarian track. Otherwise full +/// subtitles in the preferred language, falling back to English. +fn pick_subtitle(tracks: &[Track], audio_lang: Option<&str>, prefer: &str) -> Option { + let forced = |t: &Track| t.forced || has_any(&t.title, &FORCED); + let lang = |l: &str| tracks.iter().filter(|t| t.language.as_deref() == Some(l)).collect::>(); + if audio_lang == Some("hu") { + return lang("hu").into_iter().find(|t| forced(t)).map(|t| t.index); + } + let mut cands = lang(prefer); + if cands.is_empty() { + cands = lang("en"); + } + let full: Vec<&&Track> = cands.iter().filter(|t| !forced(t)).collect(); + full.iter().find(|t| t.default).or_else(|| full.first()).map(|t| t.index).or_else(|| cands.first().map(|t| t.index)) +} + +fn track_label(t: &Track) -> String { + let lang = format::language(t.language.as_deref()); + match &t.title { + Some(title) if !title.to_lowercase().contains(&lang.to_lowercase()) && !title.trim().is_empty() => format!("{lang} — {title}"), + _ => lang, + } +} + +fn menus(c: &Controller) { + let Some(ui) = c.ui() else { return }; + let st = c.state.borrow(); + let Some(p) = st.player.as_ref() else { return }; + let audio: Vec = p + .audio + .iter() + .map(|t| MenuItem { text: track_label(t).into(), detail: format::channels(t.channels).into(), checked: t.index == p.audio_on }) + .collect(); + let mut subs = vec![MenuItem { text: "Kikapcsolva".into(), detail: "".into(), checked: p.subs_on.is_none() }]; + subs.extend(p.subs.iter().map(|t| MenuItem { + text: track_label(t).into(), + detail: if t.forced { "kényszerített".into() } else { "".into() }, + checked: Some(t.index) == p.subs_on, + })); + let sync: Vec = + SYNC_STEPS.iter().map(|ms| MenuItem { text: format::delay(*ms).into(), detail: "".into(), checked: *ms == p.delay_ms }).collect(); + ui.set_player_audio(ModelRc::new(VecModel::from(audio))); + ui.set_player_subs(ModelRc::new(VecModel::from(subs))); + ui.set_player_sync(ModelRc::new(VecModel::from(sync))); + ui.set_player_panel(p.panel); + ui.set_player_audio_focus(p.focus[0] as i32); + ui.set_player_subs_focus(p.focus[1] as i32); + ui.set_player_sync_focus(p.focus[2] as i32); +} + +fn save_progress(c: &Controller, position: f64, duration: Option) { + let st = c.state.borrow(); + let Some(p) = st.player.as_ref() else { return }; + let Some(m) = p.media.as_ref() else { return }; + let (api, kind, id, ep, hash, file) = (st.api.clone(), p.req.kind, p.req.id.clone(), p.req.ep, m.hash.clone(), m.file); + task::background("progress", move || api.save_progress(kind, &id, ep, position, duration, &hash, file)); +} + +/// The end of the film: the next episode, or back. +fn finished(c: &Controller) { + let (next, auto, req, duration) = { + let st = c.state.borrow(); + let Some(p) = st.player.as_ref() else { return }; + (p.req.next, st.settings.auto_next.unwrap_or(true), p.req.clone(), p.duration) + }; + if let Some(d) = duration { + save_progress(c, d, Some(d)); + } + match next { + Some(ep) if auto => play_next(c, &req, ep), + _ => leave(c), + } +} + +fn play_next(c: &Controller, req: &Request, ep: (i32, i32)) { + let next = detail::next_after(c, ep); + let name = detail::episode_name(c, ep); + play(c, Request { ep: Some(ep), episode_name: name, resume: 0.0, next, ..req.clone() }); +} + +/// Stops playback; `save`: remember the position on the server. +pub fn stop(c: &Controller, save: bool) { + let pos = { + let st = c.state.borrow(); + st.player.as_ref().filter(|p| p.stage == Stage::Play).map(|p| (p.seek_target.unwrap_or(p.position), p.duration)) + }; + if save { + if let Some((pos, dur)) = pos.filter(|(p, _)| *p > 5.0) { + save_progress(c, pos, dur); + } + } + let old = c.state.borrow_mut().player.take(); + if let Some(p) = old { + p.cancel.store(true, Ordering::Relaxed); + p.timer.stop(); + drop(p); + c.glass.set_video(None); + } +} + +fn leave(c: &Controller) { + stop(c, true); + if !c.pop() { + crate::home::open(c, 0); + } +} + +pub fn key(c: &Controller, a: Action, repeat: bool) { + let stage = c.state.borrow().player.as_ref().map(|p| p.stage.clone()); + match stage { + Some(Stage::Play) => {} + Some(_) => { + if a == Action::Back { + leave(c); + } + return; + } + None => return, + } + enum Then { + Nothing, + Menus, + Leave, + Next(Request, (i32, i32)), + } + let then = { + let mut st = c.state.borrow_mut(); + let Some(p) = st.player.as_mut() else { return }; + let now = Instant::now(); + p.osd_until = now + Duration::from_secs(OSD_SECONDS); + #[cfg(target_os = "linux")] + let v = p.video.as_mut(); + if p.panel > 0 { + let col = (p.panel - 1) as usize; + let len = match col { + 0 => p.audio.len(), + 1 => p.subs.len() + 1, + _ => SYNC_STEPS.len(), + }; + match a { + Action::Up => p.focus[col] = p.focus[col].saturating_sub(1), + Action::Down => p.focus[col] = (p.focus[col] + 1).min(len.saturating_sub(1)), + Action::Left => p.panel = (p.panel - 1).max(1), + Action::Right => p.panel = (p.panel + 1).min(3), + Action::Back => p.panel = 0, + Action::Ok | Action::PlayPause => { + let i = p.focus[col]; + match col { + 0 => { + if let Some(t) = p.audio.get(i) { + p.audio_on = t.index; + #[cfg(target_os = "linux")] + if let Some(v) = v { + v.set_audio(t.index); + } + } + } + 1 => { + p.subs_on = if i == 0 { None } else { p.subs.get(i - 1).map(|t| t.index) }; + #[cfg(target_os = "linux")] + if let Some(v) = v { + v.set_text(p.subs_on); + } + } + _ => { + let ms = SYNC_STEPS[i.min(SYNC_STEPS.len() - 1)]; + p.delay_ms = ms; + #[cfg(target_os = "linux")] + if let Some(v) = v { + v.set_audio_offset_ms(ms); + } + drop(st); + menus(c); + return save_delay(c, ms); + } + } + } + } + Then::Menus + } else { + match a { + Action::Ok | Action::PlayPause => { + if p.next_focused { + match p.req.next { + Some(ep) => Then::Next(p.req.clone(), ep), + None => Then::Nothing, + } + } else { + #[cfg(target_os = "linux")] + if let Some(v) = v { + let playing = v.toggle(); + if !playing { + // Paused: a good moment to remember where. + p.last_save = now - SAVE_EVERY; + } + } + Then::Nothing + } + } + Action::Left | Action::Right => { + p.next_focused = false; + let step = if repeat { 30.0 } else { 10.0 }; + let base = p.seek_target.unwrap_or(p.position); + let max = p.duration.map(|d| (d - 2.0).max(0.0)).unwrap_or(f64::MAX); + let t = if a == Action::Left { base - step } else { base + step }; + p.seek_target = Some(t.clamp(0.0, max)); + p.seek_commit = now + Duration::from_millis(if repeat { 900 } else { 700 }); + Then::Nothing + } + Action::Up => { + if p.next_focused { + p.next_focused = false; + } else { + p.panel = 1; + p.focus = [ + p.audio.iter().position(|t| t.index == p.audio_on).unwrap_or(0), + p.subs_on.and_then(|s| p.subs.iter().position(|t| t.index == s)).map(|i| i + 1).unwrap_or(0), + SYNC_STEPS.iter().position(|ms| *ms == p.delay_ms).unwrap_or(6), + ]; + } + Then::Menus + } + Action::Down => { + if p.req.next.is_some() && p.duration.is_some_and(|d| d - p.position < 45.0) { + p.next_focused = true; + } + Then::Nothing + } + Action::Back => { + if p.next_focused { + p.next_focused = false; + Then::Nothing + } else if p.seek_target.is_some() { + p.seek_target = None; + Then::Nothing + } else { + Then::Leave + } + } + } + } + }; + match then { + Then::Nothing => {} + Then::Menus => menus(c), + Then::Leave => leave(c), + Then::Next(req, ep) => play_next(c, &req, ep), + } +} + +fn save_delay(c: &Controller, ms: i64) { + let st = c.state.borrow(); + let Some(m) = st.player.as_ref().and_then(|p| p.media.as_ref()) else { return }; + let (api, hash, file) = (st.api.clone(), m.hash.clone(), m.file); + task::background("audio delay", move || api.set_audio_delay(&hash, file, ms)); +} + +#[cfg(test)] +mod tests { + use super::*; + + fn t(index: i32, lang: &str, title: &str, default: bool, forced: bool) -> Track { + Track { index, language: Some(lang.into()), title: (!title.is_empty()).then(|| title.into()), channels: None, default, forced } + } + + #[test] + fn picks_tracks_like_the_web_app() { + let audio = [t(0, "en", "", true, false), t(1, "en", "Commentary", false, false), t(2, "hu", "", false, false)]; + assert_eq!(pick_audio(&audio), Some(2)); + assert_eq!(pick_audio(&audio[..2]), Some(0)); + let subs = [t(0, "hu", "Forced", false, true), t(1, "hu", "", false, false), t(2, "en", "", true, false)]; + // Hungarian audio: only the forced track. + assert_eq!(pick_subtitle(&subs, Some("hu"), "hu"), Some(0)); + // English audio: full Hungarian subtitles. + assert_eq!(pick_subtitle(&subs, Some("en"), "hu"), Some(1)); + assert_eq!(pick_subtitle(&subs[2..], Some("ja"), "hu"), Some(2)); + assert_eq!(pick_subtitle(&[], Some("en"), "hu"), None); + } +} diff --git a/src/screens/detail.rs b/src/screens/detail.rs new file mode 100644 index 0000000..2850c11 --- /dev/null +++ b/src/screens/detail.rs @@ -0,0 +1,608 @@ +//! A movie's or series' page (the web app's pages/Detail.tsx): hero with +//! Play / Continue / Next, My List, watched, versions; seasons as poster +//! cards, episodes as rows; nCore versions with their badges; cast. + +use std::any::Any; +use std::collections::HashMap; + +use crate::api::{EpisodeInfo, MediaType, ProgressRow, ReleaseLanguages, SeasonDetail, SourceCandidate, SourcesResult, TitleDetail, TitleState, TitleSummary}; +use crate::app::{Cx, Look, Screen}; +use crate::page::{C, Ch, Frame, Kind, L, Spec}; +use crate::screens::Load; +use crate::screens::home::meta_line; +use crate::{format, player}; + +/// NFO languages load by themselves for the top rows only (one nCore page each). +const AUTO_LANGS: usize = 5; + +type Ep = (i32, i32); + +pub struct Detail { + kind: MediaType, + id: String, + summary: Option, + data: Load, + progress: Vec, + state: TitleState, + season: Option, + seasons: HashMap>, + /// Versions open: the movie (None) or an episode. + open: Option>, + sources: HashMap>, + langs: HashMap>, + all_langs: bool, + started: bool, +} + +fn source_key(ep: Option) -> String { + ep.map(|(s, e)| format!("{s}:{e}")).unwrap_or_else(|| "movie".into()) +} + +impl Detail { + pub fn new(kind: MediaType, id: &str, summary: Option) -> Detail { + Detail { + kind, + id: id.to_string(), + summary, + data: Load::Loading, + progress: Vec::new(), + state: TitleState::default(), + season: None, + seasons: HashMap::new(), + open: None, + sources: HashMap::new(), + langs: HashMap::new(), + all_langs: false, + started: false, + } + } + + fn load(&mut self, cx: &Cx) { + let (api, kind, id) = (cx.api(), self.kind, self.id.clone()); + cx.spawn::( + move || { + let d = api.title(kind, &id); + let p = api.progress(kind, &id).unwrap_or_default(); + let st = api.list_status().ok().and_then(|m| m.get(&format!("{}:{}", kind.key(), id)).cloned()).unwrap_or_default(); + let hu = api.hungarian(&[(kind, id.clone())]).ok().and_then(|m| m.into_values().next()).flatten(); + (d, p, st, hu) + }, + |s, cx, (d, p, st, hu)| { + s.data = Load::from(d, cx); + s.progress = p; + s.state = st; + if let Some(d) = s.data.ready_mut() { + if d.summary.hu.is_none() { + d.summary.hu = hu; + } + } + if s.kind == MediaType::Tv && s.season.is_none() { + if let Some(d) = s.data.ready() { + let n = current_season(d, &s.progress); + s.season = Some(n); + s.load_season(cx, n); + } + } + }, + ); + } + + fn load_season(&mut self, cx: &Cx, n: i32) { + if self.seasons.contains_key(&n) { + return; + } + self.seasons.insert(n, Load::Loading); + let (api, id) = (cx.api(), self.id.clone()); + cx.spawn::(move || api.season(&id, n), move |s, cx, r| { + s.seasons.insert(n, Load::from(r, cx)); + }); + } + + fn reload_progress(&mut self, cx: &Cx) { + let (api, kind, id) = (cx.api(), self.kind, self.id.clone()); + cx.spawn::( + move || (api.progress(kind, &id).unwrap_or_default(), api.list_status().ok().and_then(|m| m.get(&format!("{}:{}", kind.key(), id)).cloned())), + |s, _cx, (p, st)| { + s.progress = p; + if let Some(st) = st { + s.state = st; + } + }, + ); + } + + fn load_sources(&mut self, cx: &Cx, ep: Option) { + let key = source_key(ep); + if self.sources.contains_key(&key) { + self.load_langs(cx, &key); + return; + } + self.sources.insert(key.clone(), Load::Loading); + let (api, kind, id) = (cx.api(), self.kind, self.id.clone()); + cx.spawn::(move || api.sources(kind, &id, ep), move |s, cx, r| { + s.sources.insert(key.clone(), Load::from(r, cx)); + s.load_langs(cx, &key); + }); + } + + fn load_langs(&mut self, cx: &Cx, key: &str) { + let Some(list) = self.sources.get(key).and_then(|l| l.ready()) else { return }; + let n = if self.all_langs { list.candidates.len() } else { AUTO_LANGS }; + let ids: Vec = list.candidates.iter().take(n).map(|c| c.torrent.id).filter(|id| !self.langs.contains_key(id)).collect(); + for nid in ids { + self.langs.insert(nid, Load::Loading); + let api = cx.api(); + cx.spawn::(move || api.release_languages(nid), move |s, cx, r| { + s.langs.insert(nid, Load::from(r, cx)); + }); + } + } + + fn title(&self) -> String { + self.data.ready().map(|d| d.summary.title.clone()).or_else(|| self.summary.as_ref().map(|s| s.title.clone())).unwrap_or_default() + } + + fn backdrop(&self) -> Option { + self.data.ready().and_then(|d| d.summary.backdrop.clone()).or_else(|| self.summary.as_ref().and_then(|s| s.backdrop.clone())) + } + + fn play(&self, cx: &Cx, ep: Option, ncore: Option) { + let mut r = player::Request::title(self.kind, &self.id, self.title(), ep, self.backdrop()); + r.pinned = ncore; + cx.play(r); + } + + fn source_lines(&self, cx: &Cx, ep: Option, out: &mut Vec) { + let key = source_key(ep); + let id = |s: &str| format!("src:{key}:{s}"); + match self.sources.get(&key) { + None | Some(Load::Loading) => out.push(L::text(id("loading"), "Verziók keresése az nCore-on…", "caption")), + Some(Load::Failed(e)) => out.push(L::text(id("error"), e.clone(), "bad")), + Some(Load::Ready(r)) if r.candidates.is_empty() => out.push(L::text( + id("none"), + format!("Ehhez most nincs verzió az nCore-on{}.", if r.searched_by.as_deref() == Some("name") { " (IMDb azonosító nélkül, név alapján kerestünk)" } else { "" }), + "label", + )), + Some(Load::Ready(r)) => { + for (i, c) in r.candidates.iter().enumerate() { + out.push(self.source_item(&key, i, c)); + } + let rest = r.candidates.len().saturating_sub(AUTO_LANGS); + if rest > 0 && !self.all_langs { + out.push(L::chips(format!("srclangs:{key}"), "", vec![Ch::new("langs", "Hangsávok a többi verziónál is").icon("audio")])); + } + } + } + let _ = cx; + } + + fn source_item(&self, key: &str, i: usize, c: &SourceCandidate) -> L { + let mut badges: Vec = Vec::new(); + if i == 0 { + badges.push("Ajánlott".into()); + } + if let Some(local) = &c.local { + badges.push( + match local.as_str() { + "seeding" => "A szerveren, seedel", + "eligible" => "A szerveren", + "downloading" => "Letöltés alatt", + _ => "A szerveren", + } + .into(), + ); + } + let nfo = self.langs.get(&c.torrent.id).and_then(|l| l.ready()); + let subs: Vec = nfo.map(|n| n.subs.clone()).unwrap_or_default(); + if c.parsed.hungarian_audio { + badges.push("Magyar szinkron".into()); + } + if c.parsed.hungarian_subs && !subs.iter().any(|s| s == "hu") { + badges.push("Magyar felirat".into()); + } + if let Some(n) = nfo { + if !n.audio.is_empty() { + badges.push(format!("Hang: {}", n.audio.iter().map(|l| format::language(Some(l)).to_lowercase()).collect::>().join(", "))); + } + if !subs.is_empty() { + badges.push(format!("Felirat: {}", subs.iter().map(|l| format::language(Some(l)).to_lowercase()).collect::>().join(", "))); + } + if n.found && n.audio.is_empty() && subs.is_empty() { + badges.push("nyelv ismeretlen".into()); + } + } else if matches!(self.langs.get(&c.torrent.id), Some(Load::Loading)) { + badges.push("NFO…".into()); + } + if let Some(r) = c.parsed.resolution { + badges.push(format!("{}{}", if r >= 2160 { "4K".to_string() } else { format!("{r}p") }, if c.parsed.hdr { " HDR" } else { "" })); + } + badges.push(format!("{} seeder", c.torrent.seeders)); + if c.torrent.freeleech { + badges.push("Freeleech".into()); + } + let mut text = vec![crate::api::format_bytes(c.torrent.size)]; + if c.pack { + text.push("évadcsomag".into()); + } + if let Some(d) = &c.torrent.uploaded_at { + text.push(format::date(Some(d))); + } + let mut l = L::item( + format!("src:{key}:{}", c.torrent.id), + c.torrent.name.clone(), + badges.join(" · "), + text.into_iter().filter(|s| !s.is_empty()).collect::>().join(" · "), + vec![Ch::new("play", if i == 0 { "Lejátszás ezzel (ajánlott)" } else { "Lejátszás ezzel" }).icon("play")], + ); + l.indent = 40.0; + l + } + + fn episode_item(&self, d: &TitleDetail, e: &EpisodeInfo, cx: &Cx) -> L { + let today = format::today(); + let aired = e.air_date.as_deref().is_none_or(|a| a <= today.as_str()); + let p = self.progress.iter().find(|p| p.season == e.season && p.episode == e.episode); + let done = p.is_some_and(|p| p.completed); + let mut meta = vec![format!("{}. rész", e.episode)]; + let rt = format::runtime(e.runtime); + if !rt.is_empty() { + meta.push(rt); + } + if !aired { + meta.push(format!("érkezik: {}", format::date(e.air_date.as_deref()))); + } else if let Some(a) = &e.air_date { + meta.push(format::date(Some(a))); + } + if done { + meta.push("megnézted".into()); + } + let open = self.open == Some(Some((e.season, e.episode))); + let chips = if aired { + vec![ + Ch::new("play", "Lejátszás").icon("play"), + Ch::new("versions", "Verziók").icon("list").active(open), + Ch::new("watched", if done { "Megnézve" } else { "Megnéztem" }).icon("check").active(done), + ] + } else { + Vec::new() + }; + let mut l = L::item( + format!("ep:{}:{}", e.season, e.episode), + e.name.clone().unwrap_or_else(|| format!("{}. rész", e.episode)), + meta.join(" · "), + e.overview.clone().unwrap_or_default(), + chips, + ); + let still = cx.api().image(e.still.as_deref().or(d.summary.backdrop.as_deref()), false); + l = l.image(still); + l.progress = match p { + Some(p) if p.completed => 1.0, + Some(p) => p.duration.filter(|x| *x > 0.0).map(|x| (p.position / x).min(1.0) as f32).unwrap_or(-1.0), + None => -1.0, + }; + if !aired { + l.tone = "dim".into(); + } + l + } +} + +/// Where Play goes, and its label (web: resumeTarget). +fn target(d: &TitleDetail, progress: &[ProgressRow]) -> (Option, String) { + if d.summary.kind == MediaType::Movie { + let p = progress.iter().find(|r| r.season == 0 && r.episode == 0); + return (None, if p.is_some_and(|p| !p.completed && p.position > 60.0) { "Folytatás".into() } else { "Lejátszás".into() }); + } + let latest = progress.iter().filter(|r| r.season > 0).max_by_key(|r| (r.season, r.episode)); + let Some(latest) = latest else { + return (Some((d.seasons.first().map(|s| s.number).unwrap_or(1), 1)), "Lejátszás".into()); + }; + if !latest.completed { + return (Some((latest.season, latest.episode)), format!("Folytatás · {}", format::episode_code(latest.season, latest.episode))); + } + let season = d.seasons.iter().find(|s| s.number == latest.season); + let next = if season.is_some_and(|s| latest.episode < s.episode_count) { + Some((latest.season, latest.episode + 1)) + } else if d.seasons.iter().any(|s| s.number == latest.season + 1) { + Some((latest.season + 1, 1)) + } else { + None + }; + match next { + Some((s, e)) => (Some((s, e)), format!("Következő · {}", format::episode_code(s, e))), + None => (Some((latest.season, latest.episode)), "Újra".into()), + } +} + +/// The season you are in (web: currentSeason). +fn current_season(d: &TitleDetail, progress: &[ProgressRow]) -> i32 { + let first = d.seasons.first().map(|s| s.number).unwrap_or(1); + let last = progress.iter().filter(|r| r.season > 0).map(|r| r.season).max().unwrap_or(0); + if last == 0 { + return first; + } + let Some(s) = d.seasons.iter().find(|x| x.number == last) else { return last }; + let watched = progress.iter().filter(|r| r.season == last && r.completed).count() as i32; + if watched < s.aired() { + return last; + } + d.seasons.iter().find(|x| x.number > last && x.aired() > 0).map(|x| x.number).unwrap_or(last) +} + +impl Screen for Detail { + fn spec(&mut self, cx: &Cx) -> Spec { + if !self.started { + self.started = true; + self.load(cx); + } + let api = cx.api(); + let mut lines = Vec::new(); + let d = self.data.ready().cloned(); + let summary = d.as_ref().map(|d| d.summary.clone()).or_else(|| self.summary.clone()); + + // ---- hero ---- + let mut hero = L::new("hero", Kind::Hero); + if let Some(t) = &summary { + hero.title = t.title.clone(); + hero.logo = api.image(t.logo.as_deref(), true); + hero.subtitle = t.original_title.clone().filter(|o| *o != t.title).unwrap_or_default(); + let extra = match &d { + Some(d) if d.summary.kind == MediaType::Movie => format::runtime(d.runtime), + Some(d) => d.number_of_seasons.filter(|n| *n > 0).map(|n| format!("{n} évad")).unwrap_or_default(), + None => String::new(), + }; + hero.meta = meta_line(t, &extra); + let overview = t.overview.clone().unwrap_or_default(); + hero.text = match d.as_ref().and_then(|d| d.tagline.clone()) { + Some(tag) if !tag.is_empty() => format!("{tag}\n{overview}"), + _ => overview, + }; + } + if let Some(d) = &d { + if let Some(n) = d.next_episode_to_air.as_ref().filter(|_| d.summary.kind == MediaType::Tv) { + hero.extra = format!("Új rész érkezik: {} · {}", format::episode_code(n.season, n.episode), format::date_long(n.air_date.as_deref())); + } + let (_, label) = target(d, &self.progress); + hero.chips.push(Ch::new("play", label).icon("play").tone("primary")); + } else { + hero.chips.push(Ch::new("play", "Lejátszás").icon("play").tone("primary").enabled(false)); + } + hero.chips.push(Ch::new("list", if self.state.listed { "Listámon" } else { "Listám" }).icon(if self.state.listed { "check" } else { "plus" }).active(self.state.listed)); + if self.kind == MediaType::Movie { + hero.chips.push(Ch::new("watched", if self.state.watched { "Megnézve" } else { "Megnéztem" }).icon("check").active(self.state.watched)); + hero.chips.push(Ch::new("versions", "Verziók").icon("list").active(self.open == Some(None))); + if let Some(p) = self.progress.iter().find(|r| r.season == 0 && r.episode == 0 && !r.completed && r.position > 60.0) { + if let Some(dur) = p.duration.filter(|d| *d > 0.0) { + hero.progress = (p.position / dur).min(1.0) as f32; + hero.note = format!("még {} perc", ((dur - p.position) / 60.0).round().max(1.0) as i64); + } + } + } + lines.push(hero); + if let Some(st) = self.data.status("status") { + lines.push(st); + } + + // ---- movie: versions ---- + if self.kind == MediaType::Movie && self.open == Some(None) { + lines.push(L::heading("versions-h", "Verziók az nCore-on").sub("A Lejátszás magától a legjobb verziót választja; itt kézzel is dönthetsz.")); + self.source_lines(cx, None, &mut lines); + lines.push(L::chips("versions-close", "", vec![Ch::new("close", "Bezárás").icon("close")])); + } + + // ---- series: seasons and episodes ---- + if let (Some(d), MediaType::Tv) = (&d, self.kind) { + if !d.seasons.is_empty() { + let season = self.season.unwrap_or(1); + lines.push(L::heading("eps-h", "Epizódok").sub(if d.seasons.len() > 1 { format!("{} évad", d.seasons.len()) } else { String::new() })); + let cards: Vec = d + .seasons + .iter() + .map(|s| { + let watched = self.progress.iter().filter(|p| p.season == s.number && p.completed).count() as i32; + let aired = s.aired(); + let complete = aired > 0 && watched >= aired; + let poster = s.poster.as_deref().or(d.summary.poster.as_deref()); + let mut c = C::new(format!("season:{}", s.number), s.label(), api.image(poster, false)); + c.caption = s.label(); + c.detail = format!( + "{}{}", + if watched > 0 { format!("{} / {aired} rész", watched.min(aired)) } else { format!("{} rész", s.episode_count) }, + s.air_date.as_deref().filter(|a| a.len() >= 4).map(|a| format!(" · {}", &a[..4])).unwrap_or_default() + ); + if s.poster.is_none() { + c.big = s.number.to_string(); + } + if complete { + c.mark = "check"; + } else if watched > 0 && aired > 0 { + c.progress = watched as f32 / aired as f32; + } + c.current = s.number == season; + c + }) + .collect(); + let mut sl = L::cards("seasons", "", "season", cards).captions(); + sl.indent = 0.0; + lines.push(sl); + let current = d.seasons.iter().find(|s| s.number == season); + match self.seasons.get(&season) { + None | Some(Load::Loading) => lines.push(L::text("eps-loading", "Epizódok betöltése…", "caption")), + Some(Load::Failed(e)) => lines.push(L::notice("eps-error", "bad", "Az epizódok nem töltődtek be", e.clone())), + Some(Load::Ready(sd)) => { + let today = format::today(); + let aired: Vec<&EpisodeInfo> = sd.episodes.iter().filter(|e| e.air_date.as_deref().is_none_or(|a| a <= today.as_str())).collect(); + let done = aired.iter().filter(|e| self.progress.iter().any(|p| p.season == e.season && p.episode == e.episode && p.completed)).count(); + let all = !aired.is_empty() && done == aired.len(); + let mut h = L::heading("season-h", current.map(|s| s.label()).unwrap_or_else(|| format!("{season}. évad"))); + if !aired.is_empty() { + h.subtitle = format!("{done} / {} rész megnézve", aired.len()); + } + lines.push(h); + if !aired.is_empty() { + lines.push(L::chips( + "season-watched", + "", + vec![Ch::new("all", if all { "Évad megnézettségének törlése" } else { "Egész évad megnézve" }).icon("check").active(all)], + )); + } + for e in &sd.episodes { + lines.push(self.episode_item(d, e, cx)); + if self.open == Some(Some((e.season, e.episode))) { + self.source_lines(cx, Some((e.season, e.episode)), &mut lines); + } + } + } + } + } + } + + // ---- cast ---- + if let Some(d) = &d { + if !d.cast.is_empty() || !d.directors.is_empty() { + lines.push(L::heading("cast-h", "Szereplők és alkotók")); + if !d.directors.is_empty() { + lines.push(L::text("directors", format!("{}: {}", if d.directors.len() > 1 { "Rendezők" } else { "Rendező" }, d.directors.join(", ")), "label")); + } + if !d.cast.is_empty() { + lines.push(L::text("cast", format!("Szereplők: {}", d.cast.iter().take(14).cloned().collect::>().join(", ")), "label")); + } + } + } + Spec { lines, frame: Frame::default() } + } + + fn activate(&mut self, cx: &Cx, line: &str, item: &str) { + match (line, item) { + ("hero", "play") => { + if let Some(d) = self.data.ready() { + let (ep, _) = target(d, &self.progress); + self.play(cx, ep, None); + } + } + ("hero", "list") => { + let on = !self.state.listed; + self.state.listed = on; + let (api, kind, id) = (cx.api(), self.kind, self.id.clone()); + cx.call::("Listám", move || api.set_listed(kind, &id, on), |_, _| {}); + cx.toast(if on { "Mentve a könyvtáradba" } else { "Eltávolítva a könyvtáradból" }); + } + ("hero", "watched") => { + let on = !self.state.watched; + self.state.watched = on; + let (api, kind, id) = (cx.api(), self.kind, self.id.clone()); + cx.call::("Megnézve", move || api.mark_watched(kind, &id, &[(0, 0)], on), |s, cx| s.reload_progress(cx)); + } + ("hero", "versions") => { + if self.open == Some(None) { + self.open = None; + } else { + self.open = Some(None); + self.load_sources(cx, None); + cx.focus_on("versions-h", 0); + } + } + ("versions-close", _) => { + self.open = None; + cx.focus_on("hero", 3); + } + ("seasons", s) => { + if let Some(n) = s.strip_prefix("season:").and_then(|n| n.parse::().ok()) { + self.season = Some(n); + self.open = None; + self.load_season(cx, n); + } + } + ("season-watched", _) => { + let Some(season) = self.season else { return }; + let Some(sd) = self.seasons.get(&season).and_then(|l| l.ready()) else { return }; + let today = format::today(); + let eps: Vec = sd.episodes.iter().filter(|e| e.air_date.as_deref().is_none_or(|a| a <= today.as_str())).map(|e| (e.season, e.episode)).collect(); + let all = eps.iter().all(|(s, e)| self.progress.iter().any(|p| p.season == *s && p.episode == *e && p.completed)); + let (api, kind, id) = (cx.api(), self.kind, self.id.clone()); + cx.call::("Megnézve", move || api.mark_watched(kind, &id, &eps, !all), |s, cx| s.reload_progress(cx)); + } + (l, act) if l.starts_with("ep:") => { + let mut p = l[3..].split(':'); + let (Some(s), Some(e)) = (p.next().and_then(|v| v.parse().ok()), p.next().and_then(|v| v.parse().ok())) else { return }; + match act { + "play" => self.play(cx, Some((s, e)), None), + "versions" => { + if self.open == Some(Some((s, e))) { + self.open = None; + } else { + self.open = Some(Some((s, e))); + self.load_sources(cx, Some((s, e))); + } + } + "watched" => { + let done = self.progress.iter().any(|p| p.season == s && p.episode == e && p.completed); + let (api, kind, id) = (cx.api(), self.kind, self.id.clone()); + cx.call::("Megnézve", move || api.mark_watched(kind, &id, &[(s, e)], !done), |s, cx| s.reload_progress(cx)); + } + _ => {} + } + } + (l, "langs") if l.starts_with("srclangs:") => { + self.all_langs = true; + let key = l["srclangs:".len()..].to_string(); + self.load_langs(cx, &key); + } + (l, "play") if l.starts_with("src:") => { + // src::, key = "movie" or "s:e" + let rest = &l[4..]; + let (key, nid) = rest.rsplit_once(':').unwrap_or((rest, "")); + let Ok(nid) = nid.parse::() else { return }; + let ep = if key == "movie" { + None + } else { + let mut p = key.split(':'); + p.next().and_then(|v| v.parse().ok()).zip(p.next().and_then(|v| v.parse().ok())) + }; + self.play(cx, ep, Some(nid)); + } + _ => {} + } + } + + fn focus(&mut self, cx: &Cx, _line: &str, _item: &str) { + let url = cx.api().image(self.backdrop().as_deref(), false); + cx.backdrop(&url, Look::Sharp, &format!("detail:{}", self.id)); + } + + fn shown(&mut self, cx: &Cx) { + self.reload_progress(cx); + } + + fn as_any(&mut self) -> &mut dyn Any { + self + } +} + +#[cfg(test)] +mod tests { + use super::*; + + fn detail(seasons: &[(i32, i32)]) -> TitleDetail { + let json = format!( + r#"{{"type":"tv","id":"tt1","title":"X","genres":[],"seasons":[{}]}}"#, + seasons.iter().map(|(n, c)| format!(r#"{{"number":{n},"episodeCount":{c},"airedCount":{c}}}"#)).collect::>().join(",") + ); + serde_json::from_str(&json).unwrap() + } + + fn row(s: i32, e: i32, completed: bool) -> ProgressRow { + ProgressRow { season: s, episode: e, position: 100.0, duration: Some(1000.0), completed } + } + + #[test] + fn resume_targets() { + let d = detail(&[(1, 3), (2, 2)]); + assert_eq!(target(&d, &[]), (Some((1, 1)), "Lejátszás".into())); + assert_eq!(target(&d, &[row(1, 2, false)]).1, "Folytatás · S01E02"); + assert_eq!(target(&d, &[row(1, 3, true)]), (Some((2, 1)), "Következő · S02E01".into())); + assert_eq!(target(&d, &[row(2, 2, true)]).1, "Újra"); + assert_eq!(current_season(&d, &[row(1, 1, true), row(1, 2, true), row(1, 3, true)]), 2); + assert_eq!(current_season(&d, &[row(1, 1, true)]), 1); + } +} diff --git a/src/screens/home.rs b/src/screens/home.rs new file mode 100644 index 0000000..1d6b0c2 --- /dev/null +++ b/src/screens/home.rs @@ -0,0 +1,283 @@ +//! Kezdőlap: the admin's setup checklist, the spotlight (popular movies and +//! series taking turns), "Folytasd, ahol abbahagytad", the server's rows. + +use std::any::Any; +use std::collections::HashMap; +use std::time::Instant; + +use crate::api::{HomeData, MediaType, NcoreStatus, TitleState, TitleSummary, VpnStatus}; +use crate::app::{Cx, Look, Screen}; +use crate::page::{Ch, Frame, Kind, L, Spec}; +use crate::screens::{self, Load, continue_card, row_copy, title_cards}; +use crate::{format, player}; + +const DWELL_SECS: u64 = 9; + +pub struct Home { + data: Load, + states: HashMap, + setup: Option<(VpnStatus, NcoreStatus)>, + /// The server answered 409: nothing can play until VPN / nCore are set up. + needs_setup: bool, + spotlight: Vec, + index: usize, + since: Instant, + hero_focused: bool, + loaded: bool, +} + +impl Home { + pub fn new() -> Home { + Home { + data: Load::Loading, + states: HashMap::new(), + setup: None, + needs_setup: false, + spotlight: Vec::new(), + index: 0, + since: Instant::now(), + hero_focused: true, + loaded: false, + } + } + + fn load(&mut self, cx: &Cx) { + let api = cx.api(); + let admin = cx.user().is_admin; + cx.spawn::( + move || { + let home = api.home(); + let states = api.list_status().unwrap_or_default(); + let setup = if admin { api.vpn().ok().zip(api.ncore().ok()) } else { None }; + (home, states, setup) + }, + |s, cx, (home, states, setup)| { + s.needs_setup = matches!(&home, Err(e) if crate::api::status_of(e) == Some(409)); + s.data = if s.needs_setup { Load::Ready(HomeData { rows: Vec::new(), continue_watching: Vec::new() }) } else { Load::from(home, cx) }; + s.states = states; + s.setup = setup; + if let Some(d) = s.data.ready() { + s.spotlight = spotlight(&d.rows); + s.index = s.index.min(s.spotlight.len().saturating_sub(1)); + } + }, + ); + } + + fn current(&self) -> Option<&TitleSummary> { + self.spotlight.get(self.index) + } + + fn find(&self, key: &str) -> Option { + let d = self.data.ready()?; + if let Some((kind, id)) = screens::parse_title_key(key) { + return d.rows.iter().flat_map(|r| r.items.iter()).chain(self.spotlight.iter()).find(|t| t.kind == kind && t.id == id).cloned(); + } + if let Some((kind, id, _)) = screens::parse_continue(key) { + return d.continue_watching.iter().map(|c| &c.title).find(|t| t.kind == kind && t.id == id).cloned(); + } + None + } +} + +/// Popular movies and series, alternating, that have artwork worth showing. +fn spotlight(rows: &[crate::api::HomeRow]) -> Vec { + let pick = |id: &str| -> Vec { rows.iter().find(|r| r.id == id).map(|r| r.items.iter().filter(|t| t.backdrop.is_some()).cloned().collect()).unwrap_or_default() }; + let (movies, series) = (pick("popular-movie"), pick("popular-tv")); + let mut out = Vec::new(); + let mut i = 0; + while out.len() < 6 && (i < movies.len() || i < series.len()) { + if let Some(m) = movies.get(i) { + out.push(m.clone()); + } + if let Some(s) = series.get(i).filter(|_| out.len() < 6) { + out.push(s.clone()); + } + i += 1; + } + if out.is_empty() { + out.extend(rows.first().map(|r| r.items.iter().filter(|t| t.backdrop.is_some()).take(6).cloned().collect::>()).unwrap_or_default()); + } + out +} + +pub fn hu_text(t: &TitleSummary) -> &'static str { + match t.hu { + Some(h) if h.dub => "Magyar szinkron", + Some(h) if h.sub => "Magyar felirat", + _ => "", + } +} + +/// "★ 7.8 · 2024 · Film · Dráma, Krimi · Magyar szinkron" +pub fn meta_line(t: &TitleSummary, extra: &str) -> String { + let mut p: Vec = Vec::new(); + if let Some(r) = t.rating.filter(|r| *r > 0.0) { + p.push(format!("★ {}", format::rating(r))); + } + if let Some(y) = t.year_label.clone().or_else(|| t.year.map(|y| y.to_string())) { + p.push(y); + } + p.push(t.kind.label().into()); + if !extra.is_empty() { + p.push(extra.into()); + } + if !t.genres.is_empty() { + p.push(t.genres.iter().take(2).map(|g| format::genre(g)).collect::>().join(", ")); + } + let hu = hu_text(t); + if !hu.is_empty() { + p.push(hu.into()); + } + p.join(" · ") +} + +impl Screen for Home { + fn spec(&mut self, cx: &Cx) -> Spec { + if !self.loaded { + self.loaded = true; + self.load(cx); + } + let api = cx.api(); + let mut lines = Vec::new(); + + // Setup checklist (admin): VPN and nCore. + if let Some((vpn, ncore)) = &self.setup { + let vpn_ok = vpn.traffic.path == "vpn"; + let ncore_ok = ncore.configured && ncore.circuit.state == "ok"; + let left = [vpn_ok, ncore_ok].iter().filter(|b| !**b).count(); + if left > 0 || self.needs_setup { + let title = match left { + 0 => "Minden készen áll".to_string(), + 1 => "Még egy lépés, és indulhat a filmezés".to_string(), + _ => "Még két lépés, és indulhat a filmezés".to_string(), + }; + lines.push(L::notice("setup", "info", title, "Tunnel nélkül semmi nem megy ki a szerverről, a katalógus sem tölt be. Az nCore fiókból jönnek a filmek és a sorozatok.")); + lines.push(L::checks( + "setup-checks", + vec![ + (vpn_ok as i32, "WireGuard tunnel csatlakoztatva".into(), vpn.traffic.reason.clone().unwrap_or_default()), + (ncore_ok as i32, "nCore fiók megadva".into(), ncore.circuit.message.clone().unwrap_or_default()), + ], + )); + let mut chips = Vec::new(); + if !vpn_ok { + chips.push(Ch::new("vpn", "VPN beállítása").tone("primary")); + } + if !ncore_ok { + chips.push(Ch::new("ncore", "nCore fiók megadása").tone("primary")); + } + if !chips.is_empty() { + lines.push(L::chips("setup-go", "", chips)); + } + } + } else if self.needs_setup { + lines.push(L::notice("setup", "info", "A szerver még nincs kész", "A VPN-t és az nCore fiókot az admin állítja be. Amint kész, itt megjelennek a filmek és a sorozatok.")); + } + + // Spotlight. + if let Some(t) = self.current() { + let listed = self.states.get(&format!("{}:{}", t.kind.key(), t.id)).is_some_and(|s| s.listed); + let mut hero = L::new("hero", Kind::Hero); + hero.style = "KIEMELT TARTALOM".into(); + hero.title = t.title.clone(); + hero.logo = api.image(t.logo.as_deref(), true); + hero.meta = meta_line(t, ""); + hero.text = t.overview.clone().unwrap_or_default(); + hero.subtitle = format!("{} / {}", self.index + 1, self.spotlight.len()); + hero.chips = vec![ + Ch::new("play", if t.kind == MediaType::Movie { "Lejátszás" } else { "Epizódok" }).icon("play").tone("primary"), + Ch::new("info", "További infók").icon("info"), + Ch::new("list", "").icon(if listed { "check" } else { "plus" }).active(listed), + ]; + lines.push(hero); + } + + if let Some(st) = self.data.status("status") { + lines.push(st); + } + if let Some(d) = self.data.ready() { + if !d.continue_watching.is_empty() { + lines.push(L::cards("continue", "Folytasd, ahol abbahagytad", "landscape", d.continue_watching.iter().map(|c| continue_card(&api, c)).collect()).captions()); + } + for r in &d.rows { + let (title, note) = row_copy(&r.id).map(|(t, n)| (t.to_string(), n.to_string())).unwrap_or((r.title.clone(), String::new())); + lines.push(L::cards(format!("row:{}", r.id), title, "poster", title_cards(&api, &r.items, &self.states)).sub(note)); + } + } + Spec { lines, frame: Frame { nav: Some(0), ..Frame::default() } } + } + + fn activate(&mut self, cx: &Cx, line: &str, item: &str) { + match (line, item) { + ("setup-go", "vpn") => cx.c.open_settings("vpn"), + ("setup-go", "ncore") => cx.c.open_settings("ncore"), + ("hero", "play") => { + let Some(t) = self.current().cloned() else { return }; + if t.kind == MediaType::Movie { + cx.play(player::Request::title(t.kind, &t.id, t.title.clone(), None, t.backdrop.clone())); + } else { + cx.push(Box::new(screens::detail::Detail::new(t.kind, &t.id, Some(t)))); + } + } + ("hero", "info") => { + if let Some(t) = self.current().cloned() { + cx.push(Box::new(screens::detail::Detail::new(t.kind, &t.id, Some(t)))); + } + } + ("hero", "list") => { + let Some(t) = self.current().cloned() else { return }; + let key = format!("{}:{}", t.kind.key(), t.id); + let on = !self.states.get(&key).is_some_and(|s| s.listed); + self.states.entry(key).or_default().listed = on; + let api = cx.api(); + cx.call::("Listám", move || api.set_listed(t.kind, &t.id, on), |_, _| {}); + cx.toast(if on { "Hozzáadva a listádhoz" } else { "Eltávolítva a listádról" }); + } + (_, key) => { + let found = self.find(key); + screens::open_card(cx, key, |_| found.clone()); + } + } + } + + fn focus(&mut self, cx: &Cx, line: &str, item: &str) { + self.hero_focused = line == "hero"; + self.since = Instant::now(); + if self.hero_focused { + if let Some(t) = self.current() { + let url = cx.api().image(t.backdrop.as_deref(), false); + cx.backdrop(&url, Look::Sharp, &format!("spot:{}", t.id)); + } + return; + } + match self.find(item) { + Some(t) => { + let url = cx.api().image(t.backdrop.as_deref(), false); + cx.backdrop(&url, Look::Soft, item); + } + None => cx.backdrop("", Look::Soft, ""), + } + } + + fn tick(&mut self, cx: &Cx) { + // The spotlight turns after a while without a key press (any focus + // move restarts the clock): Play always plays what it shows. + if self.spotlight.len() >= 2 && self.since.elapsed().as_secs() >= DWELL_SECS { + self.since = Instant::now(); + self.index = (self.index + 1) % self.spotlight.len(); + cx.refresh(); + if self.hero_focused { + self.focus(cx, "hero", ""); + } + } + } + + fn shown(&mut self, cx: &Cx) { + self.load(cx); + } + + fn as_any(&mut self) -> &mut dyn Any { + self + } +} diff --git a/src/screens/mod.rs b/src/screens/mod.rs new file mode 100644 index 0000000..fbec942 --- /dev/null +++ b/src/screens/mod.rs @@ -0,0 +1,210 @@ +//! The browsing screens. Each one describes its page as lines (src/page.rs) +//! and reacts to OK; see app::Screen. + +pub mod anime_detail; +pub mod anime_hub; +pub mod detail; +pub mod home; +pub mod mylist; +pub mod search; +pub mod settings; +pub mod source; + +use std::collections::HashMap; + +use crate::api::{AnimeSummary, Api, ContinueItem, MediaType, TitleState, TitleSummary}; +use crate::app::{Cx, Screen}; +use crate::format; +use crate::page::{C, L}; + +/// The screen of a top navigation section. +pub fn section(n: usize) -> Box { + match n { + 1 => Box::new(source::Source::new(MediaType::Movie)), + 2 => Box::new(source::Source::new(MediaType::Tv)), + 3 => Box::new(anime_hub::AnimeHub::new()), + 4 => Box::new(mylist::MyList::new()), + 5 => Box::new(search::Search::new()), + 6 => Box::new(settings::Settings::new()), + _ => Box::new(home::Home::new()), + } +} + +/// Data that loads. +#[derive(Debug, Clone, Default)] +pub enum Load { + #[default] + Loading, + Ready(T), + Failed(String), +} + +impl Load { + pub fn ready(&self) -> Option<&T> { + match self { + Load::Ready(t) => Some(t), + _ => None, + } + } + pub fn ready_mut(&mut self) -> Option<&mut T> { + match self { + Load::Ready(t) => Some(t), + _ => None, + } + } + pub fn from(r: anyhow::Result, cx: &Cx) -> Load { + match r { + Ok(t) => Load::Ready(t), + Err(e) => { + if crate::api::is_unauthenticated(&e) { + cx.error("", &e); + } + Load::Failed(crate::api::describe(&e)) + } + } + } + /// The loading / error line, or None when ready. + pub fn status(&self, id: &str) -> Option { + match self { + Load::Loading => Some(L::text(id, "Betöltés…", "caption")), + Load::Failed(e) => Some(L::notice(id, "bad", "Nem sikerült betölteni", e.clone())), + Load::Ready(_) => None, + } + } +} + +/// "t:movie:tt0133093" +pub fn title_key(kind: MediaType, id: &str) -> String { + format!("t:{}:{}", kind.key(), id) +} + +pub fn parse_title_key(key: &str) -> Option<(MediaType, String)> { + let mut p = key.splitn(3, ':'); + if p.next()? != "t" { + return None; + } + let kind = match p.next()? { + "movie" => MediaType::Movie, + "tv" => MediaType::Tv, + _ => return None, + }; + Some((kind, p.next()?.to_string())) +} + +/// A movie / series card (poster); `state` adds the watched marks. +pub fn title_card(api: &Api, t: &TitleSummary, state: Option<&TitleState>) -> C { + let mut c = C::new(title_key(t.kind, &t.id), t.title.clone(), api.image(t.poster.as_deref(), false)); + c.caption = t.title.clone(); + let mut detail = vec![t.year_label.clone().or_else(|| t.year.map(|y| y.to_string())).unwrap_or_default(), t.kind.label().to_string()]; + if let Some(r) = t.rating.filter(|r| *r > 0.0) { + detail.push(format!("★ {}", format::rating(r))); + } + c.detail = detail.into_iter().filter(|s| !s.is_empty()).collect::>().join(" · "); + if let Some(hu) = t.hu { + if hu.dub { + c.badge = "Szinkron".into(); + c.badge_tone = "dub"; + } else if hu.sub { + c.badge = "Felirat".into(); + c.badge_tone = "sub"; + } + } + if let Some(s) = state { + if s.watched { + c.mark = "check"; + } else if s.watched_episodes > 0 && t.kind == MediaType::Tv { + c.detail = format!("{} · {} rész megnézve", c.detail, s.watched_episodes); + } + } + c +} + +pub fn title_cards(api: &Api, items: &[TitleSummary], states: &HashMap) -> Vec { + items.iter().map(|t| title_card(api, t, states.get(&format!("{}:{}", t.kind.key(), t.id)))).collect() +} + +/// "Folytatás" card: landscape art, progress, "S01E02 · még 12 perc". +pub fn continue_card(api: &Api, item: &ContinueItem) -> C { + let t = &item.title; + let ep = item.season.zip(item.episode).filter(|(s, _)| *s > 0 && t.kind == MediaType::Tv); + let id = match ep { + Some((s, e)) => format!("c:{}:{}:{s}:{e}", t.kind.key(), t.id), + None => format!("c:{}:{}", t.kind.key(), t.id), + }; + let art = t.backdrop.as_deref().or(t.poster.as_deref()); + let mut c = C::new(id, t.title.clone(), api.image(art, false)); + c.caption = t.title.clone(); + let left = item.duration.map(|d| ((d - item.position) / 60.0).round().max(0.0) as i64); + let what = ep.map(|(s, e)| format::episode_code(s, e)).unwrap_or_else(|| "Film".into()); + c.detail = match left { + Some(l) if l > 0 => format!("{what} · még {l} perc"), + _ => what, + }; + c.progress = item.duration.filter(|d| *d > 0.0).map(|d| (item.position / d).min(1.0) as f32).unwrap_or(-1.0); + c +} + +/// Parses a "Folytatás" card id: (type, id, episode). +pub fn parse_continue(key: &str) -> Option<(MediaType, String, Option<(i32, i32)>)> { + let p: Vec<&str> = key.split(':').collect(); + if p.first() != Some(&"c") || p.len() < 3 { + return None; + } + let kind = if p[1] == "tv" { MediaType::Tv } else { MediaType::Movie }; + let ep = if p.len() >= 5 { p[3].parse().ok().zip(p[4].parse().ok()) } else { None }; + Some((kind, p[2].to_string(), ep)) +} + +/// An anime card (cover). +pub fn anime_card(api: &Api, a: &AnimeSummary) -> C { + let mut c = C::new(format!("a:{}", a.id), a.title.name(), api.image(a.cover_image.as_deref(), false)); + c.caption = a.title.name(); + let mut d = vec![format::anime_season(a.season.as_deref(), a.season_year), format::anime_format(a.format.as_deref())]; + if let Some(s) = a.average_score.filter(|s| *s > 0.0) { + d.push(format!("★ {}", format::anime_score(s))); + } + c.detail = d.into_iter().filter(|s| !s.is_empty()).collect::>().join(" · "); + c +} + +pub fn parse_anime_key(key: &str) -> Option { + key.strip_prefix("a:")?.split(':').next()?.parse().ok() +} + +/// The web app's names for the server's home rows: (title, note). +pub fn row_copy(id: &str) -> Option<(&'static str, &'static str)> { + Some(match id { + "popular-movie" => ("Most felkapott", "Népszerű filmek"), + "ncore-movie" => ("Épp most érkezett", "Friss filmek az nCore-on"), + "ncore-tv" => ("Friss részek, friss évadok", "Új sorozat-feltöltések az nCore-on"), + "popular-tv" => ("Sorozatok, amiket nem tudsz majd letenni", "Népszerű sorozatok"), + "new-movie" => ("Idén mutatták be", "Idei filmek"), + "featured-movie" => ("Kihagyhatatlan filmek", "Kiemelt filmek"), + "featured-tv" => ("Sorozatok, amikbe beleszeretsz", "Kiemelt sorozatok"), + _ => return None, + }) +} + +/// Opens the page of a card id ("t:…", "c:…", "a:…"); true if it was one. +pub fn open_card(cx: &Cx, key: &str, find: impl Fn(&str) -> Option) -> bool { + if let Some((kind, id)) = parse_title_key(key) { + cx.push(Box::new(detail::Detail::new(kind, &id, find(key)))); + return true; + } + if let Some((kind, id, ep)) = parse_continue(key) { + // "Folytatás" plays right away, where it stopped. + let summary = find(key); + cx.play(crate::player::Request::title(kind, &id, summary.as_ref().map(|s| s.title.clone()).unwrap_or_default(), ep, summary.and_then(|s| s.backdrop))); + return true; + } + if let Some(id) = key.strip_prefix("ac:").and_then(|r| r.split(':').next()).and_then(|v| v.parse::().ok()) { + let ep: i32 = key.rsplit(':').next().and_then(|v| v.parse().ok()).unwrap_or(1); + cx.play(crate::player::Request::anime(id, String::new(), ep, None)); + return true; + } + if let Some(id) = parse_anime_key(key) { + cx.push(Box::new(anime_detail::AnimeDetail::new(id))); + return true; + } + false +} diff --git a/src/screens/source.rs b/src/screens/source.rs new file mode 100644 index 0000000..145bb63 --- /dev/null +++ b/src/screens/source.rs @@ -0,0 +1,559 @@ +//! Filmek / Sorozatok: Ajánlott, Könyvtáram, Böngészés (as in the web app's +//! pages/Browse.tsx). + +use std::any::Any; +use std::collections::{HashMap, HashSet}; + +use crate::api::{ContinueItem, Genre, ListItem, MediaType, TitleState, TitleSummary}; +use crate::app::{Cx, Look, Screen}; +use crate::page::{C, Ch, Frame, GRID, L, Spec, grid_lines}; +use crate::screens::{self, Load, continue_card, title_card}; + +/// Pages in a row that matched nothing before loading stops and asks. +const MAX_EMPTY_STREAK: usize = 3; +const DECADES: [(&str, Option, Option); 6] = [ + ("2020-as évek", Some(2020), None), + ("2010-es évek", Some(2010), Some(2019)), + ("2000-es évek", Some(2000), Some(2009)), + ("1990-es évek", Some(1990), Some(1999)), + ("1980-as évek", Some(1980), Some(1989)), + ("Régebbi", None, Some(1979)), +]; + +#[derive(Debug, Clone, Copy, PartialEq, Eq)] +enum Tab { + Recommended, + Mine, + All, +} + +struct Entry { + title: TitleSummary, + saved: bool, + watched: bool, + last: Option, + added: Option, +} + +#[derive(Debug, Clone, PartialEq)] +struct Filters { + sort: &'static str, + genre: Option, + yf: Option, + yt: Option, + rf: Option, + rt: Option, +} + +impl Filters { + fn filtered(&self) -> bool { + self.genre.is_some() || self.yf.is_some() || self.yt.is_some() || self.rf.is_some() || self.rt.is_some() + } + fn custom(&self) -> usize { + (self.yf.is_some() || self.yt.is_some()) as usize + (self.rf.is_some() || self.rt.is_some()) as usize + } +} + +#[derive(Default)] +struct Catalog { + items: Vec, + page: u32, + cursor: Option, + has_more: bool, + loading: bool, + /// Pages loaded; empty ones since `resume_from` count towards the stop. + pages: Vec, + resume_from: usize, + error: Option, + generation: u64, +} + +pub struct Source { + kind: MediaType, + tab: Tab, + started: bool, + genres: Load>, + continuing: Vec, + library: Load>, + states: HashMap, + rails: Vec<(String, String, String, Load>)>, + rails_started: bool, + // Könyvtáram + show: &'static str, + lib_sort: &'static str, + // Böngészés + f: Filters, + open: bool, + cat: Catalog, +} + +fn this_year() -> i32 { + crate::format::today()[0..4].parse().unwrap_or(2026) +} + +impl Source { + pub fn new(kind: MediaType) -> Source { + Source { + kind, + tab: Tab::Recommended, + started: false, + genres: Load::Loading, + continuing: Vec::new(), + library: Load::Loading, + states: HashMap::new(), + rails: Vec::new(), + rails_started: false, + show: "all", + lib_sort: "recent", + f: Filters { sort: "popularity", genre: None, yf: None, yt: None, rf: None, rt: None }, + open: false, + cat: Catalog::default(), + } + } + + fn copy(&self) -> (&'static str, &'static str, &'static str, &'static str, &'static str, &'static str) { + match self.kind { + MediaType::Movie => ("Filmek", "Népszerű most", "A legjobbra értékelt filmek", "Idei bemutatók", "Még egy filmet sem mentettél", "Egy film oldalán a + gombbal mentheted el, és itt vár rád, amikor ráérsz."), + MediaType::Tv => ("Sorozatok", "Népszerű sorozatok most", "A legjobbra értékelt sorozatok", "Idén indult", "Még egy sorozatot sem mentettél", "Egy sorozat oldalán a + gombbal mentheted el. Amit elkezdesz, magától is ide kerül."), + } + } + + fn start(&mut self, cx: &Cx) { + let (api, kind) = (cx.api(), self.kind); + cx.spawn::( + move || { + let genres = api.genres(kind); + let cont = api.continue_watching().unwrap_or_default(); + let mine = api.my_list(); + let history = api.history().unwrap_or_default(); + let states = api.list_status().unwrap_or_default(); + (genres, cont, mine, history, states) + }, + move |s, cx, (genres, cont, mine, history, states)| { + s.genres = Load::from(genres, cx); + s.continuing = cont.into_iter().filter(|c| c.title.kind == s.kind).collect(); + s.states = states; + s.library = match mine { + Ok(mine) => Load::Ready(library(s.kind, mine, history)), + Err(e) => Load::Failed(crate::api::describe(&e)), + }; + s.start_rails(cx); + }, + ); + } + + fn start_rails(&mut self, cx: &Cx) { + if self.rails_started { + return; + } + let Some(genres) = self.genres.ready().cloned() else { return }; + self.rails_started = true; + let (_, popular, rating, fresh, _, _) = self.copy(); + let year = this_year(); + let mut defs: Vec<(String, String, &'static str, Option, Option)> = vec![ + ("popularity".into(), popular.into(), "popularity", None, None), + ("rating".into(), rating.into(), "rating", None, None), + ("new".into(), fresh.into(), "new", None, Some(year)), + ]; + for g in genres.iter().take(5) { + defs.push((format!("g:{}", g.id), g.name.clone(), "popularity", Some(g.id.clone()), None)); + } + for (id, title, sort, genre, yr) in defs { + self.rails.push((id.clone(), title, genre.clone().unwrap_or_default(), Load::Loading)); + let (api, kind) = (cx.api(), self.kind); + cx.spawn::( + move || api.browse(kind, sort, genre.as_deref(), yr, (None, None), (None, None), 1, None), + move |s, cx, r| { + if let Some(rail) = s.rails.iter_mut().find(|x| x.0 == id) { + rail.3 = Load::from(r.map(|p| p.items), cx); + } + }, + ); + } + } + + fn reload_catalog(&mut self, cx: &Cx) { + self.cat = Catalog { generation: self.cat.generation + 1, has_more: true, ..Catalog::default() }; + self.next_page(cx); + } + + fn next_page(&mut self, cx: &Cx) { + if self.cat.loading || !self.cat.has_more || self.paused() { + return; + } + self.cat.loading = true; + let (api, kind, f, page, cursor, generation) = (cx.api(), self.kind, self.f.clone(), self.cat.page + 1, self.cat.cursor.clone(), self.cat.generation); + cx.spawn::( + move || api.browse(kind, f.sort, f.genre.as_deref(), None, (f.yf, f.yt), (f.rf, f.rt), page, cursor.as_deref()), + move |s, _cx, r| { + if s.cat.generation != generation { + return; + } + s.cat.loading = false; + match r { + Ok(p) => { + let seen: HashSet = s.cat.items.iter().map(|t| t.id.clone()).collect(); + let new: Vec = p.items.into_iter().filter(|t| !seen.contains(&t.id)).collect(); + s.cat.pages.push(new.len()); + s.cat.items.extend(new); + s.cat.page = page; + s.cat.cursor = p.cursor; + s.cat.has_more = p.has_more; + s.cat.error = None; + } + Err(e) => s.cat.error = Some(crate::api::describe(&e)), + } + }, + ); + } + + fn paused(&self) -> bool { + let streak = self.cat.pages[self.cat.resume_from.min(self.cat.pages.len())..].iter().rev().take_while(|n| **n == 0).count(); + streak >= MAX_EMPTY_STREAK + } + + fn find(&self, key: &str) -> Option { + let (kind, id) = screens::parse_title_key(key).or_else(|| screens::parse_continue(key).map(|(k, i, _)| (k, i)))?; + let lib = self.library.ready().into_iter().flatten().map(|e| &e.title); + let rails = self.rails.iter().filter_map(|r| r.3.ready()).flatten(); + self.cat.items.iter().chain(lib).chain(rails).chain(self.continuing.iter().map(|c| &c.title)).find(|t| t.kind == kind && t.id == id).cloned() + } + + fn cards(&self, cx: &Cx, items: &[TitleSummary]) -> Vec { + let api = cx.api(); + items.iter().map(|t| title_card(&api, t, self.states.get(&format!("{}:{}", t.kind.key(), t.id)))).collect() + } + + fn pick_year(&mut self, cx: &Cx, which: &'static str) { + let current = if which == "yf" { self.f.yf } else { self.f.yt }; + let empty = if which == "yf" { "Kezdettől" } else { "Máig" }; + let mut items = vec![(empty.to_string(), String::new(), current.is_none())]; + let years: Vec = (1920..=this_year()).rev().collect(); + items.extend(years.iter().map(|y| (y.to_string(), String::new(), current == Some(*y)))); + cx.select::(if which == "yf" { "Megjelenés ettől" } else { "Megjelenés eddig" }, items, move |s, cx, i| { + let v = if i == 0 { None } else { years.get(i - 1).copied() }; + if which == "yf" { + s.f.yf = v; + if let (Some(a), Some(b)) = (s.f.yf, s.f.yt) { + if a > b { + s.f.yt = Some(a); + } + } + } else { + s.f.yt = v; + if let (Some(a), Some(b)) = (s.f.yf, s.f.yt) { + if a > b { + s.f.yf = Some(b); + } + } + } + s.reload_catalog(cx); + }); + } + + fn pick_rating(&mut self, cx: &Cx, which: &'static str) { + let current = if which == "rf" { self.f.rf } else { self.f.rt }; + let list: Vec = (0..17).map(|i| 9.5 - i as f64 * 0.5).collect(); + let fmt = |v: f64| format!("{v:.1}").replace('.', ","); + let mut items = vec![(if which == "rf" { "Bármennyi" } else { "10-ig" }.to_string(), String::new(), current.is_none())]; + items.extend(list.iter().map(|r| (format!("{}{}", fmt(*r), if which == "rf" { "-tól" } else { "-ig" }), String::new(), current == Some(*r)))); + cx.select::(if which == "rf" { "IMDb értékelés legalább" } else { "IMDb értékelés legfeljebb" }, items, move |s, cx, i| { + let v = if i == 0 { None } else { list.get(i - 1).copied() }; + if which == "rf" { + s.f.rf = v; + if let (Some(a), Some(b)) = (s.f.rf, s.f.rt) { + if a > b { + s.f.rt = Some(a); + } + } + } else { + s.f.rt = v; + if let (Some(a), Some(b)) = (s.f.rf, s.f.rt) { + if a > b { + s.f.rf = Some(b); + } + } + } + s.reload_catalog(cx); + }); + } +} + +fn library(kind: MediaType, mine: Vec, history: Vec) -> Vec { + let mut out: Vec = Vec::new(); + for it in mine.into_iter().filter(|i| i.title.kind == kind) { + out.push(Entry { title: it.title, saved: true, watched: false, last: None, added: it.added_at }); + } + for it in history.into_iter().filter(|i| i.title.kind == kind) { + match out.iter_mut().find(|e| e.title.id == it.title.id) { + Some(e) => { + e.watched = true; + e.last = it.last_watched_at; + } + None => out.push(Entry { title: it.title, saved: false, watched: true, last: it.last_watched_at, added: None }), + } + } + out +} + +fn ts(iso: &Option) -> i64 { + iso.as_deref().and_then(crate::format::parse_iso).unwrap_or(0) +} + +impl Screen for Source { + fn spec(&mut self, cx: &Cx) -> Spec { + if !self.started { + self.started = true; + self.start(cx); + } + let (title, _, _, _, empty_mine, empty_hint) = self.copy(); + let lib_n = self.library.ready().map(|l| l.len()).unwrap_or(0); + let mut lines = vec![ + L::page_title("title", title, ""), + L::chips( + "tabs", + "", + vec![ + Ch::new("rec", "Ajánlott").active(self.tab == Tab::Recommended), + Ch::new("mine", format!("Könyvtáram ({lib_n})")).active(self.tab == Tab::Mine), + Ch::new("all", "Böngészés").active(self.tab == Tab::All), + ], + ), + ]; + let api = cx.api(); + match self.tab { + Tab::Recommended => { + if !self.continuing.is_empty() { + lines.push(L::cards("continue", "Folytasd, ahol abbahagytad", "landscape", self.continuing.iter().map(|c| continue_card(&api, c)).collect()).captions()); + } + if let Some(lib) = self.library.ready() { + let saved: Vec = lib.iter().filter(|e| e.saved).take(30).map(|e| e.title.clone()).collect(); + if !saved.is_empty() { + let n = lib.iter().filter(|e| e.saved).count(); + lines.push(L::cards("saved", "A könyvtáradból", "poster", self.cards(cx, &saved)).sub(format!("{n} mentett cím"))); + } + } + if let Some(st) = self.genres.status("status") { + lines.push(st); + } + for (id, title, _, rail) in &self.rails { + match rail { + Load::Ready(items) if !items.is_empty() => lines.push(L::cards(format!("rail:{id}"), title.clone(), "poster", self.cards(cx, items))), + Load::Loading => lines.push(L::cards(format!("rail:{id}"), title.clone(), "poster", Vec::new())), + _ => {} + } + } + if self.genres.ready().is_some_and(|g| g.len() > 5) { + lines.push(L::chips("browse-all", "", vec![Ch::new("all", "Minden műfaj böngészése").icon("list")])); + } + } + Tab::Mine => { + let filters = [("all", "Minden"), ("saved", "Mentett"), ("watched", "Nézett"), ("unwatched", "Nem nézett")]; + lines.push(L::chips("show", "", filters.iter().map(|(id, l)| Ch::new(*id, *l).active(self.show == *id)).collect())); + let sorts = [("recent", "Legutóbbi"), ("oldest", "Legrégebben nézett"), ("title", "Cím"), ("year", "Megjelenés")]; + lines.push(L::chips("sort", "RENDEZÉS", sorts.iter().map(|(id, l)| Ch::new(*id, *l).active(self.lib_sort == *id)).collect())); + match &self.library { + Load::Ready(lib) if lib.is_empty() => lines.push(L::notice("empty", "info", empty_mine, empty_hint)), + Load::Ready(lib) => { + let mut shown: Vec<&Entry> = lib + .iter() + .filter(|e| match self.show { + "saved" => e.saved, + "watched" => e.watched, + "unwatched" => !e.watched, + _ => true, + }) + .collect(); + match self.lib_sort { + "title" => shown.sort_by(|a, b| a.title.title.to_lowercase().cmp(&b.title.title.to_lowercase())), + "year" => shown.sort_by_key(|e| std::cmp::Reverse(e.title.year.unwrap_or(0))), + "oldest" => shown.sort_by_key(|e| if e.last.is_some() { ts(&e.last) } else { i64::MAX }), + _ => shown.sort_by_key(|e| std::cmp::Reverse(ts(&e.added).max(ts(&e.last)))), + } + if shown.is_empty() { + lines.push(L::notice("empty", "info", "Ehhez a szűréshez nincs cím", "Válts a „Minden” nézetre.")); + } else { + let items: Vec = shown.iter().map(|e| e.title.clone()).collect(); + lines.extend(grid_lines("lib", "", "poster", self.cards(cx, &items), GRID)); + } + } + other => lines.extend(other.status("status")), + } + } + Tab::All => { + let sorts = [("popularity", "Népszerű"), ("rating", "Legjobbra értékelt"), ("new", "Legújabb")]; + let mut chips: Vec = sorts.iter().map(|(id, l)| Ch::new(format!("sort:{id}"), *l).active(self.f.sort == *id)).collect(); + let custom = self.f.custom(); + chips.push(Ch::new("filters", if custom > 0 { format!("Szűrők ({custom})") } else { "Szűrők".into() }).icon("settings").active(self.open || custom > 0)); + if self.f.filtered() { + chips.push(Ch::new("reset", "Törlés").icon("close")); + } + lines.push(L::chips("cat-sort", "", chips)); + if self.open { + let year = |v: Option, empty: &str| v.map(|y| y.to_string()).unwrap_or_else(|| empty.to_string()); + let mut yc = vec![ + Ch::new("yf", format!("Ettől: {}", year(self.f.yf, "kezdettől"))).active(self.f.yf.is_some()), + Ch::new("yt", format!("Eddig: {}", year(self.f.yt, "máig"))).active(self.f.yt.is_some()), + ]; + yc.extend(DECADES.iter().enumerate().map(|(i, (l, a, b))| Ch::new(format!("dec:{i}"), *l).active(self.f.yf == *a && self.f.yt == *b))); + lines.push(L::chips("cat-year", "MEGJELENÉS", yc)); + let r = |v: Option, suffix: &str, empty: &str| v.map(|v| format!("{}{suffix}", format!("{v:.1}").replace('.', ","))).unwrap_or_else(|| empty.to_string()); + let mut rc = vec![ + Ch::new("rf", format!("★ {}", r(self.f.rf, "-tól", "Bármennyi"))).active(self.f.rf.is_some()), + Ch::new("rt", r(self.f.rt, "-ig", "10-ig")).active(self.f.rt.is_some()), + ]; + rc.extend([6.0, 7.0, 8.0].iter().map(|v| Ch::new(format!("rp:{v}"), format!("{v}+")).active(self.f.rf == Some(*v) && self.f.rt.is_none()))); + lines.push(L::chips("cat-rating", "IMDB", rc)); + } + let mut gc = vec![Ch::new("g:", "Minden műfaj").active(self.f.genre.is_none())]; + if let Some(gs) = self.genres.ready() { + gc.extend(gs.iter().map(|g| Ch::new(format!("g:{}", g.id), g.name.clone()).active(self.f.genre.as_deref() == Some(g.id.as_str())))); + } + lines.push(L::chips("cat-genre", "MŰFAJ", gc)); + if self.cat.items.is_empty() { + if let Some(e) = &self.cat.error { + lines.push(L::notice("cat-error", "bad", "Nem sikerült betölteni", e.clone())); + lines.push(L::chips("cat-retry", "", vec![Ch::new("retry", "Újrapróbálom").icon("refresh")])); + } else if self.cat.loading || self.cat.has_more { + lines.push(L::text("cat-loading", "Betöltés…", "caption")); + } else { + lines.push(L::notice("cat-empty", "info", "Ehhez a szűréshez nincs találat", "Tágítsd az év- vagy az értékelés-tartományt, vagy válassz másik műfajt.")); + if self.f.filtered() { + lines.push(L::chips("cat-reset", "", vec![Ch::new("reset", "Szűrők törlése").icon("close")])); + } + } + } else { + lines.extend(grid_lines("cat", "", "poster", self.cards(cx, &self.cat.items.clone()), GRID)); + if self.cat.error.is_some() { + lines.push(L::chips("cat-retry", "", vec![Ch::new("retry", "Újrapróbálom").icon("refresh")])); + } else if self.paused() && self.cat.has_more && !self.cat.loading { + lines.push(L::text("cat-deep", "Szűk szűrés: a katalógus mélyén már ritka a találat.", "caption")); + lines.push(L::chips("cat-more", "", vec![Ch::new("more", "Keresés tovább")])); + } else if self.cat.loading { + lines.push(L::text("cat-loading", "Betöltés…", "caption")); + } else if !self.cat.has_more { + lines.push(L::text("cat-end", format!("A lista végére értél · {} cím", self.cat.items.len()), "caption")); + } + } + } + } + Spec { lines, frame: Frame { nav: Some(if self.kind == MediaType::Movie { 1 } else { 2 }), ..Frame::default() } } + } + + fn activate(&mut self, cx: &Cx, line: &str, item: &str) { + match (line, item) { + ("tabs", t) | ("browse-all", t) => { + self.tab = match t { + "mine" => Tab::Mine, + "all" => Tab::All, + _ => Tab::Recommended, + }; + if self.tab == Tab::All && self.cat.pages.is_empty() && !self.cat.loading { + self.reload_catalog(cx); + } + if line == "browse-all" { + cx.focus_on("tabs", 2); + } + } + ("show", v) => { + self.show = match v { + "saved" => "saved", + "watched" => "watched", + "unwatched" => "unwatched", + _ => "all", + } + } + ("sort", v) => { + self.lib_sort = match v { + "oldest" => "oldest", + "title" => "title", + "year" => "year", + _ => "recent", + } + } + ("cat-sort", "filters") => self.open = !self.open, + ("cat-sort", "reset") | ("cat-reset", _) => { + self.f = Filters { sort: self.f.sort, genre: None, yf: None, yt: None, rf: None, rt: None }; + self.reload_catalog(cx); + } + ("cat-sort", s) => { + self.f.sort = match s.trim_start_matches("sort:") { + "rating" => "rating", + "new" => "new", + _ => "popularity", + }; + self.reload_catalog(cx); + } + ("cat-year", "yf") => self.pick_year(cx, "yf"), + ("cat-year", "yt") => self.pick_year(cx, "yt"), + ("cat-year", d) => { + if let Some((_, a, b)) = d.strip_prefix("dec:").and_then(|i| i.parse::().ok()).and_then(|i| DECADES.get(i)) { + let on = self.f.yf == *a && self.f.yt == *b; + (self.f.yf, self.f.yt) = if on { (None, None) } else { (*a, *b) }; + self.reload_catalog(cx); + } + } + ("cat-rating", "rf") => self.pick_rating(cx, "rf"), + ("cat-rating", "rt") => self.pick_rating(cx, "rt"), + ("cat-rating", p) => { + if let Some(v) = p.strip_prefix("rp:").and_then(|v| v.parse::().ok()) { + let on = self.f.rf == Some(v) && self.f.rt.is_none(); + (self.f.rf, self.f.rt) = if on { (None, None) } else { (Some(v), None) }; + self.reload_catalog(cx); + } + } + ("cat-genre", g) => { + let g = g.trim_start_matches("g:"); + self.f.genre = if g.is_empty() || self.f.genre.as_deref() == Some(g) { None } else { Some(g.to_string()) }; + self.reload_catalog(cx); + } + ("cat-retry", _) => { + self.cat.error = None; + self.next_page(cx); + } + ("cat-more", _) => { + self.cat.resume_from = self.cat.pages.len(); + self.next_page(cx); + } + (_, key) => { + let found = self.find(key); + screens::open_card(cx, key, |_| found.clone()); + } + } + } + + fn focus(&mut self, cx: &Cx, _line: &str, item: &str) { + match self.find(item) { + Some(t) => { + let url = cx.api().image(t.backdrop.as_deref(), false); + cx.backdrop(&url, Look::Soft, item); + } + None => cx.backdrop("", Look::Soft, ""), + } + } + + fn more(&mut self, cx: &Cx, list: &str) { + if list == "cat" { + self.next_page(cx); + } + } + + fn shown(&mut self, cx: &Cx) { + // Progress and lists may have changed on a details page. + let (api, kind) = (cx.api(), self.kind); + cx.spawn::( + move || (api.continue_watching().unwrap_or_default(), api.my_list(), api.history().unwrap_or_default(), api.list_status().unwrap_or_default()), + move |s, _cx, (cont, mine, history, states)| { + s.continuing = cont.into_iter().filter(|c| c.title.kind == kind).collect(); + if let Ok(mine) = mine { + s.library = Load::Ready(library(kind, mine, history)); + } + s.states = states; + }, + ); + } + + fn as_any(&mut self) -> &mut dyn Any { + self + } +} diff --git a/src/task.rs b/src/task.rs new file mode 100644 index 0000000..5528c47 --- /dev/null +++ b/src/task.rs @@ -0,0 +1,49 @@ +//! Blocking work (HTTP calls) on a thread, its result back on the UI thread. +//! +//! `done` runs on the Slint event loop, so it may touch the UI and `Rc` +//! state; it is kept in a thread-local table while the work runs. + +use std::cell::RefCell; +use std::collections::HashMap; +use std::sync::atomic::{AtomicU64, Ordering}; + +type Done = Box)>; + +thread_local! { + static WAITING: RefCell> = RefCell::new(HashMap::new()); +} + +static NEXT: AtomicU64 = AtomicU64::new(1); + +/// Runs `work` on a new thread; `done(result)` runs on the UI thread. Call it +/// from the UI thread. +pub fn spawn(work: impl FnOnce() -> T + Send + 'static, done: impl FnOnce(T) + 'static) { + let id = NEXT.fetch_add(1, Ordering::Relaxed); + WAITING.with(|w| { + w.borrow_mut().insert( + id, + Box::new(move |any: Box| { + if let Ok(v) = any.downcast::() { + done(*v); + } + }), + ) + }); + std::thread::spawn(move || { + let result: Box = Box::new(work()); + let _ = slint::invoke_from_event_loop(move || { + if let Some(done) = WAITING.with(|w| w.borrow_mut().remove(&id)) { + done(result); + } + }); + }); +} + +/// Fire and forget (saving progress...): errors are only logged. +pub fn background(what: &'static str, work: impl FnOnce() -> anyhow::Result<()> + Send + 'static) { + std::thread::spawn(move || { + if let Err(e) = work() { + log::warn!("{what}: {e:#}"); + } + }); +} diff --git a/tools/mock_server.py b/tools/mock_server.py new file mode 100644 index 0000000..103a7d7 --- /dev/null +++ b/tools/mock_server.py @@ -0,0 +1,320 @@ +#!/usr/bin/env python3 +"""A stand-in Netflex server for developing the TV app without one. + +Real catalog data (Cinemeta, artwork through /api/img) on the same API the +app uses; sign-in with any user name and the password "netflex"; playback +streams a local video file with range requests. + + python3 tools/mock_server.py [--port 7880] [--video test.mkv] + NETFLEX_SERVER=http://localhost:7880 cargo run + +Standard library only. Not a real server: no torrents, no nCore. +""" + +import argparse +import json +import os +import re +import threading +import urllib.parse +import urllib.request +from http.server import BaseHTTPRequestHandler, ThreadingHTTPServer + +CATALOGS = "https://cinemeta-catalogs.strem.io/top/catalog" +CINEMETA = "https://v3-cinemeta.strem.io" +TOKEN = "dev-token" +GENRES = ["Action", "Comedy", "Drama", "Thriller", "Sci-Fi", "Animation", "Crime", "Horror", "Romance", "Documentary"] +GENRE_HU = {"Action": "Akció", "Comedy": "Vígjáték", "Drama": "Dráma", "Thriller": "Thriller", "Sci-Fi": "Sci-fi", + "Animation": "Animáció", "Crime": "Krimi", "Horror": "Horror", "Romance": "Romantikus", "Documentary": "Dokumentum"} + +cache = {} +cache_lock = threading.Lock() +my_list = {} +progress = {} +VIDEO = None + + +def fetch(url, binary=False): + with cache_lock: + if url in cache: + return cache[url] + req = urllib.request.Request(url, headers={"User-Agent": "netflex-mock"}) + with urllib.request.urlopen(req, timeout=20) as r: + data = r.read() + value = data if binary else json.loads(data) + with cache_lock: + cache[url] = value + return value + + +def ctype(t): + return "series" if t == "tv" else "movie" + + +def summary(t, m): + year_label = m.get("releaseInfo") or m.get("year") + year = None + try: + year = int(str(year_label or m.get("released") or "")[:4]) + except ValueError: + pass + try: + rating = float(m.get("imdbRating") or 0) or None + except ValueError: + rating = None + return { + "type": "tv" if m.get("type") == "series" else ("movie" if m.get("type") == "movie" else t), + "id": m.get("imdb_id") or m.get("id"), + "tmdbId": None, + "title": m.get("name") or "Névtelen", + "originalTitle": None, + "overview": m.get("description"), + "poster": m.get("poster"), + "backdrop": m.get("background"), + "logo": m.get("logo"), + "year": year, + "yearLabel": str(year_label).replace("-", "–") if year_label else None, + "rating": rating, + "genres": m.get("genres") or m.get("genre") or [], + } + + +def catalog(t, genre=None, skip=0): + path = f"{CATALOGS}/{ctype(t)}/top" + extra = [] + if genre: + extra.append("genre=" + urllib.parse.quote(genre)) + if skip: + extra.append(f"skip={skip}") + url = path + ("/" + "&".join(extra) if extra else "") + ".json" + metas = fetch(url).get("metas", []) + return [summary(t, m) for m in metas] + + +def episodes(m): + out = [] + for v in m.get("videos") or []: + try: + s, e = int(v.get("season")), int(v.get("episode") or v.get("number")) + except (TypeError, ValueError): + continue + out.append({"season": s, "episode": e, "name": v.get("name") or v.get("title"), + "overview": v.get("overview") or v.get("description"), + "airDate": (v.get("released") or v.get("firstAired") or "")[:10] or None, + "runtime": None, "still": v.get("thumbnail"), "rating": None}) + return sorted(out, key=lambda x: (x["season"], x["episode"])) + + +def detail(t, id_): + m = fetch(f"{CINEMETA}/meta/{ctype(t)}/{id_}.json").get("meta") or {} + eps = episodes(m) + seasons = sorted({e["season"] for e in eps if e["season"] > 0}) + d = summary(t, m) + try: + runtime = int(re.sub(r"\D", "", str(m.get("runtime") or "")) or 0) or None + except ValueError: + runtime = None + d.update({ + "runtime": runtime, "tagline": None, "status": m.get("status"), + "cast": (m.get("cast") or [])[:15], "directors": m.get("director") or [], "trailerKey": None, + "seasons": [{"number": n, "name": f"{n}. évad", "episodeCount": sum(1 for e in eps if e["season"] == n), + "airedCount": sum(1 for e in eps if e["season"] == n), "airDate": None, "poster": None} for n in seasons], + "numberOfSeasons": len(seasons) if t == "tv" else None, + "lastEpisodeToAir": None, "nextEpisodeToAir": None, "huSource": None, + }) + return d, eps + + +class Handler(BaseHTTPRequestHandler): + server_version = "netflex-mock" + + def log_message(self, fmt, *args): + print("mock:", self.command, self.path.split("?")[0], fmt % args if "%" in fmt else "") + + def authed(self, q): + auth = self.headers.get("Authorization", "") + return auth == f"Bearer {TOKEN}" or q.get("token", [""])[0] == TOKEN + + def send_json(self, value, status=200): + body = json.dumps(value).encode() + self.send_response(status) + self.send_header("Content-Type", "application/json") + self.send_header("Content-Length", str(len(body))) + self.end_headers() + self.wfile.write(body) + + def body(self): + n = int(self.headers.get("Content-Length") or 0) + return json.loads(self.rfile.read(n) or b"{}") if n else {} + + def do_GET(self): + self.route("GET") + + def do_POST(self): + self.route("POST") + + def do_PUT(self): + self.route("PUT") + + def do_DELETE(self): + self.route("DELETE") + + def do_HEAD(self): + self.route("HEAD") + + def route(self, method): + url = urllib.parse.urlparse(self.path) + q = urllib.parse.parse_qs(url.query) + p = url.path + try: + if p == "/api/auth/status": + return self.send_json({"setupRequired": False, "user": {"id": 1, "username": "dev", "name": "Dev", "isAdmin": True} if self.authed(q) else None}) + if p == "/api/auth/login" and method == "POST": + b = self.body() + if b.get("password") != "netflex": + return self.send_json({"error": "Hibás felhasználónév vagy jelszó"}, 401) + return self.send_json({"token": TOKEN, "user": {"id": 1, "username": b.get("username", "dev"), "name": "Dev", "isAdmin": True}}) + if not self.authed(q): + return self.send_json({"error": "Bejelentkezés szükséges", "code": "unauthenticated"}, 401) + if p == "/api/img": + return self.image(q.get("u", [""])[0]) + if p.startswith("/api/stream/"): + return self.stream(method) + if p == "/api/settings": + return self.send_json({"subtitleLang": "hu", "autoNext": True}) + if p == "/api/home": + movies, series = catalog("movie")[:20], catalog("tv")[:20] + cont = [{"title": series[0], "season": 1, "episode": 2, "position": 900, "duration": 2700, "updatedAt": ""}, + {"title": movies[3], "season": None, "episode": None, "position": 3100, "duration": 7200, "updatedAt": ""}] + return self.send_json({"rows": [{"id": "popular-movie", "title": "Népszerű filmek", "items": movies}, + {"id": "popular-tv", "title": "Népszerű sorozatok", "items": series}, + {"id": "featured-movie", "title": "Kiemelt filmek", "items": catalog("movie", skip=20)[:20]}], + "continueWatching": cont}) + if p == "/api/genres": + return self.send_json([{"id": g, "name": GENRE_HU[g]} for g in GENRES]) + if p == "/api/browse": + t = q.get("type", ["movie"])[0] + page = int(q.get("page", ["1"])[0]) + items = catalog(t, q.get("genre", [None])[0], skip=(page - 1) * 50) + return self.send_json({"page": page, "hasMore": len(items) >= 50, "items": items}) + if p == "/api/search": + term = urllib.parse.quote(q.get("q", [""])[0]) + items = [] + for t in ("movie", "tv"): + metas = fetch(f"{CINEMETA}/catalog/{ctype(t)}/top/search={term}.json").get("metas", []) + items += [summary(t, m) for m in metas[:16]] + return self.send_json({"page": 1, "hasMore": False, "items": items}) + m = re.fullmatch(r"/api/title/(movie|tv)/([^/]+)", p) + if m: + return self.send_json(detail(m[1], m[2])[0]) + m = re.fullmatch(r"/api/title/tv/([^/]+)/season/(\d+)", p) + if m: + eps = [e for e in detail("tv", m[1])[1] if e["season"] == int(m[2])] + return self.send_json({"number": int(m[2]), "name": f"{m[2]}. évad", "episodes": eps}) + m = re.fullmatch(r"/api/progress/(movie|tv)/([^/]+)", p) + if m: + return self.send_json(progress.get(f"{m[1]}:{m[2]}", [])) + if p == "/api/progress" and method == "PUT": + b = self.body() + key = f"{b['type']}:{b['titleId']}" + rows = [r for r in progress.get(key, []) if not (r["season"] == b.get("season", 0) and r["episode"] == b.get("episode", 0))] + dur = b.get("duration") + rows.append({"season": b.get("season", 0), "episode": b.get("episode", 0), "position": b["position"], "duration": dur, + "completed": bool(dur and b["position"] / dur >= 0.92), "infoHash": None, "fileIndex": None}) + progress[key] = rows + return self.send_json({"ok": True}) + if p == "/api/lists/status": + return self.send_json({k: {"listed": True, "watchedEpisodes": 0, "watched": False} for k in my_list}) + if p == "/api/lists/mine": + return self.send_json([{"title": v, "addedAt": None, "lastWatchedAt": None, "watchedEpisodes": 0} for v in my_list.values()]) + m = re.fullmatch(r"/api/lists/mine/(movie|tv)/([^/]+)", p) + if m: + if method == "PUT": + my_list[f"{m[1]}:{m[2]}"] = summary(m[1], fetch(f"{CINEMETA}/meta/{ctype(m[1])}/{m[2]}.json").get("meta") or {}) + else: + my_list.pop(f"{m[1]}:{m[2]}", None) + return self.send_json({"ok": True}) + if p.startswith("/api/sources/"): + return self.send_json({"imdbId": None, "searchedBy": "imdb", "candidates": [ + {"torrent": {"id": 1, "name": "Mock.Release.2024.1080p.WEB-DL.HUN.ENG", "category": "hd_hun", "size": 4.2e9, "seeders": 42, + "leechers": 1, "uploadedAt": None, "imdbId": None, "imdbRating": None, "freeleech": False}, + "parsed": {}, "score": 1, "reasons": [], "pack": False, "local": "seeding"}]}) + if p == "/api/play/start": + return self.send_json({"infoHash": "0" * 40, "fileIndex": 0, "fileName": os.path.basename(VIDEO or "none.mkv"), "size": 1}) + m = re.fullmatch(r"/api/media/[0-9a-f]{40}/\d+/probe", p) + if m: + if not VIDEO: + return self.send_json({"error": "A mock szervernek nincs videója (--video)"}, 422) + return self.send_json({"durationSec": None, "tracks": [], "audioLangs": [], "subtitleLangs": [], "englishDub": False, + "hungarianDub": False, "attachments": [], "fileName": os.path.basename(VIDEO), + "fileSize": os.path.getsize(VIDEO), "local": True, "audioDelayMs": 0}) + if re.fullmatch(r"/api/media/[0-9a-f]{40}/\d+/audio-delay", p): + return self.send_json({"audioDelayMs": self.body().get("ms", 0)}) + if p.startswith("/api/torrent/"): + return self.send_json({"ready": True, "fileProgress": 1, "downloadSpeed": 0}) + return self.send_json({"error": "Nem található"}, 404) + except Exception as e: # noqa: BLE001 - a dev tool: report everything + print("mock: error", p, e) + return self.send_json({"error": f"mock: {e}"}, 502) + + def image(self, u): + if not u.startswith("https://"): + return self.send_json({"error": "bad url"}, 400) + data = fetch(u, binary=True) + self.send_response(200) + self.send_header("Content-Type", "image/jpeg" if data[:2] == b"\xff\xd8" else "image/png") + self.send_header("Content-Length", str(len(data))) + self.send_header("Cache-Control", "public, max-age=31536000") + self.end_headers() + self.wfile.write(data) + + def stream(self, method): + if not VIDEO: + return self.send_json({"error": "no video"}, 404) + size = os.path.getsize(VIDEO) + start, end = 0, size - 1 + rng = re.match(r"bytes=(\d*)-(\d*)", self.headers.get("Range", "")) + if rng: + if rng[1] == "" and rng[2]: + start = max(0, size - int(rng[2])) + else: + start = int(rng[1] or 0) + if rng[2]: + end = min(int(rng[2]), size - 1) + self.send_response(206) + self.send_header("Content-Range", f"bytes {start}-{end}/{size}") + else: + self.send_response(200) + self.send_header("Accept-Ranges", "bytes") + self.send_header("Content-Type", "video/x-matroska") + self.send_header("Content-Length", str(end - start + 1)) + self.end_headers() + if method == "HEAD": + return + with open(VIDEO, "rb") as f: + f.seek(start) + left = end - start + 1 + try: + while left > 0: + chunk = f.read(min(1 << 16, left)) + if not chunk: + break + self.wfile.write(chunk) + left -= len(chunk) + except (BrokenPipeError, ConnectionResetError): + pass + + +def main(): + global VIDEO + ap = argparse.ArgumentParser(description=__doc__, formatter_class=argparse.RawDescriptionHelpFormatter) + ap.add_argument("--port", type=int, default=7880) + ap.add_argument("--video", help="a local video file to stream for every title") + args = ap.parse_args() + VIDEO = args.video + print(f"mock Netflex on http://localhost:{args.port} (password: netflex)") + ThreadingHTTPServer(("0.0.0.0", args.port), Handler).serve_forever() + + +if __name__ == "__main__": + main() diff --git a/ui/app.slint b/ui/app.slint new file mode 100644 index 0000000..b651621 --- /dev/null +++ b/ui/app.slint @@ -0,0 +1,204 @@ +// Netflex for Fennec OS: the root window. +// +// Screens: "message" (start-up, errors), "page" (every browsing screen: a +// LinePage built by src/page.rs), "player". Over them: the text input +// (sign-in and every text field), the picker, the toast. +// +// Rust owns state and focus: every key goes to the `key` callback, except +// while a keyboard has the focus (the input overlay, the search keyboard). + +import { TvWindow, Tv, SfText, GlassRect, MenuItem } from "@sf-ui/sf-ui.slint"; +import { Line, Chip, Card, Check } from "types.slint"; +import { LinePage } from "page.slint"; +import { PlayerScreen } from "player.slint"; +import { SignInScreen, MessageScreen } from "signin.slint"; +import { SelectOverlay, Toast } from "overlays.slint"; + +export { Tv, SfText, MenuItem, Line, Chip, Card, Check } + +export component App inherits TvWindow { + title: "Netflex"; + forward-focus: keys; + + // "message", "page", "player" + in property screen: "message"; + // The key text (Slint's Key codes) and whether it repeats; true = handled. + callback key(string, bool) -> bool; + + out property message-t: self.screen == "message" && !self.input-open ? 1 : 0; + animate message-t { duration: 420ms; easing: cubic-bezier(0.22, 1, 0.36, 1); } + out property page-t: self.screen == "page" ? 1 : 0; + animate page-t { duration: 420ms; easing: cubic-bezier(0.22, 1, 0.36, 1); } + out property player-t: self.screen == "player" ? 1 : 0; + animate player-t { duration: 420ms; easing: cubic-bezier(0.22, 1, 0.36, 1); } + out property input-t: self.input-open ? 1 : 0; + animate input-t { duration: 420ms; easing: cubic-bezier(0.22, 1, 0.36, 1); } + out property select-t: self.select-open ? 1 : 0; + animate select-t { duration: 300ms; easing: cubic-bezier(0.3, 1.18, 0.4, 1); } + // Whatever an overlay would cover goes away first. + property under: max(0, 1 - 1.6 * max(self.input-t, self.select-t)); + // The outgoing screen goes first, the incoming one follows. + function vis(t: float) -> float { + clamp(t * 2 - 1, 0, 1) + } + + keys := FocusScope { + key-pressed(event) => { + if root.input-open { + return input.key(event); + } + if root.screen == "page" && root.page-kb-focused && !root.select-open { + return page.kb-key(event); + } + if root.key(event.text, event.repeat) { + return accept; + } + reject + } + } + + // ---- message ---- + in property message-busy <=> message.busy; + in property message-title <=> message.title; + in property message-text <=> message.text; + in property message-action-a <=> message.action-a; + in property message-action-b <=> message.action-b; + in property message-action <=> message.action; + message := MessageScreen { + alpha: root.vis(root.message-t); + visible: self.alpha > 0.001; + } + + // ---- page ---- + in property <[Line]> page-lines <=> page.lines; + in property page-focus <=> page.focus-line; + in property page-scroll <=> page.scroll; + in property page-show-nav <=> page.show-nav; + in property <[string]> page-nav-items <=> page.nav-items; + in property page-nav-index <=> page.nav-index; + in property page-nav-focused <=> page.nav-focused; + in property page-vpn-label <=> page.vpn-label; + in property page-vpn-ok <=> page.vpn-ok; + in property page-side-title <=> page.side-title; + in property <[string]> page-side-items <=> page.side-items; + in property page-side-index <=> page.side-index; + in property page-side-focus <=> page.side-focus; + in property page-kb-y <=> page.kb-y; + in property page-kb-focused <=> page.kb-focused; + in property page-kb-placeholder <=> page.kb-placeholder; + in-out property page-query <=> page.query; + callback search-submitted(string); + callback search-changed(string); + changed page-query => { + root.search-changed(self.page-query); + } + callback search-exit-down(); + callback search-exit-up(); + callback search-cancelled(); + public function page-kb-reset() { + page.kb-reset(); + } + page := LinePage { + alpha: root.vis(root.page-t) * root.under; + visible: root.page-t > 0.001; + search-submitted(t) => { root.search-submitted(t); } + search-exit-down => { root.search-exit-down(); } + search-exit-up => { root.search-exit-up(); } + search-cancelled => { root.search-cancelled(); } + } + + // ---- player ---- + in property player-stage <=> player.stage; + in property player-title <=> player.title; + in property player-heading <=> player.heading; + in property player-info <=> player.info; + in property player-stage-text <=> player.stage-text; + in property player-detail-text <=> player.detail-text; + in property player-error-text <=> player.error-text; + in property player-osd <=> player.osd; + in property player-paused <=> player.paused; + in property player-buffering <=> player.buffering; + in property player-buffer-text <=> player.buffer-text; + in property player-progress <=> player.progress; + in property player-buffered <=> player.buffered; + in property player-time-text <=> player.time-text; + in property player-remaining-text <=> player.remaining-text; + in property player-downloaded-text <=> player.downloaded-text; + in property player-seeking <=> player.seeking; + in property player-seek-text <=> player.seek-text; + in property player-seek-delta <=> player.seek-delta; + in property player-seek-back <=> player.seek-back; + in property player-osd-area <=> player.osd-area; + in property player-osd-button <=> player.osd-button; + in property player-has-prev <=> player.has-prev; + in property player-has-next <=> player.has-next; + in property player-panel <=> player.panel; + in property <[MenuItem]> player-audio <=> player.audio; + in property <[MenuItem]> player-subs <=> player.subs; + in property <[MenuItem]> player-sync <=> player.sync; + in property <[MenuItem]> player-quality <=> player.quality; + in property player-audio-focus <=> player.audio-focus; + in property player-subs-focus <=> player.subs-focus; + in property player-sync-focus <=> player.sync-focus; + in property player-quality-focus <=> player.quality-focus; + in property player-skip-label <=> player.skip-label; + in property player-next-label <=> player.next-label; + in property player-next-text <=> player.next-text; + player := PlayerScreen { + alpha: root.vis(root.player-t); + visible: self.alpha > 0.001; + } + + // ---- text input (sign-in, every text field) ---- + in property input-open; + in property input-title <=> input.title; + in property input-subtitle <=> input.subtitle; + in property input-placeholder <=> input.placeholder; + in property input-secret <=> input.secret; + in property input-submit-label <=> input.submit-label; + in property input-min-length <=> input.min-length; + in property input-footer <=> input.footer; + in property input-busy <=> input.busy; + in-out property input-text <=> input.text; + in-out property input-error <=> input.error; + callback input-submitted(string); + callback input-cancelled(); + public function input-reset() { + input.reset(); + } + input := SignInScreen { + alpha: root.vis(root.input-t); + visible: root.input-t > 0.001; + submitted(t) => { root.input-submitted(t); } + cancelled => { root.input-cancelled(); } + } + + // ---- picker ---- + in property select-open; + in property select-title <=> select.title; + in property <[MenuItem]> select-items <=> select.items; + in property select-focus <=> select.focus-index; + select := SelectOverlay { + alpha: root.select-t; + visible: root.select-t > 0.001; + } + + // ---- toast ---- + in property toast-text <=> toast.text; + in property toast-bad <=> toast.bad; + toast := Toast { } + + // ---- glass, in drawing order (listed by src/main.rs) ---- + out property <[GlassRect]> glass-message: message.glass; + out property <[GlassRect]> glass-page: page.glass; + out property <[GlassRect]> glass-page-keyboard: page.glass-keyboard; + out property <[GlassRect]> glass-player: player.glass; + out property <[GlassRect]> glass-player-audio: player.glass-audio; + out property <[GlassRect]> glass-player-subs: player.glass-subs; + out property <[GlassRect]> glass-player-sync: player.glass-sync; + out property <[GlassRect]> glass-player-quality: player.glass-quality; + out property <[GlassRect]> glass-input: input.glass; + out property <[GlassRect]> glass-input-keyboard: input.glass-keyboard; + out property <[GlassRect]> glass-select: select.glass; + out property <[GlassRect]> glass-toast: toast.glass; +} diff --git a/ui/overlays.slint b/ui/overlays.slint new file mode 100644 index 0000000..cf90ab5 --- /dev/null +++ b/ui/overlays.slint @@ -0,0 +1,66 @@ +// Overlays over any page: a picker (Select) and a toast. The page under them +// fades out first (Nothing-under-glass): app.slint dims it while one is open. + +import { Tv, GlassRect, GlassPane, GlassMenu, MenuItem, Icon } from "@sf-ui/sf-ui.slint"; + +// A list to choose from, centred. +export component SelectOverlay inherits Rectangle { + in property alpha; + in property title; + in property <[MenuItem]> items; + in property focus-index; + menu := GlassMenu { + x: (root.width - self.width) / 2; + y: (root.height - self.height) / 2; + width: 640 * Tv.u; + title: root.title; + items: root.items; + focused-index: root.focus-index; + alpha: root.alpha; + accent: #e50914; + visible-rows: 9; + } + out property <[GlassRect]> glass: menu.glass; +} + +// A short message at the bottom ("Elmentve", errors). +export component Toast inherits Rectangle { + in property text; + in property bad; + out property t: self.text != "" ? 1 : 0; + animate t { duration: 300ms; easing: cubic-bezier(0.3, 1.18, 0.4, 1); } + pane := GlassPane { + x: (root.width - self.width) / 2; + y: root.height - (64 + 96 * root.t) * Tv.u; + width: min(1400 * Tv.u, label.preferred-width + 140 * Tv.u); + height: 80 * Tv.u; + radius: self.height / 2; + frost: 2.4; + tint: Tv.smoke.with-alpha(0.5); + glow: root.bad ? Tv.danger : #ffffff; + lit: 0.3; + alpha: root.t; + HorizontalLayout { + padding-left: 36 * Tv.u; + padding-right: 36 * Tv.u; + spacing: 14 * Tv.u; + alignment: center; + opacity: root.t; + Icon { + y: (parent.height - self.height) / 2; + name: root.bad ? "warning" : "check"; + size: 30 * Tv.u; + ink: root.bad ? Tv.danger-ink : Tv.ok-ink; + } + label := Text { + vertical-alignment: center; + text: root.text; + font-size: 25 * Tv.u; + font-weight: 600; + color: Tv.text; + overflow: elide; + } + } + } + out property <[GlassRect]> glass: [pane.glass]; +} diff --git a/ui/page.slint b/ui/page.slint new file mode 100644 index 0000000..94e2de7 --- /dev/null +++ b/ui/page.slint @@ -0,0 +1,773 @@ +// The page renderer: every screen except the player and the sign-in is a +// list of Lines built by Rust (src/page.rs), which also owns the focus and +// the scroll position. This file draws them and their glass: +// - the top navigation capsule (main sections) or the settings side list, +// - hero buttons (glass at rest), +// - one focus pill that glides to the focused chip on any other line, +// - the search keyboard's pane. +// Everything else (cards, texts, unfocused chips) is plain Slint over the +// backdrop, so nothing Slint draws sits under glass. + +import { Tv, GlassRect, GlassPane, Keyboard, Icon, Spinner, Display, Headline, Title, SectionTitle, Body, Item, Label, Caption } from "@sf-ui/sf-ui.slint"; +import { Line, Chip, Card, Check } from "types.slint"; + +// A poster, landscape artwork or season card. +component NfCard inherits Rectangle { + in property card; + in property focused; + in property art-h; + in property captions; + out property f: self.focused ? 1 : 0; + animate f { duration: 260ms; easing: cubic-bezier(0.22, 1, 0.36, 1); } + + art := Rectangle { + y: 0; + height: root.art-h; + transform-scale: 1 + 0.08 * root.f; + Rectangle { + border-radius: 20 * Tv.u; + background: #1b1d24; + drop-shadow-blur: (14 + 22 * root.f) * Tv.u; + drop-shadow-offset-y: (8 + 12 * root.f) * Tv.u; + drop-shadow-color: #00000090; + } + Rectangle { + border-radius: 20 * Tv.u; + clip: true; + if root.card.image.width == 0: Text { + x: 20 * Tv.u; + width: parent.width - 40 * Tv.u; + horizontal-alignment: center; + vertical-alignment: center; + text: root.card.big != "" ? "" : root.card.title; + font-size: 24 * Tv.u; + font-weight: 600; + color: Tv.text-tertiary; + wrap: word-wrap; + } + Image { + width: 100%; + height: 100%; + source: root.card.image; + image-fit: cover; + } + if root.card.big != "": Rectangle { + background: #00000070; + Text { + text: root.card.big; + font-size: 68 * Tv.u; + font-weight: 700; + letter-spacing: -2 * Tv.u; + color: Tv.text; + } + } + Rectangle { + background: #000000; + opacity: 0.22 * (1 - root.f); + } + if root.card.progress >= 0: Rectangle { + x: 12 * Tv.u; + y: parent.height - 18 * Tv.u; + width: parent.width - 24 * Tv.u; + height: 6 * Tv.u; + border-radius: self.height / 2; + background: #ffffff40; + Rectangle { + x: 0; + width: parent.width * clamp(root.card.progress, 0, 1); + border-radius: self.height / 2; + background: root.card.progress >= 0.999 ? Tv.ok : #e50914; + } + } + } + if root.card.badge != "": Rectangle { + x: 12 * Tv.u; + y: 12 * Tv.u; + width: badge-text.preferred-width + 22 * Tv.u; + height: 34 * Tv.u; + border-radius: self.height / 2; + background: root.card.badge-tone == "dub" ? #1f7a4dd8 : root.card.badge-tone == "sub" ? #2b5fa8d8 : root.card.badge-tone == "accent" ? #e50914d8 : #000000b8; + badge-text := Text { + text: root.card.badge; + font-size: 19 * Tv.u; + font-weight: 700; + color: Tv.text; + } + } + if root.card.mark == "check": Rectangle { + x: parent.width - self.width - 12 * Tv.u; + y: 12 * Tv.u; + width: 36 * Tv.u; + height: 36 * Tv.u; + border-radius: self.height / 2; + background: #000000b8; + Icon { + name: "check"; + size: 22 * Tv.u; + ink: Tv.ok-ink; + } + } + if root.card.current: Rectangle { + border-radius: 20 * Tv.u; + border-width: 4 * Tv.u; + border-color: #e50914; + } + } + if root.captions: Text { + x: 0; + y: root.art-h + 18 * Tv.u; + width: root.width; + text: root.card.caption; + font-size: 24 * Tv.u; + font-weight: 600; + color: root.focused ? Tv.text : #ffffffd0; + overflow: elide; + } + if root.captions: Text { + x: 0; + y: root.art-h + 52 * Tv.u; + width: root.width; + text: root.card.detail; + font-size: 20 * Tv.u; + color: Tv.text-tertiary; + overflow: elide; + } +} + +// A chip drawn by Slint. Focused chips get the page's glass pill underneath, +// hero chips are glass all the time: neither draws a background then. +component NfChip inherits Rectangle { + in property chip; + in property focused; + in property on-glass; + property plain: root.focused || root.on-glass; + property ink: root.focused && root.chip.tone != "primary" ? Tv.ink + : root.chip.tone == "include" ? Tv.ok-ink + : root.chip.tone == "exclude" || root.chip.tone == "danger" ? Tv.danger-ink + : root.chip.active || root.on-glass || root.chip.tone == "primary" ? Tv.text + : #ffffffd0; + x: root.chip.x * Tv.u; + y: root.chip.y * Tv.u; + width: root.chip.w * Tv.u; + height: root.chip.h * Tv.u; + opacity: root.chip.enabled ? 1 : 0.42; + Rectangle { + visible: !root.plain; + border-radius: root.chip.tone == "field" ? 22 * Tv.u : self.height / 2; + background: root.chip.tone == "field" ? #ffffff10 + : root.chip.tone == "primary" ? #e5091480 + : root.chip.tone == "include" ? #34c75938 + : root.chip.tone == "exclude" ? #ff453a38 + : root.chip.active ? #ffffff2c + : #ffffff12; + border-width: root.chip.tone == "field" ? 1.5 * Tv.u : 0; + border-color: #ffffff38; + } + HorizontalLayout { + padding-left: root.chip.tone == "field" ? 28 * Tv.u : root.chip.text == "" ? (root.height - 30 * Tv.u) / 2 : (root.chip.icon == "" ? 26 : 20) * Tv.u; + padding-right: root.chip.tone == "field" ? 28 * Tv.u : root.chip.text == "" ? (root.height - 30 * Tv.u) / 2 : 26 * Tv.u; + spacing: 10 * Tv.u; + alignment: root.chip.tone == "field" ? start : center; + if root.chip.icon != "": Icon { + y: (parent.height - self.height) / 2; + name: root.chip.icon; + size: 28 * Tv.u; + ink: root.ink; + } + if root.chip.text != "": Text { + vertical-alignment: center; + horizontal-stretch: root.chip.tone == "field" ? 1 : 0; + text: root.chip.text; + font-size: (root.chip.tone == "field" ? 26 : 23) * Tv.u; + font-weight: root.chip.active || root.focused || root.chip.tone == "primary" ? 700 : 600; + color: root.ink; + overflow: elide; + } + } +} + +export component LinePage inherits Rectangle { + in property alpha: 1; + in property <[Line]> lines; + in property focus-line: -1; + // Vertical scroll position (design px), animated here. + in property scroll; + // Top navigation (main sections). + in property show-nav; + in property <[string]> nav-items; + in property nav-index; + in property nav-focused; + in property vpn-label; + in property vpn-ok; + // Settings side list. + in property side-title; + in property <[string]> side-items; + in property side-index; + in property side-focus: -1; + // Embedded search keyboard: its top (design px, page coordinates; < 0 = none). + in property kb-y: -1; + in property kb-focused; + in property kb-placeholder; + in property kb-submit-label: "Keresés"; + in-out property query; + callback search-submitted(string); + callback search-exit-down(); + callback search-exit-up(); + callback search-cancelled(); + public function kb-key(event: KeyEvent) -> EventResult { + kb.key(event) + } + public function kb-reset() { + kb.reset(); + } + + property side: self.side-items.length > 0; + // Content left edge (design px). + property cx: self.side ? 600 : 96; + out property scroll-anim: self.scroll; + animate scroll-anim { duration: 380ms; easing: cubic-bezier(0.22, 1, 0.36, 1); } + property content-focus: !self.nav-focused && self.side-focus < 0 && !self.kb-focused; + + // ---- lines ---- + for line[li] in root.lines: Rectangle { + property ty: line.y - root.scroll-anim; + property lf: li == root.focus-line && root.content-focus; + x: (root.cx + line.x) * Tv.u; + y: self.ty * Tv.u; + width: line.w * Tv.u; + height: line.h * Tv.u; + visible: self.ty + line.h > -40 && self.ty < 1120; + opacity: root.alpha; + + // hero + if line.kind == "hero": Rectangle { + if line.logo.width > 0: Image { + x: 0; + y: 40 * Tv.u; + width: 620 * Tv.u; + height: 190 * Tv.u; + source: line.logo; + image-fit: contain; + horizontal-alignment: left; + vertical-alignment: bottom; + } + if line.logo.width == 0: Display { + x: 0; + y: 90 * Tv.u; + width: 1300 * Tv.u; + text: line.title; + font-size: (line.title.character-count > 24 ? 64 : 88) * Tv.u; + } + if line.style != "": Text { + x: 0; + y: 12 * Tv.u; + text: line.style; + font-size: 20 * Tv.u; + font-weight: 700; + letter-spacing: 3 * Tv.u; + color: Tv.text-secondary; + } + Caption { + x: 0; + y: 242 * Tv.u; + width: 1300 * Tv.u; + text: line.subtitle; + } + Label { + x: 0; + y: 274 * Tv.u; + width: 1500 * Tv.u; + text: line.meta; + color: Tv.text; + } + Label { + x: 0; + y: 312 * Tv.u; + width: 1500 * Tv.u; + text: line.extra; + color: #ff8a8a; + font-weight: 600; + } + Body { + x: 0; + y: (line.extra == "" ? 316 : 352) * Tv.u; + width: 1100 * Tv.u; + height: (line.extra == "" ? 152 : 116) * Tv.u; + text: line.text; + font-size: 26 * Tv.u; + } + for chip[ci] in line.chips: NfChip { + chip: chip; + focused: lf && line.col == ci; + on-glass: true; + } + if line.progress >= 0: Rectangle { + x: 0; + y: (line.h - 22) * Tv.u; + width: 360 * Tv.u; + height: 6 * Tv.u; + border-radius: self.height / 2; + background: #ffffff33; + Rectangle { + x: 0; + width: parent.width * clamp(line.progress, 0, 1); + border-radius: self.height / 2; + background: #e50914; + } + } + if line.note != "": Caption { + x: 380 * Tv.u; + y: (line.h - 34) * Tv.u; + text: line.note; + } + } + + // heading + if line.kind == "heading": Rectangle { + Text { + x: 0; + y: 4 * Tv.u; + text: line.title; + font-size: (line.style == "big" ? 56 : 38) * Tv.u; + font-weight: 700; + letter-spacing: (line.style == "big" ? -1 : -0.4) * Tv.u; + color: Tv.text; + } + Caption { + x: 0; + y: (line.style == "big" ? 76 : 54) * Tv.u; + width: parent.width; + text: line.subtitle; + } + } + + // text + if line.kind == "text": Text { + x: 0; + y: 0; + width: parent.width; + height: parent.height; + text: line.text; + wrap: word-wrap; + vertical-alignment: top; + font-size: (line.style == "caption" ? 22 : line.style == "label" ? 24 : 26) * Tv.u; + font-weight: line.style == "label" ? 600 : 400; + color: line.style == "warn" ? Tv.warn-ink : line.style == "bad" ? Tv.danger-ink : line.style == "good" ? Tv.ok-ink : line.style == "caption" ? Tv.text-tertiary : Tv.text-secondary; + } + + // notice + if line.kind == "notice": Rectangle { + Icon { + x: 0; + y: 4 * Tv.u; + size: 36 * Tv.u; + name: line.icon != "" ? line.icon : line.tone == "good" ? "check" : line.tone == "info" ? "info" : "warning"; + ink: line.tone == "good" ? Tv.ok-ink : line.tone == "bad" ? Tv.danger-ink : line.tone == "warn" ? Tv.warn-ink : Tv.text-secondary; + } + Item { + x: 56 * Tv.u; + y: 4 * Tv.u; + width: parent.width - 56 * Tv.u; + text: line.title; + font-size: 27 * Tv.u; + } + Text { + x: 56 * Tv.u; + y: 44 * Tv.u; + width: parent.width - 56 * Tv.u; + height: parent.height - 44 * Tv.u; + text: line.text; + wrap: word-wrap; + font-size: 23 * Tv.u; + color: Tv.text-secondary; + } + } + + // checks + if line.kind == "checks": Rectangle { + for c[i] in line.checks: Rectangle { + x: mod(i, 2) * parent.width / 2; + y: floor(i / 2) * 84 * Tv.u; + width: parent.width / 2 - 24 * Tv.u; + height: 80 * Tv.u; + Icon { + x: 0; + y: 2 * Tv.u; + size: 28 * Tv.u; + name: c.state == 1 ? "check" : c.state == 0 ? "close" : "info"; + ink: c.state == 1 ? Tv.ok-ink : c.state == 0 ? Tv.danger-ink : Tv.warn-ink; + } + Text { + x: 44 * Tv.u; + y: 0; + width: parent.width - 44 * Tv.u; + text: c.label; + font-size: 23 * Tv.u; + font-weight: 600; + color: Tv.text; + overflow: elide; + } + Text { + x: 44 * Tv.u; + y: 32 * Tv.u; + width: parent.width - 44 * Tv.u; + height: 48 * Tv.u; + text: c.detail; + font-size: 20 * Tv.u; + color: Tv.text-tertiary; + wrap: word-wrap; + overflow: elide; + } + } + } + + // chips + if line.kind == "chips": Rectangle { + if line.title != "": Text { + x: 0; + y: 0; + text: line.title; + font-size: 22 * Tv.u; + font-weight: 600; + letter-spacing: 1 * Tv.u; + color: Tv.text-tertiary; + } + for chip[ci] in line.chips: NfChip { + chip: chip; + focused: lf && line.col == ci; + } + } + + // item + if line.kind == "item": Rectangle { + property pic: line.style == "image"; + property tx: (self.pic ? 288 : 0) * Tv.u; + if self.pic: Rectangle { + x: 0; + y: 8 * Tv.u; + width: 256 * Tv.u; + height: 144 * Tv.u; + border-radius: 16 * Tv.u; + clip: true; + background: #1b1d24; + Image { + width: 100%; + height: 100%; + source: line.image; + image-fit: cover; + } + if line.progress >= 0: Rectangle { + x: 10 * Tv.u; + y: parent.height - 16 * Tv.u; + width: parent.width - 20 * Tv.u; + height: 6 * Tv.u; + border-radius: self.height / 2; + background: #ffffff40; + Rectangle { + x: 0; + width: parent.width * clamp(line.progress, 0, 1); + border-radius: self.height / 2; + background: line.progress >= 0.999 ? Tv.ok : #e50914; + } + } + } + if !self.pic && line.progress >= 0: Rectangle { + x: 0; + y: parent.height - 12 * Tv.u; + width: 900 * Tv.u; + height: 6 * Tv.u; + border-radius: self.height / 2; + background: #ffffff26; + Rectangle { + x: 0; + width: parent.width * clamp(line.progress, 0, 1); + border-radius: self.height / 2; + background: line.tone == "warn" ? Tv.warn : line.tone == "good" ? Tv.ok : #4f8cff; + } + } + Text { + x: parent.tx; + y: 6 * Tv.u; + width: parent.width - parent.tx; + text: line.title; + font-size: 26 * Tv.u; + font-weight: 600; + color: line.tone == "dim" ? Tv.text-tertiary : Tv.text; + overflow: elide; + } + Text { + x: parent.tx; + y: 42 * Tv.u; + width: parent.width - parent.tx; + text: line.meta; + font-size: 21 * Tv.u; + font-weight: 500; + color: line.tone == "bad" ? Tv.danger-ink : line.tone == "warn" ? Tv.warn-ink : Tv.text-tertiary; + overflow: elide; + } + Text { + x: parent.tx; + y: 74 * Tv.u; + width: min(parent.width - parent.tx, 1100 * Tv.u); + height: 58 * Tv.u; + text: line.text; + font-size: 21 * Tv.u; + color: Tv.text-secondary; + wrap: word-wrap; + overflow: elide; + } + for chip[ci] in line.chips: NfChip { + chip: chip; + focused: lf && line.col == ci; + } + } + + // cards + if line.kind == "cards": Rectangle { + property cw: line.style == "landscape" ? 400 : line.style == "season" ? 168 : 196; + property ch: line.style == "landscape" ? 225 : line.style == "season" ? 252 : 294; + property step: self.cw + 32; + property head: line.title != "" ? 56 : 0; + property fit: floor((line.w + 32) / self.step); + property scroll-to: clamp(line.col - 1, 0, max(0, line.cards.length - self.fit)); + property sc: self.scroll-to; + animate sc { duration: 320ms; easing: cubic-bezier(0.22, 1, 0.36, 1); } + if line.title != "": Text { + x: 0; + y: 0; + text: line.title; + font-size: 32 * Tv.u; + font-weight: 600; + color: lf ? Tv.text : #ffffffc8; + } + if line.subtitle != "": Caption { + x: title-w.preferred-width + 20 * Tv.u; + y: 10 * Tv.u; + text: line.subtitle; + } + title-w := Text { + visible: false; + text: line.title; + font-size: 32 * Tv.u; + font-weight: 600; + } + for card[ci] in line.cards: NfCard { + x: (ci - parent.sc) * parent.step * Tv.u; + y: parent.head * Tv.u; + width: parent.cw * Tv.u; + height: (parent.ch + (line.captions ? 80 : 0)) * Tv.u; + art-h: parent.ch * Tv.u; + visible: ci >= parent.sc - 2 && ci < parent.sc + parent.fit + 2; + card: card; + captions: line.captions; + focused: lf && line.col == ci; + } + } + } + + // ---- embedded keyboard (search) ---- + kb-pane := GlassPane { + x: (root.width - self.width) / 2; + y: (root.kb-y - root.scroll-anim) * Tv.u; + width: 1720 * Tv.u; + height: 508 * Tv.u; + radius: 48 * Tv.u; + frost: 3.4; + tint: Tv.smoke.with-alpha(0.44); + alpha: root.kb-y >= 0 ? root.alpha : 0; + visible: root.kb-y >= 0; + kb := Keyboard { + x: 0; + y: 40 * Tv.u; + width: parent.width; + compact: true; + placeholder: root.kb-placeholder; + submit-label: root.kb-submit-label; + min-length: 2; + max-length: 60; + active: root.kb-focused; + alpha: root.kb-y >= 0 ? root.alpha : 0; + text <=> root.query; + submitted(t) => { root.search-submitted(t); } + cancelled => { root.search-cancelled(); } + exit-down => { root.search-exit-down(); } + exit-up => { root.search-exit-up(); } + } + } + + // ---- settings side list ---- + if root.side: Headline { + x: Tv.safe-x; + y: 56 * Tv.u; + text: root.side-title; + opacity: root.alpha; + } + for item[i] in root.side-items: Text { + x: (96 + 28) * Tv.u; + y: (184 + i * 80) * Tv.u; + width: (440 - 56) * Tv.u; + height: 72 * Tv.u; + vertical-alignment: center; + text: item; + font-size: 26 * Tv.u; + font-weight: 600; + color: i == root.side-focus ? Tv.ink : i == root.side-index ? Tv.text : Tv.text-secondary; + opacity: root.alpha; + } + + // ---- top navigation ---- + property tab-w: 176 * Tv.u; + property nav-a: root.show-nav ? root.alpha * (root.nav-focused ? 1 : clamp(1 - root.scroll-anim / 120, 0, 1)) : 0; + nav := GlassPane { + x: (root.width - self.width) / 2; + y: 40 * Tv.u; + width: root.nav-items.length * root.tab-w + 16 * Tv.u; + height: 80 * Tv.u; + radius: self.height / 2; + frost: 1.6; + tint: #ffffff0a; + alpha: root.nav-a; + visible: root.show-nav; + for t[i] in root.nav-items: Text { + x: 8 * Tv.u + i * root.tab-w; + width: root.tab-w; + height: parent.height; + horizontal-alignment: center; + vertical-alignment: center; + text: t; + font-size: 25 * Tv.u; + font-weight: 600; + color: i == root.nav-index ? (root.nav-focused ? Tv.ink : Tv.text) : Tv.text-secondary; + opacity: root.nav-a; + } + } + if root.show-nav && root.vpn-label != "": HorizontalLayout { + x: nav.x + nav.width + 28 * Tv.u; + y: nav.y; + height: nav.height; + spacing: 10 * Tv.u; + opacity: root.nav-a; + Rectangle { + width: 12 * Tv.u; + Rectangle { + y: (parent.height - self.height) / 2; + height: 12 * Tv.u; + border-radius: self.height / 2; + background: root.vpn-ok ? Tv.ok : Tv.danger; + } + } + Text { + vertical-alignment: center; + text: root.vpn-label; + font-size: 22 * Tv.u; + font-weight: 600; + color: root.vpn-ok ? Tv.ok-ink : Tv.danger-ink; + } + } + out property tab-pos: self.nav-index; + animate tab-pos { duration: 260ms; easing: cubic-bezier(0.22, 1, 0.36, 1); } + out property nav-t: self.nav-focused ? 1 : 0; + animate nav-t { duration: 220ms; easing: ease-out; } + out property side-pos: self.side-index; + animate side-pos { duration: 260ms; easing: cubic-bezier(0.22, 1, 0.36, 1); } + out property side-fpos: max(0, self.side-focus); + animate side-fpos { duration: 220ms; easing: cubic-bezier(0.22, 1, 0.36, 1); } + + // ---- glass ---- + property fl: root.focus-line >= 0 && root.focus-line < root.lines.length ? root.lines[root.focus-line] : root.lines[0]; + property fc: root.fl.chips[max(0, root.fl.col)]; + property pill-on: root.content-focus && root.focus-line >= 0 && root.fl.kind != "hero" && root.fl.kind != "cards" && root.fc.w > 0; + out property pill-x: root.cx + root.fl.x + root.fc.x; + animate pill-x { duration: 220ms; easing: cubic-bezier(0.22, 1, 0.36, 1); } + out property pill-w: root.fc.w; + animate pill-w { duration: 220ms; easing: cubic-bezier(0.22, 1, 0.36, 1); } + out property pill-y: root.fl.y + root.fc.y; + animate pill-y { duration: 300ms; easing: cubic-bezier(0.22, 1, 0.36, 1); } + out property pill-a: root.pill-on ? 1 : 0; + animate pill-a { duration: 160ms; easing: ease-out; } + property hero: root.lines.length > 0 && root.lines[0].kind == "hero" ? root.lines[0] : root.fl; + property has-hero: root.lines.length > 0 && root.lines[0].kind == "hero"; + + pure function hero-rect(i: int) -> GlassRect { + let c = root.hero.chips[i]; + let f = root.has-hero && root.focus-line == 0 && root.content-focus && root.hero.col == i ? 1 : 0; + let s = 1 + 0.05 * f; + { + x: (root.cx + root.hero.x + c.x) * Tv.u - c.w * Tv.u * (s - 1) / 2, + y: (root.hero.y + c.y - root.scroll-anim) * Tv.u - c.h * Tv.u * (s - 1) / 2, + w: c.w * Tv.u * s, + h: c.h * Tv.u * s, + r: c.h * Tv.u * s / 2, + focus: f, + alpha: root.has-hero && c.w > 0 && i < root.hero.chips.length ? root.alpha * (c.enabled ? 1 : 0.5) : 0, + blur: 1.4, + glow: c.tone == "primary" ? #e50914 : #ffffff, + tint: c.tone == "primary" ? #e50914.with-alpha(0.42 + 0.4 * f) : #ffffff.with-alpha((c.active ? 0.16 : 0.07) + 0.8 * f), + group: 0, + } + } + + out property <[GlassRect]> glass: [ + nav.glass, + { + x: nav.absolute-position.x + 8 * Tv.u + root.tab-pos * root.tab-w, + y: nav.absolute-position.y + 8 * Tv.u, + w: root.tab-w, + h: nav.height - 16 * Tv.u, + r: (nav.height - 16 * Tv.u) / 2, + focus: root.nav-t, + alpha: root.nav-a, + blur: -1, + glow: #ffffff, + tint: #ffffff.with-alpha(0.12 + 0.76 * root.nav-t), + group: 0, + }, + { + x: 96 * Tv.u, + y: (184 + root.side-pos * 80) * Tv.u, + w: 440 * Tv.u, + h: 72 * Tv.u, + r: 36 * Tv.u, + focus: 0, + alpha: root.side ? root.alpha * (root.side-focus == root.side-index ? 0 : 1) : 0, + blur: 1.2, + glow: #ffffff, + tint: #ffffff14, + group: 0, + }, + { + x: 96 * Tv.u, + y: (184 + root.side-fpos * 80) * Tv.u, + w: 440 * Tv.u, + h: 72 * Tv.u, + r: 36 * Tv.u, + focus: 1, + alpha: root.side && root.side-focus >= 0 ? root.alpha : 0, + blur: 1.2, + glow: #ffffff, + tint: #ffffffe0, + group: 0, + }, + root.hero-rect(0), + root.hero-rect(1), + root.hero-rect(2), + root.hero-rect(3), + root.hero-rect(4), + root.hero-rect(5), + { + x: root.pill-x * Tv.u, + y: (root.pill-y - root.scroll-anim) * Tv.u, + w: root.pill-w * Tv.u, + h: root.fc.h * Tv.u, + r: root.fc.tone == "field" ? 22 * Tv.u : root.fc.h * Tv.u / 2, + focus: 1, + alpha: root.alpha * root.pill-a, + blur: 1.2, + glow: root.fc.tone == "primary" ? #e50914 : #ffffff, + tint: root.fc.tone == "primary" ? #e50914.with-alpha(0.85) : #ffffff.with-alpha(root.fc.tone == "field" ? 0.82 : 0.88), + group: 0, + }, + kb-pane.glass, + ]; + out property <[GlassRect]> glass-keyboard: kb.glass; +} diff --git a/ui/player.slint b/ui/player.slint new file mode 100644 index 0000000..b4f7307 --- /dev/null +++ b/ui/player.slint @@ -0,0 +1,358 @@ +// Playback. The film itself is the glass backdrop (Rust: glass.set_video), +// so the controls are glass that refracts the picture. +// +// Stages: "prep" (finding the source, starting the torrent), "play", +// "error". With the controls hidden the remote drives playback directly +// (OK = play/pause or the skip prompt, left/right = seek); shown, up/down +// moves between the seek bar and the buttons. All focus state is Rust's. + +import { Tv, GlassRect, GlassPane, GlassButton, GlassMenu, MenuItem, ProgressBar, Spinner, Title, Label, Caption, Item, Icon } from "@sf-ui/sf-ui.slint"; + +export component PlayerScreen inherits Rectangle { + in property alpha: 1; + in property stage: "prep"; + in property title; + // Accent line above the title ("S01E03 · Pilot", "3. rész", "2024"). + in property heading; + // "HEVC 2160p · Magyar (+200 ms) · Angol felirat" + in property info; + in property stage-text; + in property detail-text; + in property error-text; + // Playing. + in property osd; + in property paused; + in property buffering; + in property buffer-text; + in property progress; + in property buffered; + in property time-text; + in property remaining-text; + in property downloaded-text; + // Seeking with left/right: the target and how far it is. + in property seeking; + in property seek-text; + in property seek-delta; + in property seek-back; + // Controls: 0 = seek bar, 1 = buttons; which button. + in property osd-area; + in property osd-button; + in property has-prev; + in property has-next; + // Track panel: 0 = closed, else the focused column + 1 (audio, subtitles, sync, quality). + in property panel; + in property <[MenuItem]> audio; + in property <[MenuItem]> subs; + in property <[MenuItem]> sync; + in property <[MenuItem]> quality; + in property audio-focus; + in property subs-focus; + in property sync-focus; + in property quality-focus; + // Anime: "Intro átugrása"... while a segment plays. + in property skip-label; + // The end: "Következik" card. + in property next-label; + in property next-text; + + out property osd-t: self.stage == "play" && (self.osd || self.paused || self.panel > 0) ? 1 : 0; + animate osd-t { duration: 320ms; easing: cubic-bezier(0.22, 1, 0.36, 1); } + out property panel-t: self.panel > 0 ? 1 : 0; + animate panel-t { duration: 360ms; easing: cubic-bezier(0.22, 1, 0.36, 1); } + property prep-a: self.alpha * (self.stage == "play" ? 0 : 1); + property osd-a: self.alpha * self.osd-t; + property buttons: self.osd-t > 0.5 && self.osd-area == 1 && self.panel == 0; + + // Darkens the film behind the controls (Slint over video is fine). + Rectangle { + y: root.height * 0.5; + height: root.height * 0.5; + background: @linear-gradient(180deg, #00000000 0%, #000000b8 100%); + opacity: root.osd-a; + } + + // ---- preparing / error ---- + VerticalLayout { + x: Tv.safe-x; + width: root.width - 2 * Tv.safe-x; + y: 330 * Tv.u; + height: 460 * Tv.u; + spacing: 24 * Tv.u; + alignment: start; + opacity: root.prep-a; + if root.stage == "prep": HorizontalLayout { + alignment: center; + Spinner { size: 72 * Tv.u; } + } + if root.stage == "error": HorizontalLayout { + alignment: center; + Icon { name: "warning"; size: 64 * Tv.u; ink: Tv.danger-ink; } + } + Title { + horizontal-alignment: center; + text: root.stage == "error" ? "Nem sikerült elindítani" : root.heading == "" ? root.title : root.title + " · " + root.heading; + } + Label { + horizontal-alignment: center; + text: root.stage == "error" ? root.error-text : root.stage-text; + wrap: word-wrap; + color: Tv.text-secondary; + } + Caption { + horizontal-alignment: center; + text: root.stage == "error" ? "Vissza: vissza az adatlapra" : root.detail-text; + wrap: word-wrap; + } + } + + // ---- buffering ---- + buf := GlassPane { + x: (root.width - self.width) / 2; + y: (root.height - self.height) / 2; + width: 620 * Tv.u; + height: 190 * Tv.u; + radius: 40 * Tv.u; + frost: 3.2; + tint: Tv.smoke.with-alpha(0.4); + alpha: root.stage == "play" && root.buffering && !root.seeking ? root.alpha : 0; + VerticalLayout { + padding: 32 * Tv.u; + spacing: 20 * Tv.u; + alignment: center; + opacity: parent.alpha; + HorizontalLayout { + alignment: center; + Spinner { size: 56 * Tv.u; } + } + Label { + horizontal-alignment: center; + text: root.buffer-text == "" ? "Betöltés…" : root.buffer-text; + overflow: elide; + } + } + } + if root.stage == "play" && root.paused && !root.buffering && root.panel == 0 && !root.seeking && root.next-label == "": Icon { + x: (root.width - self.width) / 2; + y: (root.height - self.height) / 2 - 60 * Tv.u; + name: "pause"; + size: 96 * Tv.u; + opacity: 0.85 * root.alpha; + } + + // ---- seek preview ---- + seek := GlassPane { + x: (root.width - self.width) / 2; + y: (root.height - self.height) / 2 - 60 * Tv.u; + width: 520 * Tv.u; + height: 108 * Tv.u; + radius: self.height / 2; + frost: 3.0; + tint: Tv.smoke.with-alpha(0.4); + alpha: root.stage == "play" && root.seeking ? root.alpha : 0; + HorizontalLayout { + alignment: center; + spacing: 18 * Tv.u; + opacity: parent.alpha; + Icon { + y: (parent.height - self.height) / 2; + name: root.seek-back ? "rewind" : "fast-forward"; + size: 40 * Tv.u; + } + Text { + vertical-alignment: center; + text: root.seek-text; + font-size: 44 * Tv.u; + font-weight: 700; + color: Tv.text; + } + Text { + vertical-alignment: center; + text: root.seek-delta; + font-size: 26 * Tv.u; + color: Tv.text-secondary; + } + } + } + + // ---- skip prompt (anime) ---- + skip := GlassButton { + x: root.width - Tv.safe-x - self.width; + y: root.height - (root.osd-t > 0.5 ? 340 : 120) * Tv.u; + text: root.skip-label; + icon: "fast-forward"; + primary: true; + accent: #e50914; + focused: root.skip-label != "" && root.osd-t < 0.5 && root.panel == 0; + alpha: root.stage == "play" && root.skip-label != "" && root.panel == 0 && root.next-label == "" ? root.alpha : 0; + } + + // ---- up next ---- + upnext := GlassPane { + x: root.width - Tv.safe-x - self.width; + y: root.height - 380 * Tv.u; + width: 520 * Tv.u; + height: 168 * Tv.u; + radius: 40 * Tv.u; + frost: 3.2; + tint: Tv.smoke.with-alpha(0.42); + alpha: root.next-label != "" ? root.alpha : 0; + VerticalLayout { + padding: 32 * Tv.u; + spacing: 6 * Tv.u; + opacity: parent.alpha; + Caption { text: "KÖVETKEZIK"; letter-spacing: 2 * Tv.u; } + Title { text: root.next-label; font-size: 34 * Tv.u; } + Label { text: root.next-text; } + } + } + + // ---- controls ---- + Rectangle { + x: Tv.safe-x; + y: root.height - 360 * Tv.u + (1 - root.osd-t) * 30 * Tv.u; + width: root.width - 2 * Tv.safe-x; + height: 300 * Tv.u; + opacity: root.osd-a; + Text { + x: 0; + y: 0; + text: root.heading; + font-size: 24 * Tv.u; + font-weight: 700; + color: #ff8a8a; + } + Text { + x: 0; + y: 34 * Tv.u; + width: parent.width - 420 * Tv.u; + text: root.title; + font-size: 44 * Tv.u; + font-weight: 700; + letter-spacing: -0.8 * Tv.u; + color: Tv.text; + overflow: elide; + } + Caption { + x: 0; + y: 96 * Tv.u; + width: parent.width - 420 * Tv.u; + text: root.info; + color: Tv.text-secondary; + } + Caption { + x: parent.width - 400 * Tv.u; + y: 96 * Tv.u; + width: 400 * Tv.u; + horizontal-alignment: right; + text: root.downloaded-text; + } + Text { + x: 0; + y: 172 * Tv.u; + text: root.time-text; + font-size: 24 * Tv.u; + font-weight: 600; + color: Tv.text; + } + Text { + x: parent.width - 300 * Tv.u; + y: 172 * Tv.u; + width: 300 * Tv.u; + horizontal-alignment: right; + text: root.remaining-text; + font-size: 24 * Tv.u; + font-weight: 600; + color: Tv.text-secondary; + } + } + bar := ProgressBar { + x: Tv.safe-x; + y: root.height - 222 * Tv.u + (1 - root.osd-t) * 30 * Tv.u; + width: root.width - 2 * Tv.safe-x; + height: (root.osd-area == 0 && root.panel == 0 ? 14 : 10) * Tv.u; + value: root.progress; + buffered: root.buffered; + fill: root.seeking ? #e50914 : Tv.text; + nested: false; + alpha: root.osd-a; + } + HorizontalLayout { + x: Tv.safe-x; + y: root.height - 146 * Tv.u + (1 - root.osd-t) * 30 * Tv.u; + height: 72 * Tv.u; + spacing: 20 * Tv.u; + alignment: start; + b0 := GlassButton { icon: root.paused ? "play" : "pause"; focused: root.buttons && root.osd-button == 0; alpha: root.osd-a; } + b1 := GlassButton { icon: "rewind"; text: "10 mp"; focused: root.buttons && root.osd-button == 1; alpha: root.osd-a; } + b2 := GlassButton { icon: "fast-forward"; text: "10 mp"; focused: root.buttons && root.osd-button == 2; alpha: root.osd-a; } + b3 := GlassButton { icon: "previous"; text: "Előző rész"; enabled: root.has-prev; focused: root.buttons && root.osd-button == 3; alpha: root.has-prev ? root.osd-a : 0; visible: root.has-prev; } + b4 := GlassButton { icon: "next"; text: "Következő rész"; enabled: root.has-next; focused: root.buttons && root.osd-button == 4; alpha: root.has-next ? root.osd-a : 0; visible: root.has-next; } + } + b5 := GlassButton { + x: root.width - Tv.safe-x - self.width; + y: root.height - 146 * Tv.u + (1 - root.osd-t) * 30 * Tv.u; + icon: "subtitles"; + text: "Hang és felirat"; + focused: root.buttons && root.osd-button == 5; + alpha: root.osd-a; + } + + // ---- tracks panel ---- + property col-w: 400 * Tv.u; + property panel-y: root.height - 400 * Tv.u; + property has-quality: root.quality.length > 0; + m-audio := GlassMenu { + x: Tv.safe-x; + y: root.panel-y - self.height + (1 - root.panel-t) * 30 * Tv.u; + width: root.col-w; + title: "Hang"; + items: root.audio; + focused-index: root.audio-focus; + active: root.panel == 1; + alpha: root.alpha * root.panel-t; + accent: #e50914; + visible-rows: 6; + } + m-subs := GlassMenu { + x: Tv.safe-x + root.col-w + 28 * Tv.u; + y: root.panel-y - self.height + (1 - root.panel-t) * 30 * Tv.u; + width: root.col-w; + title: "Felirat"; + items: root.subs; + focused-index: root.subs-focus; + active: root.panel == 2; + alpha: root.alpha * root.panel-t; + accent: #e50914; + visible-rows: 6; + } + m-sync := GlassMenu { + x: Tv.safe-x + 2 * (root.col-w + 28 * Tv.u); + y: root.panel-y - self.height + (1 - root.panel-t) * 30 * Tv.u; + width: 320 * Tv.u; + title: "Hangkésés"; + items: root.sync; + focused-index: root.sync-focus; + active: root.panel == 3; + alpha: root.alpha * root.panel-t; + accent: #e50914; + visible-rows: 6; + } + m-quality := GlassMenu { + x: Tv.safe-x + 2 * (root.col-w + 28 * Tv.u) + 348 * Tv.u; + y: root.panel-y - self.height + (1 - root.panel-t) * 30 * Tv.u; + width: 330 * Tv.u; + title: "Minőség"; + items: root.quality; + focused-index: root.quality-focus; + active: root.panel == 4; + alpha: root.has-quality ? root.alpha * root.panel-t : 0; + accent: #e50914; + visible-rows: 6; + } + + out property <[GlassRect]> glass: [buf.glass, seek.glass, bar.glass, b0.glass, b1.glass, b2.glass, b3.glass, b4.glass, b5.glass, skip.glass, upnext.glass]; + out property <[GlassRect]> glass-audio: m-audio.glass; + out property <[GlassRect]> glass-subs: m-subs.glass; + out property <[GlassRect]> glass-sync: m-sync.glass; + out property <[GlassRect]> glass-quality: m-quality.glass; +} diff --git a/ui/signin.slint b/ui/signin.slint new file mode 100644 index 0000000..a06a454 --- /dev/null +++ b/ui/signin.slint @@ -0,0 +1,132 @@ +// Sign-in (server address, user name, password) on a modal glass pane with +// the on-screen keyboard, and a plain message screen (loading, errors). + +import { Tv, GlassRect, GlassPane, GlassButton, Keyboard, Spinner, Title, Label, Caption, Icon } from "@sf-ui/sf-ui.slint"; + +export component SignInScreen inherits Rectangle { + in property alpha: 1; + in property title: "Bejelentkezés"; + in property subtitle; + in property placeholder; + in property secret; + in property submit-label: "Tovább"; + in property min-length: 1; + in property footer; + in property busy; + in-out property text; + in-out property error; + callback submitted(string); + callback cancelled(); + + public function key(event: KeyEvent) -> EventResult { + if root.busy { + return accept; + } + kb.key(event) + } + + public function reset() { + kb.reset(); + } + + pane := GlassPane { + x: (root.width - self.width) / 2; + y: (root.height - self.height) / 2 - 24 * Tv.u; + width: 1720 * Tv.u; + height: 720 * Tv.u; + radius: 56 * Tv.u; + frost: 3.8; + tint: Tv.smoke.with-alpha(0.48); + glow: #e50914; + alpha: root.alpha; + kb := Keyboard { + x: 0; + y: 72 * Tv.u; + width: parent.width; + title: root.title; + subtitle: root.subtitle; + placeholder: root.placeholder; + secret: root.secret; + submit-label: root.submit-label; + min-length: root.min-length; + max-length: 200; + alpha: root.alpha * (root.busy ? 0.4 : 1); + active: !root.busy; + text <=> root.text; + error <=> root.error; + submitted(t) => { root.submitted(t); } + cancelled => { root.cancelled(); } + } + } + HorizontalLayout { + x: pane.x; + y: pane.y + pane.height + 28 * Tv.u; + width: pane.width; + height: 48 * Tv.u; + alignment: center; + spacing: 16 * Tv.u; + opacity: root.alpha; + if root.busy: Spinner { size: 40 * Tv.u; } + Caption { + vertical-alignment: center; + text: root.footer; + } + } + + out property <[GlassRect]> glass: [pane.glass]; + out property <[GlassRect]> glass-keyboard: kb.glass; +} + +// Loading and errors, with up to two buttons. +export component MessageScreen inherits Rectangle { + in property alpha: 1; + in property busy; + in property title; + in property text; + in property action-a; + in property action-b; + in property action; + + VerticalLayout { + x: Tv.safe-x; + width: root.width - 2 * Tv.safe-x; + y: 320 * Tv.u; + height: 440 * Tv.u; + spacing: 24 * Tv.u; + alignment: start; + opacity: root.alpha; + HorizontalLayout { + alignment: center; + if root.busy: Spinner { size: 72 * Tv.u; } + if !root.busy: Icon { name: "warning"; size: 64 * Tv.u; ink: Tv.warn-ink; } + } + Title { + horizontal-alignment: center; + text: root.title; + } + Label { + horizontal-alignment: center; + text: root.text; + wrap: word-wrap; + } + HorizontalLayout { + alignment: center; + spacing: 24 * Tv.u; + padding-top: 24 * Tv.u; + a := GlassButton { + text: root.action-a; + focused: root.action == 0; + alpha: root.action-a != "" ? root.alpha : 0; + visible: root.action-a != ""; + } + b := GlassButton { + text: root.action-b; + focused: root.action == 1; + alpha: root.action-b != "" ? root.alpha : 0; + visible: root.action-b != ""; + } + } + } + + out property <[GlassRect]> glass: [a.glass, b.glass]; +} diff --git a/ui/types.slint b/ui/types.slint new file mode 100644 index 0000000..e6ae091 --- /dev/null +++ b/ui/types.slint @@ -0,0 +1,82 @@ +// Data the Rust side fills in. Every page is a list of Lines (src/page.rs); +// all lengths here are design px (1920x1080 grid), multiplied by Tv.u. + +// A button / choice / text field on a line. x, y relative to the line. +export struct Chip { + id: string, + text: string, + icon: string, + x: float, + y: float, + w: float, + h: float, + // Selected (a choice, the current tab). + active: bool, + // "" | "primary" (accent glass) | "include" | "exclude" | "danger" | "field" (text field) + tone: string, + enabled: bool, +} + +// A card in a cards line. +export struct Card { + id: string, + title: string, + // Under the card (cards lines with captions). + caption: string, + detail: string, + image: image, + // 0..1 watched; negative = no bar. + progress: float, + // Small pill over the top-left corner, and its tone ("dub", "sub", "accent", ""). + badge: string, + badge-tone: string, + // "check" = watched mark (top-right). + mark: string, + // Big number over a dimmed picture (a season without its own poster). + big: string, + // Highlighted (the current season / franchise entry). + current: bool, +} + +// One line of a checks list: state 1 = ok, 0 = failed, -1 = unknown. +export struct Check { + state: int, + label: string, + detail: string, +} + +// One line of a page. +// hero big title block with buttons (detail pages, spotlight) +// heading section title (+ subtitle) +// text paragraph (style "body" | "caption" | "label" | "warn" | "bad" | "good") +// notice icon + title + text, toned ("good" | "bad" | "warn" | "info") +// chips a row of chips (title = label above them) +// cards a row of cards (style "poster" | "landscape" | "season"; captions under them) +// item list row: optional picture, title, meta, text, progress, chips +// checks two columns of check rows +// keyboard room for the page's on-screen keyboard +export struct Line { + id: string, + kind: string, + y: float, + h: float, + x: float, + w: float, + title: string, + subtitle: string, + meta: string, + extra: string, + text: string, + note: string, + style: string, + tone: string, + icon: string, + image: image, + logo: image, + progress: float, + col: int, + captions: bool, + cards: [Card], + chips: [Chip], + checks: [Check], +}