From c37f31bbc5664eb84e1cbc845b69e9fd98bb7bcb Mon Sep 17 00:00:00 2001 From: Lachezar Lechev Date: Thu, 1 Aug 2024 17:56:56 +0300 Subject: [PATCH 01/50] chore(stremio-core-android): update time dep. and introduce `kotlin` feature Signed-off-by: Lachezar Lechev --- Cargo.lock | 1842 ++++++++++++++++++++++++++-------------------------- Cargo.toml | 79 ++- 2 files changed, 994 insertions(+), 927 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 9bf7293..dfef4a8 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -8,8 +8,8 @@ version = "0.11.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "fe438c63458706e03479442743baae6c88256498e6431708f6dfc520a26515d3" dependencies = [ - "lazy_static", - "regex", + "lazy_static", + "regex", ] [[package]] @@ -18,7 +18,7 @@ version = "0.21.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8a30b2e23b9e17a9f90641c7ab1549cd9b44f296d3ccbf309d2863cfe398a0cb" dependencies = [ - "gimli", + "gimli", ] [[package]] @@ -33,7 +33,7 @@ version = "1.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b2969dcb958b36655471fc61f7e416fa76033bdd4bfed0678d8fee1e2d07a1f0" dependencies = [ - "memchr", + "memchr", ] [[package]] @@ -48,7 +48,7 @@ version = "0.1.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "819e7219dbd41043ac279b19830f2efc897156490d7fd6ea916720117ee66311" dependencies = [ - "libc", + "libc", ] [[package]] @@ -63,7 +63,7 @@ version = "0.0.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "23589ecb866b460d3a0f1278834750268c607e8e28a1b982c907219f3178cd72" dependencies = [ - "nodrop", + "nodrop", ] [[package]] @@ -72,9 +72,9 @@ version = "1.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "81953c529336010edd6d8e358f886d9581267795c61b19475b71314bffa46d35" dependencies = [ - "concurrent-queue", - "event-listener 2.5.3", - "futures-core", + "concurrent-queue", + "event-listener 2.5.3", + "futures-core", ] [[package]] @@ -83,11 +83,11 @@ version = "2.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1ca33f4bc4ed1babef42cad36cc1f51fa88be00420404e5b1e80ab1b18f7678c" dependencies = [ - "concurrent-queue", - "event-listener 4.0.0", - "event-listener-strategy", - "futures-core", - "pin-project-lite", + "concurrent-queue", + "event-listener 4.0.0", + "event-listener-strategy", + "futures-core", + "pin-project-lite", ] [[package]] @@ -96,12 +96,12 @@ version = "1.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "17ae5ebefcc48e7452b4987947920dac9450be1110cadf34d1b8c116bdbaf97c" dependencies = [ - "async-lock 3.2.0", - "async-task", - "concurrent-queue", - "fastrand 2.0.1", - "futures-lite 2.1.0", - "slab", + "async-lock 3.2.0", + "async-task", + "concurrent-queue", + "fastrand 2.0.1", + "futures-lite 2.1.0", + "slab", ] [[package]] @@ -110,13 +110,13 @@ version = "2.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "05b1b633a2115cd122d73b955eadd9916c18c8f510ec9cd1686404c60ad1c29c" dependencies = [ - "async-channel 2.1.1", - "async-executor", - "async-io 2.2.2", - "async-lock 3.2.0", - "blocking", - "futures-lite 2.1.0", - "once_cell", + "async-channel 2.1.1", + "async-executor", + "async-io 2.2.2", + "async-lock 3.2.0", + "blocking", + "futures-lite 2.1.0", + "once_cell", ] [[package]] @@ -125,18 +125,18 @@ version = "1.13.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0fc5b45d93ef0529756f812ca52e44c221b35341892d3dcc34132ac02f3dd2af" dependencies = [ - "async-lock 2.8.0", - "autocfg", - "cfg-if 1.0.0", - "concurrent-queue", - "futures-lite 1.13.0", - "log", - "parking", - "polling 2.8.0", - "rustix 0.37.27", - "slab", - "socket2 0.4.10", - "waker-fn", + "async-lock 2.8.0", + "autocfg", + "cfg-if 1.0.0", + "concurrent-queue", + "futures-lite 1.13.0", + "log", + "parking", + "polling 2.8.0", + "rustix 0.37.27", + "slab", + "socket2 0.4.10", + "waker-fn", ] [[package]] @@ -145,17 +145,17 @@ version = "2.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6afaa937395a620e33dc6a742c593c01aced20aa376ffb0f628121198578ccc7" dependencies = [ - "async-lock 3.2.0", - "cfg-if 1.0.0", - "concurrent-queue", - "futures-io", - "futures-lite 2.1.0", - "parking", - "polling 3.3.1", - "rustix 0.38.28", - "slab", - "tracing", - "windows-sys 0.52.0", + "async-lock 3.2.0", + "cfg-if 1.0.0", + "concurrent-queue", + "futures-io", + "futures-lite 2.1.0", + "parking", + "polling 3.3.1", + "rustix 0.38.28", + "slab", + "tracing", + "windows-sys 0.52.0", ] [[package]] @@ -164,7 +164,7 @@ version = "2.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "287272293e9d8c41773cec55e365490fe034813a2f172f502d6ddcf75b2f582b" dependencies = [ - "event-listener 2.5.3", + "event-listener 2.5.3", ] [[package]] @@ -173,9 +173,9 @@ version = "3.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7125e42787d53db9dd54261812ef17e937c95a51e4d291373b670342fa44310c" dependencies = [ - "event-listener 4.0.0", - "event-listener-strategy", - "pin-project-lite", + "event-listener 4.0.0", + "event-listener-strategy", + "pin-project-lite", ] [[package]] @@ -184,15 +184,15 @@ version = "1.8.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ea6438ba0a08d81529c69b36700fa2f95837bfe3e776ab39cde9c14d9149da88" dependencies = [ - "async-io 1.13.0", - "async-lock 2.8.0", - "async-signal", - "blocking", - "cfg-if 1.0.0", - "event-listener 3.1.0", - "futures-lite 1.13.0", - "rustix 0.38.28", - "windows-sys 0.48.0", + "async-io 1.13.0", + "async-lock 2.8.0", + "async-signal", + "blocking", + "cfg-if 1.0.0", + "event-listener 3.1.0", + "futures-lite 1.13.0", + "rustix 0.38.28", + "windows-sys 0.48.0", ] [[package]] @@ -201,16 +201,16 @@ version = "0.2.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9e47d90f65a225c4527103a8d747001fc56e375203592b25ad103e1ca13124c5" dependencies = [ - "async-io 2.2.2", - "async-lock 2.8.0", - "atomic-waker", - "cfg-if 1.0.0", - "futures-core", - "futures-io", - "rustix 0.38.28", - "signal-hook-registry", - "slab", - "windows-sys 0.48.0", + "async-io 2.2.2", + "async-lock 2.8.0", + "atomic-waker", + "cfg-if 1.0.0", + "futures-core", + "futures-io", + "rustix 0.38.28", + "signal-hook-registry", + "slab", + "windows-sys 0.48.0", ] [[package]] @@ -219,25 +219,25 @@ version = "1.12.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "62565bb4402e926b29953c785397c6dc0391b7b446e45008b0049eb43cec6f5d" dependencies = [ - "async-channel 1.9.0", - "async-global-executor", - "async-io 1.13.0", - "async-lock 2.8.0", - "async-process", - "crossbeam-utils", - "futures-channel", - "futures-core", - "futures-io", - "futures-lite 1.13.0", - "gloo-timers", - "kv-log-macro", - "log", - "memchr", - "once_cell", - "pin-project-lite", - "pin-utils", - "slab", - "wasm-bindgen-futures", + "async-channel 1.9.0", + "async-global-executor", + "async-io 1.13.0", + "async-lock 2.8.0", + "async-process", + "crossbeam-utils", + "futures-channel", + "futures-core", + "futures-io", + "futures-lite 1.13.0", + "gloo-timers", + "kv-log-macro", + "log", + "memchr", + "once_cell", + "pin-project-lite", + "pin-utils", + "slab", + "wasm-bindgen-futures", ] [[package]] @@ -252,9 +252,9 @@ version = "0.1.74" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a66537f1bb974b254c98ed142ff995236e81b9d0fe4db0575f46612cb15eb0f9" dependencies = [ - "proc-macro2", - "quote", - "syn 2.0.41", + "proc-macro2", + "quote", + "syn 2.0.41", ] [[package]] @@ -269,10 +269,10 @@ version = "0.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7862e21c893d65a1650125d157eaeec691439379a1cee17ee49031b79236ada4" dependencies = [ - "proc-macro-error", - "proc-macro2", - "quote", - "syn 1.0.109", + "proc-macro-error", + "proc-macro2", + "quote", + "syn 1.0.109", ] [[package]] @@ -287,13 +287,13 @@ version = "0.3.69" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2089b7e3f35b9dd2d0ed921ead4f6d318c27680d4a5bd167b3ee120edb105837" dependencies = [ - "addr2line", - "cc", - "cfg-if 1.0.0", - "libc", - "miniz_oxide", - "object", - "rustc-demangle", + "addr2line", + "cc", + "cfg-if 1.0.0", + "libc", + "miniz_oxide", + "object", + "rustc-demangle", ] [[package]] @@ -302,7 +302,7 @@ version = "0.10.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0b25d992356d2eb0ed82172f5248873db5560c4721f564b13cb5193bda5e668e" dependencies = [ - "byteorder", + "byteorder", ] [[package]] @@ -329,7 +329,7 @@ version = "1.3.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b1f45e9417d87227c7a56d22e471c6206462cba514c7590c09aff4cf6d1ddcad" dependencies = [ - "serde", + "serde", ] [[package]] @@ -350,10 +350,10 @@ version = "0.7.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c0940dc441f31689269e10ac70eb1002a3a1d3ad1390e030043662eb7fe4688b" dependencies = [ - "block-padding", - "byte-tools", - "byteorder", - "generic-array 0.12.4", + "block-padding", + "byte-tools", + "byteorder", + "generic-array 0.12.4", ] [[package]] @@ -362,7 +362,7 @@ version = "0.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4152116fd6e9dadb291ae18fc1ec3575ed6d84c29642d97890f4b4a3417297e4" dependencies = [ - "generic-array 0.14.7", + "generic-array 0.14.7", ] [[package]] @@ -371,7 +371,7 @@ version = "0.10.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3078c7629b62d3f0439517fa394996acacc5cbc91c5a20d8c658e77abd503a71" dependencies = [ - "generic-array 0.14.7", + "generic-array 0.14.7", ] [[package]] @@ -380,7 +380,7 @@ version = "0.1.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "fa79dedbb091f449f1f39e53edf88d5dbe95f895dae6135a8d7b881fb5af73f5" dependencies = [ - "byte-tools", + "byte-tools", ] [[package]] @@ -389,14 +389,14 @@ version = "1.5.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6a37913e8dc4ddcc604f0c6d3bf2887c995153af3611de9e23c352b44c1b9118" dependencies = [ - "async-channel 2.1.1", - "async-lock 3.2.0", - "async-task", - "fastrand 2.0.1", - "futures-io", - "futures-lite 2.1.0", - "piper", - "tracing", + "async-channel 2.1.1", + "async-lock 3.2.0", + "async-task", + "fastrand 2.0.1", + "futures-io", + "futures-lite 2.1.0", + "piper", + "tracing", ] [[package]] @@ -435,21 +435,21 @@ version = "10.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5c13caedf5b624de6448b78e980320a27266557350198dc67cf64bc8561c27e8" dependencies = [ - "async-std", - "digest 0.9.0", - "either", - "futures", - "hex 0.4.3", - "memmap2", - "serde", - "serde_derive", - "serde_json", - "sha-1 0.9.8", - "sha2 0.9.9", - "ssri", - "tempfile", - "thiserror", - "walkdir", + "async-std", + "digest 0.9.0", + "either", + "futures", + "hex 0.4.3", + "memmap2", + "serde", + "serde_derive", + "serde_json", + "sha-1 0.9.8", + "sha2 0.9.9", + "ssri", + "tempfile", + "thiserror", + "walkdir", ] [[package]] @@ -464,7 +464,7 @@ version = "1.0.83" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f1174fb0b6ec23863f8b971027804a42614e347eafb0a95bf0b12cdae21fc4d0" dependencies = [ - "libc", + "libc", ] [[package]] @@ -491,13 +491,13 @@ version = "0.4.31" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7f2c685bad3eb3d45a01354cedb7d5faa66194d1d58ba6e267a8de788f79db38" dependencies = [ - "android-tzdata", - "iana-time-zone", - "js-sys", - "num-traits", - "serde", - "wasm-bindgen", - "windows-targets 0.48.5", + "android-tzdata", + "iana-time-zone", + "js-sys", + "num-traits", + "serde", + "wasm-bindgen", + "windows-targets 0.48.5", ] [[package]] @@ -506,8 +506,8 @@ version = "4.6.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "35ed6e9d84f0b51a7f52daf1c7d71dd136fd7a3f41a8462b8cdb8c78d920fad4" dependencies = [ - "bytes", - "memchr", + "bytes", + "memchr", ] [[package]] @@ -516,7 +516,7 @@ version = "2.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d16048cd947b08fa32c24458a22f5dc5e835264f689f4f5653210c69fd107363" dependencies = [ - "crossbeam-utils", + "crossbeam-utils", ] [[package]] @@ -531,8 +531,8 @@ version = "0.9.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "91e195e091a93c46f7102ec7818a2aa394e1e1771c3ab4825963fa03e45afb8f" dependencies = [ - "core-foundation-sys", - "libc", + "core-foundation-sys", + "libc", ] [[package]] @@ -547,7 +547,7 @@ version = "0.2.11" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ce420fe07aecd3e67c5f910618fe65e94158f6dcc0adf44e00d69ce2bdfe0fd0" dependencies = [ - "libc", + "libc", ] [[package]] @@ -556,7 +556,7 @@ version = "1.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b540bd8bc810d3885c6ea91e2018302f68baba2129ab3e88f32389ee9370880d" dependencies = [ - "cfg-if 1.0.0", + "cfg-if 1.0.0", ] [[package]] @@ -565,7 +565,7 @@ version = "0.8.17" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c06d96137f14f244c37f989d9fff8f95e6c18b918e71f36638f8c49112e4c78f" dependencies = [ - "cfg-if 1.0.0", + "cfg-if 1.0.0", ] [[package]] @@ -574,8 +574,8 @@ version = "0.1.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1bfb12502f3fc46cca1bb51ac28df9d618d813cdc3d2f25b9fe775a34af26bb3" dependencies = [ - "generic-array 0.14.7", - "typenum", + "generic-array 0.14.7", + "typenum", ] [[package]] @@ -584,8 +584,8 @@ version = "0.20.8" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "54e36fcd13ed84ffdfda6f5be89b31287cbb80c439841fe69e04841435464391" dependencies = [ - "darling_core", - "darling_macro", + "darling_core", + "darling_macro", ] [[package]] @@ -594,12 +594,12 @@ version = "0.20.8" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9c2cf1c23a687a1feeb728783b993c4e1ad83d99f351801977dd809b48d0a70f" dependencies = [ - "fnv", - "ident_case", - "proc-macro2", - "quote", - "strsim", - "syn 2.0.41", + "fnv", + "ident_case", + "proc-macro2", + "quote", + "strsim", + "syn 2.0.41", ] [[package]] @@ -608,9 +608,9 @@ version = "0.20.8" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a668eda54683121533a393014d8692171709ff57a7d61f187b6e782719f8933f" dependencies = [ - "darling_core", - "quote", - "syn 2.0.41", + "darling_core", + "quote", + "syn 2.0.41", ] [[package]] @@ -619,8 +619,8 @@ version = "0.3.10" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8eb30d70a07a3b04884d2677f06bec33509dc67ca60d92949e5535352d3191dc" dependencies = [ - "powerfmt", - "serde", + "powerfmt", + "serde", ] [[package]] @@ -629,9 +629,9 @@ version = "2.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "fcc3dd5e9e9c0b295d6e1e4d811fb6f157d5ffd784b8d202fc62eac8035a770b" dependencies = [ - "proc-macro2", - "quote", - "syn 1.0.109", + "proc-macro2", + "quote", + "syn 1.0.109", ] [[package]] @@ -640,11 +640,11 @@ version = "0.99.17" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4fb810d30a7c1953f91334de7244731fc3f3c10d7fe163338a35b9f640960321" dependencies = [ - "convert_case", - "proc-macro2", - "quote", - "rustc_version", - "syn 1.0.109", + "convert_case", + "proc-macro2", + "quote", + "rustc_version", + "syn 1.0.109", ] [[package]] @@ -653,7 +653,7 @@ version = "0.8.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f3d0c8c8752312f9713efd397ff63acb9f85585afbf179282e720e7704954dd5" dependencies = [ - "generic-array 0.12.4", + "generic-array 0.12.4", ] [[package]] @@ -662,7 +662,7 @@ version = "0.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d3dd60d1080a57a05ab032377049e0591415d2b31afd7028356dbf3cc6dcb066" dependencies = [ - "generic-array 0.14.7", + "generic-array 0.14.7", ] [[package]] @@ -671,8 +671,8 @@ version = "0.10.7" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9ed9a281f7bc9b7576e61468ba615a66a5c8cfdff42420a70aa82701a3b1e292" dependencies = [ - "block-buffer 0.10.4", - "crypto-common", + "block-buffer 0.10.4", + "crypto-common", ] [[package]] @@ -693,7 +693,7 @@ version = "0.8.33" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7268b386296a025e474d5140678f75d6de9493ae55a5d709eeb9dd08149945e1" dependencies = [ - "cfg-if 1.0.0", + "cfg-if 1.0.0", ] [[package]] @@ -708,8 +708,8 @@ version = "0.3.8" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a258e46cdc063eb8519c00b9fc845fc47bcfca4130e2f08e88665ceda8474245" dependencies = [ - "libc", - "windows-sys 0.52.0", + "libc", + "windows-sys 0.52.0", ] [[package]] @@ -724,9 +724,9 @@ version = "3.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d93877bcde0eb80ca09131a08d23f0a5c18a620b01db137dba666d18cd9b30c2" dependencies = [ - "concurrent-queue", - "parking", - "pin-project-lite", + "concurrent-queue", + "parking", + "pin-project-lite", ] [[package]] @@ -735,9 +735,9 @@ version = "4.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "770d968249b5d99410d61f5bf89057f3199a077a04d087092f58e7d10692baae" dependencies = [ - "concurrent-queue", - "parking", - "pin-project-lite", + "concurrent-queue", + "parking", + "pin-project-lite", ] [[package]] @@ -746,8 +746,8 @@ version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "958e4d70b6d5e81971bebec42271ec641e7ff4e170a6fa605f2b8a8b65cb97d3" dependencies = [ - "event-listener 4.0.0", - "pin-project-lite", + "event-listener 4.0.0", + "pin-project-lite", ] [[package]] @@ -762,7 +762,7 @@ version = "1.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e51093e27b0797c359783294ca4f0a911c270184cb10f85783b118614a1501be" dependencies = [ - "instant", + "instant", ] [[package]] @@ -783,8 +783,8 @@ version = "1.0.28" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "46303f565772937ffe1d394a4fac6f411c6013172fadde9dcdb1e147a086940e" dependencies = [ - "crc32fast", - "miniz_oxide", + "crc32fast", + "miniz_oxide", ] [[package]] @@ -799,7 +799,7 @@ version = "0.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f6f339eb8adc052cd2ca78910fda869aefa38d22d5cb648e6485e4d3fc06f3b1" dependencies = [ - "foreign-types-shared", + "foreign-types-shared", ] [[package]] @@ -814,7 +814,7 @@ version = "1.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e13624c2627564efccf4934284bdd98cbaa14e79b0b5a141218e507b3a823456" dependencies = [ - "percent-encoding", + "percent-encoding", ] [[package]] @@ -829,13 +829,13 @@ version = "0.3.29" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "da0290714b38af9b4a7b094b8a37086d1b4e61f2df9122c3cad2577669145335" dependencies = [ - "futures-channel", - "futures-core", - "futures-executor", - "futures-io", - "futures-sink", - "futures-task", - "futures-util", + "futures-channel", + "futures-core", + "futures-executor", + "futures-io", + "futures-sink", + "futures-task", + "futures-util", ] [[package]] @@ -844,8 +844,8 @@ version = "0.3.29" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ff4dd66668b557604244583e3e1e1eada8c5c2e96a6d0d6653ede395b78bbacb" dependencies = [ - "futures-core", - "futures-sink", + "futures-core", + "futures-sink", ] [[package]] @@ -860,9 +860,9 @@ version = "0.3.29" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0f4fb8693db0cf099eadcca0efe2a5a22e4550f98ed16aba6c48700da29597bc" dependencies = [ - "futures-core", - "futures-task", - "futures-util", + "futures-core", + "futures-task", + "futures-util", ] [[package]] @@ -877,13 +877,13 @@ version = "1.13.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "49a9d51ce47660b1e808d3c990b4709f2f415d928835a17dfd16991515c46bce" dependencies = [ - "fastrand 1.9.0", - "futures-core", - "futures-io", - "memchr", - "parking", - "pin-project-lite", - "waker-fn", + "fastrand 1.9.0", + "futures-core", + "futures-io", + "memchr", + "parking", + "pin-project-lite", + "waker-fn", ] [[package]] @@ -892,11 +892,11 @@ version = "2.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "aeee267a1883f7ebef3700f262d2d54de95dfaf38189015a74fdc4e0c7ad8143" dependencies = [ - "fastrand 2.0.1", - "futures-core", - "futures-io", - "parking", - "pin-project-lite", + "fastrand 2.0.1", + "futures-core", + "futures-io", + "parking", + "pin-project-lite", ] [[package]] @@ -905,9 +905,9 @@ version = "0.3.29" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "53b153fd91e4b0147f4aced87be237c98248656bb01050b96bf3ee89220a8ddb" dependencies = [ - "proc-macro2", - "quote", - "syn 2.0.41", + "proc-macro2", + "quote", + "syn 2.0.41", ] [[package]] @@ -928,16 +928,16 @@ version = "0.3.29" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a19526d624e703a3179b3d322efec918b6246ea0fa51d41124525f00f1cc8104" dependencies = [ - "futures-channel", - "futures-core", - "futures-io", - "futures-macro", - "futures-sink", - "futures-task", - "memchr", - "pin-project-lite", - "pin-utils", - "slab", + "futures-channel", + "futures-core", + "futures-io", + "futures-macro", + "futures-sink", + "futures-task", + "memchr", + "pin-project-lite", + "pin-utils", + "slab", ] [[package]] @@ -946,7 +946,7 @@ version = "0.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c31b6d751ae2c7f11320402d34e41349dd1016f8d5d45e48c4312bc8625af50c" dependencies = [ - "byteorder", + "byteorder", ] [[package]] @@ -955,7 +955,7 @@ version = "0.12.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ffdf9f34f1447443d37393cc6c2b8313aebddcd96906caf34e54c68d8e57d7bd" dependencies = [ - "typenum", + "typenum", ] [[package]] @@ -964,8 +964,8 @@ version = "0.14.7" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "85649ca51fd72272d7821adaf274ad91c288277713d9c18820d8499a7ff69e9a" dependencies = [ - "typenum", - "version_check", + "typenum", + "version_check", ] [[package]] @@ -974,9 +974,9 @@ version = "0.2.11" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "fe9006bed769170c11f845cf00c7c1e9092aeb3f268e007c3e760ac68008070f" dependencies = [ - "cfg-if 1.0.0", - "libc", - "wasi", + "cfg-if 1.0.0", + "libc", + "wasi", ] [[package]] @@ -997,10 +997,10 @@ version = "0.2.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9b995a66bb87bebce9a0f4a95aed01daca4872c050bfcb21653361c03bc35e5c" dependencies = [ - "futures-channel", - "futures-core", - "js-sys", - "wasm-bindgen", + "futures-channel", + "futures-core", + "js-sys", + "wasm-bindgen", ] [[package]] @@ -1009,17 +1009,17 @@ version = "0.3.22" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4d6250322ef6e60f93f9a2162799302cd6f68f79f6e5d85c8c16f14d1d958178" dependencies = [ - "bytes", - "fnv", - "futures-core", - "futures-sink", - "futures-util", - "http", - "indexmap 2.1.0", - "slab", - "tokio", - "tokio-util", - "tracing", + "bytes", + "fnv", + "futures-core", + "futures-sink", + "futures-util", + "http", + "indexmap 2.1.0", + "slab", + "tokio", + "tokio-util", + "tracing", ] [[package]] @@ -1040,7 +1040,7 @@ version = "0.3.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6d621efb26863f0e9924c6ac577e8275e5e6b77455db64ffa6c65c904e9e132c" dependencies = [ - "unicode-segmentation", + "unicode-segmentation", ] [[package]] @@ -1073,7 +1073,7 @@ version = "0.5.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5444c27eef6923071f7ebcc33e3444508466a76f7a2b93da00ed6e19f30c1ddb" dependencies = [ - "windows-sys 0.48.0", + "windows-sys 0.48.0", ] [[package]] @@ -1082,9 +1082,9 @@ version = "0.2.11" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8947b1a6fad4393052c7ba1f4cd97bed3e953a95c79c92ad9b051a04611d9fbb" dependencies = [ - "bytes", - "fnv", - "itoa", + "bytes", + "fnv", + "itoa", ] [[package]] @@ -1093,9 +1093,9 @@ version = "0.4.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7ceab25649e9960c0311ea418d17bee82c0dcec1bd053b5f9a66e265a693bed2" dependencies = [ - "bytes", - "http", - "pin-project-lite", + "bytes", + "http", + "pin-project-lite", ] [[package]] @@ -1104,17 +1104,17 @@ version = "0.6.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a4454aac149336202b5fc06a4451ffd0f032419ae3b3e98212cf38a47b29c548" dependencies = [ - "anyhow", - "async-trait", - "bincode", - "cacache", - "http", - "http-cache-semantics", - "httpdate", - "miette 4.7.1", - "serde", - "thiserror", - "url", + "anyhow", + "async-trait", + "bincode", + "cacache", + "http", + "http-cache-semantics", + "httpdate", + "miette 4.7.1", + "serde", + "thiserror", + "url", ] [[package]] @@ -1123,16 +1123,16 @@ version = "0.4.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9c5229affa77eaf70b605f56fe5b66a3e1f5f2c9df063e94acdc82f321319667" dependencies = [ - "anyhow", - "async-trait", - "http", - "http-cache", - "http-cache-semantics", - "reqwest", - "reqwest-middleware", - "serde", - "task-local-extensions", - "url", + "anyhow", + "async-trait", + "http", + "http-cache", + "http-cache-semantics", + "reqwest", + "reqwest-middleware", + "serde", + "task-local-extensions", + "url", ] [[package]] @@ -1141,10 +1141,10 @@ version = "1.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7aec9f678bca3f4a15194b980f20ed9bfe0dd38e8d298c65c559a93dfbd6380a" dependencies = [ - "http", - "http-serde", - "serde", - "time", + "http", + "http-serde", + "serde", + "time", ] [[package]] @@ -1153,8 +1153,8 @@ version = "1.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6f560b665ad9f1572cfcaf034f7fb84338a7ce945216d64a90fd81f046a3caee" dependencies = [ - "http", - "serde", + "http", + "serde", ] [[package]] @@ -1175,22 +1175,22 @@ version = "0.14.27" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ffb1cfd654a8219eaef89881fdb3bb3b1cdc5fa75ded05d6933b2b382e395468" dependencies = [ - "bytes", - "futures-channel", - "futures-core", - "futures-util", - "h2", - "http", - "http-body", - "httparse", - "httpdate", - "itoa", - "pin-project-lite", - "socket2 0.4.10", - "tokio", - "tower-service", - "tracing", - "want", + "bytes", + "futures-channel", + "futures-core", + "futures-util", + "h2", + "http", + "http-body", + "httparse", + "httpdate", + "itoa", + "pin-project-lite", + "socket2 0.4.10", + "tokio", + "tower-service", + "tracing", + "want", ] [[package]] @@ -1199,12 +1199,12 @@ version = "0.24.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ec3efd23720e2049821a693cbc7e65ea87c72f1c58ff2f9522ff332b1491e590" dependencies = [ - "futures-util", - "http", - "hyper", - "rustls", - "tokio", - "tokio-rustls", + "futures-util", + "http", + "hyper", + "rustls", + "tokio", + "tokio-rustls", ] [[package]] @@ -1213,11 +1213,11 @@ version = "0.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d6183ddfa99b85da61a140bea0efc93fdf56ceaa041b37d553518030827f9905" dependencies = [ - "bytes", - "hyper", - "native-tls", - "tokio", - "tokio-native-tls", + "bytes", + "hyper", + "native-tls", + "tokio", + "tokio-native-tls", ] [[package]] @@ -1226,12 +1226,12 @@ version = "0.1.58" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8326b86b6cff230b97d0d312a6c40a60726df3332e721f72a1b035f451663b20" dependencies = [ - "android_system_properties", - "core-foundation-sys", - "iana-time-zone-haiku", - "js-sys", - "wasm-bindgen", - "windows-core", + "android_system_properties", + "core-foundation-sys", + "iana-time-zone-haiku", + "js-sys", + "wasm-bindgen", + "windows-core", ] [[package]] @@ -1240,7 +1240,7 @@ version = "0.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f31827a206f56af32e590ba56d5d2d085f558508192593743f16b2306495269f" dependencies = [ - "cc", + "cc", ] [[package]] @@ -1251,12 +1251,12 @@ checksum = "b9e0384b61958566e926dc50660321d12159025e767c18e043daf26b70104c39" [[package]] name = "idna" -version = "0.5.0" +version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "634d9b1461af396cad843f47fdba5597a4f9e6ddd4bfb6ff5d85028c25cb12f6" +checksum = "7d20d6b07bfbc108882d88ed8e37d39636dcc260e15e30c45e6ba089610b917c" dependencies = [ - "unicode-bidi", - "unicode-normalization", + "unicode-bidi", + "unicode-normalization", ] [[package]] @@ -1265,9 +1265,9 @@ version = "1.9.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "bd070e393353796e801d209ad339e89596eb4c8d430d18ede6a1cced8fafbd99" dependencies = [ - "autocfg", - "hashbrown 0.12.3", - "serde", + "autocfg", + "hashbrown 0.12.3", + "serde", ] [[package]] @@ -1276,9 +1276,9 @@ version = "2.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d530e1a18b1cb4c484e6e34556a0d948706958449fca0cab753d649f2bce3d1f" dependencies = [ - "equivalent", - "hashbrown 0.14.3", - "serde", + "equivalent", + "hashbrown 0.14.3", + "serde", ] [[package]] @@ -1287,7 +1287,7 @@ version = "0.1.12" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7a5bbe824c507c5da5956355e86a746d82e0e1464f65d862cc5e71da70e94b2c" dependencies = [ - "cfg-if 1.0.0", + "cfg-if 1.0.0", ] [[package]] @@ -1296,9 +1296,9 @@ version = "1.0.11" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "eae7b9aee968036d54dce06cebaefd919e4472e753296daccd6d344e3e2df0c2" dependencies = [ - "hermit-abi", - "libc", - "windows-sys 0.48.0", + "hermit-abi", + "libc", + "windows-sys 0.48.0", ] [[package]] @@ -1313,7 +1313,7 @@ version = "0.10.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b0fd2260e829bddf4cb6ea802289de2f86d6a7a690192fbe91b3f46e0f2c8473" dependencies = [ - "either", + "either", ] [[package]] @@ -1322,7 +1322,7 @@ version = "0.11.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b1c173a5686ce8bfa551b3563d0c2170bf24ca44da99c7ca4bfdab5418c3fe57" dependencies = [ - "either", + "either", ] [[package]] @@ -1337,12 +1337,12 @@ version = "0.19.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c6df18c2e3db7e453d3c6ac5b3e9d5182664d28788126d39b91f2d1e22b017ec" dependencies = [ - "cesu8", - "combine", - "jni-sys", - "log", - "thiserror", - "walkdir", + "cesu8", + "combine", + "jni-sys", + "log", + "thiserror", + "walkdir", ] [[package]] @@ -1353,11 +1353,11 @@ checksum = "8eaf4bc02d17cbdd7ff4c7438cafcdf7fb9a4613313ad11b4f8fefe7d3fa0130" [[package]] name = "js-sys" -version = "0.3.66" +version = "0.3.55" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cee9c64da59eae3b50095c18d3e74f8b73c0b86d2792824ff01bbce68ba229ca" +checksum = "7cc9ffccd38c451a86bf13657df244e9c3f37493cce8e5e21e940963777acc84" dependencies = [ - "wasm-bindgen", + "wasm-bindgen", ] [[package]] @@ -1366,7 +1366,7 @@ version = "1.0.7" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0de8b303297635ad57c9f5059fd9cee7a47f8e8daa09df0fcd07dd39fb22977f" dependencies = [ - "log", + "log", ] [[package]] @@ -1404,10 +1404,10 @@ name = "localsearch" version = "0.1.0" source = "git+https://github.com/Stremio/local-search?branch=main#74fefe1da2fa17d2b4ef7e3e629da00f3946ee72" dependencies = [ - "fst", - "fxhash", - "num-traits", - "utf8-ranges", + "fst", + "fxhash", + "num-traits", + "utf8-ranges", ] [[package]] @@ -1416,7 +1416,7 @@ version = "0.4.20" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b5e6163cb8c49088c2c36f57875e58ccd8c87c7427f7fbd50ea6710b2f3f2e8f" dependencies = [ - "value-bag", + "value-bag", ] [[package]] @@ -1425,7 +1425,7 @@ version = "0.13.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c000ca4d908ff18ac99b93a062cb8958d331c3220719c52e77cb19cc6ac5d2c1" dependencies = [ - "logos-derive", + "logos-derive", ] [[package]] @@ -1434,12 +1434,12 @@ version = "0.13.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "dc487311295e0002e452025d6b580b77bb17286de87b57138f3b5db711cded68" dependencies = [ - "beef", - "fnv", - "proc-macro2", - "quote", - "regex-syntax 0.6.29", - "syn 2.0.41", + "beef", + "fnv", + "proc-macro2", + "quote", + "regex-syntax 0.6.29", + "syn 2.0.41", ] [[package]] @@ -1448,7 +1448,7 @@ version = "0.13.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "dbfc0d229f1f42d790440136d941afd806bc9e949e2bcb8faa813b0f00d1267e" dependencies = [ - "logos-codegen", + "logos-codegen", ] [[package]] @@ -1457,8 +1457,8 @@ version = "2.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ac3b4c4004e88aca00cc0c60782e5642c8fc628deca19e530ce58aa76e737d74" dependencies = [ - "lazy_static", - "regex", + "lazy_static", + "regex", ] [[package]] @@ -1479,7 +1479,7 @@ version = "0.5.10" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "83faa42c0a078c393f6b29d5db232d8be22776a891f8f56e5284faee4a20b327" dependencies = [ - "libc", + "libc", ] [[package]] @@ -1488,10 +1488,10 @@ version = "4.7.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1c90329e44f9208b55f45711f9558cec15d7ef8295cc65ecd6d4188ae8edc58c" dependencies = [ - "miette-derive 4.7.1", - "once_cell", - "thiserror", - "unicode-width", + "miette-derive 4.7.1", + "once_cell", + "thiserror", + "unicode-width", ] [[package]] @@ -1500,10 +1500,10 @@ version = "5.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "59bb584eaeeab6bd0226ccf3509a69d7936d148cf3d036ad350abe35e8c6856e" dependencies = [ - "miette-derive 5.10.0", - "once_cell", - "thiserror", - "unicode-width", + "miette-derive 5.10.0", + "once_cell", + "thiserror", + "unicode-width", ] [[package]] @@ -1512,9 +1512,9 @@ version = "4.7.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6b5bc45b761bcf1b5e6e6c4128cd93b84c218721a8d9b894aa0aff4ed180174c" dependencies = [ - "proc-macro2", - "quote", - "syn 1.0.109", + "proc-macro2", + "quote", + "syn 1.0.109", ] [[package]] @@ -1523,9 +1523,9 @@ version = "5.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "49e7bc1560b95a3c4a25d03de42fe76ca718ab92d1a22a55b9b4cf67b3ae635c" dependencies = [ - "proc-macro2", - "quote", - "syn 2.0.41", + "proc-macro2", + "quote", + "syn 2.0.41", ] [[package]] @@ -1540,8 +1540,8 @@ version = "2.0.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4192263c238a5f0d0c6bfd21f336a313a4ce1c450542449ca191bb657b4642ef" dependencies = [ - "mime", - "unicase", + "mime", + "unicase", ] [[package]] @@ -1550,7 +1550,7 @@ version = "0.7.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e7810e0be55b428ada41041c41f32c9f1a42817901b4ccf45fa3d4b6561e74c7" dependencies = [ - "adler", + "adler", ] [[package]] @@ -1559,9 +1559,9 @@ version = "0.8.10" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8f3d0b296e374a4e6f3c7b0a1f5a51d748a0d34c85e7dc48fc3fa9a87657fe09" dependencies = [ - "libc", - "wasi", - "windows-sys 0.48.0", + "libc", + "wasi", + "windows-sys 0.48.0", ] [[package]] @@ -1576,16 +1576,16 @@ version = "0.2.11" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "07226173c32f2926027b63cce4bcd8076c3552846cbe7925f3aaffeac0a3b92e" dependencies = [ - "lazy_static", - "libc", - "log", - "openssl", - "openssl-probe", - "openssl-sys", - "schannel", - "security-framework", - "security-framework-sys", - "tempfile", + "lazy_static", + "libc", + "log", + "openssl", + "openssl-probe", + "openssl-sys", + "schannel", + "security-framework", + "security-framework-sys", + "tempfile", ] [[package]] @@ -1600,11 +1600,11 @@ version = "0.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b05180d69e3da0e530ba2a1dae5110317e49e3b7f3d41be227dc5f92e49ee7af" dependencies = [ - "num-complex", - "num-integer", - "num-iter", - "num-rational", - "num-traits", + "num-complex", + "num-integer", + "num-iter", + "num-rational", + "num-traits", ] [[package]] @@ -1613,17 +1613,23 @@ version = "0.4.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1ba157ca0885411de85d6ca030ba7e2a83a28636056c7c699b07c8b6f7383214" dependencies = [ - "num-traits", + "num-traits", ] +[[package]] +name = "num-conv" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "51d515d32fb182ee37cda2ccdcb92950d6a3c2893aa280e540671c2cd0f3b1d9" + [[package]] name = "num-integer" version = "0.1.45" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "225d3389fb3509a24c93f5c29eb6bde2586b98d9f016636dff58d7c6f7569cd9" dependencies = [ - "autocfg", - "num-traits", + "autocfg", + "num-traits", ] [[package]] @@ -1632,9 +1638,9 @@ version = "0.1.43" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7d03e6c028c5dc5cac6e2dec0efda81fc887605bb3d884578bb6d6bf7514e252" dependencies = [ - "autocfg", - "num-integer", - "num-traits", + "autocfg", + "num-integer", + "num-traits", ] [[package]] @@ -1643,9 +1649,9 @@ version = "0.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0638a1c9d0a3c0914158145bc76cff373a75a627e6ecbfb71cbe6f453a5a19b0" dependencies = [ - "autocfg", - "num-integer", - "num-traits", + "autocfg", + "num-integer", + "num-traits", ] [[package]] @@ -1654,7 +1660,7 @@ version = "0.2.17" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "39e3200413f237f41ab11ad6d161bc7239c84dcb631773ccd7de3dfe4b5c267c" dependencies = [ - "autocfg", + "autocfg", ] [[package]] @@ -1663,8 +1669,8 @@ version = "1.16.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4161fcb6d602d4d2081af7c3a45852d875a03dd337a6bfdd6e06407b61342a43" dependencies = [ - "hermit-abi", - "libc", + "hermit-abi", + "libc", ] [[package]] @@ -1673,7 +1679,7 @@ version = "0.32.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9cf5f9dd3933bd50a9e1f149ec995f39ae2c496d31fd772c1fd45ebc27e902b0" dependencies = [ - "memchr", + "memchr", ] [[package]] @@ -1700,13 +1706,13 @@ version = "0.10.40" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "fb81a6430ac911acb25fe5ac8f1d2af1b4ea8a4fdfda0f1ee4292af2e2d8eb0e" dependencies = [ - "bitflags 1.3.2", - "cfg-if 1.0.0", - "foreign-types", - "libc", - "once_cell", - "openssl-macros", - "openssl-sys", + "bitflags 1.3.2", + "cfg-if 1.0.0", + "foreign-types", + "libc", + "once_cell", + "openssl-macros", + "openssl-sys", ] [[package]] @@ -1715,9 +1721,9 @@ version = "0.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a948666b637a0f465e8564c73e89d4dde00d72d4d473cc972f390fc3dcee7d9c" dependencies = [ - "proc-macro2", - "quote", - "syn 2.0.41", + "proc-macro2", + "quote", + "syn 2.0.41", ] [[package]] @@ -1732,7 +1738,7 @@ version = "111.25.0+1.1.1t" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3173cd3626c43e3854b1b727422a276e568d9ec5fe8cec197822cf52cfb743d6" dependencies = [ - "cc", + "cc", ] [[package]] @@ -1741,12 +1747,12 @@ version = "0.9.74" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "835363342df5fba8354c5b453325b110ffd54044e588c539cf2f20a8014e4cb1" dependencies = [ - "autocfg", - "cc", - "libc", - "openssl-src", - "pkg-config", - "vcpkg", + "autocfg", + "cc", + "libc", + "openssl-src", + "pkg-config", + "vcpkg", ] [[package]] @@ -1767,8 +1773,8 @@ version = "0.6.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e1d3afd2628e69da2be385eb6f2fd57c8ac7977ceeff6dc166ff1657b0e386a9" dependencies = [ - "fixedbitset", - "indexmap 2.1.0", + "fixedbitset", + "indexmap 2.1.0", ] [[package]] @@ -1789,9 +1795,9 @@ version = "0.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "668d31b1c4eba19242f2088b2bf3316b82ca31082a8335764db4e083db7485d4" dependencies = [ - "atomic-waker", - "fastrand 2.0.1", - "futures-io", + "atomic-waker", + "fastrand 2.0.1", + "futures-io", ] [[package]] @@ -1806,14 +1812,14 @@ version = "2.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4b2d323e8ca7996b3e23126511a523f7e62924d93ecd5ae73b333815b0eb3dce" dependencies = [ - "autocfg", - "bitflags 1.3.2", - "cfg-if 1.0.0", - "concurrent-queue", - "libc", - "log", - "pin-project-lite", - "windows-sys 0.48.0", + "autocfg", + "bitflags 1.3.2", + "cfg-if 1.0.0", + "concurrent-queue", + "libc", + "log", + "pin-project-lite", + "windows-sys 0.48.0", ] [[package]] @@ -1822,12 +1828,12 @@ version = "3.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "cf63fa624ab313c11656b4cda960bfc46c410187ad493c41f6ba2d8c1e991c9e" dependencies = [ - "cfg-if 1.0.0", - "concurrent-queue", - "pin-project-lite", - "rustix 0.38.28", - "tracing", - "windows-sys 0.52.0", + "cfg-if 1.0.0", + "concurrent-queue", + "pin-project-lite", + "rustix 0.38.28", + "tracing", + "windows-sys 0.52.0", ] [[package]] @@ -1842,8 +1848,8 @@ version = "0.2.15" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ae005bd773ab59b4725093fd7df83fd7892f7d8eafb48dbd7de6e024e4215f9d" dependencies = [ - "proc-macro2", - "syn 2.0.41", + "proc-macro2", + "syn 2.0.41", ] [[package]] @@ -1852,8 +1858,8 @@ version = "1.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7f4c021e1093a56626774e81216a4ce732a735e5bad4868a03f3ed65ca0c3919" dependencies = [ - "once_cell", - "toml_edit", + "once_cell", + "toml_edit", ] [[package]] @@ -1862,11 +1868,11 @@ version = "1.0.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "da25490ff9892aab3fcf7c36f08cfb902dd3e71ca0f9f9517bea02a73a5ce38c" dependencies = [ - "proc-macro-error-attr", - "proc-macro2", - "quote", - "syn 1.0.109", - "version_check", + "proc-macro-error-attr", + "proc-macro2", + "quote", + "syn 1.0.109", + "version_check", ] [[package]] @@ -1875,9 +1881,9 @@ version = "1.0.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a1be40180e52ecc98ad80b184934baf3d0d29f979574e439af5a55274b35f869" dependencies = [ - "proc-macro2", - "quote", - "version_check", + "proc-macro2", + "quote", + "version_check", ] [[package]] @@ -1886,7 +1892,7 @@ version = "1.0.70" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "39278fbbf5fb4f646ce651690877f89d1c5811a3d4acb27700c1cb3cdb78fd3b" dependencies = [ - "unicode-ident", + "unicode-ident", ] [[package]] @@ -1895,9 +1901,9 @@ version = "0.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d0c2a098cd8aaa29f66da27a684ad19f4b7bc886f576abf12f7df4a7391071c7" dependencies = [ - "proc-macro2", - "quote", - "syn 2.0.41", + "proc-macro2", + "quote", + "syn 2.0.41", ] [[package]] @@ -1906,8 +1912,8 @@ version = "0.12.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "146c289cda302b98a28d40c8b3b90498d6e526dd24ac2ecea73e4e491685b94a" dependencies = [ - "bytes", - "prost-derive", + "bytes", + "prost-derive", ] [[package]] @@ -1916,20 +1922,20 @@ version = "0.12.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c55e02e35260070b6f716a2423c2ff1c3bb1642ddca6f99e1f26d06268a0e2d2" dependencies = [ - "bytes", - "heck 0.4.1", - "itertools 0.10.5", - "log", - "multimap", - "once_cell", - "petgraph", - "prettyplease", - "prost", - "prost-types", - "regex", - "syn 2.0.41", - "tempfile", - "which", + "bytes", + "heck 0.4.1", + "itertools 0.11.0", + "log", + "multimap", + "once_cell", + "petgraph", + "prettyplease", + "prost", + "prost-types", + "regex", + "syn 2.0.41", + "tempfile", + "which", ] [[package]] @@ -1938,11 +1944,11 @@ version = "0.12.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "efb6c9a1dd1def8e2124d17e83a20af56f1570d6c2d2bd9e266ccb768df3840e" dependencies = [ - "anyhow", - "itertools 0.10.5", - "proc-macro2", - "quote", - "syn 2.0.41", + "anyhow", + "itertools 0.11.0", + "proc-macro2", + "quote", + "syn 2.0.41", ] [[package]] @@ -1951,11 +1957,11 @@ version = "0.12.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "057237efdb71cf4b3f9396302a3d6599a92fa94063ba537b66130980ea9909f3" dependencies = [ - "logos", - "miette 5.10.0", - "once_cell", - "prost", - "prost-types", + "logos", + "miette 5.10.0", + "once_cell", + "prost", + "prost-types", ] [[package]] @@ -1964,7 +1970,7 @@ version = "0.12.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "193898f59edcf43c26227dcd4c8427f00d99d61e95dcde58dabd49fa291d470e" dependencies = [ - "prost", + "prost", ] [[package]] @@ -1973,13 +1979,13 @@ version = "0.5.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "00bb76c5f6221de491fe2c8f39b106330bbd9762c6511119c07940e10eb9ff11" dependencies = [ - "bytes", - "miette 5.10.0", - "prost", - "prost-reflect", - "prost-types", - "protox-parse", - "thiserror", + "bytes", + "miette 5.10.0", + "prost", + "prost-reflect", + "prost-types", + "protox-parse", + "thiserror", ] [[package]] @@ -1988,10 +1994,10 @@ version = "0.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7b4581f441c58863525a3e6bec7b8de98188cf75239a56c725a3e7288450a33f" dependencies = [ - "logos", - "miette 5.10.0", - "prost-types", - "thiserror", + "logos", + "miette 5.10.0", + "prost-types", + "thiserror", ] [[package]] @@ -2000,7 +2006,7 @@ version = "1.0.33" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5267fca4496028628a95160fc423a33e8b2e6af8a5302579e322e4b520293cae" dependencies = [ - "proc-macro2", + "proc-macro2", ] [[package]] @@ -2009,7 +2015,7 @@ version = "0.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4722d768eff46b75989dd134e5c353f0d6296e5aaa3132e776cbdb56be7731aa" dependencies = [ - "bitflags 1.3.2", + "bitflags 1.3.2", ] [[package]] @@ -2018,10 +2024,10 @@ version = "1.10.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "380b951a9c5e80ddfd6136919eef32310721aa4aacd4889a8d39124b026ab343" dependencies = [ - "aho-corasick", - "memchr", - "regex-automata", - "regex-syntax 0.8.2", + "aho-corasick", + "memchr", + "regex-automata", + "regex-syntax 0.8.2", ] [[package]] @@ -2030,9 +2036,9 @@ version = "0.4.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5f804c7828047e88b2d32e2d7fe5a105da8ee3264f01902f796c8e067dc2483f" dependencies = [ - "aho-corasick", - "memchr", - "regex-syntax 0.8.2", + "aho-corasick", + "memchr", + "regex-syntax 0.8.2", ] [[package]] @@ -2053,42 +2059,42 @@ version = "0.11.22" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "046cd98826c46c2ac8ddecae268eb5c2e58628688a5fc7a2643704a73faba95b" dependencies = [ - "base64 0.21.5", - "bytes", - "encoding_rs", - "futures-core", - "futures-util", - "h2", - "http", - "http-body", - "hyper", - "hyper-rustls", - "hyper-tls", - "ipnet", - "js-sys", - "log", - "mime", - "mime_guess", - "native-tls", - "once_cell", - "percent-encoding", - "pin-project-lite", - "rustls", - "rustls-pemfile", - "serde", - "serde_json", - "serde_urlencoded", - "system-configuration", - "tokio", - "tokio-native-tls", - "tokio-rustls", - "tower-service", - "url", - "wasm-bindgen", - "wasm-bindgen-futures", - "web-sys", - "webpki-roots", - "winreg", + "base64 0.21.5", + "bytes", + "encoding_rs", + "futures-core", + "futures-util", + "h2", + "http", + "http-body", + "hyper", + "hyper-rustls", + "hyper-tls", + "ipnet", + "js-sys", + "log", + "mime", + "mime_guess", + "native-tls", + "once_cell", + "percent-encoding", + "pin-project-lite", + "rustls", + "rustls-pemfile", + "serde", + "serde_json", + "serde_urlencoded", + "system-configuration", + "tokio", + "tokio-native-tls", + "tokio-rustls", + "tower-service", + "url", + "wasm-bindgen", + "wasm-bindgen-futures", + "web-sys", + "webpki-roots", + "winreg", ] [[package]] @@ -2097,14 +2103,14 @@ version = "0.1.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "69539cea4148dce683bec9dc95be3f0397a9bb2c248a49c8296a9d21659a8cdd" dependencies = [ - "anyhow", - "async-trait", - "futures", - "http", - "reqwest", - "serde", - "task-local-extensions", - "thiserror", + "anyhow", + "async-trait", + "futures", + "http", + "reqwest", + "serde", + "task-local-extensions", + "thiserror", ] [[package]] @@ -2113,12 +2119,12 @@ version = "0.17.7" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "688c63d65483050968b2a8937f7995f443e27041a0f7700aa59b0822aedebb74" dependencies = [ - "cc", - "getrandom", - "libc", - "spin", - "untrusted", - "windows-sys 0.48.0", + "cc", + "getrandom", + "libc", + "spin", + "untrusted", + "windows-sys 0.48.0", ] [[package]] @@ -2133,7 +2139,7 @@ version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "bfa0f585226d2e68097d4f95d113b15b83a82e819ab25717ec0590d9584ef366" dependencies = [ - "semver", + "semver", ] [[package]] @@ -2142,12 +2148,12 @@ version = "0.37.27" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "fea8ca367a3a01fe35e6943c400addf443c0f57670e6ec51196f71a4b8762dd2" dependencies = [ - "bitflags 1.3.2", - "errno", - "io-lifetimes", - "libc", - "linux-raw-sys 0.3.8", - "windows-sys 0.48.0", + "bitflags 1.3.2", + "errno", + "io-lifetimes", + "libc", + "linux-raw-sys 0.3.8", + "windows-sys 0.48.0", ] [[package]] @@ -2156,11 +2162,11 @@ version = "0.38.28" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "72e572a5e8ca657d7366229cdde4bd14c4eb5499a9573d4d366fe1b599daa316" dependencies = [ - "bitflags 2.4.1", - "errno", - "libc", - "linux-raw-sys 0.4.12", - "windows-sys 0.52.0", + "bitflags 2.4.1", + "errno", + "libc", + "linux-raw-sys 0.4.12", + "windows-sys 0.52.0", ] [[package]] @@ -2169,10 +2175,10 @@ version = "0.21.10" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f9d5a6813c0759e4609cd494e8e725babae6a2ca7b62a5536a13daaec6fcb7ba" dependencies = [ - "log", - "ring", - "rustls-webpki", - "sct", + "log", + "ring", + "rustls-webpki", + "sct", ] [[package]] @@ -2181,7 +2187,7 @@ version = "1.0.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1c74cae0a4cf6ccbbf5f359f08efdf8ee7e1dc532573bf0db71968cb56b1448c" dependencies = [ - "base64 0.21.5", + "base64 0.21.5", ] [[package]] @@ -2190,8 +2196,8 @@ version = "0.101.7" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8b6275d1ee7a1cd780b64aca7726599a1dbc893b1e64144529e55c3c2f745765" dependencies = [ - "ring", - "untrusted", + "ring", + "untrusted", ] [[package]] @@ -2212,7 +2218,7 @@ version = "1.0.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "93fc1dc3aaa9bfed95e02e6eadabb4baf7e3078b0bd1b4d7b6b0b68378900502" dependencies = [ - "winapi-util", + "winapi-util", ] [[package]] @@ -2221,7 +2227,7 @@ version = "0.1.22" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0c3733bf4cf7ea0880754e19cb5a462007c4a8c1914bff372ccc95b464f1df88" dependencies = [ - "windows-sys 0.48.0", + "windows-sys 0.48.0", ] [[package]] @@ -2230,8 +2236,8 @@ version = "0.7.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "da046153aa2352493d6cb7da4b6e5c0c057d8a1d0a9aa8560baffdd945acd414" dependencies = [ - "ring", - "untrusted", + "ring", + "untrusted", ] [[package]] @@ -2240,11 +2246,11 @@ version = "2.9.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "05b64fb303737d99b81884b2c63433e9ae28abebe5eb5045dcdd175dc2ecf4de" dependencies = [ - "bitflags 1.3.2", - "core-foundation", - "core-foundation-sys", - "libc", - "security-framework-sys", + "bitflags 1.3.2", + "core-foundation", + "core-foundation-sys", + "libc", + "security-framework-sys", ] [[package]] @@ -2253,8 +2259,8 @@ version = "2.9.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e932934257d3b408ed8f30db49d85ea163bfe74961f017f405b025af298f0c7a" dependencies = [ - "core-foundation-sys", - "libc", + "core-foundation-sys", + "libc", ] [[package]] @@ -2263,7 +2269,7 @@ version = "1.0.20" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "836fa6a3e1e547f9a2c4040802ec865b5d85f4014efe00555d7090a3dcaa1090" dependencies = [ - "serde", + "serde", ] [[package]] @@ -2272,7 +2278,7 @@ version = "1.0.193" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "25dd9975e68d0cb5aa1120c288333fc98731bd1dd12f561e468ea4728c042b89" dependencies = [ - "serde_derive", + "serde_derive", ] [[package]] @@ -2281,8 +2287,8 @@ version = "0.2.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a70dfc7b7438b99896e7f8992363ab8e2c4ba26aa5ec675d32d1c3c2c33d413e" dependencies = [ - "serde", - "serde_bytes", + "serde", + "serde_bytes", ] [[package]] @@ -2291,7 +2297,7 @@ version = "0.11.12" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ab33ec92f677585af6d88c65593ae2375adde54efdbf16d597f2cbc7a6d368ff" dependencies = [ - "serde", + "serde", ] [[package]] @@ -2300,9 +2306,9 @@ version = "1.0.193" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "43576ca501357b9b071ac53cdc7da8ef0cbd9493d8df094cd821777ea6e894d3" dependencies = [ - "proc-macro2", - "quote", - "syn 2.0.41", + "proc-macro2", + "quote", + "syn 2.0.41", ] [[package]] @@ -2311,9 +2317,9 @@ version = "1.0.108" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3d1c7e3eac408d115102c4c24ad393e0821bb3a5df4d506a80f85f7a742a526b" dependencies = [ - "itoa", - "ryu", - "serde", + "itoa", + "ryu", + "serde", ] [[package]] @@ -2322,8 +2328,8 @@ version = "0.1.14" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4beec8bce849d58d06238cb50db2e1c417cfeafa4c63f692b15c82b7c80f8335" dependencies = [ - "itoa", - "serde", + "itoa", + "serde", ] [[package]] @@ -2332,8 +2338,8 @@ version = "0.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2c43307d0640738af32fe8d01e47119bc0fc8a686be470a44a586caff76dfb34" dependencies = [ - "serde", - "url", + "serde", + "url", ] [[package]] @@ -2342,10 +2348,10 @@ version = "0.7.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d3491c14715ca2294c4d6a88f15e84739788c1d030eed8c110436aafdaa2f3fd" dependencies = [ - "form_urlencoded", - "itoa", - "ryu", - "serde", + "form_urlencoded", + "itoa", + "ryu", + "serde", ] [[package]] @@ -2354,16 +2360,16 @@ version = "3.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ee80b0e361bbf88fd2f6e242ccd19cfda072cb0faa6ae694ecee08199938569a" dependencies = [ - "base64 0.21.5", - "chrono", - "hex 0.4.3", - "indexmap 1.9.3", - "indexmap 2.1.0", - "serde", - "serde_derive", - "serde_json", - "serde_with_macros", - "time", + "base64 0.21.5", + "chrono", + "hex 0.4.3", + "indexmap 1.9.3", + "indexmap 2.1.0", + "serde", + "serde_derive", + "serde_json", + "serde_with_macros", + "time", ] [[package]] @@ -2372,10 +2378,10 @@ version = "3.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6561dc161a9224638a31d876ccdfefbc1df91d3f3a8342eddb35f055d48c7655" dependencies = [ - "darling", - "proc-macro2", - "quote", - "syn 2.0.41", + "darling", + "proc-macro2", + "quote", + "syn 2.0.41", ] [[package]] @@ -2384,10 +2390,10 @@ version = "0.8.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f7d94d0bede923b3cea61f3f1ff57ff8cdfd77b400fb8f9998949e0cf04163df" dependencies = [ - "block-buffer 0.7.3", - "digest 0.8.1", - "fake-simd", - "opaque-debug 0.2.3", + "block-buffer 0.7.3", + "digest 0.8.1", + "fake-simd", + "opaque-debug 0.2.3", ] [[package]] @@ -2396,11 +2402,11 @@ version = "0.9.8" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "99cd6713db3cf16b6c84e06321e049a9b9f699826e16096d23bbcc44d15d51a6" dependencies = [ - "block-buffer 0.9.0", - "cfg-if 1.0.0", - "cpufeatures", - "digest 0.9.0", - "opaque-debug 0.3.0", + "block-buffer 0.9.0", + "cfg-if 1.0.0", + "cpufeatures", + "digest 0.9.0", + "opaque-debug 0.3.0", ] [[package]] @@ -2409,9 +2415,9 @@ version = "0.10.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e3bf829a2d51ab4a5ddf1352d8470c140cadc8301b2ae1789db023f01cedd6ba" dependencies = [ - "cfg-if 1.0.0", - "cpufeatures", - "digest 0.10.7", + "cfg-if 1.0.0", + "cpufeatures", + "digest 0.10.7", ] [[package]] @@ -2420,10 +2426,10 @@ version = "0.8.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a256f46ea78a0c0d9ff00077504903ac881a1dafdc20da66545699e7776b3e69" dependencies = [ - "block-buffer 0.7.3", - "digest 0.8.1", - "fake-simd", - "opaque-debug 0.2.3", + "block-buffer 0.7.3", + "digest 0.8.1", + "fake-simd", + "opaque-debug 0.2.3", ] [[package]] @@ -2432,11 +2438,11 @@ version = "0.9.9" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4d58a1e1bf39749807d89cf2d98ac2dfa0ff1cb3faa38fbb64dd88ac8013d800" dependencies = [ - "block-buffer 0.9.0", - "cfg-if 1.0.0", - "cpufeatures", - "digest 0.9.0", - "opaque-debug 0.3.0", + "block-buffer 0.9.0", + "cfg-if 1.0.0", + "cpufeatures", + "digest 0.9.0", + "opaque-debug 0.3.0", ] [[package]] @@ -2445,9 +2451,9 @@ version = "0.10.8" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "793db75ad2bcafc3ffa7c68b215fee268f537982cd901d132f89c6343f3a3dc8" dependencies = [ - "cfg-if 1.0.0", - "cpufeatures", - "digest 0.10.7", + "cfg-if 1.0.0", + "cpufeatures", + "digest 0.10.7", ] [[package]] @@ -2456,7 +2462,7 @@ version = "1.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d8229b473baa5980ac72ef434c4415e70c4b5e71b423043adb4ba059f89c99a1" dependencies = [ - "libc", + "libc", ] [[package]] @@ -2465,7 +2471,7 @@ version = "0.4.9" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8f92a496fb766b417c996b9c5e57daf2f7ad3b0bebe1ccfca4856390e3d3bb67" dependencies = [ - "autocfg", + "autocfg", ] [[package]] @@ -2474,7 +2480,7 @@ version = "0.6.14" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b97fcaeba89edba30f044a10c6a3cc39df9c3f17d7cd829dd1446cab35f890e0" dependencies = [ - "maybe-uninit", + "maybe-uninit", ] [[package]] @@ -2483,8 +2489,8 @@ version = "0.4.10" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9f7916fc008ca5542385b89a3d3ce689953c143e9304a9bf8beec1de48994c0d" dependencies = [ - "libc", - "winapi", + "libc", + "winapi", ] [[package]] @@ -2493,8 +2499,8 @@ version = "0.5.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7b5fac59a5cb5dd637972e5fca70daf0523c9067fcdc4842f053dae04a18f8e9" dependencies = [ - "libc", - "windows-sys 0.48.0", + "libc", + "windows-sys 0.48.0", ] [[package]] @@ -2509,114 +2515,140 @@ version = "7.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a9cec0d388f39fbe79d7aa600e8d38053bf97b1bc8d350da7c0ba800d0f423f2" dependencies = [ - "base64 0.10.1", - "digest 0.8.1", - "hex 0.3.2", - "serde", - "sha-1 0.8.2", - "sha2 0.8.2", - "thiserror", + "base64 0.10.1", + "digest 0.8.1", + "hex 0.3.2", + "serde", + "sha-1 0.8.2", + "sha2 0.8.2", + "thiserror", ] [[package]] name = "stremio-core" version = "0.1.0" -source = "git+https://github.com/Stremio/stremio-core?branch=development#f74c212752443ef625a17d48ce4dc955f2300bc7" -dependencies = [ - "anyhow", - "base64 0.21.5", - "boolinator", - "chrono", - "derivative", - "derive_more", - "either", - "enclose", - "flate2", - "futures", - "hex 0.4.3", - "http", - "itertools 0.11.0", - "lazy_static", - "lazysort", - "localsearch", - "magnet-url", - "num", - "once_cell", - "percent-encoding", - "regex", - "semver", - "serde", - "serde_bencode", - "serde_json", - "serde_path_to_error", - "serde_url_params", - "serde_with", - "sha1", - "sha2 0.10.8", - "stremio-derive", - "stremio-official-addons", - "stremio-serde-hex", - "stremio-watched-bitfield", - "strum 0.25.0", - "thiserror", - "tracing", - "url", +source = "git+https://github.com/Stremio/stremio-core?branch=feat/serialize-model-separatelly-from-creating-it#212584dd9409600bb60f55ebc84139319b4642e2" +dependencies = [ + "anyhow", + "base64 0.21.5", + "boolinator", + "chrono", + "derivative", + "derive_more", + "either", + "enclose", + "flate2", + "futures", + "hex 0.4.3", + "http", + "itertools 0.11.0", + "lazy_static", + "lazysort", + "localsearch", + "magnet-url", + "num", + "once_cell", + "percent-encoding", + "regex", + "semver", + "serde", + "serde_bencode", + "serde_json", + "serde_path_to_error", + "serde_url_params", + "serde_with", + "sha1", + "sha2 0.10.8", + "stremio-derive", + "stremio-official-addons", + "stremio-serde-hex", + "stremio-watched-bitfield", + "strum 0.25.0", + "thiserror", + "tracing", + "url", ] [[package]] name = "stremio-core-android" version = "1.2.6" dependencies = [ - "Inflector", - "auto_impl", - "base64 0.13.1", - "boolinator", - "bytes", - "cfg-if 0.1.10", - "chrono", - "either", - "enclose", - "flate2", - "futures", - "getrandom", - "glob", - "hex 0.4.3", - "http", - "http-cache-reqwest", - "itertools 0.10.5", - "jni", - "lazy_static", - "once_cell", - "openssl", - "percent-encoding", - "prost", - "prost-build", - "prost-types", - "protox", - "reqwest", - "reqwest-middleware", - "semver", - "serde", - "serde_json", - "serde_path_to_error", - "stremio-core", - "stremio-watched-bitfield", - "strum 0.22.0", - "tokio", - "url", + "Inflector", + "auto_impl", + "base64 0.13.1", + "boolinator", + "bytes", + "cfg-if 0.1.10", + "chrono", + "either", + "enclose", + "flate2", + "futures", + "getrandom", + "glob", + "hex 0.4.3", + "http", + "http-cache-reqwest", + "itertools 0.10.5", + "jni", + "lazy_static", + "once_cell", + "openssl", + "percent-encoding", + "prost", + "prost-build", + "prost-types", + "protox", + "reqwest", + "reqwest-middleware", + "semver", + "serde", + "serde_json", + "serde_path_to_error", + "stremio-core", + "stremio-core-web", + "strum 0.22.0", + "tokio", + "url", +] + +[[package]] +name = "stremio-core-web" +version = "0.47.7" +source = "git+https://github.com/Stremio/stremio-core?branch=feat/serialize-model-separatelly-from-creating-it#212584dd9409600bb60f55ebc84139319b4642e2" +dependencies = [ + "Inflector", + "boolinator", + "cfg-if 1.0.0", + "chrono", + "either", + "enclose", + "futures", + "hex 0.4.3", + "http", + "itertools 0.10.5", + "lazy_static", + "regex", + "semver", + "serde", + "serde_json", + "serde_path_to_error", + "stremio-core", + "tracing", + "url", ] [[package]] name = "stremio-derive" version = "0.1.0" -source = "git+https://github.com/Stremio/stremio-core?branch=development#f74c212752443ef625a17d48ce4dc955f2300bc7" +source = "git+https://github.com/Stremio/stremio-core?branch=feat/serialize-model-separatelly-from-creating-it#212584dd9409600bb60f55ebc84139319b4642e2" dependencies = [ - "case", - "proc-macro-crate", - "proc-macro2", - "proc_macro_roids", - "quote", - "syn 2.0.41", + "case", + "proc-macro-crate", + "proc-macro2", + "proc_macro_roids", + "quote", + "syn 2.0.41", ] [[package]] @@ -2625,8 +2657,8 @@ version = "2.0.12" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5b03b5836f294463f2ad0eeebac3bcde05dcbecfefa4fc6da2029c5e15d17ad9" dependencies = [ - "once_cell", - "serde_json", + "once_cell", + "serde_json", ] [[package]] @@ -2635,19 +2667,19 @@ version = "0.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5a5600c4d6b97a1e6b4c0a9fa6e14d94eba885f2aa7610fc52a1557a9a140e69" dependencies = [ - "array-init", - "serde", - "smallvec", + "array-init", + "serde", + "smallvec", ] [[package]] name = "stremio-watched-bitfield" version = "0.1.0" -source = "git+https://github.com/Stremio/stremio-core?branch=development#f74c212752443ef625a17d48ce4dc955f2300bc7" +source = "git+https://github.com/Stremio/stremio-core?branch=feat/serialize-model-separatelly-from-creating-it#212584dd9409600bb60f55ebc84139319b4642e2" dependencies = [ - "base64 0.13.1", - "flate2", - "serde", + "base64 0.13.1", + "flate2", + "serde", ] [[package]] @@ -2662,7 +2694,7 @@ version = "0.22.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f7ac893c7d471c8a21f31cfe213ec4f6d9afeed25537c772e08ef3f005f8729e" dependencies = [ - "strum_macros 0.22.0", + "strum_macros 0.22.0", ] [[package]] @@ -2671,7 +2703,7 @@ version = "0.25.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "290d54ea6f91c969195bdbcd7442c8c2a2ba87da8bf60a7ee86a235d4bc1e125" dependencies = [ - "strum_macros 0.25.3", + "strum_macros 0.25.3", ] [[package]] @@ -2680,10 +2712,10 @@ version = "0.22.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "339f799d8b549e3744c7ac7feb216383e4005d94bdb22561b3ab8f3b808ae9fb" dependencies = [ - "heck 0.3.3", - "proc-macro2", - "quote", - "syn 1.0.109", + "heck 0.3.3", + "proc-macro2", + "quote", + "syn 1.0.109", ] [[package]] @@ -2692,11 +2724,11 @@ version = "0.25.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "23dc1fa9ac9c169a78ba62f0b841814b7abae11bdd047b9c58f893439e309ea0" dependencies = [ - "heck 0.4.1", - "proc-macro2", - "quote", - "rustversion", - "syn 2.0.41", + "heck 0.4.1", + "proc-macro2", + "quote", + "rustversion", + "syn 2.0.41", ] [[package]] @@ -2705,9 +2737,9 @@ version = "1.0.109" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "72b64191b275b66ffe2469e8af2c1cfe3bafa67b529ead792a6d0160888b4237" dependencies = [ - "proc-macro2", - "quote", - "unicode-ident", + "proc-macro2", + "quote", + "unicode-ident", ] [[package]] @@ -2716,9 +2748,9 @@ version = "2.0.41" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "44c8b28c477cc3bf0e7966561e3460130e1255f7a1cf71931075f1c5e7a7e269" dependencies = [ - "proc-macro2", - "quote", - "unicode-ident", + "proc-macro2", + "quote", + "unicode-ident", ] [[package]] @@ -2727,9 +2759,9 @@ version = "0.5.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ba3a3adc5c275d719af8cb4272ea1c4a6d668a777f37e115f6d11ddbc1c8e0e7" dependencies = [ - "bitflags 1.3.2", - "core-foundation", - "system-configuration-sys", + "bitflags 1.3.2", + "core-foundation", + "system-configuration-sys", ] [[package]] @@ -2738,8 +2770,8 @@ version = "0.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a75fb188eb626b924683e3b95e3a48e63551fcfb51949de2f06a9d91dbee93c9" dependencies = [ - "core-foundation-sys", - "libc", + "core-foundation-sys", + "libc", ] [[package]] @@ -2748,7 +2780,7 @@ version = "0.1.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ba323866e5d033818e3240feeb9f7db2c4296674e4d9e16b97b7bf8f490434e8" dependencies = [ - "pin-utils", + "pin-utils", ] [[package]] @@ -2757,11 +2789,11 @@ version = "3.8.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7ef1adac450ad7f4b3c28589471ade84f25f731a7a0fe30d71dfa9f60fd808e5" dependencies = [ - "cfg-if 1.0.0", - "fastrand 2.0.1", - "redox_syscall", - "rustix 0.38.28", - "windows-sys 0.48.0", + "cfg-if 1.0.0", + "fastrand 2.0.1", + "redox_syscall", + "rustix 0.38.28", + "windows-sys 0.48.0", ] [[package]] @@ -2770,7 +2802,7 @@ version = "1.0.50" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f9a7210f5c9a7156bb50aa36aed4c95afb51df0df00713949448cf9e97d382d2" dependencies = [ - "thiserror-impl", + "thiserror-impl", ] [[package]] @@ -2779,23 +2811,24 @@ version = "1.0.50" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "266b2e40bc00e5a6c09c3584011e08b06f123c00362c92b975ba9843aaaa14b8" dependencies = [ - "proc-macro2", - "quote", - "syn 2.0.41", + "proc-macro2", + "quote", + "syn 2.0.41", ] [[package]] name = "time" -version = "0.3.30" +version = "0.3.36" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c4a34ab300f2dee6e562c10a046fc05e358b29f9bf92277f30c3c8d82275f6f5" +checksum = "5dfd88e563464686c916c7e46e623e520ddc6d79fa6641390f2e3fa86e83e885" dependencies = [ - "deranged", - "itoa", - "powerfmt", - "serde", - "time-core", - "time-macros", + "deranged", + "itoa", + "num-conv", + "powerfmt", + "serde", + "time-core", + "time-macros", ] [[package]] @@ -2806,11 +2839,12 @@ checksum = "ef927ca75afb808a4d64dd374f00a2adf8d0fcff8e7b184af886c3c87ec4a3f3" [[package]] name = "time-macros" -version = "0.2.15" +version = "0.2.18" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4ad70d68dba9e1f8aceda7aa6711965dfec1cac869f311a51bd08b3a2ccbce20" +checksum = "3f252a68540fde3a3877aeea552b832b40ab9a69e318efd078774a01ddee1ccf" dependencies = [ - "time-core", + "num-conv", + "time-core", ] [[package]] @@ -2819,7 +2853,7 @@ version = "1.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "87cc5ceb3875bb20c2890005a4e226a4651264a5c75edb2421b52861a0a0cb50" dependencies = [ - "tinyvec_macros", + "tinyvec_macros", ] [[package]] @@ -2834,14 +2868,14 @@ version = "1.35.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "841d45b238a16291a4e1584e61820b8ae57d696cc5015c459c229ccc6990cc1c" dependencies = [ - "backtrace", - "bytes", - "libc", - "mio", - "num_cpus", - "pin-project-lite", - "socket2 0.5.5", - "windows-sys 0.48.0", + "backtrace", + "bytes", + "libc", + "mio", + "num_cpus", + "pin-project-lite", + "socket2 0.5.5", + "windows-sys 0.48.0", ] [[package]] @@ -2850,8 +2884,8 @@ version = "0.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "bbae76ab933c85776efabc971569dd6119c580d8f5d448769dec1764bf796ef2" dependencies = [ - "native-tls", - "tokio", + "native-tls", + "tokio", ] [[package]] @@ -2860,8 +2894,8 @@ version = "0.24.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c28327cf380ac148141087fbfb9de9d7bd4e84ab5d2c28fbc911d753de8a7081" dependencies = [ - "rustls", - "tokio", + "rustls", + "tokio", ] [[package]] @@ -2870,12 +2904,12 @@ version = "0.7.10" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5419f34732d9eb6ee4c3578b7989078579b7f039cbbb9ca2c4da015749371e15" dependencies = [ - "bytes", - "futures-core", - "futures-sink", - "pin-project-lite", - "tokio", - "tracing", + "bytes", + "futures-core", + "futures-sink", + "pin-project-lite", + "tokio", + "tracing", ] [[package]] @@ -2890,9 +2924,9 @@ version = "0.19.15" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1b5bb770da30e5cbfde35a2d7b9b8a2c4b8ef89548a7a6aeab5c9a576e3e7421" dependencies = [ - "indexmap 2.1.0", - "toml_datetime", - "winnow", + "indexmap 2.1.0", + "toml_datetime", + "winnow", ] [[package]] @@ -2907,9 +2941,9 @@ version = "0.1.40" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c3523ab5a71916ccf420eebdf5521fcef02141234bbc0b8a49f2fdc4544364ef" dependencies = [ - "pin-project-lite", - "tracing-attributes", - "tracing-core", + "pin-project-lite", + "tracing-attributes", + "tracing-core", ] [[package]] @@ -2918,9 +2952,9 @@ version = "0.1.27" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "34704c8d6ebcbc939824180af020566b01a7c01f80641264eba0999f6c2b6be7" dependencies = [ - "proc-macro2", - "quote", - "syn 2.0.41", + "proc-macro2", + "quote", + "syn 2.0.41", ] [[package]] @@ -2929,7 +2963,7 @@ version = "0.1.32" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c06d3da6113f116aaee68e4d601191614c9053067f9ab7f6edbcb161237daa54" dependencies = [ - "once_cell", + "once_cell", ] [[package]] @@ -2950,7 +2984,7 @@ version = "2.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f7d2d4dafb69621809a81864c9c1b864479e1235c0dd4e199924b9742439ed89" dependencies = [ - "version_check", + "version_check", ] [[package]] @@ -2971,7 +3005,7 @@ version = "0.1.22" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5c5713f0fc4b5db668a2ac63cdb7bb4469d8c9fed047b1d0292cc7b0ce2ba921" dependencies = [ - "tinyvec", + "tinyvec", ] [[package]] @@ -2994,14 +3028,14 @@ checksum = "8ecb6da28b8a351d773b68d5825ac39017e680750f980f3a1a85cd8dd28a47c1" [[package]] name = "url" -version = "2.5.0" +version = "2.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "31e6302e3bb753d46e83516cae55ae196fc0c309407cf11ab35cc51a4c2a4633" +checksum = "143b538f18257fac9cad154828a57c6bf5157e1aa604d4816b5995bf6de87ae5" dependencies = [ - "form_urlencoded", - "idna", - "percent-encoding", - "serde", + "form_urlencoded", + "idna", + "percent-encoding", + "serde", ] [[package]] @@ -3040,8 +3074,8 @@ version = "2.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d71d857dc86794ca4c280d616f7da00d2dbfd8cd788846559a6813e6aa4b54ee" dependencies = [ - "same-file", - "winapi-util", + "same-file", + "winapi-util", ] [[package]] @@ -3050,7 +3084,7 @@ version = "0.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "bfa7760aed19e106de2c7c0b581b509f2f25d3dacaf737cb82ac61bc6d760b0e" dependencies = [ - "try-lock", + "try-lock", ] [[package]] @@ -3061,78 +3095,78 @@ checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423" [[package]] name = "wasm-bindgen" -version = "0.2.89" +version = "0.2.78" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0ed0d4f68a3015cc185aff4db9506a015f4b96f95303897bfa23f846db54064e" +checksum = "632f73e236b219150ea279196e54e610f5dbafa5d61786303d4da54f84e47fce" dependencies = [ - "cfg-if 1.0.0", - "wasm-bindgen-macro", + "cfg-if 1.0.0", + "wasm-bindgen-macro", ] [[package]] name = "wasm-bindgen-backend" -version = "0.2.89" +version = "0.2.78" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1b56f625e64f3a1084ded111c4d5f477df9f8c92df113852fa5a374dbda78826" +checksum = "a317bf8f9fba2476b4b2c85ef4c4af8ff39c3c7f0cdfeed4f82c34a880aa837b" dependencies = [ - "bumpalo", - "log", - "once_cell", - "proc-macro2", - "quote", - "syn 2.0.41", - "wasm-bindgen-shared", + "bumpalo", + "lazy_static", + "log", + "proc-macro2", + "quote", + "syn 1.0.109", + "wasm-bindgen-shared", ] [[package]] name = "wasm-bindgen-futures" -version = "0.4.39" +version = "0.4.28" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ac36a15a220124ac510204aec1c3e5db8a22ab06fd6706d881dc6149f8ed9a12" +checksum = "8e8d7523cb1f2a4c96c1317ca690031b714a51cc14e05f712446691f413f5d39" dependencies = [ - "cfg-if 1.0.0", - "js-sys", - "wasm-bindgen", - "web-sys", + "cfg-if 1.0.0", + "js-sys", + "wasm-bindgen", + "web-sys", ] [[package]] name = "wasm-bindgen-macro" -version = "0.2.89" +version = "0.2.78" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0162dbf37223cd2afce98f3d0785506dcb8d266223983e4b5b525859e6e182b2" +checksum = "d56146e7c495528bf6587663bea13a8eb588d39b36b679d83972e1a2dbbdacf9" dependencies = [ - "quote", - "wasm-bindgen-macro-support", + "quote", + "wasm-bindgen-macro-support", ] [[package]] name = "wasm-bindgen-macro-support" -version = "0.2.89" +version = "0.2.78" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f0eb82fcb7930ae6219a7ecfd55b217f5f0893484b7a13022ebb2b2bf20b5283" +checksum = "7803e0eea25835f8abdc585cd3021b3deb11543c6fe226dcd30b228857c5c5ab" dependencies = [ - "proc-macro2", - "quote", - "syn 2.0.41", - "wasm-bindgen-backend", - "wasm-bindgen-shared", + "proc-macro2", + "quote", + "syn 1.0.109", + "wasm-bindgen-backend", + "wasm-bindgen-shared", ] [[package]] name = "wasm-bindgen-shared" -version = "0.2.89" +version = "0.2.78" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7ab9b36309365056cd639da3134bf87fa8f3d86008abf99e612384a6eecd459f" +checksum = "0237232789cf037d5480773fe568aac745bfe2afbc11a863e97901780a6b47cc" [[package]] name = "web-sys" -version = "0.3.66" +version = "0.3.55" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "50c24a44ec86bb68fbecd1b3efed7e85ea5621b39b35ef2766b66cd984f8010f" +checksum = "38eb105f1c59d9eaa6b5cdc92b859d85b926e82cb2e0945cd0c9259faa6fe9fb" dependencies = [ - "js-sys", - "wasm-bindgen", + "js-sys", + "wasm-bindgen", ] [[package]] @@ -3147,10 +3181,10 @@ version = "4.4.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "87ba24419a2078cd2b0f2ede2691b6c66d8e47836da3b6db8265ebad47afbfc7" dependencies = [ - "either", - "home", - "once_cell", - "rustix 0.38.28", + "either", + "home", + "once_cell", + "rustix 0.38.28", ] [[package]] @@ -3159,8 +3193,8 @@ version = "0.3.9" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5c839a674fcd7a98952e593242ea400abe93992746761e38641405d28b00f419" dependencies = [ - "winapi-i686-pc-windows-gnu", - "winapi-x86_64-pc-windows-gnu", + "winapi-i686-pc-windows-gnu", + "winapi-x86_64-pc-windows-gnu", ] [[package]] @@ -3175,7 +3209,7 @@ version = "0.1.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f29e6f9198ba0d26b4c9f07dbe6f9ed633e1f3d5b8b414090084349e46a52596" dependencies = [ - "winapi", + "winapi", ] [[package]] @@ -3190,7 +3224,7 @@ version = "0.51.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f1f8cf84f35d2db49a46868f947758c7a1138116f7fac3bc844f43ade1292e64" dependencies = [ - "windows-targets 0.48.5", + "windows-targets 0.48.5", ] [[package]] @@ -3199,7 +3233,7 @@ version = "0.48.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "677d2418bec65e3338edb076e806bc1ec15693c5d0104683f2efe857f61056a9" dependencies = [ - "windows-targets 0.48.5", + "windows-targets 0.48.5", ] [[package]] @@ -3208,7 +3242,7 @@ version = "0.52.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "282be5f36a8ce781fad8c8ae18fa3f9beff57ec1b52cb3de0789201425d9a33d" dependencies = [ - "windows-targets 0.52.0", + "windows-targets 0.52.0", ] [[package]] @@ -3217,13 +3251,13 @@ 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", + "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]] @@ -3232,13 +3266,13 @@ version = "0.52.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8a18201040b24831fbb9e4eb208f8892e1f50a37feb53cc7ff887feb8f50e7cd" dependencies = [ - "windows_aarch64_gnullvm 0.52.0", - "windows_aarch64_msvc 0.52.0", - "windows_i686_gnu 0.52.0", - "windows_i686_msvc 0.52.0", - "windows_x86_64_gnu 0.52.0", - "windows_x86_64_gnullvm 0.52.0", - "windows_x86_64_msvc 0.52.0", + "windows_aarch64_gnullvm 0.52.0", + "windows_aarch64_msvc 0.52.0", + "windows_i686_gnu 0.52.0", + "windows_i686_msvc 0.52.0", + "windows_x86_64_gnu 0.52.0", + "windows_x86_64_gnullvm 0.52.0", + "windows_x86_64_msvc 0.52.0", ] [[package]] @@ -3331,7 +3365,7 @@ version = "0.5.28" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6c830786f7720c2fd27a1a0e27a709dbd3c4d009b56d098fc742d4f4eab91fe2" dependencies = [ - "memchr", + "memchr", ] [[package]] @@ -3340,6 +3374,6 @@ version = "0.50.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "524e57b2c537c0f9b1e69f1965311ec12182b4122e45035b1508cd24d2adadb1" dependencies = [ - "cfg-if 1.0.0", - "windows-sys 0.48.0", + "cfg-if 1.0.0", + "windows-sys 0.48.0", ] diff --git a/Cargo.toml b/Cargo.toml index 4cb572f..fe31eb7 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -3,58 +3,90 @@ name = "stremio-core-android" version = "1.2.6" authors = ["Smart Code OOD"] edition = "2021" -resolver = "2" rust-version = "1.67.1" +[features] +default = ["kotlin"] +kotlin = [ + "dep:http", + "dep:reqwest", + "dep:openssl", + "dep:http-cache-reqwest", + "dep:reqwest-middleware", + "dep:tokio", + "dep:jni", + "dep:getrandom", +] + [lib] -crate_type = ["staticlib", "dylib"] +crate-type = ["staticlib", "dylib"] path = "src/commonMain/rust/lib.rs" +[workspace] +resolver = "2" + [profile.release] lto = true opt-level = 3 [dependencies] -stremio-core = { git = "https://github.com/Stremio/stremio-core", branch = "development", features = [ +stremio-core = { version = "0.1", git = "https://github.com/Stremio/stremio-core", branch = "feat/serialize-model-separatelly-from-creating-it", features = [ "derive", "analytics", "env-future-send", ] } +# For share UI models +stremio-core-web = { version = "0.47", git = "https://github.com/Stremio/stremio-core", branch = "feat/serialize-model-separatelly-from-creating-it", default-features = false } + -stremio-watched-bitfield = { git = "https://github.com/Stremio/stremio-core", branch = "development" } serde = "1.0.*" serde_json = "1.0.*" -futures = "0.3.*" -http = "0.2.*" -url = { version = "2.4", features = ["serde"] } -percent-encoding = "2.1" -chrono = "0.4.*" +serde_path_to_error = "0.1.*" + +strum = { version = "0.22.*", features = ["derive"] } + +# Utils +once_cell = "1.12.0" semver = { version = "1", features = ["serde"] } -base64 = "0.13.*" -hex = "0.4.*" -flate2 = "1.0.*" +chrono = "0.4.*" either = "1.6.*" lazy_static = "1.4.*" enclose = "1.1.*" itertools = "0.10.*" -strum = { version = "0.22.*", features = ["derive"] } boolinator = "2.4.*" Inflector = "0.11.*" -getrandom = "0.2.*" cfg-if = "0.1.*" auto_impl = "0.5.*" -serde_path_to_error = "0.1.*" -jni = "0.19.*" -reqwest = { version = "0.11", features = ["json", "rustls-tls"] } -tokio = { version = "1", features = ["rt", "rt-multi-thread"] } -openssl = { version = "=0.10.40", features = ["vendored"] } + +base64 = "0.13.*" +hex = "0.4.*" +flate2 = "1.0.*" +url = { version = "2.4", features = ["serde"] } +percent-encoding = "2.1" + +# kotlin specific + Env impl +getrandom = { version = "0.2.*", optional = true } + +jni = { version = "0.19.*", optional = true } + + +# Async executor +tokio = { version = "1", features = ["rt", "rt-multi-thread"], optional = true } +# Futures +futures = "0.3.*" + +# Http Request handling +http = { version = "0.2.*", optional = true } +reqwest = { version = "0.11", features = ["json", "rustls-tls"], optional = true } +openssl = { version = "=0.10.40", features = ["vendored"], optional = true } +http-cache-reqwest = { version = "0.4.5", optional = true } +reqwest-middleware = { version = "0.1.6", optional = true } + +# Bytes / Protobuf bytes = "1.1.0" prost = "0.12" prost-types = "0.12" -http-cache-reqwest = "0.4.5" -reqwest-middleware = "0.1.6" -once_cell = "1.12.0" [build-dependencies] prost-build = "0.12" @@ -63,4 +95,5 @@ glob = "0.3.0" # A way to quickly test with local version of `core` crates # [patch.'https://github.com/Stremio/stremio-core'] -# stremio-core = { path = "../stremio-core" } +# stremio-core = { path = "../core" } +# stremio-core-web = { path = "../core/stremio-core-web" } From 51c604a562cd31ec68e7adaf19abcb357ac8e642 Mon Sep 17 00:00:00 2001 From: Lachezar Lechev Date: Thu, 1 Aug 2024 18:58:39 +0300 Subject: [PATCH 02/50] feat(stremio-core-protobuf): move proto files and codegen there and re-export in stremio-core-android Signed-off-by: Lachezar Lechev --- .gitignore | 3 + Cargo.lock | 21 ++++- Cargo.toml | 3 +- build.gradle.kts | 2 +- src/commonMain/rust/bridge.rs | 38 +++++++++ src/commonMain/rust/bridge/loadable.rs | 19 +++-- src/commonMain/rust/bridge/mod.rs | 80 ------------------- .../rust/bridge/resource_loadable.rs | 2 +- src/commonMain/rust/env/mod.rs | 14 ---- src/commonMain/rust/lib.rs | 44 ++++++++-- .../rust/{model/mod.rs => model.rs} | 1 - src/commonMain/rust/model/fields.rs | 12 +++ .../rust/model/fields/catalogs_with_extra.rs | 17 ++++ .../rust/model/fields/meta_details.rs | 2 +- src/commonMain/rust/model/fields/mod.rs | 35 -------- .../rust/model/fields/streaming_server.rs | 2 + stremio-core-protobuf/Cargo.toml | 16 ++++ build.rs => stremio-core-protobuf/build.rs | 14 +++- .../stremio/core/models/addon_details.proto | 0 .../core/models/addons_with_filters.proto | 0 .../core/models/catalog_with_filters.proto | 0 .../core/models/catalogs_with_extra.proto | 0 .../models/continue_watching_preview.proto | 0 .../proto/stremio/core/models/ctx.proto | 0 .../stremio/core/models/library_by_type.proto | 0 .../core/models/library_with_filters.proto | 0 .../proto/stremio/core/models/link.proto | 0 .../proto/stremio/core/models/loadable.proto | 0 .../stremio/core/models/meta_details.proto | 0 .../proto/stremio/core/models/player.proto | 0 .../core/models/streaming_server.proto | 13 +-- .../proto/stremio/core/runtime/action.proto | 0 .../runtime/action_catalog_with_filters.proto | 0 .../runtime/action_catalogs_with_extra.proto | 0 .../stremio/core/runtime/action_ctx.proto | 0 .../core/runtime/action_library_by_type.proto | 0 .../stremio/core/runtime/action_link.proto | 0 .../stremio/core/runtime/action_load.proto | 0 .../core/runtime/action_meta_details.proto | 0 .../stremio/core/runtime/action_player.proto | 0 .../runtime/action_streaming_server.proto | 0 .../proto/stremio/core/runtime/event.proto | 0 .../proto/stremio/core/runtime/field.proto | 0 .../proto/stremio/core/runtime/runtime.proto | 0 .../proto/stremio/core/types/addon.proto | 0 .../proto/stremio/core/types/api.proto | 0 .../stremio/core/types/auth_request.proto | 0 .../proto/stremio/core/types/library.proto | 0 .../proto/stremio/core/types/manifest.proto | 0 .../proto/stremio/core/types/meta_item.proto | 0 .../core/types/meta_item_preview.proto | 0 .../proto/stremio/core/types/profile.proto | 0 .../proto/stremio/core/types/stream.proto | 0 .../proto/stremio/core/types/subtitle.proto | 0 .../proto/stremio/core/types/video.proto | 0 stremio-core-protobuf/src/lib.rs | 12 +++ 56 files changed, 190 insertions(+), 160 deletions(-) create mode 100644 src/commonMain/rust/bridge.rs delete mode 100644 src/commonMain/rust/bridge/mod.rs delete mode 100644 src/commonMain/rust/env/mod.rs rename src/commonMain/rust/{model/mod.rs => model.rs} (98%) create mode 100644 src/commonMain/rust/model/fields.rs delete mode 100644 src/commonMain/rust/model/fields/mod.rs create mode 100644 stremio-core-protobuf/Cargo.toml rename build.rs => stremio-core-protobuf/build.rs (72%) rename {src/main => stremio-core-protobuf}/proto/stremio/core/models/addon_details.proto (100%) rename {src/main => stremio-core-protobuf}/proto/stremio/core/models/addons_with_filters.proto (100%) rename {src/main => stremio-core-protobuf}/proto/stremio/core/models/catalog_with_filters.proto (100%) rename {src/main => stremio-core-protobuf}/proto/stremio/core/models/catalogs_with_extra.proto (100%) rename {src/main => stremio-core-protobuf}/proto/stremio/core/models/continue_watching_preview.proto (100%) rename {src/main => stremio-core-protobuf}/proto/stremio/core/models/ctx.proto (100%) rename {src/main => stremio-core-protobuf}/proto/stremio/core/models/library_by_type.proto (100%) rename {src/main => stremio-core-protobuf}/proto/stremio/core/models/library_with_filters.proto (100%) rename {src/main => stremio-core-protobuf}/proto/stremio/core/models/link.proto (100%) rename {src/main => stremio-core-protobuf}/proto/stremio/core/models/loadable.proto (100%) rename {src/main => stremio-core-protobuf}/proto/stremio/core/models/meta_details.proto (100%) rename {src/main => stremio-core-protobuf}/proto/stremio/core/models/player.proto (100%) rename {src/main => stremio-core-protobuf}/proto/stremio/core/models/streaming_server.proto (88%) rename {src/main => stremio-core-protobuf}/proto/stremio/core/runtime/action.proto (100%) rename {src/main => stremio-core-protobuf}/proto/stremio/core/runtime/action_catalog_with_filters.proto (100%) rename {src/main => stremio-core-protobuf}/proto/stremio/core/runtime/action_catalogs_with_extra.proto (100%) rename {src/main => stremio-core-protobuf}/proto/stremio/core/runtime/action_ctx.proto (100%) rename {src/main => stremio-core-protobuf}/proto/stremio/core/runtime/action_library_by_type.proto (100%) rename {src/main => stremio-core-protobuf}/proto/stremio/core/runtime/action_link.proto (100%) rename {src/main => stremio-core-protobuf}/proto/stremio/core/runtime/action_load.proto (100%) rename {src/main => stremio-core-protobuf}/proto/stremio/core/runtime/action_meta_details.proto (100%) rename {src/main => stremio-core-protobuf}/proto/stremio/core/runtime/action_player.proto (100%) rename {src/main => stremio-core-protobuf}/proto/stremio/core/runtime/action_streaming_server.proto (100%) rename {src/main => stremio-core-protobuf}/proto/stremio/core/runtime/event.proto (100%) rename {src/main => stremio-core-protobuf}/proto/stremio/core/runtime/field.proto (100%) rename {src/main => stremio-core-protobuf}/proto/stremio/core/runtime/runtime.proto (100%) rename {src/main => stremio-core-protobuf}/proto/stremio/core/types/addon.proto (100%) rename {src/main => stremio-core-protobuf}/proto/stremio/core/types/api.proto (100%) rename {src/main => stremio-core-protobuf}/proto/stremio/core/types/auth_request.proto (100%) rename {src/main => stremio-core-protobuf}/proto/stremio/core/types/library.proto (100%) rename {src/main => stremio-core-protobuf}/proto/stremio/core/types/manifest.proto (100%) rename {src/main => stremio-core-protobuf}/proto/stremio/core/types/meta_item.proto (100%) rename {src/main => stremio-core-protobuf}/proto/stremio/core/types/meta_item_preview.proto (100%) rename {src/main => stremio-core-protobuf}/proto/stremio/core/types/profile.proto (100%) rename {src/main => stremio-core-protobuf}/proto/stremio/core/types/stream.proto (100%) rename {src/main => stremio-core-protobuf}/proto/stremio/core/types/subtitle.proto (100%) rename {src/main => stremio-core-protobuf}/proto/stremio/core/types/video.proto (100%) create mode 100644 stremio-core-protobuf/src/lib.rs diff --git a/.gitignore b/.gitignore index ea2e880..b589443 100644 --- a/.gitignore +++ b/.gitignore @@ -7,3 +7,6 @@ !/**/rust/protobuf/README.md /.idea/ /local.properties + +/stremio-core-protobuf/src/protobuf/* +!/stremio-core-protobuf/src/protobuf//README.md \ No newline at end of file diff --git a/Cargo.lock b/Cargo.lock index dfef4a8..b5ecaba 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2527,7 +2527,7 @@ dependencies = [ [[package]] name = "stremio-core" version = "0.1.0" -source = "git+https://github.com/Stremio/stremio-core?branch=feat/serialize-model-separatelly-from-creating-it#212584dd9409600bb60f55ebc84139319b4642e2" +source = "git+https://github.com/Stremio/stremio-core?branch=feat/serialize-model-separatelly-from-creating-it#64d55209d343dbe444b334d0fbf1fbfff9c30dcd" dependencies = [ "anyhow", "base64 0.21.5", @@ -2606,16 +2606,29 @@ dependencies = [ "serde_json", "serde_path_to_error", "stremio-core", + "stremio-core-protobuf", "stremio-core-web", "strum 0.22.0", "tokio", "url", ] +[[package]] +name = "stremio-core-protobuf" +version = "0.1.0" +dependencies = [ + "bytes", + "glob", + "prost", + "prost-build", + "prost-types", + "protox", +] + [[package]] name = "stremio-core-web" version = "0.47.7" -source = "git+https://github.com/Stremio/stremio-core?branch=feat/serialize-model-separatelly-from-creating-it#212584dd9409600bb60f55ebc84139319b4642e2" +source = "git+https://github.com/Stremio/stremio-core?branch=feat/serialize-model-separatelly-from-creating-it#64d55209d343dbe444b334d0fbf1fbfff9c30dcd" dependencies = [ "Inflector", "boolinator", @@ -2641,7 +2654,7 @@ dependencies = [ [[package]] name = "stremio-derive" version = "0.1.0" -source = "git+https://github.com/Stremio/stremio-core?branch=feat/serialize-model-separatelly-from-creating-it#212584dd9409600bb60f55ebc84139319b4642e2" +source = "git+https://github.com/Stremio/stremio-core?branch=feat/serialize-model-separatelly-from-creating-it#64d55209d343dbe444b334d0fbf1fbfff9c30dcd" dependencies = [ "case", "proc-macro-crate", @@ -2675,7 +2688,7 @@ dependencies = [ [[package]] name = "stremio-watched-bitfield" version = "0.1.0" -source = "git+https://github.com/Stremio/stremio-core?branch=feat/serialize-model-separatelly-from-creating-it#212584dd9409600bb60f55ebc84139319b4642e2" +source = "git+https://github.com/Stremio/stremio-core?branch=feat/serialize-model-separatelly-from-creating-it#64d55209d343dbe444b334d0fbf1fbfff9c30dcd" dependencies = [ "base64 0.13.1", "flate2", diff --git a/Cargo.toml b/Cargo.toml index fe31eb7..3978e48 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -25,6 +25,7 @@ path = "src/commonMain/rust/lib.rs" [workspace] resolver = "2" +members = ["stremio-core-protobuf"] [profile.release] lto = true @@ -38,7 +39,7 @@ stremio-core = { version = "0.1", git = "https://github.com/Stremio/stremio-core ] } # For share UI models stremio-core-web = { version = "0.47", git = "https://github.com/Stremio/stremio-core", branch = "feat/serialize-model-separatelly-from-creating-it", default-features = false } - +stremio-core-protobuf = { version = "0.1", path = "stremio-core-protobuf", default-features = false } serde = "1.0.*" serde_json = "1.0.*" diff --git a/build.gradle.kts b/build.gradle.kts index 2fbea8c..beeeac5 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -90,7 +90,7 @@ android { } protobuf { - generatedFilesBaseDir = "$projectDir/src" + generatedFilesBaseDir = "$projectDir/stremio-core-protobuf/proto" protoc { artifact = "com.google.protobuf:protoc:${protobufVersion}" diff --git a/src/commonMain/rust/bridge.rs b/src/commonMain/rust/bridge.rs new file mode 100644 index 0000000..39760e0 --- /dev/null +++ b/src/commonMain/rust/bridge.rs @@ -0,0 +1,38 @@ +//! This module contains all the bridge impls which take [`stremio_core`] types +//! and allow `FromProtobuf` and `ToProtobuf` for Protobuf generates structs and enums. +//! +//! # Bridge + +mod action; +mod android_model_field; +mod auth_request; +mod date; +mod env_error; +mod event; +mod events; +mod extra_value; +mod library_item; +mod link; +mod list; +mod loadable; +mod manifest; +mod meta_preview; +mod option; +mod pair; +mod poster_shape; +mod profile; +mod resource_loadable; +mod resource_path; +mod resource_request; +mod stream; +mod string; +mod subtitle; + +mod to_protobuf; +pub use to_protobuf::*; + +mod from_protobuf; +pub use from_protobuf::*; + +mod to_jni_byte_array; +pub use to_jni_byte_array::*; diff --git a/src/commonMain/rust/bridge/loadable.rs b/src/commonMain/rust/bridge/loadable.rs index 60a077a..4bbcebd 100644 --- a/src/commonMain/rust/bridge/loadable.rs +++ b/src/commonMain/rust/bridge/loadable.rs @@ -1,18 +1,21 @@ +use url::Url; + use stremio_core::deep_links::MetaItemDeepLinks; use stremio_core::models::common::{Loadable, ResourceError}; use stremio_core::models::ctx::{Ctx, CtxError}; use stremio_core::models::link::LinkError; use stremio_core::models::streaming_server::PlaybackDevice; use stremio_core::runtime::EnvError; -use stremio_core::types::addon::{Descriptor, DescriptorPreview, ResourcePath, ResourceRequest}; -use stremio_core::types::api::{ - GetModalResponse, GetNotificationResponse, LinkAuthKey, LinkCodeResponse, + +use stremio_core::types::{ + addon::{Descriptor, DescriptorPreview, ResourcePath, ResourceRequest}, + api::{GetModalResponse, GetNotificationResponse, LinkAuthKey, LinkCodeResponse}, + library::LibraryItem, + resource::{MetaItem, MetaItemPreview, Stream, Subtitles}, + streaming_server::{Settings, Statistics}, + watched_bitfield::WatchedBitField, }; -use stremio_core::types::library::LibraryItem; -use stremio_core::types::resource::{MetaItem, MetaItemPreview, Stream, Subtitles}; -use stremio_core::types::streaming_server::{Settings, Statistics}; -use stremio_watched_bitfield::WatchedBitField; -use url::Url; + use crate::bridge::ToProtobuf; use crate::protobuf::stremio::core::models; diff --git a/src/commonMain/rust/bridge/mod.rs b/src/commonMain/rust/bridge/mod.rs deleted file mode 100644 index 87a3d63..0000000 --- a/src/commonMain/rust/bridge/mod.rs +++ /dev/null @@ -1,80 +0,0 @@ -mod action; -pub use action::*; - -mod android_model_field; -pub use android_model_field::*; - -mod auth_request; -pub use auth_request::*; - -mod date; -pub use date::*; - -mod env_error; -pub use env_error::*; - -mod event; -pub use event::*; - -mod events; -pub use events::*; - -mod extra_value; -pub use extra_value::*; - -mod library_item; -pub use library_item::*; - -mod link; -pub use link::*; - -mod list; -pub use list::*; - -mod loadable; -pub use loadable::*; - -mod manifest; -pub use manifest::*; - -mod meta_preview; -pub use meta_preview::*; - -mod option; -pub use option::*; - -mod pair; -pub use pair::*; - -mod poster_shape; -pub use poster_shape::*; - -mod profile; -pub use profile::*; - -mod resource_loadable; -pub use resource_loadable::*; - -mod resource_path; -pub use resource_path::*; - -mod resource_request; -pub use resource_request::*; - -mod stream; -pub use stream::*; - -mod string; -pub use string::*; - -mod subtitle; -pub use subtitle::*; - -mod to_protobuf; -pub use to_protobuf::*; - -mod from_protobuf; -pub use from_protobuf::*; - -mod to_jni_byte_array; -pub use to_jni_byte_array::*; diff --git a/src/commonMain/rust/bridge/resource_loadable.rs b/src/commonMain/rust/bridge/resource_loadable.rs index 4b6f9cb..adf64ce 100644 --- a/src/commonMain/rust/bridge/resource_loadable.rs +++ b/src/commonMain/rust/bridge/resource_loadable.rs @@ -5,7 +5,7 @@ use stremio_core::models::ctx::Ctx; use stremio_core::types::addon::{DescriptorPreview, ResourceRequest}; use stremio_core::types::library::LibraryItem; use stremio_core::types::resource::{MetaItem, MetaItemPreview, Stream, Subtitles}; -use stremio_watched_bitfield::WatchedBitField; +use stremio_core::types::watched_bitfield::WatchedBitField; use url::Url; use crate::bridge::ToProtobuf; diff --git a/src/commonMain/rust/env/mod.rs b/src/commonMain/rust/env/mod.rs deleted file mode 100644 index 7cf22e6..0000000 --- a/src/commonMain/rust/env/mod.rs +++ /dev/null @@ -1,14 +0,0 @@ -mod env; -pub use env::*; - -mod event; -pub use event::*; - -mod fetch; -use fetch::*; - -mod kotlin_class_name; -pub use kotlin_class_name::*; - -mod storage; -use storage::*; diff --git a/src/commonMain/rust/lib.rs b/src/commonMain/rust/lib.rs index eb91b06..0558eeb 100644 --- a/src/commonMain/rust/lib.rs +++ b/src/commonMain/rust/lib.rs @@ -1,10 +1,44 @@ #![allow(clippy::module_inception)] -mod bridge; -mod env; -mod model; +#[cfg(feature = "kotlin")] +// Re-export the kotlin-specific impls +pub use stremio_core_android::*; + +#[cfg(feature = "kotlin")] +pub mod bridge; +#[cfg(feature = "kotlin")] +/// Contains all android (kotlin) related implementations for the bridge between +/// Rust and Kotlin. +/// +/// - [AndroidEnv](crate::env::AndroidEnv) +/// - [Storage](crate::env::Storage) +/// - [Making requests](crate::env::fetch) +/// - [AndroidEvent](crate::env::AndroidEvent)s +pub mod env { + mod env; + pub use env::*; + + mod event; + pub use event::*; + + mod fetch; + pub use fetch::*; + + mod kotlin_class_name; + pub use kotlin_class_name::*; + + mod storage; + pub use storage::*; +} + +pub mod model; #[allow(clippy::all)] -mod protobuf; +/// Protobuf generated module +pub mod protobuf { + pub use stremio_core_protobuf::protobuf::*; +} -mod jni_ext; +#[cfg(feature = "kotlin")] +pub mod jni_ext; +#[cfg(feature = "kotlin")] mod stremio_core_android; diff --git a/src/commonMain/rust/model/mod.rs b/src/commonMain/rust/model.rs similarity index 98% rename from src/commonMain/rust/model/mod.rs rename to src/commonMain/rust/model.rs index 889644d..9fbd777 100644 --- a/src/commonMain/rust/model/mod.rs +++ b/src/commonMain/rust/model.rs @@ -1,5 +1,4 @@ mod fields; - mod addons; pub use addons::*; diff --git a/src/commonMain/rust/model/fields.rs b/src/commonMain/rust/model/fields.rs new file mode 100644 index 0000000..f5637ea --- /dev/null +++ b/src/commonMain/rust/model/fields.rs @@ -0,0 +1,12 @@ +mod addon_detail; +mod addons_with_filters; +mod catalogs_with_extra; +mod continue_watching_preview; +mod ctx; +mod discover; +mod library; +mod library_by_type; +mod link; +mod meta_details; +mod player; +mod streaming_server; \ No newline at end of file diff --git a/src/commonMain/rust/model/fields/catalogs_with_extra.rs b/src/commonMain/rust/model/fields/catalogs_with_extra.rs index 870ed3c..32ce33d 100644 --- a/src/commonMain/rust/model/fields/catalogs_with_extra.rs +++ b/src/commonMain/rust/model/fields/catalogs_with_extra.rs @@ -7,6 +7,23 @@ use stremio_core::types::resource::MetaItemPreview; use crate::bridge::{FromProtobuf, ToProtobuf}; use crate::protobuf::stremio::core::models; +// impl<'a> From> for CatalogsWithExtra { +// fn from(model: stremio_core_web::model::CatalogsWithExtra<'a>) -> Self { +// CatalogsWithExtra { +// selected: model.selected, +// catalogs: model.catalogs, +// } +// } +// } + +// impl<'a> SerializeModel for CatalogsWithExtra<'a> { +// type Error = serde_json::Error; + +// fn serialize_model(&self) -> Result { +// wasm_bindgen::JsValue::try_from(self) +// } +// } + impl FromProtobuf for models::catalogs_with_extra::Selected { fn from_protobuf(&self) -> Selected { Selected { diff --git a/src/commonMain/rust/model/fields/meta_details.rs b/src/commonMain/rust/model/fields/meta_details.rs index d75513a..de42082 100644 --- a/src/commonMain/rust/model/fields/meta_details.rs +++ b/src/commonMain/rust/model/fields/meta_details.rs @@ -6,7 +6,7 @@ use stremio_core::runtime::Env; use stremio_core::types::addon::ResourceRequest; use stremio_core::types::library::LibraryItem; use stremio_core::types::resource::{MetaItem, SeriesInfo, Video}; -use stremio_watched_bitfield::WatchedBitField; +use stremio_core::types::watched_bitfield::WatchedBitField; use crate::bridge::{FromProtobuf, ToProtobuf}; use crate::env::AndroidEnv; diff --git a/src/commonMain/rust/model/fields/mod.rs b/src/commonMain/rust/model/fields/mod.rs deleted file mode 100644 index 129d57e..0000000 --- a/src/commonMain/rust/model/fields/mod.rs +++ /dev/null @@ -1,35 +0,0 @@ -mod addon_detail; -pub use addon_detail::*; - -mod addons_with_filters; -pub use addons_with_filters::*; - -mod catalogs_with_extra; -pub use catalogs_with_extra::*; - -mod continue_watching_preview; -pub use continue_watching_preview::*; - -mod ctx; -pub use ctx::*; - -mod discover; -pub use discover::*; - -mod library; -pub use library::*; - -mod library_by_type; -pub use library_by_type::*; - -mod link; -pub use link::*; - -mod meta_details; -pub use meta_details::*; - -mod player; -pub use player::*; - -mod streaming_server; -pub use streaming_server::*; diff --git a/src/commonMain/rust/model/fields/streaming_server.rs b/src/commonMain/rust/model/fields/streaming_server.rs index 20462ab..ffc79b7 100644 --- a/src/commonMain/rust/model/fields/streaming_server.rs +++ b/src/commonMain/rust/model/fields/streaming_server.rs @@ -15,6 +15,7 @@ impl FromProtobuf for models::streaming_server::Settings { remote_https: self.remote_https.clone(), transcode_profile: self.transcode_profile.to_owned(), cache_size: self.cache_size.to_owned(), + proxy_streams_enabled: self.proxy_streams_enabled, bt_max_connections: self.bt_max_connections, bt_handshake_timeout: self.bt_handshake_timeout, bt_request_timeout: self.bt_request_timeout, @@ -86,6 +87,7 @@ impl ToProtobuf for Settings { remote_https: self.remote_https.clone(), transcode_profile: self.transcode_profile.to_owned(), cache_size: self.cache_size, + proxy_streams_enabled: self.proxy_streams_enabled, bt_max_connections: self.bt_max_connections, bt_handshake_timeout: self.bt_handshake_timeout, bt_request_timeout: self.bt_request_timeout, diff --git a/stremio-core-protobuf/Cargo.toml b/stremio-core-protobuf/Cargo.toml new file mode 100644 index 0000000..c68b022 --- /dev/null +++ b/stremio-core-protobuf/Cargo.toml @@ -0,0 +1,16 @@ +[package] +name = "stremio-core-protobuf" +version = "0.1.0" +edition = "2021" + +[dependencies] + +# Bytes / Protobuf +bytes = "1.1.0" +prost = "0.12" +prost-types = "0.12" + +[build-dependencies] +prost-build = "0.12" +protox = "0.5" +glob = "0.3.0" \ No newline at end of file diff --git a/build.rs b/stremio-core-protobuf/build.rs similarity index 72% rename from build.rs rename to stremio-core-protobuf/build.rs index ea016eb..fb169b7 100644 --- a/build.rs +++ b/stremio-core-protobuf/build.rs @@ -2,11 +2,19 @@ use glob::glob; use prost_build::Config; fn main() { - let proto_dir = "src/main/proto"; + let proto_dir = "proto"; let proto_paths = glob(format!("{proto_dir}/**/*.proto").as_str()) .unwrap() - .filter_map(Result::ok) + .filter_map(|result| { + if let Err(err) = &result { + eprintln!("Glob error: {err}"); + } + + + result.ok() + }) .collect::>(); + for path in &proto_paths { let display_path = path.display(); println!("cargo:rerun-if-changed={display_path}"); @@ -15,7 +23,7 @@ fn main() { protox::compile(proto_paths, [proto_dir]).expect("Expected file descriptors"); Config::new() .compile_well_known_types() - .out_dir("src/commonMain/rust/protobuf") + .out_dir("src/protobuf") .include_file("mod.rs") .compile_fds(file_descriptors) .expect("Expected successful protobuf codegen"); diff --git a/src/main/proto/stremio/core/models/addon_details.proto b/stremio-core-protobuf/proto/stremio/core/models/addon_details.proto similarity index 100% rename from src/main/proto/stremio/core/models/addon_details.proto rename to stremio-core-protobuf/proto/stremio/core/models/addon_details.proto diff --git a/src/main/proto/stremio/core/models/addons_with_filters.proto b/stremio-core-protobuf/proto/stremio/core/models/addons_with_filters.proto similarity index 100% rename from src/main/proto/stremio/core/models/addons_with_filters.proto rename to stremio-core-protobuf/proto/stremio/core/models/addons_with_filters.proto diff --git a/src/main/proto/stremio/core/models/catalog_with_filters.proto b/stremio-core-protobuf/proto/stremio/core/models/catalog_with_filters.proto similarity index 100% rename from src/main/proto/stremio/core/models/catalog_with_filters.proto rename to stremio-core-protobuf/proto/stremio/core/models/catalog_with_filters.proto diff --git a/src/main/proto/stremio/core/models/catalogs_with_extra.proto b/stremio-core-protobuf/proto/stremio/core/models/catalogs_with_extra.proto similarity index 100% rename from src/main/proto/stremio/core/models/catalogs_with_extra.proto rename to stremio-core-protobuf/proto/stremio/core/models/catalogs_with_extra.proto diff --git a/src/main/proto/stremio/core/models/continue_watching_preview.proto b/stremio-core-protobuf/proto/stremio/core/models/continue_watching_preview.proto similarity index 100% rename from src/main/proto/stremio/core/models/continue_watching_preview.proto rename to stremio-core-protobuf/proto/stremio/core/models/continue_watching_preview.proto diff --git a/src/main/proto/stremio/core/models/ctx.proto b/stremio-core-protobuf/proto/stremio/core/models/ctx.proto similarity index 100% rename from src/main/proto/stremio/core/models/ctx.proto rename to stremio-core-protobuf/proto/stremio/core/models/ctx.proto diff --git a/src/main/proto/stremio/core/models/library_by_type.proto b/stremio-core-protobuf/proto/stremio/core/models/library_by_type.proto similarity index 100% rename from src/main/proto/stremio/core/models/library_by_type.proto rename to stremio-core-protobuf/proto/stremio/core/models/library_by_type.proto diff --git a/src/main/proto/stremio/core/models/library_with_filters.proto b/stremio-core-protobuf/proto/stremio/core/models/library_with_filters.proto similarity index 100% rename from src/main/proto/stremio/core/models/library_with_filters.proto rename to stremio-core-protobuf/proto/stremio/core/models/library_with_filters.proto diff --git a/src/main/proto/stremio/core/models/link.proto b/stremio-core-protobuf/proto/stremio/core/models/link.proto similarity index 100% rename from src/main/proto/stremio/core/models/link.proto rename to stremio-core-protobuf/proto/stremio/core/models/link.proto diff --git a/src/main/proto/stremio/core/models/loadable.proto b/stremio-core-protobuf/proto/stremio/core/models/loadable.proto similarity index 100% rename from src/main/proto/stremio/core/models/loadable.proto rename to stremio-core-protobuf/proto/stremio/core/models/loadable.proto diff --git a/src/main/proto/stremio/core/models/meta_details.proto b/stremio-core-protobuf/proto/stremio/core/models/meta_details.proto similarity index 100% rename from src/main/proto/stremio/core/models/meta_details.proto rename to stremio-core-protobuf/proto/stremio/core/models/meta_details.proto diff --git a/src/main/proto/stremio/core/models/player.proto b/stremio-core-protobuf/proto/stremio/core/models/player.proto similarity index 100% rename from src/main/proto/stremio/core/models/player.proto rename to stremio-core-protobuf/proto/stremio/core/models/player.proto diff --git a/src/main/proto/stremio/core/models/streaming_server.proto b/stremio-core-protobuf/proto/stremio/core/models/streaming_server.proto similarity index 88% rename from src/main/proto/stremio/core/models/streaming_server.proto rename to stremio-core-protobuf/proto/stremio/core/models/streaming_server.proto index d305cd9..866b717 100644 --- a/src/main/proto/stremio/core/models/streaming_server.proto +++ b/stremio-core-protobuf/proto/stremio/core/models/streaming_server.proto @@ -30,12 +30,13 @@ message StreamingServer { optional string remote_https = 4; optional string transcode_profile = 5; optional double cache_size = 6; - required uint64 bt_max_connections = 7; - required uint64 bt_handshake_timeout = 8; - required uint64 bt_request_timeout = 9; - required double bt_download_speed_soft_limit = 10; - required double bt_download_speed_hard_limit = 11; - required uint64 bt_min_peers_for_stable = 12; + required bool proxy_streams_enabled = 7; + required uint64 bt_max_connections = 8; + required uint64 bt_handshake_timeout = 9; + required uint64 bt_request_timeout = 10; + required double bt_download_speed_soft_limit = 11; + required double bt_download_speed_hard_limit = 12; + required uint64 bt_min_peers_for_stable = 13; } message Statistics { required string name = 1; diff --git a/src/main/proto/stremio/core/runtime/action.proto b/stremio-core-protobuf/proto/stremio/core/runtime/action.proto similarity index 100% rename from src/main/proto/stremio/core/runtime/action.proto rename to stremio-core-protobuf/proto/stremio/core/runtime/action.proto diff --git a/src/main/proto/stremio/core/runtime/action_catalog_with_filters.proto b/stremio-core-protobuf/proto/stremio/core/runtime/action_catalog_with_filters.proto similarity index 100% rename from src/main/proto/stremio/core/runtime/action_catalog_with_filters.proto rename to stremio-core-protobuf/proto/stremio/core/runtime/action_catalog_with_filters.proto diff --git a/src/main/proto/stremio/core/runtime/action_catalogs_with_extra.proto b/stremio-core-protobuf/proto/stremio/core/runtime/action_catalogs_with_extra.proto similarity index 100% rename from src/main/proto/stremio/core/runtime/action_catalogs_with_extra.proto rename to stremio-core-protobuf/proto/stremio/core/runtime/action_catalogs_with_extra.proto diff --git a/src/main/proto/stremio/core/runtime/action_ctx.proto b/stremio-core-protobuf/proto/stremio/core/runtime/action_ctx.proto similarity index 100% rename from src/main/proto/stremio/core/runtime/action_ctx.proto rename to stremio-core-protobuf/proto/stremio/core/runtime/action_ctx.proto diff --git a/src/main/proto/stremio/core/runtime/action_library_by_type.proto b/stremio-core-protobuf/proto/stremio/core/runtime/action_library_by_type.proto similarity index 100% rename from src/main/proto/stremio/core/runtime/action_library_by_type.proto rename to stremio-core-protobuf/proto/stremio/core/runtime/action_library_by_type.proto diff --git a/src/main/proto/stremio/core/runtime/action_link.proto b/stremio-core-protobuf/proto/stremio/core/runtime/action_link.proto similarity index 100% rename from src/main/proto/stremio/core/runtime/action_link.proto rename to stremio-core-protobuf/proto/stremio/core/runtime/action_link.proto diff --git a/src/main/proto/stremio/core/runtime/action_load.proto b/stremio-core-protobuf/proto/stremio/core/runtime/action_load.proto similarity index 100% rename from src/main/proto/stremio/core/runtime/action_load.proto rename to stremio-core-protobuf/proto/stremio/core/runtime/action_load.proto diff --git a/src/main/proto/stremio/core/runtime/action_meta_details.proto b/stremio-core-protobuf/proto/stremio/core/runtime/action_meta_details.proto similarity index 100% rename from src/main/proto/stremio/core/runtime/action_meta_details.proto rename to stremio-core-protobuf/proto/stremio/core/runtime/action_meta_details.proto diff --git a/src/main/proto/stremio/core/runtime/action_player.proto b/stremio-core-protobuf/proto/stremio/core/runtime/action_player.proto similarity index 100% rename from src/main/proto/stremio/core/runtime/action_player.proto rename to stremio-core-protobuf/proto/stremio/core/runtime/action_player.proto diff --git a/src/main/proto/stremio/core/runtime/action_streaming_server.proto b/stremio-core-protobuf/proto/stremio/core/runtime/action_streaming_server.proto similarity index 100% rename from src/main/proto/stremio/core/runtime/action_streaming_server.proto rename to stremio-core-protobuf/proto/stremio/core/runtime/action_streaming_server.proto diff --git a/src/main/proto/stremio/core/runtime/event.proto b/stremio-core-protobuf/proto/stremio/core/runtime/event.proto similarity index 100% rename from src/main/proto/stremio/core/runtime/event.proto rename to stremio-core-protobuf/proto/stremio/core/runtime/event.proto diff --git a/src/main/proto/stremio/core/runtime/field.proto b/stremio-core-protobuf/proto/stremio/core/runtime/field.proto similarity index 100% rename from src/main/proto/stremio/core/runtime/field.proto rename to stremio-core-protobuf/proto/stremio/core/runtime/field.proto diff --git a/src/main/proto/stremio/core/runtime/runtime.proto b/stremio-core-protobuf/proto/stremio/core/runtime/runtime.proto similarity index 100% rename from src/main/proto/stremio/core/runtime/runtime.proto rename to stremio-core-protobuf/proto/stremio/core/runtime/runtime.proto diff --git a/src/main/proto/stremio/core/types/addon.proto b/stremio-core-protobuf/proto/stremio/core/types/addon.proto similarity index 100% rename from src/main/proto/stremio/core/types/addon.proto rename to stremio-core-protobuf/proto/stremio/core/types/addon.proto diff --git a/src/main/proto/stremio/core/types/api.proto b/stremio-core-protobuf/proto/stremio/core/types/api.proto similarity index 100% rename from src/main/proto/stremio/core/types/api.proto rename to stremio-core-protobuf/proto/stremio/core/types/api.proto diff --git a/src/main/proto/stremio/core/types/auth_request.proto b/stremio-core-protobuf/proto/stremio/core/types/auth_request.proto similarity index 100% rename from src/main/proto/stremio/core/types/auth_request.proto rename to stremio-core-protobuf/proto/stremio/core/types/auth_request.proto diff --git a/src/main/proto/stremio/core/types/library.proto b/stremio-core-protobuf/proto/stremio/core/types/library.proto similarity index 100% rename from src/main/proto/stremio/core/types/library.proto rename to stremio-core-protobuf/proto/stremio/core/types/library.proto diff --git a/src/main/proto/stremio/core/types/manifest.proto b/stremio-core-protobuf/proto/stremio/core/types/manifest.proto similarity index 100% rename from src/main/proto/stremio/core/types/manifest.proto rename to stremio-core-protobuf/proto/stremio/core/types/manifest.proto diff --git a/src/main/proto/stremio/core/types/meta_item.proto b/stremio-core-protobuf/proto/stremio/core/types/meta_item.proto similarity index 100% rename from src/main/proto/stremio/core/types/meta_item.proto rename to stremio-core-protobuf/proto/stremio/core/types/meta_item.proto diff --git a/src/main/proto/stremio/core/types/meta_item_preview.proto b/stremio-core-protobuf/proto/stremio/core/types/meta_item_preview.proto similarity index 100% rename from src/main/proto/stremio/core/types/meta_item_preview.proto rename to stremio-core-protobuf/proto/stremio/core/types/meta_item_preview.proto diff --git a/src/main/proto/stremio/core/types/profile.proto b/stremio-core-protobuf/proto/stremio/core/types/profile.proto similarity index 100% rename from src/main/proto/stremio/core/types/profile.proto rename to stremio-core-protobuf/proto/stremio/core/types/profile.proto diff --git a/src/main/proto/stremio/core/types/stream.proto b/stremio-core-protobuf/proto/stremio/core/types/stream.proto similarity index 100% rename from src/main/proto/stremio/core/types/stream.proto rename to stremio-core-protobuf/proto/stremio/core/types/stream.proto diff --git a/src/main/proto/stremio/core/types/subtitle.proto b/stremio-core-protobuf/proto/stremio/core/types/subtitle.proto similarity index 100% rename from src/main/proto/stremio/core/types/subtitle.proto rename to stremio-core-protobuf/proto/stremio/core/types/subtitle.proto diff --git a/src/main/proto/stremio/core/types/video.proto b/stremio-core-protobuf/proto/stremio/core/types/video.proto similarity index 100% rename from src/main/proto/stremio/core/types/video.proto rename to stremio-core-protobuf/proto/stremio/core/types/video.proto diff --git a/stremio-core-protobuf/src/lib.rs b/stremio-core-protobuf/src/lib.rs new file mode 100644 index 0000000..787899d --- /dev/null +++ b/stremio-core-protobuf/src/lib.rs @@ -0,0 +1,12 @@ +#[allow(clippy::all)] +/// The generated module before any export's take place in the API's top level +/// Made public because of the compatibility with stremio-core-android +pub mod protobuf; + +#[doc(inline)] +pub use protobuf::{ + // Re-export all google protobuf specific structs + google::protobuf::*, + // Re-export all core modules on the API's top level + stremio::core::*, +}; From ba59b4baafdda3f69fa747243ed4544589b28a80 Mon Sep 17 00:00:00 2001 From: Lachezar Lechev Date: Fri, 2 Aug 2024 13:13:15 +0300 Subject: [PATCH 03/50] chore: add workspace deps for stremio-* crates Signed-off-by: Lachezar Lechev --- Cargo.lock | 75 +++++++++++++++++++++++++++++------------------------- Cargo.toml | 15 +++++++---- 2 files changed, 50 insertions(+), 40 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index b5ecaba..f134d80 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -317,6 +317,12 @@ version = "0.21.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "35636a1494ede3b646cc98f74f8e62c773a38a659ebc777a2cf26b9b74171df9" +[[package]] +name = "base64" +version = "0.22.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "72b3254f16251a8381aa12e40e3c4d2f0199f8c6508fbecb9d91f575e0fbb8c6" + [[package]] name = "beef" version = "0.5.2" @@ -580,9 +586,9 @@ dependencies = [ [[package]] name = "darling" -version = "0.20.8" +version = "0.20.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "54e36fcd13ed84ffdfda6f5be89b31287cbb80c439841fe69e04841435464391" +checksum = "6f63b86c8a8826a49b8c21f08a2d07338eec8d900540f8630dc76284be802989" dependencies = [ "darling_core", "darling_macro", @@ -590,9 +596,9 @@ dependencies = [ [[package]] name = "darling_core" -version = "0.20.8" +version = "0.20.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9c2cf1c23a687a1feeb728783b993c4e1ad83d99f351801977dd809b48d0a70f" +checksum = "95133861a8032aaea082871032f5815eb9e98cef03fa916ab4500513994df9e5" dependencies = [ "fnv", "ident_case", @@ -604,9 +610,9 @@ dependencies = [ [[package]] name = "darling_macro" -version = "0.20.8" +version = "0.20.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a668eda54683121533a393014d8692171709ff57a7d61f187b6e782719f8933f" +checksum = "d336a2a514f6ccccaa3e09b02d41d35330c07ddf03a62165fcec10bb561c7806" dependencies = [ "darling_core", "quote", @@ -636,15 +642,15 @@ dependencies = [ [[package]] name = "derive_more" -version = "0.99.17" +version = "0.99.18" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4fb810d30a7c1953f91334de7244731fc3f3c10d7fe163338a35b9f640960321" +checksum = "5f33878137e4dafd7fa914ad4e259e18a4e8e532b9617a2d0150262bf53abfce" dependencies = [ "convert_case", "proc-macro2", "quote", "rustc_version", - "syn 1.0.109", + "syn 2.0.41", ] [[package]] @@ -1609,9 +1615,9 @@ dependencies = [ [[package]] name = "num-complex" -version = "0.4.4" +version = "0.4.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1ba157ca0885411de85d6ca030ba7e2a83a28636056c7c699b07c8b6f7383214" +checksum = "23c6602fda94a57c990fe0df199a035d83576b496aa29f4e634a8ac6004e68a6" dependencies = [ "num-traits", ] @@ -1624,19 +1630,18 @@ checksum = "51d515d32fb182ee37cda2ccdcb92950d6a3c2893aa280e540671c2cd0f3b1d9" [[package]] name = "num-integer" -version = "0.1.45" +version = "0.1.46" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "225d3389fb3509a24c93f5c29eb6bde2586b98d9f016636dff58d7c6f7569cd9" +checksum = "7969661fd2958a5cb096e56c8e1ad0444ac2bbcd0061bd28660485a44879858f" dependencies = [ - "autocfg", "num-traits", ] [[package]] name = "num-iter" -version = "0.1.43" +version = "0.1.45" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7d03e6c028c5dc5cac6e2dec0efda81fc887605bb3d884578bb6d6bf7514e252" +checksum = "1429034a0490724d0075ebb2bc9e875d6503c3cf69e235a8941aa757d83ef5bf" dependencies = [ "autocfg", "num-integer", @@ -2202,9 +2207,9 @@ dependencies = [ [[package]] name = "rustversion" -version = "1.0.14" +version = "1.0.17" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7ffc183a10b4478d04cbbbfc96d0873219d962dd5accaff2ffbd4ceb7df837f4" +checksum = "955d28af4278de8121b7ebeb796b6a45735dc01436d898801014aced2773a3d6" [[package]] name = "ryu" @@ -2293,9 +2298,9 @@ dependencies = [ [[package]] name = "serde_bytes" -version = "0.11.12" +version = "0.11.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ab33ec92f677585af6d88c65593ae2375adde54efdbf16d597f2cbc7a6d368ff" +checksum = "387cc504cb06bb40a96c8e04e951fe01854cf6bc921053c954e4a606d9675c6a" dependencies = [ "serde", ] @@ -2356,11 +2361,11 @@ dependencies = [ [[package]] name = "serde_with" -version = "3.7.0" +version = "3.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ee80b0e361bbf88fd2f6e242ccd19cfda072cb0faa6ae694ecee08199938569a" +checksum = "69cecfa94848272156ea67b2b1a53f20fc7bc638c4a46d2f8abde08f05f4b857" dependencies = [ - "base64 0.21.5", + "base64 0.22.1", "chrono", "hex 0.4.3", "indexmap 1.9.3", @@ -2374,9 +2379,9 @@ dependencies = [ [[package]] name = "serde_with_macros" -version = "3.7.0" +version = "3.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6561dc161a9224638a31d876ccdfefbc1df91d3f3a8342eddb35f055d48c7655" +checksum = "a8fee4991ef4f274617a51ad4af30519438dacb2f56ac773b08a1922ff743350" dependencies = [ "darling", "proc-macro2", @@ -2527,7 +2532,7 @@ dependencies = [ [[package]] name = "stremio-core" version = "0.1.0" -source = "git+https://github.com/Stremio/stremio-core?branch=feat/serialize-model-separatelly-from-creating-it#64d55209d343dbe444b334d0fbf1fbfff9c30dcd" +source = "git+https://github.com/Stremio/stremio-core?branch=feat/serialize-model-separatelly-from-creating-it#652fad29302a7cd280ef596fda134b70269c3eed" dependencies = [ "anyhow", "base64 0.21.5", @@ -2628,7 +2633,7 @@ dependencies = [ [[package]] name = "stremio-core-web" version = "0.47.7" -source = "git+https://github.com/Stremio/stremio-core?branch=feat/serialize-model-separatelly-from-creating-it#64d55209d343dbe444b334d0fbf1fbfff9c30dcd" +source = "git+https://github.com/Stremio/stremio-core?branch=feat/serialize-model-separatelly-from-creating-it#652fad29302a7cd280ef596fda134b70269c3eed" dependencies = [ "Inflector", "boolinator", @@ -2654,7 +2659,7 @@ dependencies = [ [[package]] name = "stremio-derive" version = "0.1.0" -source = "git+https://github.com/Stremio/stremio-core?branch=feat/serialize-model-separatelly-from-creating-it#64d55209d343dbe444b334d0fbf1fbfff9c30dcd" +source = "git+https://github.com/Stremio/stremio-core?branch=feat/serialize-model-separatelly-from-creating-it#652fad29302a7cd280ef596fda134b70269c3eed" dependencies = [ "case", "proc-macro-crate", @@ -2688,7 +2693,7 @@ dependencies = [ [[package]] name = "stremio-watched-bitfield" version = "0.1.0" -source = "git+https://github.com/Stremio/stremio-core?branch=feat/serialize-model-separatelly-from-creating-it#64d55209d343dbe444b334d0fbf1fbfff9c30dcd" +source = "git+https://github.com/Stremio/stremio-core?branch=feat/serialize-model-separatelly-from-creating-it#652fad29302a7cd280ef596fda134b70269c3eed" dependencies = [ "base64 0.13.1", "flate2", @@ -2697,9 +2702,9 @@ dependencies = [ [[package]] name = "strsim" -version = "0.10.0" +version = "0.11.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "73473c0e59e6d5812c5dfe2a064a6444949f089e20eec9a2e5506596494e4623" +checksum = "7da8b5736845d9f2fcb837ea5d9e2628564b3b043a70948a3f0b778838c5fb4f" [[package]] name = "strum" @@ -2927,9 +2932,9 @@ dependencies = [ [[package]] name = "toml_datetime" -version = "0.6.5" +version = "0.6.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3550f4e9685620ac18a50ed434eb3aec30db8ba93b0287467bca5826ea25baf1" +checksum = "0dd7358ecb8fc2f8d014bf86f6f638ce72ba252a2c3a2572f2a795f1d23efb41" [[package]] name = "toml_edit" @@ -3374,9 +3379,9 @@ checksum = "dff9641d1cd4be8d1a070daf9e3773c5f67e78b4d9d42263020c057706765c04" [[package]] name = "winnow" -version = "0.5.28" +version = "0.5.40" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6c830786f7720c2fd27a1a0e27a709dbd3c4d009b56d098fc742d4f4eab91fe2" +checksum = "f593a95398737aeed53e489c785df13f3618e41dbcd6718c6addbf1395aa6876" dependencies = [ "memchr", ] diff --git a/Cargo.toml b/Cargo.toml index 3978e48..392835d 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -27,11 +27,7 @@ path = "src/commonMain/rust/lib.rs" resolver = "2" members = ["stremio-core-protobuf"] -[profile.release] -lto = true -opt-level = 3 - -[dependencies] +[workspace.dependencies] stremio-core = { version = "0.1", git = "https://github.com/Stremio/stremio-core", branch = "feat/serialize-model-separatelly-from-creating-it", features = [ "derive", "analytics", @@ -41,6 +37,15 @@ stremio-core = { version = "0.1", git = "https://github.com/Stremio/stremio-core stremio-core-web = { version = "0.47", git = "https://github.com/Stremio/stremio-core", branch = "feat/serialize-model-separatelly-from-creating-it", default-features = false } stremio-core-protobuf = { version = "0.1", path = "stremio-core-protobuf", default-features = false } +[profile.release] +lto = true +opt-level = 3 + +[dependencies] +stremio-core.workspace = true +stremio-core-web.workspace = true +stremio-core-protobuf.workspace = true + serde = "1.0.*" serde_json = "1.0.*" serde_path_to_error = "0.1.*" From 8d8a6013745379866216a20d46f36222352b58bb Mon Sep 17 00:00:00 2001 From: Lachezar Lechev Date: Fri, 2 Aug 2024 13:16:13 +0300 Subject: [PATCH 04/50] chore: rustfmt & clippy fixes + suppress missing safety docs for stremio_core_android module Signed-off-by: Lachezar Lechev --- src/commonMain/rust/bridge.rs | 2 +- src/commonMain/rust/bridge/loadable.rs | 1 - src/commonMain/rust/model.rs | 2 +- src/commonMain/rust/model/fields.rs | 2 +- src/commonMain/rust/stremio_core_android.rs | 3 +++ stremio-core-protobuf/build.rs | 1 - 6 files changed, 6 insertions(+), 5 deletions(-) diff --git a/src/commonMain/rust/bridge.rs b/src/commonMain/rust/bridge.rs index 39760e0..117c2d0 100644 --- a/src/commonMain/rust/bridge.rs +++ b/src/commonMain/rust/bridge.rs @@ -1,6 +1,6 @@ //! This module contains all the bridge impls which take [`stremio_core`] types //! and allow `FromProtobuf` and `ToProtobuf` for Protobuf generates structs and enums. -//! +//! //! # Bridge mod action; diff --git a/src/commonMain/rust/bridge/loadable.rs b/src/commonMain/rust/bridge/loadable.rs index 4bbcebd..b3b3dd0 100644 --- a/src/commonMain/rust/bridge/loadable.rs +++ b/src/commonMain/rust/bridge/loadable.rs @@ -16,7 +16,6 @@ use stremio_core::types::{ watched_bitfield::WatchedBitField, }; - use crate::bridge::ToProtobuf; use crate::protobuf::stremio::core::models; use crate::protobuf::stremio::core::models::{LoadedModal, LoadedNotification, PlaybackDevices}; diff --git a/src/commonMain/rust/model.rs b/src/commonMain/rust/model.rs index 9fbd777..197c20c 100644 --- a/src/commonMain/rust/model.rs +++ b/src/commonMain/rust/model.rs @@ -1,5 +1,5 @@ -mod fields; mod addons; +mod fields; pub use addons::*; mod model; diff --git a/src/commonMain/rust/model/fields.rs b/src/commonMain/rust/model/fields.rs index f5637ea..cb06de1 100644 --- a/src/commonMain/rust/model/fields.rs +++ b/src/commonMain/rust/model/fields.rs @@ -9,4 +9,4 @@ mod library_by_type; mod link; mod meta_details; mod player; -mod streaming_server; \ No newline at end of file +mod streaming_server; diff --git a/src/commonMain/rust/stremio_core_android.rs b/src/commonMain/rust/stremio_core_android.rs index d2611ea..9471b03 100644 --- a/src/commonMain/rust/stremio_core_android.rs +++ b/src/commonMain/rust/stremio_core_android.rs @@ -1,3 +1,6 @@ +// TODO: Add safety docs and remove suppression of linter! +#![allow(clippy::missing_safety_doc)] + use std::io::Cursor; use std::os::raw::c_void; #[cfg(debug_assertions)] diff --git a/stremio-core-protobuf/build.rs b/stremio-core-protobuf/build.rs index fb169b7..ddcfd8e 100644 --- a/stremio-core-protobuf/build.rs +++ b/stremio-core-protobuf/build.rs @@ -10,7 +10,6 @@ fn main() { eprintln!("Glob error: {err}"); } - result.ok() }) .collect::>(); From 7264ed9cca0c2ce20568e8b1cdb9c825877b327c Mon Sep 17 00:00:00 2001 From: Lachezar Lechev Date: Fri, 2 Aug 2024 15:20:54 +0300 Subject: [PATCH 05/50] chore(Cargo.toml): add prost and relative crates to workspace dependencies - use workspace deps. in stremio-core-protobuf Signed-off-by: Lachezar Lechev --- Cargo.lock | 1 - Cargo.toml | 9 +++++++++ stremio-core-protobuf/Cargo.toml | 13 ++++++------- 3 files changed, 15 insertions(+), 8 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index f134d80..6b5077c 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2622,7 +2622,6 @@ dependencies = [ name = "stremio-core-protobuf" version = "0.1.0" dependencies = [ - "bytes", "glob", "prost", "prost-build", diff --git a/Cargo.toml b/Cargo.toml index 392835d..5452d95 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -37,6 +37,15 @@ stremio-core = { version = "0.1", git = "https://github.com/Stremio/stremio-core stremio-core-web = { version = "0.47", git = "https://github.com/Stremio/stremio-core", branch = "feat/serialize-model-separatelly-from-creating-it", default-features = false } stremio-core-protobuf = { version = "0.1", path = "stremio-core-protobuf", default-features = false } +# Protobuf +prost = "0.12" +prost-types = "0.12" + +# Protobuf for codegen, e.g. build.rs +prost-build = "0.12" +protox = "0.5" +glob = "0.3.0" + [profile.release] lto = true opt-level = 3 diff --git a/stremio-core-protobuf/Cargo.toml b/stremio-core-protobuf/Cargo.toml index c68b022..bd63ac6 100644 --- a/stremio-core-protobuf/Cargo.toml +++ b/stremio-core-protobuf/Cargo.toml @@ -5,12 +5,11 @@ edition = "2021" [dependencies] -# Bytes / Protobuf -bytes = "1.1.0" -prost = "0.12" -prost-types = "0.12" +# Protobuf +prost.workspace = true +prost-types.workspace = true [build-dependencies] -prost-build = "0.12" -protox = "0.5" -glob = "0.3.0" \ No newline at end of file +prost-build.workspace = true +protox.workspace = true +glob.workspace = true \ No newline at end of file From 641a7dad62c7c8e46c06685bdb720b507acaeea1 Mon Sep 17 00:00:00 2001 From: Lachezar Lechev Date: Fri, 2 Aug 2024 17:38:49 +0300 Subject: [PATCH 06/50] fix(stremio-core-protobuf): build.rs - use CARGO_MANIFEST_DIR for protobuf files location Signed-off-by: Lachezar Lechev --- stremio-core-protobuf/build.rs | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/stremio-core-protobuf/build.rs b/stremio-core-protobuf/build.rs index ddcfd8e..cfe1682 100644 --- a/stremio-core-protobuf/build.rs +++ b/stremio-core-protobuf/build.rs @@ -1,9 +1,14 @@ +use std::path::PathBuf; + use glob::glob; use prost_build::Config; +pub const CARGO_MANIFEST_DIR: &str = env!("CARGO_MANIFEST_DIR"); fn main() { - let proto_dir = "proto"; - let proto_paths = glob(format!("{proto_dir}/**/*.proto").as_str()) + + let proto_dir = PathBuf::from(CARGO_MANIFEST_DIR).join("proto"); + + let proto_paths = glob(format!("{}/**/*.proto", proto_dir.display()).as_str()) .unwrap() .filter_map(|result| { if let Err(err) = &result { From 40ed286b108bc897e99ed84320e11a3999acb5c7 Mon Sep 17 00:00:00 2001 From: Lachezar Lechev Date: Mon, 5 Aug 2024 12:21:05 +0300 Subject: [PATCH 07/50] fix: proto - Descriptor renamed to Descriptor__ because of protoc compiler Signed-off-by: Lachezar Lechev --- .../proto/stremio/core/models/addon_details.proto | 4 ++-- .../proto/stremio/core/runtime/action_ctx.proto | 6 +++--- .../proto/stremio/core/types/manifest.proto | 2 +- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/stremio-core-protobuf/proto/stremio/core/models/addon_details.proto b/stremio-core-protobuf/proto/stremio/core/models/addon_details.proto index 6595e92..de8d4a0 100644 --- a/stremio-core-protobuf/proto/stremio/core/models/addon_details.proto +++ b/stremio-core-protobuf/proto/stremio/core/models/addon_details.proto @@ -9,7 +9,7 @@ import "stremio/core/types/manifest.proto"; message AddonDetails { optional Selected selected = 1; - optional stremio.core.types.Descriptor local_addon = 2; + optional stremio.core.types.Descriptor__ local_addon = 2; optional LoadableDescriptor remote_addon = 3; message Selected { @@ -22,6 +22,6 @@ message LoadableDescriptor { oneof content { Loading loading = 2; Error error = 3; - stremio.core.types.Descriptor ready = 4; + stremio.core.types.Descriptor__ ready = 4; } } \ No newline at end of file diff --git a/stremio-core-protobuf/proto/stremio/core/runtime/action_ctx.proto b/stremio-core-protobuf/proto/stremio/core/runtime/action_ctx.proto index b4f8214..be2d298 100644 --- a/stremio-core-protobuf/proto/stremio/core/runtime/action_ctx.proto +++ b/stremio-core-protobuf/proto/stremio/core/runtime/action_ctx.proto @@ -14,11 +14,11 @@ message ActionCtx { oneof args { stremio.core.types.AuthRequest authenticate = 1; google.protobuf.Empty logout = 2; - stremio.core.types.Descriptor install_addon = 3; + stremio.core.types.Descriptor__ install_addon = 3; google.protobuf.Empty install_trakt_addon = 4; google.protobuf.Empty logout_trakt = 5; - stremio.core.types.Descriptor upgrade_addon = 6; - stremio.core.types.Descriptor uninstall_addon = 7; + stremio.core.types.Descriptor__ upgrade_addon = 6; + stremio.core.types.Descriptor__ uninstall_addon = 7; stremio.core.types.Profile.Settings update_settings = 8; stremio.core.types.MetaItemPreview add_to_library = 9; string remove_from_library = 10; diff --git a/stremio-core-protobuf/proto/stremio/core/types/manifest.proto b/stremio-core-protobuf/proto/stremio/core/types/manifest.proto index 878d0c4..631fbb4 100644 --- a/stremio-core-protobuf/proto/stremio/core/types/manifest.proto +++ b/stremio-core-protobuf/proto/stremio/core/types/manifest.proto @@ -4,7 +4,7 @@ package stremio.core.types; option java_package = "com.stremio.core.types.addon"; -message Descriptor { +message Descriptor__ { required Manifest manifest = 1; required string transport_url = 2; required DescriptorFlags flags = 3; From b91e04eed9a305b02bae3a764def64b957867eec Mon Sep 17 00:00:00 2001 From: Lachezar Lechev Date: Tue, 6 Aug 2024 10:47:21 +0300 Subject: [PATCH 08/50] feat(stremio-core-protobuf): move and generalize the bridge and model fields from stremio-core-android Signed-off-by: Lachezar Lechev --- Cargo.lock | 7 + stremio-core-protobuf/Cargo.toml | 10 + stremio-core-protobuf/src/bridge.rs | 40 ++ stremio-core-protobuf/src/bridge/action.rs | 280 ++++++++++++++ .../src/bridge/auth_request.rs | 68 ++++ stremio-core-protobuf/src/bridge/date.rs | 19 + stremio-core-protobuf/src/bridge/env_error.rs | 12 + stremio-core-protobuf/src/bridge/event.rs | 281 ++++++++++++++ stremio-core-protobuf/src/bridge/events.rs | 44 +++ .../src/bridge/extra_value.rs | 22 ++ .../src/bridge/from_protobuf.rs | 4 + .../src/bridge/library_item.rs | 48 +++ stremio-core-protobuf/src/bridge/link.rs | 23 ++ stremio-core-protobuf/src/bridge/list.rs | 13 + stremio-core-protobuf/src/bridge/loadable.rs | 360 ++++++++++++++++++ stremio-core-protobuf/src/bridge/manifest.rs | 286 ++++++++++++++ .../src/bridge/meta_preview.rs | 100 +++++ stremio-core-protobuf/src/bridge/option.rs | 13 + stremio-core-protobuf/src/bridge/pair.rs | 11 + .../src/bridge/poster_shape.rs | 24 ++ stremio-core-protobuf/src/bridge/profile.rs | 193 ++++++++++ .../src/bridge/resource_loadable.rs | 147 +++++++ .../src/bridge/resource_path.rs | 26 ++ .../src/bridge/resource_request.rs | 31 ++ stremio-core-protobuf/src/bridge/stream.rs | 216 +++++++++++ stremio-core-protobuf/src/bridge/string.rs | 14 + stremio-core-protobuf/src/bridge/subtitle.rs | 23 ++ stremio-core-protobuf/src/lib.rs | 34 +- stremio-core-protobuf/src/model/addons.rs | 61 +++ stremio-core-protobuf/src/model/fields.rs | 12 + .../src/model/fields/addon_detail.rs | 30 ++ .../src/model/fields/addons_with_filters.rs | 130 +++++++ .../src/model/fields/catalogs_with_extra.rs | 68 ++++ .../model/fields/continue_watching_preview.rs | 20 + stremio-core-protobuf/src/model/fields/ctx.rs | 12 + .../src/model/fields/discover.rs | 94 +++++ .../src/model/fields/library.rs | 127 ++++++ .../src/model/fields/library_by_type.rs | 66 ++++ .../src/model/fields/link.rs | 14 + .../src/model/fields/meta_details.rs | 234 ++++++++++++ .../src/model/fields/player.rs | 144 +++++++ .../src/model/fields/streaming_server.rs | 117 ++++++ 42 files changed, 3470 insertions(+), 8 deletions(-) create mode 100644 stremio-core-protobuf/src/bridge.rs create mode 100644 stremio-core-protobuf/src/bridge/action.rs create mode 100644 stremio-core-protobuf/src/bridge/auth_request.rs create mode 100644 stremio-core-protobuf/src/bridge/date.rs create mode 100644 stremio-core-protobuf/src/bridge/env_error.rs create mode 100644 stremio-core-protobuf/src/bridge/event.rs create mode 100644 stremio-core-protobuf/src/bridge/events.rs create mode 100644 stremio-core-protobuf/src/bridge/extra_value.rs create mode 100644 stremio-core-protobuf/src/bridge/from_protobuf.rs create mode 100644 stremio-core-protobuf/src/bridge/library_item.rs create mode 100644 stremio-core-protobuf/src/bridge/link.rs create mode 100644 stremio-core-protobuf/src/bridge/list.rs create mode 100644 stremio-core-protobuf/src/bridge/loadable.rs create mode 100644 stremio-core-protobuf/src/bridge/manifest.rs create mode 100644 stremio-core-protobuf/src/bridge/meta_preview.rs create mode 100644 stremio-core-protobuf/src/bridge/option.rs create mode 100644 stremio-core-protobuf/src/bridge/pair.rs create mode 100644 stremio-core-protobuf/src/bridge/poster_shape.rs create mode 100644 stremio-core-protobuf/src/bridge/profile.rs create mode 100644 stremio-core-protobuf/src/bridge/resource_loadable.rs create mode 100644 stremio-core-protobuf/src/bridge/resource_path.rs create mode 100644 stremio-core-protobuf/src/bridge/resource_request.rs create mode 100644 stremio-core-protobuf/src/bridge/stream.rs create mode 100644 stremio-core-protobuf/src/bridge/string.rs create mode 100644 stremio-core-protobuf/src/bridge/subtitle.rs create mode 100644 stremio-core-protobuf/src/model/addons.rs create mode 100644 stremio-core-protobuf/src/model/fields.rs create mode 100644 stremio-core-protobuf/src/model/fields/addon_detail.rs create mode 100644 stremio-core-protobuf/src/model/fields/addons_with_filters.rs create mode 100644 stremio-core-protobuf/src/model/fields/catalogs_with_extra.rs create mode 100644 stremio-core-protobuf/src/model/fields/continue_watching_preview.rs create mode 100644 stremio-core-protobuf/src/model/fields/ctx.rs create mode 100644 stremio-core-protobuf/src/model/fields/discover.rs create mode 100644 stremio-core-protobuf/src/model/fields/library.rs create mode 100644 stremio-core-protobuf/src/model/fields/library_by_type.rs create mode 100644 stremio-core-protobuf/src/model/fields/link.rs create mode 100644 stremio-core-protobuf/src/model/fields/meta_details.rs create mode 100644 stremio-core-protobuf/src/model/fields/player.rs create mode 100644 stremio-core-protobuf/src/model/fields/streaming_server.rs diff --git a/Cargo.lock b/Cargo.lock index 6b5077c..dd7e187 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2622,11 +2622,18 @@ dependencies = [ name = "stremio-core-protobuf" version = "0.1.0" dependencies = [ + "Inflector", + "boolinator", + "chrono", "glob", + "hex 0.4.3", "prost", "prost-build", "prost-types", "protox", + "semver", + "stremio-core", + "url", ] [[package]] diff --git a/stremio-core-protobuf/Cargo.toml b/stremio-core-protobuf/Cargo.toml index bd63ac6..abbced0 100644 --- a/stremio-core-protobuf/Cargo.toml +++ b/stremio-core-protobuf/Cargo.toml @@ -4,11 +4,21 @@ version = "0.1.0" edition = "2021" [dependencies] +stremio-core.workspace = true # Protobuf prost.workspace = true prost-types.workspace = true +# Utils +semver = { version = "1", features = ["serde"] } +chrono = "0.4.*" +boolinator = "2.4.*" +Inflector = "0.11.*" + +hex = "0.4.*" +url = { version = "2.4", features = ["serde"] } + [build-dependencies] prost-build.workspace = true protox.workspace = true diff --git a/stremio-core-protobuf/src/bridge.rs b/stremio-core-protobuf/src/bridge.rs new file mode 100644 index 0000000..2ad372b --- /dev/null +++ b/stremio-core-protobuf/src/bridge.rs @@ -0,0 +1,40 @@ +//! This module contains all the bridge impls which takes [`stremio_core`] types +//! and allow `FromProtobuf` and `ToProtobuf` for Protobuf generates structs and enums. +//! +//! # Bridge + +use stremio_core::runtime::Env; + +mod action; +mod auth_request; +mod date; +mod env_error; +mod event; +mod events; +mod extra_value; +mod library_item; +mod link; +mod list; +mod loadable; +mod manifest; +mod meta_preview; +mod option; +mod pair; +mod poster_shape; +mod profile; +mod resource_loadable; +mod resource_path; +mod resource_request; +mod stream; +mod string; +mod subtitle; + +pub trait ToProtobuf { + fn to_protobuf(&self, args: &A) -> T; +} + +pub trait FromProtobuf { + #[allow(clippy::wrong_self_convention)] + fn from_protobuf(&self) -> T; +} + diff --git a/stremio-core-protobuf/src/bridge/action.rs b/stremio-core-protobuf/src/bridge/action.rs new file mode 100644 index 0000000..de1a665 --- /dev/null +++ b/stremio-core-protobuf/src/bridge/action.rs @@ -0,0 +1,280 @@ +use std::ops::Range; + +use stremio_core::runtime::msg::{ + Action, ActionCatalogWithFilters, ActionCatalogsWithExtra, ActionCtx, ActionLibraryByType, + ActionLink, ActionLoad, ActionMetaDetails, ActionPlayer, ActionStreamingServer, + CreateTorrentArgs, PlayOnDeviceArgs, +}; +use stremio_core::runtime::RuntimeAction; + +use crate::bridge::FromProtobuf; +// use crate::env::AndroidEnv; +// use crate::model::AndroidModel; +use crate::protobuf::stremio::core::runtime; +use crate::protobuf::stremio::core::runtime::{ + action_catalog_with_filters, action_catalogs_with_extra, action_ctx, action_library_by_type, + action_link, action_load, action_meta_details, action_player, action_streaming_server, + create_torrent_args, Field, +}; + +impl FromProtobuf for runtime::Action { + fn from_protobuf(&self) -> Action { + match &self.r#type { + Some(runtime::action::Type::Ctx(action_ctx)) => match &action_ctx.args { + Some(action_ctx::Args::Authenticate(auth_request)) => { + Action::Ctx(ActionCtx::Authenticate(auth_request.from_protobuf())) + } + Some(action_ctx::Args::Logout(_args)) => Action::Ctx(ActionCtx::Logout), + Some(action_ctx::Args::InstallAddon(descriptor)) => { + Action::Ctx(ActionCtx::InstallAddon(descriptor.from_protobuf())) + } + Some(action_ctx::Args::InstallTraktAddon(_args)) => { + Action::Ctx(ActionCtx::InstallTraktAddon) + } + Some(action_ctx::Args::LogoutTrakt(_args)) => Action::Ctx(ActionCtx::LogoutTrakt), + Some(action_ctx::Args::UpgradeAddon(descriptor)) => { + Action::Ctx(ActionCtx::UpgradeAddon(descriptor.from_protobuf())) + } + Some(action_ctx::Args::UninstallAddon(descriptor)) => { + Action::Ctx(ActionCtx::UninstallAddon(descriptor.from_protobuf())) + } + Some(action_ctx::Args::UpdateSettings(settings)) => { + Action::Ctx(ActionCtx::UpdateSettings(settings.from_protobuf())) + } + Some(action_ctx::Args::AddToLibrary(meta_item_preview)) => { + Action::Ctx(ActionCtx::AddToLibrary(meta_item_preview.from_protobuf())) + } + Some(action_ctx::Args::RemoveFromLibrary(id)) => { + Action::Ctx(ActionCtx::RemoveFromLibrary(id.to_owned())) + } + Some(action_ctx::Args::RewindLibraryItem(id)) => { + Action::Ctx(ActionCtx::RewindLibraryItem(id.to_owned())) + } + Some(action_ctx::Args::LibraryItemMarkAsWatched(args)) => { + Action::Ctx(ActionCtx::LibraryItemMarkAsWatched { + id: args.id.to_owned(), + is_watched: args.is_watched, + }) + } + Some(action_ctx::Args::ToggleLibraryItemNotifications(args)) => Action::Ctx( + ActionCtx::ToggleLibraryItemNotifications(args.id.to_owned(), args.toggle), + ), + Some(action_ctx::Args::DismissNotificationItem(id)) => { + Action::Ctx(ActionCtx::DismissNotificationItem(id.to_owned())) + } + Some(action_ctx::Args::PushUserToApi(_args)) => { + Action::Ctx(ActionCtx::PushUserToAPI) + } + Some(action_ctx::Args::PullUserFromApi(_args)) => { + Action::Ctx(ActionCtx::PullUserFromAPI) + } + Some(action_ctx::Args::PushAddonsToApi(_args)) => { + Action::Ctx(ActionCtx::PushAddonsToAPI) + } + Some(action_ctx::Args::PullAddonsFromApi(_args)) => { + Action::Ctx(ActionCtx::PullAddonsFromAPI) + } + Some(action_ctx::Args::SyncLibraryWithApi(_args)) => { + Action::Ctx(ActionCtx::SyncLibraryWithAPI) + } + Some(action_ctx::Args::PullNotifications(_args)) => { + Action::Ctx(ActionCtx::PullNotifications) + } + Some(action_ctx::Args::GetEvents(_args)) => Action::Ctx(ActionCtx::GetEvents), + Some(action_ctx::Args::DismissEvent(id)) => { + Action::Ctx(ActionCtx::DismissEvent(id.to_owned())) + } + None => unimplemented!("ActionCtx missing"), + }, + Some(runtime::action::Type::Link(action_link)) => match &action_link.args { + Some(action_link::Args::ReadData(_args)) => Action::Link(ActionLink::ReadData), + None => unimplemented!("ActionLink missing"), + }, + Some(runtime::action::Type::CatalogWithFilters(action_catalog)) => { + match &action_catalog.args { + Some(action_catalog_with_filters::Args::LoadNextPage(_args)) => { + Action::CatalogWithFilters(ActionCatalogWithFilters::LoadNextPage) + } + None => unimplemented!("ActionCatalogWithFilters missing"), + } + } + Some(runtime::action::Type::CatalogsWithExtra(action_catalog)) => { + match &action_catalog.args { + Some(action_catalogs_with_extra::Args::LoadRange(range)) => { + Action::CatalogsWithExtra(ActionCatalogsWithExtra::LoadRange(Range { + start: range.start as usize, + end: range.end as usize, + })) + } + Some(action_catalogs_with_extra::Args::LoadNextPage(index)) => { + Action::CatalogsWithExtra(ActionCatalogsWithExtra::LoadNextPage( + *index as usize, + )) + } + None => unimplemented!("ActionCatalogsWithExtra missing"), + } + } + Some(runtime::action::Type::LibraryByType(action_library_by_type)) => { + match &action_library_by_type.args { + Some(action_library_by_type::Args::LoadNextPage(index)) => { + Action::LibraryByType(ActionLibraryByType::LoadNextPage(*index as usize)) + } + None => unimplemented!("ActionLibraryByType missing"), + } + } + Some(runtime::action::Type::MetaDetails(action_meta_details)) => { + match &action_meta_details.args { + Some(action_meta_details::Args::MarkAsWatched(watched)) => { + Action::MetaDetails(ActionMetaDetails::MarkAsWatched(*watched)) + } + Some(action_meta_details::Args::MarkVideoAsWatched(video_state)) => { + Action::MetaDetails(ActionMetaDetails::MarkVideoAsWatched( + video_state.video.from_protobuf(), + video_state.is_watched, + )) + } + None => unimplemented!("ActionMetaDetails missing"), + } + } + Some(runtime::action::Type::StreamingServer(action_streaming_server)) => { + match &action_streaming_server.args { + Some(action_streaming_server::Args::Reload(_args)) => { + Action::StreamingServer(ActionStreamingServer::Reload) + } + Some(action_streaming_server::Args::UpdateSettings(settings)) => { + Action::StreamingServer(ActionStreamingServer::UpdateSettings( + settings.from_protobuf(), + )) + } + Some(action_streaming_server::Args::CreateTorrent(create_args)) => { + match &create_args.args { + Some(create_torrent_args::Args::File(file)) => { + Action::StreamingServer(ActionStreamingServer::CreateTorrent( + CreateTorrentArgs::File(file.to_owned()), + )) + } + Some(create_torrent_args::Args::Magnet(magnet)) => { + Action::StreamingServer(ActionStreamingServer::CreateTorrent( + CreateTorrentArgs::Magnet(magnet.from_protobuf()), + )) + } + None => unimplemented!("CreateTorrentArgs missing"), + } + } + Some(action_streaming_server::Args::PlayOnDevice(args)) => { + Action::StreamingServer(ActionStreamingServer::PlayOnDevice( + PlayOnDeviceArgs { + device: args.device.to_string(), + source: args.source.to_string(), + time: args.time.map(|x| x as u64).to_owned(), + }, + )) + } + Some(action_streaming_server::Args::GetStatistics(request)) => { + Action::StreamingServer(ActionStreamingServer::GetStatistics( + request.from_protobuf(), + )) + } + None => unimplemented!("ActionStreamingServer missing"), + } + } + Some(runtime::action::Type::Player(action_player)) => match &action_player.args { + Some(action_player::Args::VideoParamsChanged(video_params)) => { + Action::Player(ActionPlayer::VideoParamsChanged { + video_params: Some(video_params.from_protobuf()), + }) + } + Some(action_player::Args::StreamStateChanged(stream_state)) => { + Action::Player(ActionPlayer::StreamStateChanged { + state: stream_state.from_protobuf(), + }) + } + Some(action_player::Args::TimeChanged(item_state)) => { + Action::Player(ActionPlayer::TimeChanged { + time: item_state.time, + duration: item_state.duration, + device: item_state.device.to_owned(), + }) + } + Some(action_player::Args::PausedChanged(paused)) => { + Action::Player(ActionPlayer::PausedChanged { paused: *paused }) + } + Some(action_player::Args::NextVideo(_args)) => { + Action::Player(ActionPlayer::NextVideo {}) + } + Some(action_player::Args::Ended(_args)) => Action::Player(ActionPlayer::Ended {}), + None => unimplemented!("ActionLink missing"), + }, + Some(runtime::action::Type::Load(action_load)) => match &action_load.args { + Some(action_load::Args::AddonDetails(selected)) => { + Action::Load(ActionLoad::AddonDetails(selected.from_protobuf())) + } + Some(action_load::Args::CatalogsWithExtra(selected)) => { + Action::Load(ActionLoad::CatalogsWithExtra(selected.from_protobuf())) + } + Some(action_load::Args::CatalogWithFilters(selected)) => Action::Load( + ActionLoad::CatalogWithFilters(Some(selected.from_protobuf())), + ), + Some(action_load::Args::AddonsWithFilters(selected)) => { + Action::Load(match selected.request.base.is_empty() { + true => ActionLoad::InstalledAddonsWithFilters(selected.from_protobuf()), + _ => ActionLoad::CatalogWithFilters(Some(selected.from_protobuf())), + }) + } + Some(action_load::Args::LibraryWithFilters(selected)) => { + Action::Load(ActionLoad::LibraryWithFilters(selected.from_protobuf())) + } + Some(action_load::Args::LibraryByType(selected)) => { + Action::Load(ActionLoad::LibraryByType(selected.from_protobuf())) + } + Some(action_load::Args::MetaDetails(selected)) => { + Action::Load(ActionLoad::MetaDetails(selected.from_protobuf())) + } + Some(action_load::Args::Player(selected)) => { + Action::Load(ActionLoad::Player(Box::new(selected.from_protobuf()))) + } + Some(action_load::Args::Link(_args)) => Action::Load(ActionLoad::Link), + Some(action_load::Args::DataExport(_args)) => Action::Load(ActionLoad::DataExport), + Some(action_load::Args::LocalSearch(_args)) => { + Action::Load(ActionLoad::LocalSearch) + } + None => unimplemented!("ActionLoad missing"), + }, + Some(runtime::action::Type::Unload(_args)) => Action::Unload, + None => unimplemented!("Action missing"), + } + } +} + +// impl FromProtobuf> for runtime::RuntimeAction { +// fn from_protobuf(&self) -> RuntimeAction { +// RuntimeAction { +// field: self +// .field +// .and_then(|value| Field::try_from(value).ok()) +// .from_protobuf(), +// action: self.action.from_protobuf(), +// } +// } +// } + + + +// impl FromProtobuf> for runtime::RuntimeAction +impl FromProtobuf> for runtime::RuntimeAction +where + E: stremio_core::runtime::Env + 'static, + M: stremio_core::runtime::Model, + // M: stremio_core::runtime::Model, + F: From, +{ + fn from_protobuf(&self) -> RuntimeAction { + RuntimeAction { + field: self + .field + .and_then(|value| Field::try_from(value).ok().map(Into::into)), + // .from_protobuf(), + action: self.action.from_protobuf(), + } + } +} \ No newline at end of file diff --git a/stremio-core-protobuf/src/bridge/auth_request.rs b/stremio-core-protobuf/src/bridge/auth_request.rs new file mode 100644 index 0000000..8227bac --- /dev/null +++ b/stremio-core-protobuf/src/bridge/auth_request.rs @@ -0,0 +1,68 @@ +use stremio_core::types::api::AuthRequest; + +use crate::bridge::{FromProtobuf, ToProtobuf}; +use crate::protobuf::stremio::core::types; + +impl FromProtobuf for types::AuthRequest { + fn from_protobuf(&self) -> AuthRequest { + match &self.r#type { + Some(types::auth_request::Type::Login(login)) => AuthRequest::Login { + email: login.email.to_owned(), + password: login.password.to_owned(), + facebook: login.facebook.to_owned(), + }, + Some(types::auth_request::Type::LoginWithToken(login_with_token)) => { + AuthRequest::LoginWithToken { + token: login_with_token.token.to_owned(), + } + } + Some(types::auth_request::Type::Facebook(facebook)) => AuthRequest::Facebook { + token: facebook.token.to_owned(), + }, + Some(types::auth_request::Type::Register(register)) => AuthRequest::Register { + email: register.email.to_owned(), + password: register.password.to_owned(), + gdpr_consent: register.gdpr_consent.from_protobuf(), + }, + None => unimplemented!("AuthRequest must be present"), + } + } +} + +impl ToProtobuf for AuthRequest { + fn to_protobuf(&self, _args: &()) -> types::AuthRequest { + let request = match self { + AuthRequest::Login { + email, + password, + facebook, + } => types::auth_request::Type::Login(types::auth_request::Login { + email: email.to_owned(), + password: password.to_owned(), + facebook: facebook.to_owned(), + }), + AuthRequest::LoginWithToken { token } => { + types::auth_request::Type::LoginWithToken(types::auth_request::LoginWithToken { + token: token.to_owned(), + }) + } + AuthRequest::Facebook { token } => { + types::auth_request::Type::Facebook(types::auth_request::Facebook { + token: token.to_owned(), + }) + } + AuthRequest::Register { + email, + password, + gdpr_consent, + } => types::auth_request::Type::Register(types::auth_request::Register { + email: email.to_owned(), + password: password.to_owned(), + gdpr_consent: gdpr_consent.to_protobuf::(&()), + }), + }; + types::AuthRequest { + r#type: Some(request), + } + } +} diff --git a/stremio-core-protobuf/src/bridge/date.rs b/stremio-core-protobuf/src/bridge/date.rs new file mode 100644 index 0000000..0656371 --- /dev/null +++ b/stremio-core-protobuf/src/bridge/date.rs @@ -0,0 +1,19 @@ +use chrono::{DateTime, TimeZone, Utc}; + +use crate::bridge::{FromProtobuf, ToProtobuf}; +use crate::protobuf::google::protobuf::Timestamp; + +impl FromProtobuf> for Timestamp { + fn from_protobuf(&self) -> DateTime { + Utc.timestamp_opt(self.seconds, self.nanos as u32).unwrap() + } +} + +impl ToProtobuf for DateTime { + fn to_protobuf(&self, _args: &()) -> Timestamp { + Timestamp { + seconds: self.timestamp(), + nanos: self.timestamp_subsec_nanos() as i32, + } + } +} diff --git a/stremio-core-protobuf/src/bridge/env_error.rs b/stremio-core-protobuf/src/bridge/env_error.rs new file mode 100644 index 0000000..43de971 --- /dev/null +++ b/stremio-core-protobuf/src/bridge/env_error.rs @@ -0,0 +1,12 @@ +use crate::bridge::ToProtobuf; +use crate::protobuf::stremio::core::runtime; +use stremio_core::runtime::EnvError; + +impl ToProtobuf for EnvError { + fn to_protobuf(&self, _args: &()) -> runtime::EnvError { + runtime::EnvError { + code: self.code() as i32, + message: self.message(), + } + } +} diff --git a/stremio-core-protobuf/src/bridge/event.rs b/stremio-core-protobuf/src/bridge/event.rs new file mode 100644 index 0000000..a549ea0 --- /dev/null +++ b/stremio-core-protobuf/src/bridge/event.rs @@ -0,0 +1,281 @@ +use stremio_core::{ + models::ctx::CtxError, + runtime::{msg::Event, RuntimeEvent}, +}; + +use crate::bridge::ToProtobuf; +use crate::stremio_core_models::runtime::{self, Field}; + +impl ToProtobuf for Event { + fn to_protobuf(&self, _args: &()) -> runtime::Event { + let event = match self { + Event::ProfilePushedToStorage { uid } => runtime::event::Type::ProfilePushedToStorage( + runtime::event::ProfilePushedToStorage { uid: uid.clone() }, + ), + Event::LibraryItemsPushedToStorage { ids } => { + runtime::event::Type::LibraryItemsPushedToStorage( + runtime::event::LibraryItemsPushedToStorage { ids: ids.clone() }, + ) + } + Event::StreamsPushedToStorage { uid } => runtime::event::Type::StreamsPushedToStorage( + runtime::event::StreamsPushedToStorage { uid: uid.clone() }, + ), + Event::SearchHistoryPushedToStorage { uid } => { + runtime::event::Type::SearchHistoryPushedToStorage( + runtime::event::SearchHistoryPushedToStorage { uid: uid.clone() }, + ) + } + Event::NotificationsPushedToStorage { ids } => { + runtime::event::Type::NotificationsPushedToStorage( + runtime::event::NotificationsPushedToStorage { ids: ids.clone() }, + ) + } + Event::DismissedEventsPushedToStorage { uid } => { + runtime::event::Type::DismissedEventsPushedToStorage( + runtime::event::DismissedEventsPushedToStorage { uid: uid.clone() }, + ) + } + Event::UserPulledFromAPI { uid } => { + runtime::event::Type::UserPulledFromApi(runtime::event::UserPulledFromApi { + uid: uid.clone(), + }) + } + Event::UserPushedToAPI { uid } => { + runtime::event::Type::UserPushedToApi(runtime::event::UserPushedToApi { + uid: uid.clone(), + }) + } + Event::AddonsPulledFromAPI { transport_urls } => { + runtime::event::Type::AddonsPulledFromApi(runtime::event::AddonsPulledFromApi { + transport_urls: transport_urls.to_protobuf::(&()), + }) + } + Event::AddonsPushedToAPI { transport_urls } => { + runtime::event::Type::AddonsPushedToApi(runtime::event::AddonsPushedToApi { + transport_urls: transport_urls.to_protobuf::(&()), + }) + } + Event::UserAuthenticated { auth_request } => { + runtime::event::Type::UserAuthenticated(runtime::event::UserAuthenticated { + auth_request: auth_request.to_protobuf::(&()), + }) + } + Event::UserAddonsLocked { addons_locked } => { + runtime::event::Type::UserAddonsLocked(runtime::event::UserAddonsLocked { + addons_locked: *addons_locked, + }) + } + Event::UserLibraryMissing { library_missing } => { + runtime::event::Type::UserLibraryMissing(runtime::event::UserLibraryMissing { + library_missing: *library_missing, + }) + } + Event::UserLoggedOut { uid } => { + runtime::event::Type::UserLoggedOut(runtime::event::UserLoggedOut { + uid: uid.clone(), + }) + } + Event::SessionDeleted { auth_key } => { + runtime::event::Type::SessionDeleted(runtime::event::SessionDeleted { + auth_key: auth_key.0.to_owned(), + }) + } + Event::TraktAddonFetched { uid } => { + runtime::event::Type::TraktAddonFetched(runtime::event::TraktAddonFetched { + uid: uid.clone(), + }) + } + Event::TraktLoggedOut { uid } => { + runtime::event::Type::TraktLoggedOut(runtime::event::TraktLoggedOut { + uid: uid.clone(), + }) + } + Event::AddonInstalled { transport_url, id } => { + runtime::event::Type::AddonInstalled(runtime::event::AddonInstalled { + transport_url: transport_url.to_string(), + id: id.to_owned(), + }) + } + Event::AddonUpgraded { transport_url, id } => { + runtime::event::Type::AddonUpgraded(runtime::event::AddonUpgraded { + transport_url: transport_url.to_string(), + id: id.to_owned(), + }) + } + Event::AddonUninstalled { transport_url, id } => { + runtime::event::Type::AddonUninstalled(runtime::event::AddonUninstalled { + transport_url: transport_url.to_string(), + id: id.to_owned(), + }) + } + Event::LibraryItemAdded { id } => { + runtime::event::Type::LibraryItemAdded(runtime::event::LibraryItemAdded { + id: id.to_owned(), + }) + } + Event::LibraryItemRemoved { id } => { + runtime::event::Type::LibraryItemRemoved(runtime::event::LibraryItemRemoved { + id: id.to_owned(), + }) + } + Event::LibraryItemRewinded { id } => { + runtime::event::Type::LibraryItemRewinded(runtime::event::LibraryItemRewinded { + id: id.to_owned(), + }) + } + Event::LibraryItemNotificationsToggled { id } => { + runtime::event::Type::LibraryItemNotificationsToggled( + runtime::event::LibraryItemNotificationsToggled { id: id.clone() }, + ) + } + Event::LibraryItemMarkedAsWatched { id, is_watched } => { + runtime::event::Type::LibraryItemMarkedAsWatched( + runtime::event::LibraryItemMarkedAsWatched { + id: id.clone(), + is_watched: *is_watched, + }, + ) + } + Event::NotificationsDismissed { id } => runtime::event::Type::NotificationsDismissed( + runtime::event::NotificationsDismissed { id: id.clone() }, + ), + Event::LibrarySyncWithAPIPlanned { uid, plan } => { + runtime::event::Type::LibrarySyncWithApiPlanned( + runtime::event::LibrarySyncWithApiPlanned { + uid: uid.clone(), + plan: plan.to_protobuf::(&()), + }, + ) + } + Event::LibraryItemsPushedToAPI { ids } => { + runtime::event::Type::LibraryItemsPushedToApi( + runtime::event::LibraryItemsPushedToApi { ids: ids.clone() }, + ) + } + Event::LibraryItemsPulledFromAPI { ids } => { + runtime::event::Type::LibraryItemsPulledFromApi( + runtime::event::LibraryItemsPulledFromApi { ids: ids.clone() }, + ) + } + Event::SettingsUpdated { settings } => { + runtime::event::Type::SettingsUpdated(runtime::event::SettingsUpdated { + settings: settings.to_protobuf::(&()), + }) + } + Event::PlayerPlaying { .. } => { + runtime::event::Type::PlayerPlaying(runtime::event::PlayerPlaying {}) + } + Event::PlayerStopped { .. } => { + runtime::event::Type::PlayerStopped(runtime::event::PlayerStopped {}) + } + Event::PlayerNextVideo { .. } => { + runtime::event::Type::PlayerNextVideo(runtime::event::PlayerNextVideo {}) + } + Event::PlayerEnded { .. } => { + runtime::event::Type::PlayerEnded(runtime::event::PlayerEnded {}) + } + Event::TraktPlaying { .. } => { + runtime::event::Type::TraktPlaying(runtime::event::TraktPlaying {}) + } + Event::TraktPaused { .. } => { + runtime::event::Type::TraktPaused(runtime::event::TraktPaused {}) + } + Event::MagnetParsed { magnet } => { + runtime::event::Type::MagnetParsed(runtime::event::MagnetParsed { + magnet: magnet.to_protobuf::(&()), + }) + } + Event::TorrentParsed { torrent } => { + runtime::event::Type::TorrentParsed(runtime::event::TorrentParsed { + torrent: torrent.to_owned(), + }) + } + Event::PlayingOnDevice { device } => { + runtime::event::Type::PlayingOnDevice(runtime::event::PlayingOnDevice { + device: device.to_owned(), + }) + } + Event::Error { error, source } => { + let error = match error { + CtxError::API(error) => error.message.to_owned(), + CtxError::Env(error) => error.message(), + CtxError::Other(error) => error.message(), + }; + runtime::event::Type::Error(Box::from(runtime::event::Error { + error, + source: Box::from(source.to_protobuf::(&())), + })) + } + }; + runtime::Event { + r#type: Some(event), + } + } +} + +// impl ToProtobuf for RuntimeEvent { +// fn to_protobuf(&self, _args: &()) -> runtime::RuntimeEvent { +// let event = match self { +// RuntimeEvent::NewState(fields, ..) => { +// runtime::runtime_event::Event::NewState(runtime::runtime_event::NewState { +// fields: fields +// .to_protobuf::(&()) +// .iter() +// .map(|field| *field as i32) +// .collect(), +// }) +// } +// RuntimeEvent::CoreEvent(event) => { +// runtime::runtime_event::Event::CoreEvent(event.to_protobuf::(&())) +// } +// }; +// runtime::RuntimeEvent { event: Some(event) } +// } +// } + +impl ToProtobuf for RuntimeEvent +where + E: stremio_core::runtime::Env + 'static, + M: stremio_core::runtime::Model, + F: Into + Clone, +{ + fn to_protobuf( + &self, + _args: &(), + ) -> runtime::RuntimeEvent { + let event = match self { + RuntimeEvent::NewState(fields, ..) => { + runtime::runtime_event::Event::NewState(runtime::runtime_event::NewState { + fields: fields + .iter() + .map(|field| field.clone().into()) + // .to_protobuf::(&()) + // .iter() + .map(|field: Field| field as i32) + .collect(), + }) + } + RuntimeEvent::CoreEvent(event) => { + runtime::runtime_event::Event::CoreEvent(event.to_protobuf::(&())) + } + }; + runtime::RuntimeEvent { event: Some(event) } + } +} + +// impl FromProtobuf> for runtime::RuntimeAction +// where +// E: stremio_core::runtime::Env + 'static, +// M: stremio_core::runtime::Model, +// F: From, +// { +// fn from_protobuf(&self) -> RuntimeAction { +// RuntimeAction { +// field: self +// .field +// .and_then(|value| Field::try_from(value).ok().map(Into::into)), +// // .from_protobuf(), +// action: self.action.from_protobuf(), +// } +// } +// } diff --git a/stremio-core-protobuf/src/bridge/events.rs b/stremio-core-protobuf/src/bridge/events.rs new file mode 100644 index 0000000..1fa6e7e --- /dev/null +++ b/stremio-core-protobuf/src/bridge/events.rs @@ -0,0 +1,44 @@ +use stremio_core::types::api::{GetModalResponse, GetNotificationResponse}; +use stremio_core::types::events::Events; + +use crate::bridge::ToProtobuf; +use crate::protobuf::stremio::core::models; + +impl ToProtobuf for Events { + fn to_protobuf(&self, _args: &()) -> models::Events { + models::Events { + modal: self.modal.to_protobuf::(&()), + notification: self.notification.to_protobuf::(&()), + } + } +} + +impl ToProtobuf for GetModalResponse { + fn to_protobuf(&self, _args: &()) -> models::EventModal { + models::EventModal { + id: self.id.to_owned(), + title: self.title.to_owned(), + message: self.message.to_owned(), + image_url: self.image_url.to_protobuf::(&()), + addon: self + .addon + .as_ref() + .map(|addon| models::event_modal::ModalAddon { + manifest_url: addon.manifest_url.to_protobuf::(&()), + name: addon.name.to_owned(), + }), + external_url: self.external_url.to_protobuf::(&()), + } + } +} + +impl ToProtobuf for GetNotificationResponse { + fn to_protobuf(&self, _args: &()) -> models::EventNotification { + models::EventNotification { + id: self.id.to_owned(), + title: self.title.to_owned(), + message: self.message.to_owned(), + external_url: self.external_url.to_protobuf::(&()), + } + } +} diff --git a/stremio-core-protobuf/src/bridge/extra_value.rs b/stremio-core-protobuf/src/bridge/extra_value.rs new file mode 100644 index 0000000..40190a8 --- /dev/null +++ b/stremio-core-protobuf/src/bridge/extra_value.rs @@ -0,0 +1,22 @@ +use stremio_core::types::addon::ExtraValue; + +use crate::bridge::{FromProtobuf, ToProtobuf}; +use crate::protobuf::stremio::core::types; + +impl FromProtobuf for types::ExtraValue { + fn from_protobuf(&self) -> ExtraValue { + ExtraValue { + name: self.name.to_owned(), + value: self.value.to_owned(), + } + } +} + +impl ToProtobuf for ExtraValue { + fn to_protobuf(&self, _args: &()) -> types::ExtraValue { + types::ExtraValue { + name: self.name.to_owned(), + value: self.value.to_owned(), + } + } +} diff --git a/stremio-core-protobuf/src/bridge/from_protobuf.rs b/stremio-core-protobuf/src/bridge/from_protobuf.rs new file mode 100644 index 0000000..36f4454 --- /dev/null +++ b/stremio-core-protobuf/src/bridge/from_protobuf.rs @@ -0,0 +1,4 @@ +pub trait FromProtobuf { + #[allow(clippy::wrong_self_convention)] + fn from_protobuf(&self) -> T; +} diff --git a/stremio-core-protobuf/src/bridge/library_item.rs b/stremio-core-protobuf/src/bridge/library_item.rs new file mode 100644 index 0000000..58f8018 --- /dev/null +++ b/stremio-core-protobuf/src/bridge/library_item.rs @@ -0,0 +1,48 @@ +use stremio_core::deep_links::LibraryItemDeepLinks; +use stremio_core::models::ctx::Ctx; +use stremio_core::types::library::LibraryItem; + +use crate::bridge::ToProtobuf; +use crate::protobuf::stremio::core::types; + +impl ToProtobuf)> for LibraryItem { + fn to_protobuf( + &self, + (ctx, maybe_notifications): &(&Ctx, Option), + ) -> types::LibraryItem { + let notifications = maybe_notifications + .or_else(|| { + ctx.notifications + .items + .get(&self.id) + .map(|notifs| notifs.len()) + }) + .unwrap_or_default(); + let settings = &ctx.profile.settings; + let streaming_server_url = &settings.streaming_server_url; + let deep_links = + LibraryItemDeepLinks::from((self, None, Some(streaming_server_url), settings)); + types::LibraryItem { + id: self.id.to_string(), + r#type: self.r#type.to_string(), + name: self.name.to_string(), + poster: self.poster.to_protobuf::(&()), + poster_shape: self.poster_shape.to_protobuf::(&()) as i32, + state: types::LibraryItemState { + time_offset: self.state.time_offset, + duration: self.state.duration, + video_id: self.state.video_id.clone(), + no_notif: self.state.no_notif, + }, + behavior_hints: self.behavior_hints.to_protobuf::(&()), + deep_links: types::MetaItemDeepLinks { + meta_details_videos: deep_links.meta_details_videos, + meta_details_streams: deep_links.meta_details_streams, + player: deep_links.player, + }, + progress: self.progress(), + watched: self.state.times_watched > 0, + notifications: notifications as u64, + } + } +} diff --git a/stremio-core-protobuf/src/bridge/link.rs b/stremio-core-protobuf/src/bridge/link.rs new file mode 100644 index 0000000..1c92c7c --- /dev/null +++ b/stremio-core-protobuf/src/bridge/link.rs @@ -0,0 +1,23 @@ +use stremio_core::types::resource::Link; + +use crate::bridge::ToProtobuf; +use crate::protobuf::stremio::core::types; + +impl ToProtobuf for Link { + fn to_protobuf(&self, _args: &()) -> types::LinkPreview { + types::LinkPreview { + name: self.name.to_string(), + category: self.category.to_string(), + } + } +} + +impl ToProtobuf for Link { + fn to_protobuf(&self, _args: &()) -> types::Link { + types::Link { + name: self.name.to_string(), + category: self.category.to_string(), + url: self.url.to_string(), + } + } +} diff --git a/stremio-core-protobuf/src/bridge/list.rs b/stremio-core-protobuf/src/bridge/list.rs new file mode 100644 index 0000000..ad9716f --- /dev/null +++ b/stremio-core-protobuf/src/bridge/list.rs @@ -0,0 +1,13 @@ +use crate::bridge::{FromProtobuf, ToProtobuf}; + +impl, U> FromProtobuf> for Vec { + fn from_protobuf(&self) -> Vec { + self.iter().map(|item| item.from_protobuf()).collect() + } +} + +impl, U, A> ToProtobuf, A> for Vec { + fn to_protobuf(&self, args: &A) -> Vec { + self.iter().map(|item| item.to_protobuf::(args)).collect() + } +} diff --git a/stremio-core-protobuf/src/bridge/loadable.rs b/stremio-core-protobuf/src/bridge/loadable.rs new file mode 100644 index 0000000..cf1ae26 --- /dev/null +++ b/stremio-core-protobuf/src/bridge/loadable.rs @@ -0,0 +1,360 @@ +use url::Url; + +use stremio_core::deep_links::MetaItemDeepLinks; +use stremio_core::models::common::{Loadable, ResourceError}; +use stremio_core::models::ctx::{Ctx, CtxError}; +use stremio_core::models::link::LinkError; +use stremio_core::models::streaming_server::PlaybackDevice; +use stremio_core::runtime::EnvError; + +use stremio_core::types::{ + addon::{Descriptor, DescriptorPreview, ResourcePath, ResourceRequest}, + api::{GetModalResponse, GetNotificationResponse, LinkAuthKey, LinkCodeResponse}, + library::LibraryItem, + resource::{MetaItem, MetaItemPreview, Stream, Subtitles}, + streaming_server::{Settings, Statistics}, + watched_bitfield::WatchedBitField, +}; + +use crate::bridge::ToProtobuf; +use crate::protobuf::stremio::core::models; +use crate::protobuf::stremio::core::models::{LoadedModal, LoadedNotification, PlaybackDevices}; + +impl ToProtobuf + for Loadable, ResourceError> +{ + fn to_protobuf( + &self, + (ctx, request): &(&Ctx, &ResourceRequest), + ) -> models::loadable_page::Content { + match &self { + Loadable::Ready(ready) => models::loadable_page::Content::Ready(models::Page { + meta_items: ready.to_protobuf::(&(*ctx, *request)), + }), + Loadable::Err(error) => models::loadable_page::Content::Error(models::Error { + message: error.to_string(), + }), + Loadable::Loading => models::loadable_page::Content::Loading(models::Loading {}), + } + } +} + +impl + ToProtobuf< + models::loadable_meta_item::Content, + ( + Option<&LibraryItem>, + Option<&WatchedBitField>, + Option<&String>, + &ResourceRequest, + ), + > for Loadable +{ + fn to_protobuf( + &self, + (library_item, watched, addon_name, meta_request): &( + Option<&LibraryItem>, + Option<&WatchedBitField>, + Option<&String>, + &ResourceRequest, + ), + ) -> models::loadable_meta_item::Content { + match &self { + Loadable::Ready(ready) => models::loadable_meta_item::Content::Ready( + ready.to_protobuf::(&(*library_item, *watched, *addon_name, *meta_request)), + ), + Loadable::Err(error) => models::loadable_meta_item::Content::Error(models::Error { + message: error.to_string(), + }), + Loadable::Loading => models::loadable_meta_item::Content::Loading(models::Loading {}), + } + } +} + +impl + ToProtobuf< + models::loadable_streams::Content, + (&Ctx, &String, &ResourceRequest, Option<&ResourceRequest>), + > for Loadable, ResourceError> +{ + fn to_protobuf( + &self, + (ctx, addon_name, stream_request, meta_request): &( + &Ctx, + &String, + &ResourceRequest, + Option<&ResourceRequest>, + ), + ) -> models::loadable_streams::Content { + match &self { + Loadable::Ready(ready) => models::loadable_streams::Content::Ready(models::Streams { + streams: ready.to_protobuf::(&( + Some(*ctx), + Some(*addon_name), + Some(*stream_request), + *meta_request, + )), + }), + Loadable::Err(error) => models::loadable_streams::Content::Error(models::Error { + message: error.to_string(), + }), + Loadable::Loading => models::loadable_streams::Content::Loading(models::Loading {}), + } + } +} + +impl + ToProtobuf< + models::loadable_stream::Content, + (&Ctx, &String, &ResourceRequest, Option<&ResourceRequest>), + > for Loadable, ResourceError> +{ + fn to_protobuf( + &self, + (ctx, addon_name, stream_request, meta_request): &( + &Ctx, + &String, + &ResourceRequest, + Option<&ResourceRequest>, + ), + ) -> models::loadable_stream::Content { + match &self { + Loadable::Ready(ready) => { + models::loadable_stream::Content::Ready(models::OptionStream { + stream: ready.to_protobuf::(&( + Some(*ctx), + Some(*addon_name), + Some(*stream_request), + *meta_request, + )), + }) + } + Loadable::Err(error) => models::loadable_stream::Content::Error(models::Error { + message: error.to_string(), + }), + Loadable::Loading => models::loadable_stream::Content::Loading(models::Loading {}), + } + } +} + +impl ToProtobuf> + for Loadable, ResourceError> +{ + fn to_protobuf(&self, addon_name: &Option<&String>) -> models::loadable_subtitles::Content { + match &self { + Loadable::Ready(ready) => { + models::loadable_subtitles::Content::Ready(models::Subtitles { + subtitles: ready.to_protobuf::(addon_name), + }) + } + Loadable::Err(error) => models::loadable_subtitles::Content::Error(models::Error { + message: error.to_string(), + }), + Loadable::Loading => models::loadable_subtitles::Content::Loading(models::Loading {}), + } + } +} + +impl ToProtobuf for Loadable { + fn to_protobuf(&self, _args: &()) -> models::LoadableSettings { + let content = match &self { + Loadable::Ready(ready) => { + models::loadable_settings::Content::Ready(ready.to_protobuf::(&())) + } + Loadable::Err(error) => models::loadable_settings::Content::Error(models::Error { + message: error.to_string(), + }), + Loadable::Loading => models::loadable_settings::Content::Loading(models::Loading {}), + }; + models::LoadableSettings { + content: Some(content), + } + } +} + +impl ToProtobuf for Loadable { + fn to_protobuf(&self, _args: &()) -> models::LoadableBaseUrl { + let content = match &self { + Loadable::Ready(ready) => models::loadable_base_url::Content::Ready(ready.to_string()), + Loadable::Err(error) => models::loadable_base_url::Content::Error(models::Error { + message: error.to_string(), + }), + Loadable::Loading => models::loadable_base_url::Content::Loading(models::Loading {}), + }; + models::LoadableBaseUrl { + content: Some(content), + } + } +} + +impl ToProtobuf for Loadable { + fn to_protobuf(&self, _args: &()) -> models::LoadableCode { + let content = match &self { + Loadable::Ready(ready) => models::loadable_code::Content::Ready(ready.to_protobuf::(&())), + Loadable::Err(error) => models::loadable_code::Content::Error(models::Error { + message: error.to_string(), + }), + Loadable::Loading => models::loadable_code::Content::Loading(models::Loading {}), + }; + models::LoadableCode { + content: Some(content), + } + } +} + +impl ToProtobuf for Loadable { + fn to_protobuf(&self, _args: &()) -> models::LoadableAuthKey { + let content = match &self { + Loadable::Ready(ready) => { + models::loadable_auth_key::Content::Ready(ready.to_protobuf::(&())) + } + Loadable::Err(error) => models::loadable_auth_key::Content::Error(models::Error { + message: error.to_string(), + }), + Loadable::Loading => models::loadable_auth_key::Content::Loading(models::Loading {}), + }; + models::LoadableAuthKey { + content: Some(content), + } + } +} + +impl ToProtobuf for Loadable { + fn to_protobuf(&self, _args: &()) -> models::LoadableTorrent { + let content = match &self { + Loadable::Ready(ready) => { + let deeplinks = MetaItemDeepLinks::from(ready).to_protobuf::(&()); + models::loadable_torrent::Deeplinks::Ready(deeplinks) + } + Loadable::Err(error) => models::loadable_torrent::Deeplinks::Error(models::Error { + message: error.to_string(), + }), + Loadable::Loading => models::loadable_torrent::Deeplinks::Loading(models::Loading {}), + }; + models::LoadableTorrent { + deeplinks: Some(content), + } + } +} + +impl ToProtobuf for Loadable, EnvError> { + fn to_protobuf(&self, _args: &()) -> models::LoadablePlaybackDevices { + let content = match &self { + Loadable::Ready(ready) => { + models::loadable_playback_devices::Content::Ready(PlaybackDevices { + devices: ready.to_protobuf::(&()), + }) + } + Loadable::Err(error) => { + models::loadable_playback_devices::Content::Error(models::Error { + message: error.to_string(), + }) + } + Loadable::Loading => { + models::loadable_playback_devices::Content::Loading(models::Loading {}) + } + }; + models::LoadablePlaybackDevices { + content: Some(content), + } + } +} + +impl ToProtobuf for Loadable { + fn to_protobuf(&self, _args: &()) -> models::LoadableStatistics { + let content = match &self { + Loadable::Ready(ready) => { + models::loadable_statistics::Content::Ready(ready.to_protobuf::(&())) + } + Loadable::Err(error) => models::loadable_statistics::Content::Error(models::Error { + message: error.to_string(), + }), + Loadable::Loading => models::loadable_statistics::Content::Loading(models::Loading {}), + }; + models::LoadableStatistics { + content: Some(content), + } + } +} + +impl ToProtobuf + for Loadable, ResourceError> +{ + fn to_protobuf(&self, ctx: &Ctx) -> models::loadable_addon_catalog::Content { + match &self { + Loadable::Ready(ready) => { + models::loadable_addon_catalog::Content::Ready(models::Addons { + items: ready.to_protobuf::(ctx), + }) + } + Loadable::Err(error) => models::loadable_addon_catalog::Content::Error(models::Error { + message: error.to_string(), + }), + Loadable::Loading => { + models::loadable_addon_catalog::Content::Loading(models::Loading {}) + } + } + } +} + +impl ToProtobuf for Loadable { + fn to_protobuf(&self, ctx: &Ctx) -> models::loadable_descriptor::Content { + match &self { + Loadable::Ready(ready) => { + models::loadable_descriptor::Content::Ready(ready.to_protobuf::(ctx)) + } + Loadable::Err(error) => models::loadable_descriptor::Content::Error(models::Error { + message: error.to_string(), + }), + Loadable::Loading => models::loadable_descriptor::Content::Loading(models::Loading {}), + } + } +} + +impl ToProtobuf for Loadable, CtxError> { + fn to_protobuf(&self, _args: &()) -> models::LoadableModal { + let content = match &self { + Loadable::Ready(ready) => models::loadable_modal::Content::Ready(LoadedModal { + modal: ready.to_protobuf::(&()), + }), + Loadable::Err(error) => models::loadable_modal::Content::Error(models::Error { + message: match error { + CtxError::API(error) => error.message.to_owned(), + CtxError::Env(error) => error.message(), + CtxError::Other(error) => error.message(), + }, + }), + Loadable::Loading => models::loadable_modal::Content::Loading(models::Loading {}), + }; + models::LoadableModal { + content: Some(content), + } + } +} + +impl ToProtobuf + for Loadable, CtxError> +{ + fn to_protobuf(&self, _args: &()) -> models::LoadableNotification { + let content = match &self { + Loadable::Ready(ready) => { + models::loadable_notification::Content::Ready(LoadedNotification { + notification: ready.to_protobuf::(&()), + }) + } + Loadable::Err(error) => models::loadable_notification::Content::Error(models::Error { + message: match error { + CtxError::API(error) => error.message.to_owned(), + CtxError::Env(error) => error.message(), + CtxError::Other(error) => error.message(), + }, + }), + Loadable::Loading => { + models::loadable_notification::Content::Loading(models::Loading {}) + } + }; + models::LoadableNotification { + content: Some(content), + } + } +} diff --git a/stremio-core-protobuf/src/bridge/manifest.rs b/stremio-core-protobuf/src/bridge/manifest.rs new file mode 100644 index 0000000..030e9a9 --- /dev/null +++ b/stremio-core-protobuf/src/bridge/manifest.rs @@ -0,0 +1,286 @@ +use semver::Version; +use std::str::FromStr; +use stremio_core::models::ctx::Ctx; +use stremio_core::types::addon::{ + Descriptor, DescriptorFlags, DescriptorPreview, ExtraProp, Manifest, ManifestBehaviorHints, + ManifestCatalog, ManifestExtra, ManifestPreview, ManifestResource, OptionsLimit, +}; + +use crate::bridge::{FromProtobuf, ToProtobuf}; +use crate::protobuf::stremio::core::types; + +impl FromProtobuf for types::ExtraProp { + fn from_protobuf(&self) -> ExtraProp { + ExtraProp { + name: self.name.to_owned(), + is_required: self.is_required, + options: self.options.to_owned(), + options_limit: OptionsLimit(self.options_limit as usize), + } + } +} + +impl FromProtobuf for types::ManifestBehaviorHints { + fn from_protobuf(&self) -> ManifestBehaviorHints { + ManifestBehaviorHints { + adult: self.adult, + p2p: self.p2p, + configurable: self.configurable, + configuration_required: self.configuration_required, + } + } +} + +impl FromProtobuf for types::manifest_extra::Extra { + fn from_protobuf(&self) -> ManifestExtra { + match self { + types::manifest_extra::Extra::Full(extra) => ManifestExtra::Full { + props: extra.props.from_protobuf(), + }, + types::manifest_extra::Extra::Short(extra) => ManifestExtra::Short { + required: extra.required.to_owned(), + supported: extra.supported.to_owned(), + }, + } + } +} + +impl FromProtobuf for types::ManifestCatalog { + fn from_protobuf(&self) -> ManifestCatalog { + ManifestCatalog { + id: self.id.to_owned(), + r#type: self.r#type.to_owned(), + name: self.name.clone(), + extra: self.extra.extra.from_protobuf().unwrap(), + } + } +} + +impl FromProtobuf for types::ManifestResource { + fn from_protobuf(&self) -> ManifestResource { + if self.types.is_empty() && self.id_prefixes.is_empty() { + ManifestResource::Short(self.name.to_owned()) + } else { + ManifestResource::Full { + name: self.name.to_owned(), + types: Some(self.types.to_owned()), + id_prefixes: Some(self.id_prefixes.to_owned()), + } + } + } +} + +impl FromProtobuf for types::ManifestPreview { + fn from_protobuf(&self) -> ManifestPreview { + ManifestPreview { + id: self.id.to_owned(), + version: Version::from_str(self.version.as_str()) + .expect("Manifest.version parsing failed"), + name: self.name.to_owned(), + description: self.description.to_owned(), + logo: self.logo.from_protobuf(), + background: self.background.from_protobuf(), + types: self.types.to_owned(), + behavior_hints: self.behavior_hints.from_protobuf(), + } + } +} + +impl FromProtobuf for types::Manifest { + fn from_protobuf(&self) -> Manifest { + Manifest { + id: self.id.to_owned(), + version: Version::from_str(self.version.as_str()) + .expect("Manifest.version parsing failed"), + name: self.name.to_owned(), + contact_email: None, + description: self.description.to_owned(), + logo: self.logo.from_protobuf(), + background: self.background.from_protobuf(), + types: self.types.to_owned(), + resources: self.resources.from_protobuf(), + id_prefixes: Some(self.id_prefixes.to_owned()) + .filter(|id_prefixes| !id_prefixes.is_empty()), + catalogs: self.catalogs.from_protobuf(), + addon_catalogs: self.addon_catalogs.from_protobuf(), + behavior_hints: self.behavior_hints.from_protobuf(), + } + } +} + +impl FromProtobuf for types::DescriptorFlags { + fn from_protobuf(&self) -> DescriptorFlags { + DescriptorFlags { + official: self.official, + protected: self.protected, + } + } +} + +impl FromProtobuf for types::Descriptor { + fn from_protobuf(&self) -> Descriptor { + Descriptor { + manifest: self.manifest.from_protobuf(), + transport_url: self.transport_url.from_protobuf(), + flags: self.flags.from_protobuf(), + } + } +} + +impl ToProtobuf for ExtraProp { + fn to_protobuf(&self, _args: &()) -> types::ExtraProp { + types::ExtraProp { + name: self.name.to_owned(), + is_required: self.is_required, + options: self.options.to_owned(), + options_limit: self.options_limit.0 as i32, + } + } +} + +impl ToProtobuf for ManifestBehaviorHints { + fn to_protobuf(&self, _args: &()) -> types::ManifestBehaviorHints { + types::ManifestBehaviorHints { + adult: self.adult, + p2p: self.p2p, + configurable: self.configurable, + configuration_required: self.configuration_required, + } + } +} + +impl ToProtobuf for ManifestExtra { + fn to_protobuf(&self, _args: &()) -> types::manifest_extra::Extra { + match self { + ManifestExtra::Full { props } => { + types::manifest_extra::Extra::Full(types::FullManifestExtra { + props: props.to_protobuf::(&()), + }) + } + ManifestExtra::Short { + required, + supported, + } => types::manifest_extra::Extra::Short(types::ShortManifestExtra { + required: required.to_owned(), + supported: supported.to_owned(), + }), + } + } +} + +impl ToProtobuf for ManifestCatalog { + fn to_protobuf(&self, _args: &()) -> types::ManifestCatalog { + types::ManifestCatalog { + id: self.id.to_owned(), + r#type: self.r#type.to_owned(), + name: self.name.clone(), + extra: types::ManifestExtra { + extra: Some(self.extra.to_protobuf::(&())), + }, + } + } +} + +impl ToProtobuf for ManifestResource { + fn to_protobuf(&self, _args: &()) -> types::ManifestResource { + match self { + ManifestResource::Short(name) => types::ManifestResource { + name: name.to_owned(), + types: vec![], + id_prefixes: vec![], + }, + ManifestResource::Full { + name, + types, + id_prefixes, + } => types::ManifestResource { + name: name.to_owned(), + types: types.to_owned().unwrap_or_default(), + id_prefixes: id_prefixes.to_owned().unwrap_or_default(), + }, + } + } +} + +impl ToProtobuf for ManifestPreview { + fn to_protobuf(&self, _args: &()) -> types::ManifestPreview { + types::ManifestPreview { + id: self.id.to_owned(), + version: self.version.to_string(), + name: self.name.to_owned(), + description: self.description.to_owned(), + logo: self.logo.to_protobuf::(&()), + background: self.background.to_protobuf::(&()), + types: self.types.to_owned(), + behavior_hints: self.behavior_hints.to_protobuf::(&()), + } + } +} + +impl ToProtobuf for Manifest { + fn to_protobuf(&self, _args: &()) -> types::Manifest { + types::Manifest { + id: self.id.to_owned(), + version: self.version.to_string(), + name: self.name.to_owned(), + description: self.description.to_owned(), + logo: self.logo.to_protobuf::(&()), + background: self.background.to_protobuf::(&()), + types: self.types.to_owned(), + contact_email: self.contact_email.to_owned(), + resources: self.resources.to_protobuf::(&()), + id_prefixes: self.id_prefixes.to_owned().unwrap_or_default(), + catalogs: self.catalogs.to_protobuf::(&()), + addon_catalogs: self.addon_catalogs.to_protobuf::(&()), + behavior_hints: self.behavior_hints.to_protobuf::(&()), + } + } +} + +impl ToProtobuf for DescriptorFlags { + fn to_protobuf(&self, _args: &()) -> types::DescriptorFlags { + types::DescriptorFlags { + official: self.official, + protected: self.protected, + } + } +} + +impl ToProtobuf for DescriptorPreview { + fn to_protobuf(&self, ctx: &Ctx) -> types::DescriptorPreview { + types::DescriptorPreview { + manifest: self.manifest.to_protobuf::(&()), + transport_url: self.transport_url.to_protobuf::(&()), + installed: ctx + .profile + .addons + .iter() + .any(|addon| addon.transport_url == self.transport_url), + } + } +} + +impl ToProtobuf for Descriptor { + fn to_protobuf(&self, ctx: &Ctx) -> types::Descriptor { + let installed_addon = ctx + .profile + .addons + .iter() + .find(|addon| addon.transport_url == self.transport_url); + types::Descriptor { + manifest: self.manifest.to_protobuf::(&()), + transport_url: self.transport_url.to_protobuf::(&()), + flags: self.flags.to_protobuf::(&()), + installed: installed_addon.is_some(), + installable: installed_addon.is_none() + && !self.manifest.behavior_hints.configuration_required, + upgradeable: installed_addon + .filter(|addon| !addon.flags.protected) + .map(|addon| addon.manifest.version != self.manifest.version) + .unwrap_or_default(), + uninstallable: installed_addon + .filter(|addon| !addon.flags.protected) + .is_some(), + } + } +} diff --git a/stremio-core-protobuf/src/bridge/meta_preview.rs b/stremio-core-protobuf/src/bridge/meta_preview.rs new file mode 100644 index 0000000..f93acdc --- /dev/null +++ b/stremio-core-protobuf/src/bridge/meta_preview.rs @@ -0,0 +1,100 @@ +use chrono::Duration; +use stremio_core::deep_links::MetaItemDeepLinks; +use stremio_core::models::ctx::Ctx; +use stremio_core::runtime::Env; +use stremio_core::types::addon::ResourceRequest; +use stremio_core::types::resource::{MetaItemBehaviorHints, MetaItemPreview, PosterShape}; + +use crate::bridge::{FromProtobuf, ToProtobuf}; +// use crate::env::AndroidEnv; +use crate::protobuf::stremio::core::types; + +impl FromProtobuf for types::MetaItemBehaviorHints { + fn from_protobuf(&self) -> MetaItemBehaviorHints { + MetaItemBehaviorHints { + default_video_id: self.default_video_id.to_owned(), + featured_video_id: self.featured_video_id.to_owned(), + has_scheduled_videos: self.has_scheduled_videos, + other: Default::default(), + } + } +} + +impl FromProtobuf for types::MetaItemPreview { + fn from_protobuf(&self) -> MetaItemPreview { + MetaItemPreview { + id: self.id.to_owned(), + r#type: self.r#type.to_owned(), + name: self.name.to_owned(), + poster_shape: types::PosterShape::try_from(self.poster_shape) + .ok() + .from_protobuf() + .unwrap_or(PosterShape::Poster), + poster: self.poster.from_protobuf(), + background: self.background.from_protobuf(), + logo: self.logo.from_protobuf(), + description: self.description.to_owned(), + release_info: self.release_info.to_owned(), + runtime: self.runtime.to_owned(), + released: self.released.from_protobuf(), + links: Default::default(), + trailer_streams: Default::default(), + behavior_hints: self.behavior_hints.from_protobuf(), + } + } +} + +impl ToProtobuf for MetaItemBehaviorHints { + fn to_protobuf(&self, _args: &()) -> types::MetaItemBehaviorHints { + types::MetaItemBehaviorHints { + default_video_id: self.default_video_id.clone(), + featured_video_id: self.featured_video_id.clone(), + has_scheduled_videos: self.has_scheduled_videos, + } + } +} + +impl ToProtobuf for MetaItemDeepLinks { + fn to_protobuf(&self, _args: &()) -> types::MetaItemDeepLinks { + types::MetaItemDeepLinks { + meta_details_videos: self.meta_details_videos.clone(), + meta_details_streams: self.meta_details_streams.clone(), + player: self.player.clone(), + } + } +} + +impl ToProtobuf for MetaItemPreview { + fn to_protobuf( + &self, + (ctx, meta_request): &(&Ctx, &ResourceRequest), + ) -> types::MetaItemPreview { + types::MetaItemPreview { + id: self.id.to_string(), + r#type: self.r#type.to_string(), + name: self.name.to_string(), + poster_shape: self.poster_shape.to_protobuf::(&()) as i32, + poster: self.poster.to_protobuf::(&()), + background: self.background.to_protobuf::(&()), + logo: self.logo.to_protobuf::(&()), + description: self.description.clone(), + release_info: self.release_info.clone(), + runtime: self.runtime.clone(), + released: self.released.to_protobuf::(&()), + links: self.links.to_protobuf::(&()), + behavior_hints: self.behavior_hints.to_protobuf::(&()), + deep_links: MetaItemDeepLinks::from((self, *meta_request)).to_protobuf::(&()), + in_library: ctx + .library + .items + .get(&self.id) + .map(|library_item| !library_item.removed) + .unwrap_or_default(), + in_cinema: self + .released + .filter(|_released| self.r#type == "movie") + .map(|released| released + Duration::days(30) > E::now()) + .unwrap_or_default(), + } + } +} diff --git a/stremio-core-protobuf/src/bridge/option.rs b/stremio-core-protobuf/src/bridge/option.rs new file mode 100644 index 0000000..daed0fd --- /dev/null +++ b/stremio-core-protobuf/src/bridge/option.rs @@ -0,0 +1,13 @@ +use crate::bridge::{FromProtobuf, ToProtobuf}; + +impl, U> FromProtobuf> for Option { + fn from_protobuf(&self) -> Option { + self.as_ref().map(|item| item.from_protobuf()) + } +} + +impl, U, A> ToProtobuf, A> for Option { + fn to_protobuf(&self, args: &A) -> Option { + self.as_ref().map(|item| item.to_protobuf::(args)) + } +} diff --git a/stremio-core-protobuf/src/bridge/pair.rs b/stremio-core-protobuf/src/bridge/pair.rs new file mode 100644 index 0000000..3fcaf3a --- /dev/null +++ b/stremio-core-protobuf/src/bridge/pair.rs @@ -0,0 +1,11 @@ +use crate::bridge::ToProtobuf; +use crate::protobuf::stremio::core::runtime; + +impl ToProtobuf for (Vec, Vec) { + fn to_protobuf(&self, _args: &()) -> runtime::PlanPair { + runtime::PlanPair { + first: self.0.clone(), + second: self.1.clone(), + } + } +} diff --git a/stremio-core-protobuf/src/bridge/poster_shape.rs b/stremio-core-protobuf/src/bridge/poster_shape.rs new file mode 100644 index 0000000..fec6632 --- /dev/null +++ b/stremio-core-protobuf/src/bridge/poster_shape.rs @@ -0,0 +1,24 @@ +use stremio_core::types::resource::PosterShape; + +use crate::bridge::{FromProtobuf, ToProtobuf}; +use crate::protobuf::stremio::core::types; + +impl FromProtobuf for types::PosterShape { + fn from_protobuf(&self) -> PosterShape { + match self { + types::PosterShape::Poster => PosterShape::Poster, + types::PosterShape::Landscape => PosterShape::Landscape, + types::PosterShape::Square => PosterShape::Square, + } + } +} + +impl ToProtobuf for PosterShape { + fn to_protobuf(&self, _args: &()) -> types::PosterShape { + match self { + PosterShape::Poster => types::PosterShape::Poster, + PosterShape::Landscape => types::PosterShape::Landscape, + PosterShape::Square => types::PosterShape::Square, + } + } +} diff --git a/stremio-core-protobuf/src/bridge/profile.rs b/stremio-core-protobuf/src/bridge/profile.rs new file mode 100644 index 0000000..9c3eb01 --- /dev/null +++ b/stremio-core-protobuf/src/bridge/profile.rs @@ -0,0 +1,193 @@ +use std::cmp; +use std::convert::TryFrom; + +use stremio_core::types::api::{LinkAuthKey, LinkCodeResponse}; +use stremio_core::types::profile::{ + Auth, FrameRateMatchingStrategy, GDPRConsent, Profile, Settings, User, +}; + +use crate::bridge::{FromProtobuf, ToProtobuf}; +use crate::protobuf::stremio::core::types; + +impl FromProtobuf for types::profile::FrameRateMatchingStrategy { + fn from_protobuf(&self) -> FrameRateMatchingStrategy { + match self { + types::profile::FrameRateMatchingStrategy::Disabled => { + FrameRateMatchingStrategy::Disabled + } + types::profile::FrameRateMatchingStrategy::FrameRateOnly => { + FrameRateMatchingStrategy::FrameRateOnly + } + types::profile::FrameRateMatchingStrategy::FrameRateAndResolution => { + FrameRateMatchingStrategy::FrameRateAndResolution + } + } + } +} + +impl ToProtobuf for FrameRateMatchingStrategy { + fn to_protobuf(&self, _args: &()) -> types::profile::FrameRateMatchingStrategy { + match self { + FrameRateMatchingStrategy::Disabled => { + types::profile::FrameRateMatchingStrategy::Disabled + } + FrameRateMatchingStrategy::FrameRateOnly => { + types::profile::FrameRateMatchingStrategy::FrameRateOnly + } + FrameRateMatchingStrategy::FrameRateAndResolution => { + types::profile::FrameRateMatchingStrategy::FrameRateAndResolution + } + } + } +} + +impl FromProtobuf for types::GdprConsent { + fn from_protobuf(&self) -> GDPRConsent { + GDPRConsent { + tos: self.tos, + privacy: self.privacy, + marketing: self.marketing, + from: self.from.clone(), + } + } +} + +impl FromProtobuf for types::profile::Settings { + fn from_protobuf(&self) -> Settings { + Settings { + interface_language: self.interface_language.to_string(), + streaming_server_url: self.streaming_server_url.from_protobuf(), + player_type: self.player_type.clone(), + binge_watching: self.binge_watching, + play_in_background: self.play_in_background, + hardware_decoding: self.hardware_decoding, + frame_rate_matching_strategy: types::profile::FrameRateMatchingStrategy::try_from( + self.frame_rate_matching_strategy, + ) + .ok() + .from_protobuf() + .unwrap_or(FrameRateMatchingStrategy::Disabled), + next_video_notification_duration: u32::try_from(cmp::max( + self.next_video_notification_duration, + 0, + )) + .unwrap_or(u32::MAX), + audio_passthrough: self.audio_passthrough, + audio_language: Some(self.audio_language.to_string()), + secondary_audio_language: self.secondary_audio_language.clone(), + subtitles_language: Some(self.subtitles_language.to_string()), + secondary_subtitles_language: self.secondary_subtitles_language.clone(), + subtitles_size: u8::try_from(cmp::max(self.subtitles_size, 0)).unwrap_or(u8::MAX), + subtitles_font: self.subtitles_font.to_string(), + subtitles_bold: self.subtitles_bold, + subtitles_offset: u8::try_from(cmp::max(self.subtitles_offset, 0)).unwrap_or(u8::MAX), + subtitles_text_color: self.subtitles_text_color.to_string(), + subtitles_background_color: self.subtitles_background_color.to_string(), + subtitles_outline_color: self.subtitles_outline_color.to_string(), + subtitles_opacity: u8::try_from(cmp::max(self.subtitles_opacity, 0)).unwrap_or(u8::MAX), + esc_exit_fullscreen: self.esc_exit_fullscreen, + seek_time_duration: u32::try_from(cmp::max(self.seek_time_duration, 0)) + .unwrap_or(u32::MAX), + seek_short_time_duration: u32::try_from(cmp::max(self.seek_time_duration, 0)) + .unwrap_or(u32::MAX), + pause_on_minimize: self.pause_on_minimize, + surround_sound: self.surround_sound, + streaming_server_warning_dismissed: None, + } + } +} + +impl ToProtobuf for LinkAuthKey { + fn to_protobuf(&self, _args: &()) -> types::LinkAuthKey { + types::LinkAuthKey { + auth_key: self.auth_key.to_string(), + } + } +} + +impl ToProtobuf for LinkCodeResponse { + fn to_protobuf(&self, _args: &()) -> types::LinkCodeResponse { + types::LinkCodeResponse { + code: self.code.to_string(), + link: self.link.to_string(), + qrcode: self.qrcode.to_string(), + } + } +} + +impl ToProtobuf for GDPRConsent { + fn to_protobuf(&self, _args: &()) -> types::GdprConsent { + types::GdprConsent { + tos: self.tos, + privacy: self.privacy, + marketing: self.marketing, + from: self.from.clone(), + } + } +} + +impl ToProtobuf for User { + fn to_protobuf(&self, _args: &()) -> types::User { + types::User { + id: self.id.to_string(), + email: self.email.to_string(), + fb_id: self.fb_id.clone(), + avatar: self.avatar.clone(), + gdpr_consent: self.gdpr_consent.to_protobuf::(&()), + date_registered: self.date_registered.to_protobuf::(&()), + last_modified: self.last_modified.to_protobuf::(&()), + premium_expire: self.premium_expire.to_protobuf::(&()), + } + } +} + +impl ToProtobuf for Auth { + fn to_protobuf(&self, _args: &()) -> types::Auth { + types::Auth { + key: self.key.0.to_string(), + user: self.user.to_protobuf::(&()), + } + } +} + +impl ToProtobuf for Settings { + fn to_protobuf(&self, _args: &()) -> types::profile::Settings { + types::profile::Settings { + interface_language: self.interface_language.to_string(), + streaming_server_url: self.streaming_server_url.to_string(), + binge_watching: self.binge_watching, + play_in_background: self.play_in_background, + hardware_decoding: self.hardware_decoding, + audio_passthrough: self.audio_passthrough, + audio_language: self.audio_language.clone().unwrap_or_default(), + subtitles_language: self.subtitles_language.clone().unwrap_or_default(), + subtitles_size: self.subtitles_size as i32, + subtitles_font: self.subtitles_font.to_string(), + subtitles_bold: self.subtitles_bold, + subtitles_offset: self.subtitles_offset as i32, + subtitles_text_color: self.subtitles_text_color.to_string(), + subtitles_background_color: self.subtitles_background_color.to_string(), + subtitles_outline_color: self.subtitles_outline_color.to_string(), + subtitles_opacity: self.subtitles_opacity as i32, + esc_exit_fullscreen: self.esc_exit_fullscreen, + seek_time_duration: self.seek_time_duration as i64, + seek_short_time_duration: self.seek_short_time_duration as i64, + pause_on_minimize: self.pause_on_minimize, + secondary_audio_language: self.secondary_audio_language.clone(), + secondary_subtitles_language: self.secondary_subtitles_language.clone(), + player_type: self.player_type.clone(), + frame_rate_matching_strategy: self.frame_rate_matching_strategy.to_protobuf::(&()) as i32, + next_video_notification_duration: self.next_video_notification_duration as i64, + surround_sound: self.surround_sound, + } + } +} + +impl ToProtobuf for Profile { + fn to_protobuf(&self, _args: &()) -> types::Profile { + types::Profile { + auth: self.auth.to_protobuf::(&()), + settings: self.settings.to_protobuf::(&()), + } + } +} diff --git a/stremio-core-protobuf/src/bridge/resource_loadable.rs b/stremio-core-protobuf/src/bridge/resource_loadable.rs new file mode 100644 index 0000000..451878a --- /dev/null +++ b/stremio-core-protobuf/src/bridge/resource_loadable.rs @@ -0,0 +1,147 @@ +use inflector::Inflector; +use stremio_core::deep_links::DiscoverDeepLinks; +use stremio_core::models::common::{DescriptorLoadable, ResourceLoadable}; +use stremio_core::models::ctx::Ctx; +use stremio_core::types::addon::{DescriptorPreview, ResourceRequest}; +use stremio_core::types::library::LibraryItem; +use stremio_core::types::resource::{MetaItem, MetaItemPreview, Stream, Subtitles}; +use stremio_core::types::watched_bitfield::WatchedBitField; +use url::Url; + +use crate::bridge::ToProtobuf; +use crate::protobuf::stremio::core::models; + +impl ToProtobuf for ResourceLoadable> { + fn to_protobuf(&self, ctx: &Ctx) -> models::LoadablePage { + let title = ctx + .profile + .addons + .iter() + .find(|addon| addon.transport_url == self.request.base) + .and_then(|addon| { + addon + .manifest + .catalogs + .iter() + .find(|manifest_catalog| { + manifest_catalog.id == self.request.path.id + && manifest_catalog.r#type == self.request.path.r#type + }) + .map(|manifest_catalog| (addon, manifest_catalog)) + }) + .map(|(addon, manifest_catalog)| { + format!( + "{} - {}", + &manifest_catalog + .name + .as_ref() + .unwrap_or(&addon.manifest.name) + .to_title_case(), + &manifest_catalog.r#type.to_title_case(), + ) + }) + .unwrap_or_default(); + let deep_links = DiscoverDeepLinks::from(&self.request).to_protobuf::(&()); + models::LoadablePage { + title, + request: self.request.to_protobuf::(&()), + content: self.content.to_protobuf::(&(ctx, &self.request)), + deep_links, + } + } +} + +impl ToProtobuf, Option<&WatchedBitField>)> + for &ResourceLoadable +{ + fn to_protobuf( + &self, + (ctx, library_item, watched): &(&Ctx, Option<&LibraryItem>, Option<&WatchedBitField>), + ) -> models::LoadableMetaItem { + let addon_name = get_addon_name(ctx, &self.request.base); + models::LoadableMetaItem { + title: addon_name.to_string(), + request: self.request.to_protobuf::(&()), + content: self.content.to_protobuf::(&( + *library_item, + *watched, + Some(&addon_name), + &self.request, + )), + } + } +} + +impl ToProtobuf)> + for ResourceLoadable> +{ + fn to_protobuf( + &self, + (ctx, meta_request): &(&Ctx, Option<&ResourceRequest>), + ) -> models::LoadableStreams { + let addon_name = get_addon_name(ctx, &self.request.base); + models::LoadableStreams { + title: addon_name.to_owned(), + request: self.request.to_protobuf::(&()), + content: self + .content + .to_protobuf::(&(ctx, &addon_name, &self.request, *meta_request)), + } + } +} + +impl ToProtobuf)> + for ResourceLoadable> +{ + fn to_protobuf( + &self, + (ctx, meta_request): &(&Ctx, Option<&ResourceRequest>), + ) -> models::LoadableStream { + let addon_name = get_addon_name(ctx, &self.request.base); + models::LoadableStream { + request: self.request.to_protobuf::(&()), + content: self + .content + .to_protobuf::(&(ctx, &addon_name, &self.request, *meta_request)), + } + } +} + +impl ToProtobuf for ResourceLoadable> { + fn to_protobuf(&self, ctx: &Ctx) -> models::LoadableSubtitles { + let addon_name = get_addon_name(ctx, &self.request.base); + models::LoadableSubtitles { + title: addon_name.to_owned(), + request: self.request.to_protobuf::(&()), + content: self.content.to_protobuf::(&(Some(&addon_name))), + } + } +} + +impl ToProtobuf for &ResourceLoadable> { + fn to_protobuf(&self, ctx: &Ctx) -> models::LoadableAddonCatalog { + models::LoadableAddonCatalog { + request: self.request.to_protobuf::(&()), + content: self.content.to_protobuf::(ctx), + } + } +} + +impl ToProtobuf for DescriptorLoadable { + fn to_protobuf(&self, ctx: &Ctx) -> models::LoadableDescriptor { + models::LoadableDescriptor { + transport_url: self.transport_url.to_string(), + content: Some(self.content.to_protobuf::(ctx)), + } + } +} + +fn get_addon_name(ctx: &Ctx, addon_url: &Url) -> String { + ctx.profile + .addons + .iter() + .find(|addon| &addon.transport_url == addon_url) + .map(|addon| &addon.manifest.name) + .cloned() + .unwrap_or_default() +} diff --git a/stremio-core-protobuf/src/bridge/resource_path.rs b/stremio-core-protobuf/src/bridge/resource_path.rs new file mode 100644 index 0000000..aa03f7a --- /dev/null +++ b/stremio-core-protobuf/src/bridge/resource_path.rs @@ -0,0 +1,26 @@ +use stremio_core::types::addon::ResourcePath; + +use crate::bridge::{FromProtobuf, ToProtobuf}; +use crate::protobuf::stremio::core::types; + +impl FromProtobuf for types::ResourcePath { + fn from_protobuf(&self) -> ResourcePath { + ResourcePath { + resource: self.resource.to_owned(), + r#type: self.r#type.to_owned(), + id: self.id.to_owned(), + extra: self.extra.from_protobuf(), + } + } +} + +impl ToProtobuf for ResourcePath { + fn to_protobuf(&self, _args: &()) -> types::ResourcePath { + types::ResourcePath { + resource: self.resource.to_owned(), + r#type: self.r#type.to_owned(), + id: self.id.to_owned(), + extra: self.extra.to_protobuf::(&()), + } + } +} diff --git a/stremio-core-protobuf/src/bridge/resource_request.rs b/stremio-core-protobuf/src/bridge/resource_request.rs new file mode 100644 index 0000000..78a4796 --- /dev/null +++ b/stremio-core-protobuf/src/bridge/resource_request.rs @@ -0,0 +1,31 @@ +use stremio_core::models::installed_addons_with_filters::InstalledAddonsRequest; +use stremio_core::types::addon::ResourceRequest; + +use crate::bridge::{FromProtobuf, ToProtobuf}; +use crate::protobuf::stremio::core::types; + +impl FromProtobuf for types::ResourceRequest { + fn from_protobuf(&self) -> ResourceRequest { + ResourceRequest { + base: self.base.from_protobuf(), + path: self.path.from_protobuf(), + } + } +} + +impl FromProtobuf for types::ResourceRequest { + fn from_protobuf(&self) -> InstalledAddonsRequest { + InstalledAddonsRequest { + r#type: Some(self.path.r#type.to_string()).filter(|s| !s.is_empty()), + } + } +} + +impl ToProtobuf for ResourceRequest { + fn to_protobuf(&self, _args: &()) -> types::ResourceRequest { + types::ResourceRequest { + base: self.base.to_string(), + path: self.path.to_protobuf::(&()), + } + } +} diff --git a/stremio-core-protobuf/src/bridge/stream.rs b/stremio-core-protobuf/src/bridge/stream.rs new file mode 100644 index 0000000..dec7cc2 --- /dev/null +++ b/stremio-core-protobuf/src/bridge/stream.rs @@ -0,0 +1,216 @@ +use hex::FromHex; +use stremio_core::deep_links::StreamDeepLinks; +use stremio_core::models::ctx::Ctx; +use stremio_core::types::addon::ResourceRequest; +use stremio_core::types::resource::{ + Stream, StreamBehaviorHints, StreamProxyHeaders, StreamSource, +}; + +use crate::bridge::{FromProtobuf, ToProtobuf}; +use crate::protobuf::stremio::core::types; + +impl FromProtobuf for types::stream::Source { + fn from_protobuf(&self) -> StreamSource { + match self { + types::stream::Source::Url(source) => StreamSource::Url { + url: source.url.from_protobuf(), + }, + types::stream::Source::YouTube(source) => StreamSource::YouTube { + yt_id: source.yt_id.to_owned(), + }, + types::stream::Source::Torrent(source) => StreamSource::Torrent { + info_hash: <[u8; 20]>::from_hex(source.info_hash.as_str()) + .expect("Stream.info_hash parse failed"), + file_idx: source.file_idx.map(|idx| idx as u16), + announce: source.announce.clone(), + file_must_include: source.file_must_include.to_owned(), + }, + types::stream::Source::External(source) => StreamSource::External { + external_url: source.external_url.from_protobuf(), + android_tv_url: source.android_tv_url.from_protobuf(), + tizen_url: None, + webos_url: None, + }, + types::stream::Source::PlayerFrame(source) => StreamSource::PlayerFrame { + player_frame_url: source.player_frame_url.from_protobuf(), + }, + types::stream::Source::Rar(source) => StreamSource::Rar { + rar_urls: source.rar_urls.from_protobuf(), + file_idx: source.file_idx.map(|idx| idx as u16), + file_must_include: source.file_must_include.to_owned(), + }, + types::stream::Source::Zip(source) => StreamSource::Zip { + zip_urls: source.zip_urls.from_protobuf(), + file_idx: source.file_idx.map(|idx| idx as u16), + file_must_include: source.file_must_include.to_owned(), + }, + } + } +} + +impl FromProtobuf for types::StreamProxyHeaders { + fn from_protobuf(&self) -> StreamProxyHeaders { + StreamProxyHeaders { + request: self.request.to_owned(), + response: self.response.to_owned(), + } + } +} + +impl FromProtobuf for types::Stream { + fn from_protobuf(&self) -> Stream { + Stream { + source: self.source.from_protobuf().unwrap(), + name: self.name.to_owned(), + description: self.description.to_owned(), + thumbnail: self.thumbnail.to_owned(), + subtitles: self.subtitles.from_protobuf(), + behavior_hints: StreamBehaviorHints { + not_web_ready: self.behavior_hints.not_web_ready, + binge_group: self.behavior_hints.binge_group.to_owned(), + country_whitelist: Some(self.behavior_hints.country_whitelist.to_owned()), + proxy_headers: self.behavior_hints.proxy_headers.from_protobuf(), + filename: self.behavior_hints.filename.to_owned(), + video_hash: self.behavior_hints.video_hash.to_owned(), + video_size: self.behavior_hints.video_size, + other: Default::default(), + }, + } + } +} + +impl ToProtobuf for StreamSource { + fn to_protobuf(&self, _args: &()) -> types::stream::Source { + match self { + StreamSource::Url { url } => types::stream::Source::Url(types::stream::Url { + url: url.to_string(), + }), + StreamSource::YouTube { yt_id } => { + types::stream::Source::YouTube(types::stream::YouTube { + yt_id: yt_id.to_string(), + }) + } + StreamSource::Torrent { + info_hash, + file_idx, + announce, + file_must_include, + } => types::stream::Source::Torrent(types::stream::Torrent { + info_hash: hex::encode(info_hash), + file_idx: file_idx.map(|idx| idx as i32), + announce: announce.clone(), + file_must_include: file_must_include.to_owned(), + }), + StreamSource::External { + external_url, + android_tv_url, + .. + } => types::stream::Source::External(types::stream::External { + external_url: external_url.to_protobuf::(&()), + android_tv_url: android_tv_url.to_protobuf::(&()), + }), + StreamSource::PlayerFrame { player_frame_url } => { + types::stream::Source::PlayerFrame(types::stream::PlayerFrame { + player_frame_url: player_frame_url.to_string(), + }) + } + StreamSource::Rar { + rar_urls, + file_idx, + file_must_include, + } => types::stream::Source::Rar(types::stream::Rar { + rar_urls: rar_urls.to_protobuf::(&()), + file_idx: file_idx.map(|idx| idx as i32), + file_must_include: file_must_include.to_owned(), + }), + StreamSource::Zip { + zip_urls, + file_idx, + file_must_include, + } => types::stream::Source::Zip(types::stream::Zip { + zip_urls: zip_urls.to_protobuf::(&()), + file_idx: file_idx.map(|idx| idx as i32), + file_must_include: file_must_include.to_owned(), + }), + } + } +} + +impl ToProtobuf for StreamProxyHeaders { + fn to_protobuf(&self, _args: &()) -> types::StreamProxyHeaders { + types::StreamProxyHeaders { + request: self.request.to_owned(), + response: self.response.to_owned(), + } + } +} + +impl + ToProtobuf< + types::Stream, + ( + Option<&Ctx>, + Option<&String>, + Option<&ResourceRequest>, + Option<&ResourceRequest>, + ), + > for Stream +{ + fn to_protobuf( + &self, + (ctx, addon_name, stream_request, meta_request): &( + Option<&Ctx>, + Option<&String>, + Option<&ResourceRequest>, + Option<&ResourceRequest>, + ), + ) -> types::Stream { + // in calls that have None for ctx this would panic if we don't set it to default. + let settings = ctx + .map(|ctx| ctx.profile.settings.to_owned()) + .unwrap_or_default(); + + let deep_links = match (stream_request, meta_request) { + (Some(stream_request), Some(meta_request)) => StreamDeepLinks::from(( + self, + *stream_request, + *meta_request, + &ctx.map(|ctx| ctx.profile.settings.streaming_server_url.clone()), + &settings, + )), + _ => StreamDeepLinks::from(( + self, + &ctx.map(|ctx| ctx.profile.settings.streaming_server_url.clone()), + &settings, + )), + }; + + types::Stream { + name: self.name.to_owned().or_else(|| addon_name.cloned()), + description: self.description.clone(), + thumbnail: self.thumbnail.clone(), + subtitles: self.subtitles.to_protobuf::(addon_name), + behavior_hints: types::StreamBehaviorHints { + not_web_ready: self.behavior_hints.not_web_ready, + binge_group: self.behavior_hints.binge_group.to_owned(), + country_whitelist: self + .behavior_hints + .country_whitelist + .to_owned() + .unwrap_or_default(), + proxy_headers: self.behavior_hints.proxy_headers.to_protobuf::(&()), + filename: self.behavior_hints.filename.to_owned(), + video_hash: self.behavior_hints.video_hash.to_owned(), + video_size: self.behavior_hints.video_size, + }, + deep_links: types::StreamDeepLinks { + player: deep_links.player, + external_player: types::stream_deep_links::ExternalPlayerLink { + download: deep_links.external_player.download, + streaming: deep_links.external_player.streaming, + }, + }, + source: Some(self.source.to_protobuf::(&())), + } + } +} diff --git a/stremio-core-protobuf/src/bridge/string.rs b/stremio-core-protobuf/src/bridge/string.rs new file mode 100644 index 0000000..3fc1291 --- /dev/null +++ b/stremio-core-protobuf/src/bridge/string.rs @@ -0,0 +1,14 @@ +use crate::bridge::{FromProtobuf, ToProtobuf}; +use url::Url; + +impl FromProtobuf for String { + fn from_protobuf(&self) -> Url { + Url::parse(self).expect("url parse failed") + } +} + +impl ToProtobuf for Url { + fn to_protobuf(&self, _args: &()) -> String { + self.to_string() + } +} diff --git a/stremio-core-protobuf/src/bridge/subtitle.rs b/stremio-core-protobuf/src/bridge/subtitle.rs new file mode 100644 index 0000000..2908e82 --- /dev/null +++ b/stremio-core-protobuf/src/bridge/subtitle.rs @@ -0,0 +1,23 @@ +use stremio_core::types::resource::Subtitles; + +use crate::bridge::{FromProtobuf, ToProtobuf}; +use crate::protobuf::stremio::core::types; + +impl FromProtobuf for types::Subtitle { + fn from_protobuf(&self) -> Subtitles { + Subtitles { + lang: self.lang.to_string(), + url: self.url.from_protobuf(), + } + } +} + +impl ToProtobuf> for Subtitles { + fn to_protobuf(&self, addon_name: &Option<&String>) -> types::Subtitle { + types::Subtitle { + lang: self.lang.to_string(), + url: self.url.to_string(), + name: addon_name.cloned(), + } + } +} diff --git a/stremio-core-protobuf/src/lib.rs b/stremio-core-protobuf/src/lib.rs index 787899d..b70b79a 100644 --- a/stremio-core-protobuf/src/lib.rs +++ b/stremio-core-protobuf/src/lib.rs @@ -1,12 +1,30 @@ +#[doc(inline)] +pub use crate::{ + bridge::{FromProtobuf, ToProtobuf}, + protobuf::{ + // Re-export all google Protobuf specific structs + google::protobuf::*, + // Re-export Protobuf core modules on the API's top level + stremio::core as stremio_core_models, + }, +}; + +pub mod bridge; + +/// Model implementations. +/// The bridge between Core and Protobuf generated core data structures +/// +/// Includes ToProtobuf and FromProtobuf impls for fields of models and custom models themseves +pub mod model { + pub use addons::*; + + mod addons; + + // Impls of ToProtobuf & FromProtobuf + mod fields; +} + #[allow(clippy::all)] /// The generated module before any export's take place in the API's top level /// Made public because of the compatibility with stremio-core-android pub mod protobuf; - -#[doc(inline)] -pub use protobuf::{ - // Re-export all google protobuf specific structs - google::protobuf::*, - // Re-export all core modules on the API's top level - stremio::core::*, -}; diff --git a/stremio-core-protobuf/src/model/addons.rs b/stremio-core-protobuf/src/model/addons.rs new file mode 100644 index 0000000..58c9de1 --- /dev/null +++ b/stremio-core-protobuf/src/model/addons.rs @@ -0,0 +1,61 @@ +use stremio_core::models::catalog_with_filters::CatalogWithFilters; +use stremio_core::models::ctx::Ctx; +use stremio_core::models::installed_addons_with_filters::InstalledAddonsWithFilters; +use stremio_core::runtime::msg::{Action, ActionLoad, Msg}; +use stremio_core::runtime::{Effects, Env, UpdateWithCtx}; +use stremio_core::types::addon::DescriptorPreview; +use stremio_core::types::profile::Profile; + +#[derive(Default, Clone)] +pub struct AddonsWithFilters { + pub remote_addons: CatalogWithFilters, + pub installed_addons: InstalledAddonsWithFilters, +} + +impl AddonsWithFilters { + pub fn new(profile: &Profile) -> (Self, Effects) { + let (remote_addons, remote_addons_effects) = + CatalogWithFilters::::new(profile); + let (installed_addons, installed_addons_effects) = InstalledAddonsWithFilters::new(profile); + let effects = remote_addons_effects.join(installed_addons_effects); + ( + Self { + remote_addons, + installed_addons, + }, + effects, + ) + } +} + +impl UpdateWithCtx for AddonsWithFilters { + fn update(&mut self, msg: &Msg, ctx: &Ctx) -> Effects { + match msg { + Msg::Action(Action::Load(ActionLoad::InstalledAddonsWithFilters(_selected))) => { + let unload_remote_effects = UpdateWithCtx::::update( + &mut self.remote_addons, + &Msg::Action(Action::Unload), + ctx, + ); + let installed_addons_effects = + UpdateWithCtx::::update(&mut self.installed_addons, msg, ctx); + unload_remote_effects.join(installed_addons_effects) + } + Msg::Action(Action::Load(ActionLoad::CatalogWithFilters(_selected))) => { + let unload_installed_effects = UpdateWithCtx::::update( + &mut self.installed_addons, + &Msg::Action(Action::Unload), + ctx, + ); + let remote_effects = UpdateWithCtx::::update(&mut self.remote_addons, msg, ctx); + unload_installed_effects.join(remote_effects) + } + _ => { + let remote_effects = UpdateWithCtx::::update(&mut self.remote_addons, msg, ctx); + let installed_effects = + UpdateWithCtx::::update(&mut self.installed_addons, msg, ctx); + remote_effects.join(installed_effects) + } + } + } +} diff --git a/stremio-core-protobuf/src/model/fields.rs b/stremio-core-protobuf/src/model/fields.rs new file mode 100644 index 0000000..cb06de1 --- /dev/null +++ b/stremio-core-protobuf/src/model/fields.rs @@ -0,0 +1,12 @@ +mod addon_detail; +mod addons_with_filters; +mod catalogs_with_extra; +mod continue_watching_preview; +mod ctx; +mod discover; +mod library; +mod library_by_type; +mod link; +mod meta_details; +mod player; +mod streaming_server; diff --git a/stremio-core-protobuf/src/model/fields/addon_detail.rs b/stremio-core-protobuf/src/model/fields/addon_detail.rs new file mode 100644 index 0000000..a6aa82e --- /dev/null +++ b/stremio-core-protobuf/src/model/fields/addon_detail.rs @@ -0,0 +1,30 @@ +use crate::bridge::{FromProtobuf, ToProtobuf}; +use crate::protobuf::stremio::core::models; +use stremio_core::models::addon_details::{AddonDetails, Selected}; +use stremio_core::models::ctx::Ctx; + +impl FromProtobuf for models::addon_details::Selected { + fn from_protobuf(&self) -> Selected { + Selected { + transport_url: self.transport_url.from_protobuf(), + } + } +} + +impl ToProtobuf for Selected { + fn to_protobuf(&self, _args: &()) -> models::addon_details::Selected { + models::addon_details::Selected { + transport_url: self.transport_url.to_string(), + } + } +} + +impl ToProtobuf for AddonDetails { + fn to_protobuf(&self, ctx: &Ctx) -> models::AddonDetails { + models::AddonDetails { + selected: self.selected.to_protobuf::(&()), + local_addon: self.local_addon.to_protobuf::(ctx), + remote_addon: self.remote_addon.to_protobuf::(ctx), + } + } +} diff --git a/stremio-core-protobuf/src/model/fields/addons_with_filters.rs b/stremio-core-protobuf/src/model/fields/addons_with_filters.rs new file mode 100644 index 0000000..febe5fd --- /dev/null +++ b/stremio-core-protobuf/src/model/fields/addons_with_filters.rs @@ -0,0 +1,130 @@ +use crate::bridge::{FromProtobuf, ToProtobuf}; +use crate::model::AddonsWithFilters; +use crate::protobuf::stremio::core::models::LoadableAddonCatalog; +use crate::protobuf::stremio::core::{models, types}; +use stremio_core::models::ctx::Ctx; +use stremio_core::models::installed_addons_with_filters::InstalledAddonsRequest; +use stremio_core::models::{catalog_with_filters, installed_addons_with_filters}; + +impl FromProtobuf for models::addons_with_filters::Selected { + fn from_protobuf(&self) -> catalog_with_filters::Selected { + catalog_with_filters::Selected { + request: self.request.from_protobuf(), + } + } +} + +impl FromProtobuf + for models::addons_with_filters::Selected +{ + fn from_protobuf(&self) -> installed_addons_with_filters::Selected { + installed_addons_with_filters::Selected { + request: self.request.from_protobuf(), + } + } +} + +impl ToProtobuf for InstalledAddonsRequest { + fn to_protobuf(&self, _args: &()) -> types::ResourceRequest { + types::ResourceRequest { + base: "".to_string(), + path: types::ResourcePath { + resource: "".to_string(), + r#type: self.r#type.clone().unwrap_or_default(), + id: "".to_string(), + extra: vec![], + }, + } + } +} + +impl ToProtobuf + for installed_addons_with_filters::Selected +{ + fn to_protobuf(&self, _args: &()) -> models::addons_with_filters::Selected { + models::addons_with_filters::Selected { + request: self.request.to_protobuf::(&()), + } + } +} + +impl ToProtobuf for AddonsWithFilters { + fn to_protobuf(&self, ctx: &Ctx) -> models::AddonsWithFilters { + models::AddonsWithFilters { + selected: self + .remote_addons + .selected + .to_owned() + .map(|selected| models::addons_with_filters::Selected { + request: selected.request.to_protobuf::(&()), + }) + .or_else(|| self.installed_addons.selected.to_protobuf::(&())), + selectable: models::addons_with_filters::Selectable { + types: match &self.remote_addons.selected.is_some() { + true => self + .remote_addons + .selectable + .types + .iter() + .map( + |selectable_type| models::addons_with_filters::SelectableType { + r#type: selectable_type.r#type.to_string(), + selected: selectable_type.selected, + request: selectable_type.request.to_protobuf::(&()), + }, + ) + .collect(), + false => self + .installed_addons + .selectable + .types + .iter() + .map( + |selectable_type| models::addons_with_filters::SelectableType { + r#type: selectable_type.r#type.clone().unwrap_or_default(), + selected: selectable_type.selected, + request: selectable_type.request.to_protobuf::(&()), + }, + ) + .collect(), + }, + catalogs: self + .remote_addons + .selectable + .catalogs + .iter() + .map(|catalog| models::addons_with_filters::SelectableCatalog { + name: catalog.catalog.to_owned(), + selected: catalog.selected, + request: catalog.request.to_protobuf::(&()), + }) + .chain([models::addons_with_filters::SelectableCatalog { + name: "Installed".to_string(), + selected: self.remote_addons.selected.is_none(), + request: InstalledAddonsRequest { r#type: None }.to_protobuf::(&()), + }]) + .collect(), + }, + catalog: match &self.remote_addons.selected { + Some(_) => self + .remote_addons + .catalog + .first() + .map(|page| page.to_protobuf::(ctx)), + None => { + self.installed_addons + .selected + .as_ref() + .map(|selected| LoadableAddonCatalog { + request: selected.request.to_protobuf::(&()), + content: Some(models::loadable_addon_catalog::Content::Ready( + models::Addons { + items: self.installed_addons.catalog.to_protobuf::(ctx), + }, + )), + }) + } + }, + } + } +} diff --git a/stremio-core-protobuf/src/model/fields/catalogs_with_extra.rs b/stremio-core-protobuf/src/model/fields/catalogs_with_extra.rs new file mode 100644 index 0000000..e97bb9a --- /dev/null +++ b/stremio-core-protobuf/src/model/fields/catalogs_with_extra.rs @@ -0,0 +1,68 @@ +use stremio_core::deep_links::DiscoverDeepLinks; +use stremio_core::models::catalog_with_filters::Catalog; +use stremio_core::models::catalogs_with_extra::{CatalogsWithExtra, Selected}; +use stremio_core::models::ctx::Ctx; +use stremio_core::types::resource::MetaItemPreview; + +use crate::bridge::{FromProtobuf, ToProtobuf}; +use crate::protobuf::stremio::core::models; + +// impl<'a> From> for CatalogsWithExtra { +// fn from(model: stremio_core_web::model::CatalogsWithExtra<'a>) -> Self { +// CatalogsWithExtra { +// selected: model.selected, +// catalogs: model.catalogs, +// } +// } +// } + +// impl<'a> SerializeModel for CatalogsWithExtra<'a> { +// type Error = serde_json::Error; + +// fn serialize_model(&self) -> Result { +// wasm_bindgen::JsValue::try_from(self) +// } +// } + +impl FromProtobuf for models::catalogs_with_extra::Selected { + fn from_protobuf(&self) -> Selected { + Selected { + r#type: self.r#type.clone(), + extra: self.extra.from_protobuf(), + } + } +} + +impl ToProtobuf for Selected { + fn to_protobuf(&self, _args: &()) -> models::catalogs_with_extra::Selected { + models::catalogs_with_extra::Selected { + r#type: self.r#type.clone(), + extra: self.extra.to_protobuf::(&()), + } + } +} + +impl ToProtobuf for Catalog { + fn to_protobuf(&self, ctx: &Ctx) -> models::Catalog { + models::Catalog { + pages: self.iter().map(|page| page.to_protobuf::(ctx)).collect(), + } + } +} + +impl ToProtobuf for CatalogsWithExtra { + fn to_protobuf(&self, ctx: &Ctx) -> models::CatalogsWithExtra { + models::CatalogsWithExtra { + selected: self.selected.to_protobuf::(&()), + catalogs: self.catalogs.to_protobuf::(ctx), + } + } +} + +impl ToProtobuf for DiscoverDeepLinks { + fn to_protobuf(&self, _args: &()) -> models::DiscoverDeepLinks { + models::DiscoverDeepLinks { + discover: self.discover.clone(), + } + } +} diff --git a/stremio-core-protobuf/src/model/fields/continue_watching_preview.rs b/stremio-core-protobuf/src/model/fields/continue_watching_preview.rs new file mode 100644 index 0000000..a7a8c83 --- /dev/null +++ b/stremio-core-protobuf/src/model/fields/continue_watching_preview.rs @@ -0,0 +1,20 @@ +use stremio_core::models::continue_watching_preview::{ContinueWatchingPreview, Item}; +use stremio_core::models::ctx::Ctx; + +use crate::bridge::ToProtobuf; +use crate::protobuf::stremio::core::{models, types}; + +impl ToProtobuf for Item { + fn to_protobuf(&self, ctx: &Ctx) -> types::LibraryItem { + self.library_item + .to_protobuf::(&(ctx, Some(self.notifications))) + } +} + +impl ToProtobuf for ContinueWatchingPreview { + fn to_protobuf(&self, ctx: &Ctx) -> models::ContinueWatchingPreview { + models::ContinueWatchingPreview { + library_items: self.items.to_protobuf::(ctx), + } + } +} diff --git a/stremio-core-protobuf/src/model/fields/ctx.rs b/stremio-core-protobuf/src/model/fields/ctx.rs new file mode 100644 index 0000000..9c14041 --- /dev/null +++ b/stremio-core-protobuf/src/model/fields/ctx.rs @@ -0,0 +1,12 @@ +use crate::bridge::ToProtobuf; +use crate::protobuf::stremio::core::models; +use stremio_core::models::ctx::Ctx; + +impl ToProtobuf for Ctx { + fn to_protobuf(&self, _args: &()) -> models::Ctx { + models::Ctx { + profile: self.profile.to_protobuf::(&()), + events: self.events.to_protobuf::(&()), + } + } +} diff --git a/stremio-core-protobuf/src/model/fields/discover.rs b/stremio-core-protobuf/src/model/fields/discover.rs new file mode 100644 index 0000000..c9b199f --- /dev/null +++ b/stremio-core-protobuf/src/model/fields/discover.rs @@ -0,0 +1,94 @@ +use stremio_core::models::catalog_with_filters::{ + CatalogWithFilters, Selectable, SelectableCatalog, SelectableExtra, SelectableExtraOption, + SelectablePage, SelectableType, Selected, +}; +use stremio_core::models::ctx::Ctx; +use stremio_core::types::resource::MetaItemPreview; + +use crate::bridge::{FromProtobuf, ToProtobuf}; +use crate::protobuf::stremio::core::models; + +impl FromProtobuf for models::catalog_with_filters::Selected { + fn from_protobuf(&self) -> Selected { + Selected { + request: self.request.from_protobuf(), + } + } +} + +impl ToProtobuf for Selected { + fn to_protobuf(&self, _args: &()) -> models::catalog_with_filters::Selected { + models::catalog_with_filters::Selected { + request: self.request.to_protobuf::(&()), + } + } +} + +impl ToProtobuf for SelectableType { + fn to_protobuf(&self, _args: &()) -> models::catalog_with_filters::SelectableType { + models::catalog_with_filters::SelectableType { + r#type: self.r#type.to_string(), + selected: self.selected, + request: self.request.to_protobuf::(&()), + } + } +} + +impl ToProtobuf for SelectableCatalog { + fn to_protobuf(&self, _args: &()) -> models::catalog_with_filters::SelectableCatalog { + models::catalog_with_filters::SelectableCatalog { + name: self.catalog.to_string(), + selected: self.selected, + request: self.request.to_protobuf::(&()), + } + } +} + +impl ToProtobuf for SelectableExtraOption { + fn to_protobuf(&self, _args: &()) -> models::catalog_with_filters::SelectableExtraOption { + models::catalog_with_filters::SelectableExtraOption { + value: self.value.clone(), + selected: self.selected, + request: self.request.to_protobuf::(&()), + } + } +} + +impl ToProtobuf for SelectableExtra { + fn to_protobuf(&self, _args: &()) -> models::catalog_with_filters::SelectableExtra { + models::catalog_with_filters::SelectableExtra { + name: self.name.to_string(), + is_required: self.is_required, + options: self.options.to_protobuf::(&()), + } + } +} + +impl ToProtobuf for SelectablePage { + fn to_protobuf(&self, _args: &()) -> models::catalog_with_filters::SelectablePage { + models::catalog_with_filters::SelectablePage { + request: self.request.to_protobuf::(&()), + } + } +} + +impl ToProtobuf for Selectable { + fn to_protobuf(&self, _args: &()) -> models::catalog_with_filters::Selectable { + models::catalog_with_filters::Selectable { + types: self.types.to_protobuf::(&()), + catalogs: self.catalogs.to_protobuf::(&()), + extra: self.extra.to_protobuf::(&()), + next_page: self.next_page.to_protobuf::(&()), + } + } +} + +impl ToProtobuf for CatalogWithFilters { + fn to_protobuf(&self, ctx: &Ctx) -> models::CatalogWithFilters { + models::CatalogWithFilters { + selected: self.selected.to_protobuf::(&()), + selectable: self.selectable.to_protobuf::(&()), + catalog: self.catalog.to_protobuf::(ctx), + } + } +} diff --git a/stremio-core-protobuf/src/model/fields/library.rs b/stremio-core-protobuf/src/model/fields/library.rs new file mode 100644 index 0000000..7b49cb8 --- /dev/null +++ b/stremio-core-protobuf/src/model/fields/library.rs @@ -0,0 +1,127 @@ +use std::cmp; +use std::convert::TryFrom; +use std::num::NonZeroUsize; +use stremio_core::models::ctx::Ctx; + +use stremio_core::models::library_with_filters::{ + LibraryRequest, LibraryRequestPage, LibraryWithFilters, Selectable, SelectablePage, + SelectableSort, SelectableType, Selected, Sort, +}; + +use crate::bridge::{FromProtobuf, ToProtobuf}; +use crate::protobuf::stremio::core::models; + +impl FromProtobuf for models::library_with_filters::Sort { + fn from_protobuf(&self) -> Sort { + match self { + models::library_with_filters::Sort::LastWatched => Sort::LastWatched, + models::library_with_filters::Sort::NameReverse => Sort::NameReverse, + models::library_with_filters::Sort::Name => Sort::Name, + models::library_with_filters::Sort::TimesWatched => Sort::TimesWatched, + models::library_with_filters::Sort::Watched => Sort::Watched, + models::library_with_filters::Sort::NotWatched => Sort::NotWatched, + } + } +} + +impl FromProtobuf for models::library_with_filters::LibraryRequest { + fn from_protobuf(&self) -> LibraryRequest { + let page = usize::try_from(cmp::max(self.page, 1)).unwrap_or(usize::MAX); + let page = LibraryRequestPage(NonZeroUsize::new(page).unwrap()); + LibraryRequest { + r#type: self.r#type.to_owned(), + sort: models::library_with_filters::Sort::try_from(self.sort) + .ok() + .from_protobuf() + .unwrap_or(Sort::LastWatched), + page, + } + } +} + +impl FromProtobuf for models::library_with_filters::Selected { + fn from_protobuf(&self) -> Selected { + Selected { + request: self.request.from_protobuf(), + } + } +} + +impl ToProtobuf for Sort { + fn to_protobuf(&self, _args: &()) -> models::library_with_filters::Sort { + match self { + Sort::LastWatched => models::library_with_filters::Sort::LastWatched, + Sort::Name => models::library_with_filters::Sort::Name, + Sort::NameReverse => models::library_with_filters::Sort::NameReverse, + Sort::TimesWatched => models::library_with_filters::Sort::TimesWatched, + Sort::Watched => models::library_with_filters::Sort::Watched, + Sort::NotWatched => models::library_with_filters::Sort::NotWatched, + } + } +} + +impl ToProtobuf for LibraryRequest { + fn to_protobuf(&self, _args: &()) -> models::library_with_filters::LibraryRequest { + models::library_with_filters::LibraryRequest { + r#type: self.r#type.clone(), + sort: self.sort.to_protobuf::(&()) as i32, + page: i64::try_from(self.page.0.get()).unwrap_or(i64::MAX), + } + } +} + +impl ToProtobuf for Selected { + fn to_protobuf(&self, _args: &()) -> models::library_with_filters::Selected { + models::library_with_filters::Selected { + request: self.request.to_protobuf::(&()), + } + } +} + +impl ToProtobuf for SelectableType { + fn to_protobuf(&self, _args: &()) -> models::library_with_filters::SelectableType { + models::library_with_filters::SelectableType { + r#type: self.r#type.clone(), + selected: self.selected, + request: self.request.to_protobuf::(&()), + } + } +} + +impl ToProtobuf for SelectableSort { + fn to_protobuf(&self, _args: &()) -> models::library_with_filters::SelectableSort { + models::library_with_filters::SelectableSort { + sort: self.sort.to_protobuf::(&()) as i32, + selected: self.selected, + request: self.request.to_protobuf::(&()), + } + } +} + +impl ToProtobuf for SelectablePage { + fn to_protobuf(&self, _args: &()) -> models::library_with_filters::SelectablePage { + models::library_with_filters::SelectablePage { + request: self.request.to_protobuf::(&()), + } + } +} + +impl ToProtobuf for Selectable { + fn to_protobuf(&self, _args: &()) -> models::library_with_filters::Selectable { + models::library_with_filters::Selectable { + types: self.types.to_protobuf::(&()), + sorts: self.sorts.to_protobuf::(&()), + next_page: self.next_page.to_protobuf::(&()), + } + } +} + +impl ToProtobuf for LibraryWithFilters { + fn to_protobuf(&self, ctx: &Ctx) -> models::LibraryWithFilters { + models::LibraryWithFilters { + selected: self.selected.to_protobuf::(&()), + selectable: self.selectable.to_protobuf::(&()), + catalog: self.catalog.to_protobuf::(&(ctx, None)), + } + } +} diff --git a/stremio-core-protobuf/src/model/fields/library_by_type.rs b/stremio-core-protobuf/src/model/fields/library_by_type.rs new file mode 100644 index 0000000..3b7e207 --- /dev/null +++ b/stremio-core-protobuf/src/model/fields/library_by_type.rs @@ -0,0 +1,66 @@ +use stremio_core::models::ctx::Ctx; +use stremio_core::models::library_by_type::{ + Catalog, LibraryByType, Selectable, SelectableSort, Selected, +}; +use stremio_core::models::library_with_filters::Sort; + +use crate::bridge::{FromProtobuf, ToProtobuf}; +use crate::protobuf::stremio::core::models; + +impl FromProtobuf for models::library_by_type::Selected { + fn from_protobuf(&self) -> Selected { + Selected { + sort: models::library_with_filters::Sort::try_from(self.sort) + .ok() + .from_protobuf() + .unwrap_or(Sort::LastWatched), + } + } +} + +impl ToProtobuf for Selected { + fn to_protobuf(&self, _args: &()) -> models::library_by_type::Selected { + models::library_by_type::Selected { + sort: self.sort.to_protobuf::(&()) as i32, + } + } +} + +impl ToProtobuf for SelectableSort { + fn to_protobuf(&self, _args: &()) -> models::library_by_type::SelectableSort { + models::library_by_type::SelectableSort { + sort: self.sort.to_protobuf::(&()) as i32, + selected: self.selected, + } + } +} + +impl ToProtobuf for Selectable { + fn to_protobuf(&self, _args: &()) -> models::library_by_type::Selectable { + models::library_by_type::Selectable { + sorts: self.sorts.to_protobuf::(&()), + } + } +} + +impl ToProtobuf for Catalog { + fn to_protobuf(&self, ctx: &Ctx) -> models::LibraryCatalog { + let items = self + .iter() + .flatten() + .map(|item| item.to_protobuf::(&(ctx, None))) + .collect::>(); + let r#type = items.first().map(|item| item.r#type.to_owned()); + models::LibraryCatalog { r#type, items } + } +} + +impl ToProtobuf for LibraryByType { + fn to_protobuf(&self, ctx: &Ctx) -> models::LibraryByType { + models::LibraryByType { + selected: self.selected.to_protobuf::(&()), + selectable: self.selectable.to_protobuf::(&()), + catalogs: self.catalogs.to_protobuf::(ctx), + } + } +} diff --git a/stremio-core-protobuf/src/model/fields/link.rs b/stremio-core-protobuf/src/model/fields/link.rs new file mode 100644 index 0000000..bce7796 --- /dev/null +++ b/stremio-core-protobuf/src/model/fields/link.rs @@ -0,0 +1,14 @@ +use stremio_core::models::link::Link; +use stremio_core::types::api::LinkAuthKey; + +use crate::bridge::ToProtobuf; +use crate::protobuf::stremio::core::models; + +impl ToProtobuf for Link { + fn to_protobuf(&self, _args: &()) -> models::AuthLink { + models::AuthLink { + code: self.code.to_protobuf::(&()), + data: self.data.to_protobuf::(&()), + } + } +} diff --git a/stremio-core-protobuf/src/model/fields/meta_details.rs b/stremio-core-protobuf/src/model/fields/meta_details.rs new file mode 100644 index 0000000..59266f9 --- /dev/null +++ b/stremio-core-protobuf/src/model/fields/meta_details.rs @@ -0,0 +1,234 @@ +use boolinator::Boolinator; +use stremio_core::deep_links::MetaItemDeepLinks; +use stremio_core::models::ctx::Ctx; +use stremio_core::models::meta_details::{MetaDetails, Selected}; +use stremio_core::runtime::Env; +use stremio_core::types::addon::ResourceRequest; +use stremio_core::types::library::LibraryItem; +use stremio_core::types::resource::{MetaItem, SeriesInfo, Video}; +use stremio_core::types::watched_bitfield::WatchedBitField; + +use crate::bridge::{FromProtobuf, ToProtobuf}; +use crate::protobuf::stremio::core::{models, types}; + +impl FromProtobuf for models::meta_details::Selected { + fn from_protobuf(&self) -> Selected { + Selected { + meta_path: self.meta_path.from_protobuf(), + stream_path: self.stream_path.from_protobuf(), + guess_stream: self.guess_stream_path, + } + } +} + +impl ToProtobuf for Selected { + fn to_protobuf(&self, _args: &()) -> models::meta_details::Selected { + models::meta_details::Selected { + meta_path: self.meta_path.to_protobuf::(&()), + stream_path: self.stream_path.to_protobuf::(&()), + guess_stream_path: self.guess_stream, + } + } +} + +impl ToProtobuf for SeriesInfo { + fn to_protobuf(&self, _args: &()) -> types::video::SeriesInfo { + types::video::SeriesInfo { + season: self.season as i64, + episode: self.episode as i64, + } + } +} + +impl FromProtobuf for types::video::SeriesInfo { + fn from_protobuf(&self) -> SeriesInfo { + SeriesInfo { + season: self.season.unsigned_abs() as u32, + episode: self.episode.unsigned_abs() as u32, + } + } +} + +impl + ToProtobuf< + types::Video, + ( + Option<&LibraryItem>, + Option<&WatchedBitField>, + Option<&String>, + ), + > for Video +{ + fn to_protobuf( + &self, + (library_item, watched, addon_name): &( + Option<&LibraryItem>, + Option<&WatchedBitField>, + Option<&String>, + ), + ) -> types::Video { + types::Video { + id: self.id.to_string(), + title: self.title.to_string(), + released: self.released.to_protobuf::(&()), + overview: self.overview.clone(), + thumbnail: self.thumbnail.clone(), + streams: self.streams.to_protobuf::(&(None, *addon_name, None, None)), + series_info: self.series_info.to_protobuf::(&()), + upcoming: self + .released + .map(|released| released > E::now()) + .unwrap_or_default(), + watched: watched + .map(|watched| watched.get_video(&self.id)) + .unwrap_or_default(), + current_video: library_item + .and_then(|library_item| library_item.state.video_id.to_owned()) + .map(|current_video_id| current_video_id == self.id) + .unwrap_or_default(), + } + } +} + +impl FromProtobuf