From 18f2fa94752bc06f1d729e2d538aabc4af53a525 Mon Sep 17 00:00:00 2001 From: Alexander Date: Sun, 12 Jul 2026 10:36:14 +0200 Subject: [PATCH] Add search for torrents --- .gitmodules | 3 + Cargo.lock | 1132 ++++++++- Cargo.toml | 2 + buf.gen.yaml | 6 +- containers/jackett.nix | 37 + dev/Music Agregator/.gitignore | 9 + dev/Music Agregator/Health.yml | 11 + dev/Music Agregator/Jackett/Search.yml | 24 + dev/Music Agregator/Jackett/folder.yml | 7 + dev/Music Agregator/Torrent/Search.yml | 14 + dev/Music Agregator/Torrent/folder.yml | 7 + dev/Music Agregator/opencollection.yml | 25 + devenv.nix | 3 +- justfile | 3 + metadata-agregator | 1 + proto/search.proto | 21 + rustfmt.toml | 5 + src/config.rs | 7 + src/generated/metadata/v1/metadata.v1.rs | 2063 +++++++++++------ .../torrent_manager/torrent_manager.rs | 100 + .../torrent_manager/torrent_manager.serde.rs | 293 +++ .../torrent_manager/torrent_manager.tonic.rs | 271 +++ src/indexer.rs | 189 ++ src/main.rs | 16 +- src/torrent.rs | 2 +- src/torrent_manager.rs | 53 + 26 files changed, 3588 insertions(+), 716 deletions(-) create mode 100644 containers/jackett.nix create mode 100644 dev/Music Agregator/.gitignore create mode 100644 dev/Music Agregator/Health.yml create mode 100644 dev/Music Agregator/Jackett/Search.yml create mode 100644 dev/Music Agregator/Jackett/folder.yml create mode 100644 dev/Music Agregator/Torrent/Search.yml create mode 100644 dev/Music Agregator/Torrent/folder.yml create mode 100644 dev/Music Agregator/opencollection.yml create mode 160000 metadata-agregator create mode 100644 proto/search.proto create mode 100644 rustfmt.toml create mode 100644 src/generated/torrent_manager/torrent_manager.rs create mode 100644 src/generated/torrent_manager/torrent_manager.serde.rs create mode 100644 src/generated/torrent_manager/torrent_manager.tonic.rs create mode 100644 src/indexer.rs create mode 100644 src/torrent_manager.rs diff --git a/.gitmodules b/.gitmodules index c93319d..61e9537 100644 --- a/.gitmodules +++ b/.gitmodules @@ -4,3 +4,6 @@ [submodule "tora"] path = tora url = /home/fujin/Code/agregators/tora +[submodule "metadata-agregator"] + path = metadata-agregator + url = ssh://git@gitea.susano-homelab.duckdns.org:2222/fujin/metadata-agregator.git diff --git a/Cargo.lock b/Cargo.lock index 85eb6e0..9fe6fc8 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -46,6 +46,29 @@ version = "1.5.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f2032f911046de80f0a198e0901378627c33f59ea0ac00e363d481118bd70a53" +[[package]] +name = "aws-lc-rs" +version = "1.17.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4342d8937fc7e5dd9b1c60292261c0670c882a2cd1719cfc11b1af41731e32ad" +dependencies = [ + "aws-lc-sys", + "zeroize", +] + +[[package]] +name = "aws-lc-sys" +version = "0.42.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6d9ceb1da931507a12f4fccea479dccd00da1943e1b4ae72d8e502d707361444" +dependencies = [ + "cc", + "cmake", + "dunce", + "fs_extra", + "pkg-config", +] + [[package]] name = "axum" version = "0.8.9" @@ -101,18 +124,53 @@ version = "2.13.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b4388bee8683e3d04af747c73422af53102d2bd24d9eadb6cbc100baef4b43f8" +[[package]] +name = "bumpalo" +version = "3.20.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "72f5acc6cb2ba439de613abc23857ec3d78374d8ed5ac84e9d11336e87da8649" + [[package]] name = "bytes" version = "1.12.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8ae3f5d315924270530207e2a68396c3cc547f6dca3fbdca317cfb1a51edb593" +[[package]] +name = "cc" +version = "1.2.66" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f5d6cac793997bd970000024b2934968efe83b382de4fdcf4fcb46b6ee4ad996" +dependencies = [ + "find-msvc-tools", + "jobserver", + "libc", + "shlex", +] + [[package]] name = "cfg-if" version = "1.0.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9330f8b2ff13f34540b44e946ef35111825727b38d33286ef986142615121801" +[[package]] +name = "cfg_aliases" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "613afe47fcd5fac7ccf1db93babcb082c5994d996f20b8b159f2ad1658eb5724" + +[[package]] +name = "chacha20" +version = "0.10.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d524456ba66e72eb8b115ff89e01e497f8e6d11d78b70b1aa13c0fbd97540a81" +dependencies = [ + "cfg-if", + "cpufeatures", + "rand_core", +] + [[package]] name = "chrono" version = "0.4.45" @@ -122,6 +180,50 @@ dependencies = [ "num-traits", ] +[[package]] +name = "cmake" +version = "0.1.58" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c0f78a02292a74a88ac736019ab962ece0bc380e3f977bf72e376c5d78ff0678" +dependencies = [ + "cc", +] + +[[package]] +name = "combine" +version = "4.6.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ba5a308b75df32fe02788e748662718f03fde005016435c444eea572398219fd" +dependencies = [ + "bytes", + "memchr", +] + +[[package]] +name = "core-foundation" +version = "0.10.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b2a6cd9ae233e7f62ba4e9353e81a88df7fc8a5987b8d445b4d90c879bd156f6" +dependencies = [ + "core-foundation-sys", + "libc", +] + +[[package]] +name = "core-foundation-sys" +version = "0.8.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "773648b94d0e5d620f64f280777445740e61fe701025087ec8b57f45c791888b" + +[[package]] +name = "cpufeatures" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8b2a41393f66f16b0823bb79094d54ac5fbd34ab292ddafb9a0456ac9f87d201" +dependencies = [ + "libc", +] + [[package]] name = "crc32fast" version = "1.5.0" @@ -131,6 +233,23 @@ dependencies = [ "cfg-if", ] +[[package]] +name = "displaydoc" +version = "0.2.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1ac70aa55017e108007fbaf5aa0f54b021c98f92ff8af59d42eda9da96e3dd4f" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "dunce" +version = "1.0.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "92773504d58c093f6de2459af4af33faa518c13451eb8f2b5698ed3d36e7c813" + [[package]] name = "either" version = "1.16.0" @@ -150,7 +269,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "39cab71617ae0d63f51a36d69f866391735b51691dbda63cf6f96d042b63efeb" dependencies = [ "libc", - "windows-sys", + "windows-sys 0.61.2", ] [[package]] @@ -159,6 +278,12 @@ version = "2.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9f1f227452a390804cdb637b74a86990f2a7d7ba4b7d5693aac9b4dd6defd8d6" +[[package]] +name = "find-msvc-tools" +version = "0.1.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5baebc0774151f905a1a2cc41989300b1e6fbb29aff0ceffa1064fdd3088d582" + [[package]] name = "fixedbitset" version = "0.5.7" @@ -187,6 +312,21 @@ version = "0.1.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d9c4f5dac5e15c24eb999c26181a6ca40b39fe946cbe4c263c7209467bc83af2" +[[package]] +name = "form_urlencoded" +version = "1.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cb4cb245038516f5f85277875cdaa4f7d2c9a0fa0468de06ed190163b1581fcf" +dependencies = [ + "percent-encoding", +] + +[[package]] +name = "fs_extra" +version = "1.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "42703706b716c37f96a77aea830392ad231f44c9e9a67872fa5548707e11b11c" + [[package]] name = "futures-channel" version = "0.3.32" @@ -226,6 +366,33 @@ dependencies = [ "slab", ] +[[package]] +name = "getrandom" +version = "0.2.17" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ff2abc00be7fca6ebc474524697ae276ad847ad0a6b3faa4bcb027e9a4614ad0" +dependencies = [ + "cfg-if", + "js-sys", + "libc", + "wasi", + "wasm-bindgen", +] + +[[package]] +name = "getrandom" +version = "0.4.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "300e883d756b2e4ec94e02791f39b04b522276138852cfc41d9fb7e904106099" +dependencies = [ + "cfg-if", + "js-sys", + "libc", + "r-efi", + "rand_core", + "wasm-bindgen", +] + [[package]] name = "h2" version = "0.4.15" @@ -333,6 +500,21 @@ dependencies = [ "want", ] +[[package]] +name = "hyper-rustls" +version = "0.27.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "33ca68d021ef39cf6463ab54c1d0f5daf03377b70561305bb89a8f83aab66e0f" +dependencies = [ + "http", + "hyper", + "hyper-util", + "rustls", + "tokio", + "tokio-rustls", + "tower-service", +] + [[package]] name = "hyper-timeout" version = "0.5.2" @@ -352,13 +534,16 @@ version = "0.1.20" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "96547c2556ec9d12fb1578c4eaf448b04993e7fb79cbaad930a656880a6bdfa0" dependencies = [ + "base64", "bytes", "futures-channel", "futures-util", "http", "http-body", "hyper", + "ipnet", "libc", + "percent-encoding", "pin-project-lite", "socket2", "tokio", @@ -366,6 +551,109 @@ dependencies = [ "tracing", ] +[[package]] +name = "icu_collections" +version = "2.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2984d1cd16c883d7935b9e07e44071dca8d917fd52ecc02c04d5fa0b5a3f191c" +dependencies = [ + "displaydoc", + "potential_utf", + "utf8_iter", + "yoke", + "zerofrom", + "zerovec", +] + +[[package]] +name = "icu_locale_core" +version = "2.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "92219b62b3e2b4d88ac5119f8904c10f8f61bf7e95b640d25ba3075e6cac2c29" +dependencies = [ + "displaydoc", + "litemap", + "tinystr", + "writeable", + "zerovec", +] + +[[package]] +name = "icu_normalizer" +version = "2.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c56e5ee99d6e3d33bd91c5d85458b6005a22140021cc324cea84dd0e72cff3b4" +dependencies = [ + "icu_collections", + "icu_normalizer_data", + "icu_properties", + "icu_provider", + "smallvec", + "zerovec", +] + +[[package]] +name = "icu_normalizer_data" +version = "2.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "da3be0ae77ea334f4da67c12f149704f19f81d1adf7c51cf482943e84a2bad38" + +[[package]] +name = "icu_properties" +version = "2.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bee3b67d0ea5c2cca5003417989af8996f8604e34fb9ddf96208a033901e70de" +dependencies = [ + "icu_collections", + "icu_locale_core", + "icu_properties_data", + "icu_provider", + "zerotrie", + "zerovec", +] + +[[package]] +name = "icu_properties_data" +version = "2.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8e2bbb201e0c04f7b4b3e14382af113e17ba4f63e2c9d2ee626b720cbce54a14" + +[[package]] +name = "icu_provider" +version = "2.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "139c4cf31c8b5f33d7e199446eff9c1e02decfc2f0eec2c8d71f65befa45b421" +dependencies = [ + "displaydoc", + "icu_locale_core", + "writeable", + "yoke", + "zerofrom", + "zerotrie", + "zerovec", +] + +[[package]] +name = "idna" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3b0875f23caa03898994f6ddc501886a45c7d3d62d04d2d90788d47be1b1e4de" +dependencies = [ + "idna_adapter", + "smallvec", + "utf8_iter", +] + +[[package]] +name = "idna_adapter" +version = "1.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cb68373c0d6620ef8105e855e7745e18b0d00d3bdb07fb532e434244cdb9a714" +dependencies = [ + "icu_normalizer", + "icu_properties", +] + [[package]] name = "indexmap" version = "2.14.0" @@ -376,6 +664,12 @@ dependencies = [ "hashbrown 0.17.1", ] +[[package]] +name = "ipnet" +version = "2.12.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d98f6fed1fde3f8c21bc40a1abb88dd75e67924f9cffc3ef95607bad8017f8e2" + [[package]] name = "itertools" version = "0.14.0" @@ -391,6 +685,76 @@ version = "1.0.18" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8f42a60cbdf9a97f5d2305f08a87dc4e09308d1276d28c869c684d7777685682" +[[package]] +name = "jni" +version = "0.22.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5efd9a482cf3a427f00d6b35f14332adc7902ce91efb778580e180ff90fa3498" +dependencies = [ + "cfg-if", + "combine", + "jni-macros", + "jni-sys", + "log", + "simd_cesu8", + "thiserror", + "walkdir", + "windows-link", +] + +[[package]] +name = "jni-macros" +version = "0.22.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a00109accc170f0bdb141fed3e393c565b6f5e072365c3bd58f5b062591560a3" +dependencies = [ + "proc-macro2", + "quote", + "rustc_version", + "simd_cesu8", + "syn", +] + +[[package]] +name = "jni-sys" +version = "0.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c6377a88cb3910bee9b0fa88d4f42e1d2da8e79915598f65fb0c7ee14c878af2" +dependencies = [ + "jni-sys-macros", +] + +[[package]] +name = "jni-sys-macros" +version = "0.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "38c0b942f458fe50cdac086d2f946512305e5631e720728f2a61aabcd47a6264" +dependencies = [ + "quote", + "syn", +] + +[[package]] +name = "jobserver" +version = "0.1.35" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1c00acbd29eabad4a2392fa0e921c874934dbbf4194312ad20f04a0ed67a3cb3" +dependencies = [ + "getrandom 0.4.3", + "libc", +] + +[[package]] +name = "js-sys" +version = "0.3.103" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "53b44bfcdb3f8d5837a46dae1ca9660a837176eee74a28b229bc626816589102" +dependencies = [ + "cfg-if", + "futures-util", + "wasm-bindgen", +] + [[package]] name = "libc" version = "0.2.186" @@ -403,12 +767,24 @@ version = "0.12.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "32a66949e030da00e8c7d4434b251670a91556f4144941d37452769c25d58a53" +[[package]] +name = "litemap" +version = "0.8.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "92daf443525c4cce67b150400bc2316076100ce0b3686209eb8cf3c31612e6f0" + [[package]] name = "log" version = "0.4.33" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0ceec5bc11778974d1bcb055b18002eba7f4b3518b6a0081b3af5f21666da9ad" +[[package]] +name = "lru-slab" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "112b39cec0b298b6c1999fee3e31427f74f676e4cb9879ed1a121b43661a4154" + [[package]] name = "matchit" version = "0.8.4" @@ -445,7 +821,7 @@ checksum = "02bd0af71c67b473010cbbc60715ee815645a4dc942899111f494b4b737d6fda" dependencies = [ "libc", "wasi", - "windows-sys", + "windows-sys 0.61.2", ] [[package]] @@ -462,6 +838,8 @@ dependencies = [ "pbjson", "pbjson-types", "prost", + "quick-xml", + "reqwest", "serde", "tokio", "toml", @@ -486,6 +864,12 @@ version = "1.21.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9f7c3e4beb33f85d45ae3e3a1792185706c8e16d043238c593331cc7cd313b50" +[[package]] +name = "openssl-probe" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7c87def4c32ab89d880effc9e097653c8da5d6ef28e6b539d313baaacfbafcbe" + [[package]] name = "pbjson" version = "0.8.0" @@ -566,6 +950,21 @@ version = "0.2.17" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a89322df9ebe1c1578d689c92318e070967d1042b512afbe49518723f4e6d5cd" +[[package]] +name = "pkg-config" +version = "0.3.33" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "19f132c84eca552bf34cab8ec81f1c1dcc229b811638f9d283dceabe58c5569e" + +[[package]] +name = "potential_utf" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0103b1cef7ec0cf76490e969665504990193874ea05c85ff9bab8b911d0a0564" +dependencies = [ + "zerovec", +] + [[package]] name = "prettyplease" version = "0.2.37" @@ -636,6 +1035,73 @@ dependencies = [ "prost", ] +[[package]] +name = "quick-xml" +version = "0.41.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e660451e55124f798a69a5af3f49ccfbefbd41910eefd25caf2393e1f3473ec1" +dependencies = [ + "memchr", + "serde", +] + +[[package]] +name = "quinn" +version = "0.11.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0c1a41e437b6bbd489372cd4971de128e85c855f56c57f283d20ff016cf7c0a8" +dependencies = [ + "bytes", + "cfg_aliases", + "pin-project-lite", + "quinn-proto", + "quinn-udp", + "rustc-hash", + "rustls", + "socket2", + "thiserror", + "tokio", + "tracing", + "web-time", +] + +[[package]] +name = "quinn-proto" +version = "0.11.16" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2f4bfc015262b9df63c8845072ce59068853ff5872180c2ce2f13038b970e560" +dependencies = [ + "aws-lc-rs", + "bytes", + "getrandom 0.4.3", + "lru-slab", + "rand", + "rand_pcg", + "ring", + "rustc-hash", + "rustls", + "rustls-pki-types", + "slab", + "thiserror", + "tinyvec", + "tracing", + "web-time", +] + +[[package]] +name = "quinn-udp" +version = "0.5.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "35a133f956daabe89a61a685c2649f13d82d5aa4bd5d12d1277e1072a21c0694" +dependencies = [ + "cfg_aliases", + "libc", + "once_cell", + "socket2", + "tracing", + "windows-sys 0.61.2", +] + [[package]] name = "quote" version = "1.0.46" @@ -645,6 +1111,38 @@ dependencies = [ "proc-macro2", ] +[[package]] +name = "r-efi" +version = "6.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f8dcc9c7d52a811697d2151c701e0d08956f92b0e24136cf4cf27b57a6a0d9bf" + +[[package]] +name = "rand" +version = "0.10.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c7f5fa3a058cd35567ef9bfa5e75732bee0f9e4c55fa90477bef2dfcdbc4be80" +dependencies = [ + "chacha20", + "getrandom 0.4.3", + "rand_core", +] + +[[package]] +name = "rand_core" +version = "0.10.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "63b8176103e19a2643978565ca18b50549f6101881c443590420e4dc998a3c69" + +[[package]] +name = "rand_pcg" +version = "0.10.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "caa0f4137e1c0a72f4c651489402276c8e8e1cf081f3b0ba156d2cbeef09e86a" +dependencies = [ + "rand_core", +] + [[package]] name = "regex" version = "1.12.4" @@ -674,6 +1172,72 @@ version = "0.8.11" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d6f6ff9a378485b298a5286656da665ba74413d36db0979633275d2e708145d4" +[[package]] +name = "reqwest" +version = "0.13.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "219c5811de6525e5416c7d5d53bb656d3afdbc6c5af816e0802bcfa42dbdc1c3" +dependencies = [ + "base64", + "bytes", + "futures-core", + "http", + "http-body", + "http-body-util", + "hyper", + "hyper-rustls", + "hyper-util", + "js-sys", + "log", + "percent-encoding", + "pin-project-lite", + "quinn", + "rustls", + "rustls-pki-types", + "rustls-platform-verifier", + "serde", + "serde_urlencoded", + "sync_wrapper", + "tokio", + "tokio-rustls", + "tower", + "tower-http", + "tower-service", + "url", + "wasm-bindgen", + "wasm-bindgen-futures", + "web-sys", +] + +[[package]] +name = "ring" +version = "0.17.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a4689e6c2294d81e88dc6261c768b63bc4fcdb852be6d1352498b114f61383b7" +dependencies = [ + "cc", + "cfg-if", + "getrandom 0.2.17", + "libc", + "untrusted", + "windows-sys 0.52.0", +] + +[[package]] +name = "rustc-hash" +version = "2.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6b1e7f9a428571be2dc5bc0505c13fb6bf936822b894ec87abf8a08a4e51742d" + +[[package]] +name = "rustc_version" +version = "0.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cfcb3a22ef46e85b45de6ee7e79d063319ebb6594faafcf1c225ea92ab6e9b92" +dependencies = [ + "semver", +] + [[package]] name = "rustix" version = "1.1.4" @@ -684,9 +1248,143 @@ dependencies = [ "errno", "libc", "linux-raw-sys", - "windows-sys", + "windows-sys 0.61.2", ] +[[package]] +name = "rustls" +version = "0.23.41" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6b92b125634d9b795e7beca796cc790df15a7fb38323bf3196fda83292d06b1f" +dependencies = [ + "aws-lc-rs", + "once_cell", + "rustls-pki-types", + "rustls-webpki", + "subtle", + "zeroize", +] + +[[package]] +name = "rustls-native-certs" +version = "0.8.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dab5152771c58876a2146916e53e35057e1a4dfa2b9df0f0305b07f611fdea4d" +dependencies = [ + "openssl-probe", + "rustls-pki-types", + "schannel", + "security-framework", +] + +[[package]] +name = "rustls-pki-types" +version = "1.15.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "764899a24af3980067ee14bc143654f297b22eaebfe3c7b6b211920a5a59b046" +dependencies = [ + "web-time", + "zeroize", +] + +[[package]] +name = "rustls-platform-verifier" +version = "0.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "26d1e2536ce4f35f4846aa13bff16bd0ff40157cdb14cc056c7b14ba41233ba0" +dependencies = [ + "core-foundation", + "core-foundation-sys", + "jni", + "log", + "once_cell", + "rustls", + "rustls-native-certs", + "rustls-platform-verifier-android", + "rustls-webpki", + "security-framework", + "security-framework-sys", + "webpki-root-certs", + "windows-sys 0.61.2", +] + +[[package]] +name = "rustls-platform-verifier-android" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f87165f0995f63a9fbeea62b64d10b4d9d8e78ec6d7d51fb2125fda7bb36788f" + +[[package]] +name = "rustls-webpki" +version = "0.103.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "61c429a8649f110dddef65e2a5ad240f747e85f7758a6bccc7e5777bd33f756e" +dependencies = [ + "aws-lc-rs", + "ring", + "rustls-pki-types", + "untrusted", +] + +[[package]] +name = "rustversion" +version = "1.0.23" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cf54715a573b99ac80df0bc206da022bcd442c974952c7b9720069370852e21f" + +[[package]] +name = "ryu" +version = "1.0.23" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9774ba4a74de5f7b1c1451ed6cd5285a32eddb5cccb8cc655a4e50009e06477f" + +[[package]] +name = "same-file" +version = "1.0.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "93fc1dc3aaa9bfed95e02e6eadabb4baf7e3078b0bd1b4d7b6b0b68378900502" +dependencies = [ + "winapi-util", +] + +[[package]] +name = "schannel" +version = "0.1.29" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "91c1b7e4904c873ef0710c1f407dde2e6287de2bebc1bbbf7d430bb7cbffd939" +dependencies = [ + "windows-sys 0.61.2", +] + +[[package]] +name = "security-framework" +version = "3.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b7f4bc775c73d9a02cde8bf7b2ec4c9d12743edf609006c7facc23998404cd1d" +dependencies = [ + "bitflags", + "core-foundation", + "core-foundation-sys", + "libc", + "security-framework-sys", +] + +[[package]] +name = "security-framework-sys" +version = "2.17.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6ce2691df843ecc5d231c0b14ece2acc3efb62c0a398c7e1d875f3983ce020e3" +dependencies = [ + "core-foundation-sys", + "libc", +] + +[[package]] +name = "semver" +version = "1.0.28" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8a7852d02fc848982e0c167ef163aaff9cd91dc640ba85e263cb1ce46fae51cd" + [[package]] name = "serde" version = "1.0.228" @@ -726,12 +1424,46 @@ dependencies = [ "serde_core", ] +[[package]] +name = "serde_urlencoded" +version = "0.7.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d3491c14715ca2294c4d6a88f15e84739788c1d030eed8c110436aafdaa2f3fd" +dependencies = [ + "form_urlencoded", + "itoa", + "ryu", + "serde", +] + +[[package]] +name = "shlex" +version = "2.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f8fadd59c855ef2080decdef8ff161eb6661b86933c9d82e5ba29dc602a55aba" + [[package]] name = "simd-adler32" version = "0.3.9" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "703d5c7ef118737c72f1af64ad2f6f8c5e1921f818cdcb97b8fe6fc69bf66214" +[[package]] +name = "simd_cesu8" +version = "1.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "94f90157bb87cddf702797c5dadfa0be7d266cdf49e22da2fcaa32eff75b2c33" +dependencies = [ + "rustc_version", + "simdutf8", +] + +[[package]] +name = "simdutf8" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e3a9fe34e3e7a50316060351f37187a3f546bce95496156754b601a5fa71b76e" + [[package]] name = "slab" version = "0.4.12" @@ -751,9 +1483,21 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "52d1cfed4120b4d927bf7c0f86d2087a4a7d6027c906d9f9d525a80573b9be51" dependencies = [ "libc", - "windows-sys", + "windows-sys 0.61.2", ] +[[package]] +name = "stable_deref_trait" +version = "1.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6ce2be8dc25455e1f91df71bfa12ad37d7af1092ae736f3a6cd0e37bc7810596" + +[[package]] +name = "subtle" +version = "2.6.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "13c2bddecc57b384dee18652358fb23172facb8a2c51ccc10d74c157bdea3292" + [[package]] name = "syn" version = "2.0.118" @@ -770,6 +1514,20 @@ name = "sync_wrapper" version = "1.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0bf256ce5efdfa370213c1dabab5935a12e49f2c58d15e9eac2870d3b4f27263" +dependencies = [ + "futures-core", +] + +[[package]] +name = "synstructure" +version = "0.13.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "728a70f3dbaf5bab7f0c4b1ac8d7ae5ea60a4b5549c8a5914361c99147a709d2" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] [[package]] name = "tempfile" @@ -780,9 +1538,54 @@ dependencies = [ "fastrand", "once_cell", "rustix", - "windows-sys", + "windows-sys 0.61.2", ] +[[package]] +name = "thiserror" +version = "2.0.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4288b5bcbc7920c07a1149a35cf9590a2aa808e0bc1eafaade0b80947865fbc4" +dependencies = [ + "thiserror-impl", +] + +[[package]] +name = "thiserror-impl" +version = "2.0.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ebc4ee7f67670e9b64d05fa4253e753e016c6c95ff35b89b7941d6b856dec1d5" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "tinystr" +version = "0.8.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c8323304221c2a851516f22236c5722a72eaa19749016521d6dff0824447d96d" +dependencies = [ + "displaydoc", + "zerovec", +] + +[[package]] +name = "tinyvec" +version = "1.11.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3e61e67053d25a4e82c844e8424039d9745781b3fc4f32b8d55ed50f5f667ef3" +dependencies = [ + "tinyvec_macros", +] + +[[package]] +name = "tinyvec_macros" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1f3ccbac311fea05f86f61904b462b55fb3df8837a366dfc601a0161d0532f20" + [[package]] name = "tokio" version = "1.52.3" @@ -795,7 +1598,7 @@ dependencies = [ "pin-project-lite", "socket2", "tokio-macros", - "windows-sys", + "windows-sys 0.61.2", ] [[package]] @@ -809,6 +1612,16 @@ dependencies = [ "syn", ] +[[package]] +name = "tokio-rustls" +version = "0.26.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1729aa945f29d91ba541258c8df89027d5792d85a8841fb65e8bf0f4ede4ef61" +dependencies = [ + "rustls", + "tokio", +] + [[package]] name = "tokio-stream" version = "0.1.18" @@ -960,6 +1773,24 @@ dependencies = [ "tracing", ] +[[package]] +name = "tower-http" +version = "0.6.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4cfcf7e2740e6fc6d4d688b4ef00650406bb94adf4731e43c096c3a19fe40840" +dependencies = [ + "bitflags", + "bytes", + "futures-util", + "http", + "http-body", + "pin-project-lite", + "tower", + "tower-layer", + "tower-service", + "url", +] + [[package]] name = "tower-layer" version = "0.3.3" @@ -1015,6 +1846,40 @@ version = "1.0.24" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e6e4313cd5fcd3dad5cafa179702e2b244f760991f45397d14d4ebf38247da75" +[[package]] +name = "untrusted" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8ecb6da28b8a351d773b68d5825ac39017e680750f980f3a1a85cd8dd28a47c1" + +[[package]] +name = "url" +version = "2.5.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ff67a8a4397373c3ef660812acab3268222035010ab8680ec4215f38ba3d0eed" +dependencies = [ + "form_urlencoded", + "idna", + "percent-encoding", + "serde", +] + +[[package]] +name = "utf8_iter" +version = "1.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b6c140620e7ffbb22c2dee59cafe6084a59b5ffc27a8859a5f0d494b5d52b6be" + +[[package]] +name = "walkdir" +version = "2.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "29790946404f91d9c5d06f9874efddea1dc06c5efe94541a7d6863108e3a5e4b" +dependencies = [ + "same-file", + "winapi-util", +] + [[package]] name = "want" version = "0.3.1" @@ -1030,12 +1895,114 @@ version = "0.11.1+wasi-snapshot-preview1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ccf3ec651a847eb01de73ccad15eb7d99f80485de043efb2f370cd654f4ea44b" +[[package]] +name = "wasm-bindgen" +version = "0.2.126" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4b067c0c11094aef6b7a801c1e34a26affafdf3d051dba08456b868789aaf9a4" +dependencies = [ + "cfg-if", + "once_cell", + "rustversion", + "wasm-bindgen-macro", + "wasm-bindgen-shared", +] + +[[package]] +name = "wasm-bindgen-futures" +version = "0.4.76" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c62df1340f32221cb9c54d6a27b030e3dba64361d4a95bed55f9aacb44da291d" +dependencies = [ + "js-sys", + "wasm-bindgen", +] + +[[package]] +name = "wasm-bindgen-macro" +version = "0.2.126" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "167ce5e579f6bcf889c4f7175a8a5a585de84e8ff93976ce393efa5f2837aab1" +dependencies = [ + "quote", + "wasm-bindgen-macro-support", +] + +[[package]] +name = "wasm-bindgen-macro-support" +version = "0.2.126" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f3997c7839262f4ef12cf90b818d6340c18e80f263f1a94bf157d0ec4420380e" +dependencies = [ + "bumpalo", + "proc-macro2", + "quote", + "syn", + "wasm-bindgen-shared", +] + +[[package]] +name = "wasm-bindgen-shared" +version = "0.2.126" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dc1b4cb0cc549fcf58d7dfc081778139b3d283a081644e833e84682ad71cea24" +dependencies = [ + "unicode-ident", +] + +[[package]] +name = "web-sys" +version = "0.3.103" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8622dcb61c0bcc9fffa6938bed81210af2da9a7e4a1a834b2e37a59b6dfb6141" +dependencies = [ + "js-sys", + "wasm-bindgen", +] + +[[package]] +name = "web-time" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5a6580f308b1fad9207618087a65c04e7a10bc77e02c8e84e9b00dd4b12fa0bb" +dependencies = [ + "js-sys", + "wasm-bindgen", +] + +[[package]] +name = "webpki-root-certs" +version = "1.0.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0d46a5a140e6f7afeccd8eae97eff335163939eac8b929834875168b29b3d267" +dependencies = [ + "rustls-pki-types", +] + +[[package]] +name = "winapi-util" +version = "0.1.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c2a7b1c03c876122aa43f3020e6c3c3ee5c05081c9a00739faf7503aeba10d22" +dependencies = [ + "windows-sys 0.61.2", +] + [[package]] name = "windows-link" version = "0.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f0805222e57f7521d6a62e36fa9163bc891acd422f971defe97d64e70d0a4fe5" +[[package]] +name = "windows-sys" +version = "0.52.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "282be5f36a8ce781fad8c8ae18fa3f9beff57ec1b52cb3de0789201425d9a33d" +dependencies = [ + "windows-targets", +] + [[package]] name = "windows-sys" version = "0.61.2" @@ -1045,8 +2012,161 @@ dependencies = [ "windows-link", ] +[[package]] +name = "windows-targets" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9b724f72796e036ab90c1021d4780d4d3d648aca59e491e6b98e725b84e99973" +dependencies = [ + "windows_aarch64_gnullvm", + "windows_aarch64_msvc", + "windows_i686_gnu", + "windows_i686_gnullvm", + "windows_i686_msvc", + "windows_x86_64_gnu", + "windows_x86_64_gnullvm", + "windows_x86_64_msvc", +] + +[[package]] +name = "windows_aarch64_gnullvm" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "32a4622180e7a0ec044bb555404c800bc9fd9ec262ec147edd5989ccd0c02cd3" + +[[package]] +name = "windows_aarch64_msvc" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "09ec2a7bb152e2252b53fa7803150007879548bc709c039df7627cabbd05d469" + +[[package]] +name = "windows_i686_gnu" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8e9b5ad5ab802e97eb8e295ac6720e509ee4c243f69d781394014ebfe8bbfa0b" + +[[package]] +name = "windows_i686_gnullvm" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0eee52d38c090b3caa76c563b86c3a4bd71ef1a819287c19d586d7334ae8ed66" + +[[package]] +name = "windows_i686_msvc" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "240948bc05c5e7c6dabba28bf89d89ffce3e303022809e73deaefe4f6ec56c66" + +[[package]] +name = "windows_x86_64_gnu" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "147a5c80aabfbf0c7d901cb5895d1de30ef2907eb21fbbab29ca94c5b08b1a78" + +[[package]] +name = "windows_x86_64_gnullvm" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "24d5b23dc417412679681396f2b49f3de8c1473deb516bd34410872eff51ed0d" + +[[package]] +name = "windows_x86_64_msvc" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "589f6da84c646204747d1270a2a5661ea66ed1cced2631d546fdfb155959f9ec" + [[package]] name = "winnow" version = "1.0.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0592e1c9d151f854e6fd382574c3a0855250e1d9b2f99d9281c6e6391af352f1" + +[[package]] +name = "writeable" +version = "0.6.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1ffae5123b2d3fc086436f8834ae3ab053a283cfac8fe0a0b8eaae044768a4c4" + +[[package]] +name = "yoke" +version = "0.8.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "709fe23a0424b6a435d82152b1bd3fdfb0833487d5fa90d05d42762a9891fef5" +dependencies = [ + "stable_deref_trait", + "yoke-derive", + "zerofrom", +] + +[[package]] +name = "yoke-derive" +version = "0.8.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "de844c262c8848816172cef550288e7dc6c7b7814b4ee56b3e1553f275f1858e" +dependencies = [ + "proc-macro2", + "quote", + "syn", + "synstructure", +] + +[[package]] +name = "zerofrom" +version = "0.1.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0ec05a11813ea801ff6d75110ad09cd0824ddba17dfe17128ea0d5f68e6c5272" +dependencies = [ + "zerofrom-derive", +] + +[[package]] +name = "zerofrom-derive" +version = "0.1.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "11532158c46691caf0f2593ea8358fed6bbf68a0315e80aae9bd41fbade684a1" +dependencies = [ + "proc-macro2", + "quote", + "syn", + "synstructure", +] + +[[package]] +name = "zeroize" +version = "1.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e13c156562582aa81c60cb29407084cdb54c4164760106ab78e6c5b0858cf64e" + +[[package]] +name = "zerotrie" +version = "0.2.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0f9152d31db0792fa83f70fb2f83148effb5c1f5b8c7686c3459e361d9bc20bf" +dependencies = [ + "displaydoc", + "yoke", + "zerofrom", +] + +[[package]] +name = "zerovec" +version = "0.11.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "90f911cbc359ab6af17377d242225f4d75119aec87ea711a880987b18cd7b239" +dependencies = [ + "yoke", + "zerofrom", + "zerovec-derive", +] + +[[package]] +name = "zerovec-derive" +version = "0.11.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "625dc425cab0dca6dc3c3319506e6593dcb08a9f387ea3b284dbd52a92c40555" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] diff --git a/Cargo.toml b/Cargo.toml index fd88d4b..09f02e2 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -25,5 +25,7 @@ tokio = { version = "1.52.3", features = [ "macros", "rt-multi-thread" ] } tonic-reflection = "0.14.6" tonic-health = "0.14.6" toml = "1.1.2" +reqwest = { version = "0.13.4", default-features = false, features = ["query", "rustls"] } +quick-xml = { version = "0.41.0", features = ["serialize"] } [workspace] \ No newline at end of file diff --git a/buf.gen.yaml b/buf.gen.yaml index 7f9139a..fc19b47 100644 --- a/buf.gen.yaml +++ b/buf.gen.yaml @@ -1,9 +1,9 @@ version: v2 inputs: - directory: proto - - directory: ../metadata-agregator/proto - - directory: ../musicfs/proto - - directory: ../tora/proto + - directory: ./metadata-agregator/proto + - directory: ./musicfs/proto + - directory: ./tora/proto plugins: - local: protoc-gen-prost #path: ../../target/debug/protoc-gen-prost diff --git a/containers/jackett.nix b/containers/jackett.nix new file mode 100644 index 0000000..5567a3c --- /dev/null +++ b/containers/jackett.nix @@ -0,0 +1,37 @@ +{ + pkgs, + lib, + config, + ... +}: + +{ + # Rootless container runtime. No daemon needed, unlike Docker. + packages = [ pkgs.podman ]; + + # Jackett indexer, running rootless via podman so it joins `devenv up` + # alongside postgres/torad/musicfs. Foreground (no `-d`) so process-compose + # supervises it and streams logs; `--rm` cleans up on `devenv up` shutdown. + # UI: http://localhost:9117 + # + # Note: podman (unlike docker) does NOT auto-create bind-mount source dirs, + # so we `mkdir -p` them first or podman fails with "statfs: no such file". + processes.jackett.exec = + let + jackettConfig = "${config.env.DEVENV_RUNTIME}/jackett-config"; + jackettDownloads = "${config.env.DEVENV_RUNTIME}/jackett-downloads"; + in + '' + mkdir -p "${jackettConfig}" "${jackettDownloads}" + ${pkgs.podman}/bin/podman run --rm \ + --name devenv-jackett \ + -p 9117:9117 \ + -e PUID=1000 \ + -e PGID=100 \ + -e TZ=Europe/Warsaw \ + -e AUTO_UPDATE=true \ + -v "${jackettConfig}":/config \ + -v "${jackettDownloads}":/downloads \ + lscr.io/linuxserver/jackett:latest + ''; +} diff --git a/dev/Music Agregator/.gitignore b/dev/Music Agregator/.gitignore new file mode 100644 index 0000000..e19311f --- /dev/null +++ b/dev/Music Agregator/.gitignore @@ -0,0 +1,9 @@ +# Secrets +.env* + +# Dependencies +node_modules + +# OS files +.DS_Store +Thumbs.db \ No newline at end of file diff --git a/dev/Music Agregator/Health.yml b/dev/Music Agregator/Health.yml new file mode 100644 index 0000000..6b367ab --- /dev/null +++ b/dev/Music Agregator/Health.yml @@ -0,0 +1,11 @@ +info: + name: Health + type: grpc + seq: 1 + +grpc: + url: localhost:50051 + method: /health.Health/Check + methodType: unary + message: "{}" + auth: inherit diff --git a/dev/Music Agregator/Jackett/Search.yml b/dev/Music Agregator/Jackett/Search.yml new file mode 100644 index 0000000..6dcad32 --- /dev/null +++ b/dev/Music Agregator/Jackett/Search.yml @@ -0,0 +1,24 @@ +info: + name: Search + type: http + seq: 2 + +http: + method: GET + url: http://localhost:9117/api/v2.0/indexers/all/results/torznab/api?apikey=bjivq1zp3bfq7eaorhsswkfhvpc5issh&t=search&q=ДДТ + params: + - name: apikey + value: bjivq1zp3bfq7eaorhsswkfhvpc5issh + type: query + - name: t + value: search + type: query + - name: q + value: ДДТ + type: query + +settings: + encodeUrl: true + timeout: 0 + followRedirects: true + maxRedirects: 5 diff --git a/dev/Music Agregator/Jackett/folder.yml b/dev/Music Agregator/Jackett/folder.yml new file mode 100644 index 0000000..61e046d --- /dev/null +++ b/dev/Music Agregator/Jackett/folder.yml @@ -0,0 +1,7 @@ +info: + name: Jackett + type: folder + seq: 3 + +request: + auth: inherit diff --git a/dev/Music Agregator/Torrent/Search.yml b/dev/Music Agregator/Torrent/Search.yml new file mode 100644 index 0000000..c8032e8 --- /dev/null +++ b/dev/Music Agregator/Torrent/Search.yml @@ -0,0 +1,14 @@ +info: + name: Search + type: grpc + seq: 2 + +grpc: + url: localhost:50051 + method: /torrent_manager.TorrentManager/Search + methodType: unary + message: |- + { + "name": "ДДТ" + } + auth: inherit diff --git a/dev/Music Agregator/Torrent/folder.yml b/dev/Music Agregator/Torrent/folder.yml new file mode 100644 index 0000000..801dcef --- /dev/null +++ b/dev/Music Agregator/Torrent/folder.yml @@ -0,0 +1,7 @@ +info: + name: Torrent + type: folder + seq: 2 + +request: + auth: inherit diff --git a/dev/Music Agregator/opencollection.yml b/dev/Music Agregator/opencollection.yml new file mode 100644 index 0000000..784e340 --- /dev/null +++ b/dev/Music Agregator/opencollection.yml @@ -0,0 +1,25 @@ +opencollection: 1.0.0 + +info: + name: Music Agregator +config: + proxy: + inherit: true + config: + protocol: http + hostname: "" + port: "" + auth: + username: "" + password: "" + bypassProxy: "" +bundled: false +extensions: + bruno: + ignore: + - node_modules + - .git + presets: + request: + type: grpc + url: localhost:50051 diff --git a/devenv.nix b/devenv.nix index 9ad70d2..0be808a 100644 --- a/devenv.nix +++ b/devenv.nix @@ -5,8 +5,9 @@ inputs, ... }: - { + imports = [ ./containers/jackett.nix ]; + languages.rust.enable = true; git-hooks.hooks = { diff --git a/justfile b/justfile index ff48e22..84d4465 100644 --- a/justfile +++ b/justfile @@ -6,3 +6,6 @@ build: proto run *FLAGS: proto cargo run -- {{FLAGS}} + +up: + devenv up diff --git a/metadata-agregator b/metadata-agregator new file mode 160000 index 0000000..995397e --- /dev/null +++ b/metadata-agregator @@ -0,0 +1 @@ +Subproject commit 995397e495c6b43336ea519039128e8ea5e50ab9 diff --git a/proto/search.proto b/proto/search.proto new file mode 100644 index 0000000..3a710aa --- /dev/null +++ b/proto/search.proto @@ -0,0 +1,21 @@ +syntax = "proto3"; + +package torrent_manager; + +service TorrentManager { + rpc Search(SearchRequest) returns (SearchResponse); +} + + +message SearchRequest { + string name = 1; +} + +message SearchResponse { + repeated SearchItem item = 1; +} + +message SearchItem { + string name = 1; + string url = 2; +} diff --git a/rustfmt.toml b/rustfmt.toml new file mode 100644 index 0000000..3d78d3d --- /dev/null +++ b/rustfmt.toml @@ -0,0 +1,5 @@ +# Declares the edition for `rustfmt` when it parses buffers via stdin +# (e.g. emacs `rust-format-buffer` / DOOM `format-all`). rustfmt does not +# consult Cargo.toml for stdin input, so without this it defaults to 2015 +# and rejects `async fn` with E0670. Must match edition in Cargo.toml. +edition = "2024" diff --git a/src/config.rs b/src/config.rs index efc67e1..b77080c 100644 --- a/src/config.rs +++ b/src/config.rs @@ -3,6 +3,7 @@ use serde::Deserialize; #[derive(Debug, Deserialize)] pub struct Config { pub service: ServiceConfig, + pub indexer: IndexerConfig, pub torrent: TorrentConfig, } @@ -11,6 +12,12 @@ pub struct ServiceConfig { pub address: String, } +#[derive(Debug, Deserialize)] +pub struct IndexerConfig { + pub address: String, + pub api: String, +} + #[derive(Debug, Deserialize)] pub struct TorrentConfig { pub address: String, diff --git a/src/generated/metadata/v1/metadata.v1.rs b/src/generated/metadata/v1/metadata.v1.rs index a82105b..2580dbb 100644 --- a/src/generated/metadata/v1/metadata.v1.rs +++ b/src/generated/metadata/v1/metadata.v1.rs @@ -2,19 +2,30 @@ // This file is @generated by prost-build. // Requests +/// GetArtistRequest looks up a single artist by one of its identifiers. #[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)] pub struct GetArtistRequest { + /// Source to resolve against and the ID namespace of `id`. + /// Example: PROVIDER_MUSICBRAINZ. #[prost(enumeration = "Provider", tag = "3")] pub provider: i32, + /// How to locate the artist. Exactly one field must be set. #[prost(oneof = "get_artist_request::Identifier", tags = "1, 2")] pub identifier: ::core::option::Option, } /// Nested message and enum types in `GetArtistRequest`. pub mod get_artist_request { + /// How to locate the artist. Exactly one field must be set. #[derive(Clone, PartialEq, Eq, Hash, ::prost::Oneof)] pub enum Identifier { + /// Provider-native identifier for the artist, in the ID namespace of + /// `provider`. For PROVIDER_MUSICBRAINZ this is the artist MBID. + /// Example: "5b11f4ce-a62d-471e-81fc-a69a8278c7da" (Radiohead). #[prost(string, tag = "1")] Id(::prost::alloc::string::String), + /// Identifier from a specific external source, when the source differs + /// from `provider` or must be named explicitly. + /// Example: {source: "musicbrainz", source_id: "5b11f4ce-..."}. #[prost(message, tag = "2")] External(super::ExternalId), } @@ -29,14 +40,19 @@ impl ::prost::Name for GetArtistRequest { "/metadata.v1.GetArtistRequest".into() } } +/// SearchArtistsRequest performs a fuzzy, paginated artist search. #[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)] pub struct SearchArtistsRequest { + /// Free-text search terms, typically the artist name. Example: "radiohead". #[prost(string, tag = "1")] pub query: ::prost::alloc::string::String, + /// Maximum number of results to return. Example: 25 (0 uses the default). #[prost(int32, tag = "2")] pub limit: i32, + /// Number of leading results to skip, for pagination. Example: 25. #[prost(int32, tag = "3")] pub offset: i32, + /// Source to search. Example: PROVIDER_MUSICBRAINZ. #[prost(enumeration = "Provider", tag = "4")] pub provider: i32, } @@ -50,19 +66,28 @@ impl ::prost::Name for SearchArtistsRequest { "/metadata.v1.SearchArtistsRequest".into() } } +/// GetAlbumRequest looks up a single album (release group) by identifier. #[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)] pub struct GetAlbumRequest { + /// Source to resolve against. Example: PROVIDER_MUSICBRAINZ. #[prost(enumeration = "Provider", tag = "3")] pub provider: i32, + /// How to locate the album. Exactly one field must be set. #[prost(oneof = "get_album_request::Identifier", tags = "1, 2")] pub identifier: ::core::option::Option, } /// Nested message and enum types in `GetAlbumRequest`. pub mod get_album_request { + /// How to locate the album. Exactly one field must be set. #[derive(Clone, PartialEq, Eq, Hash, ::prost::Oneof)] pub enum Identifier { + /// Provider-native album identifier, in the ID namespace of `provider`. + /// For PROVIDER_MUSICBRAINZ this is the release-group MBID. + /// Example: "b1392450-e666-3926-a536-22c65f834433" (OK Computer). #[prost(string, tag = "1")] Id(::prost::alloc::string::String), + /// Identifier from a specific external source. + /// Example: {source: "musicbrainz", source_id: "b1392450-..."}. #[prost(message, tag = "2")] External(super::ExternalId), } @@ -77,16 +102,25 @@ impl ::prost::Name for GetAlbumRequest { "/metadata.v1.GetAlbumRequest".into() } } +/// GetArtistAlbumsRequest lists an artist's albums, paginated and optionally +/// filtered by release type. #[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)] pub struct GetArtistAlbumsRequest { + /// Provider-native artist identifier (same namespace as GetArtistRequest.id). + /// Example: "5b11f4ce-a62d-471e-81fc-a69a8278c7da". #[prost(string, tag = "1")] pub artist_id: ::prost::alloc::string::String, + /// Maximum number of albums to return. Example: 50. #[prost(int32, tag = "2")] pub limit: i32, + /// Number of leading albums to skip, for pagination. Example: 0. #[prost(int32, tag = "3")] pub offset: i32, + /// Source to query. Example: PROVIDER_MUSICBRAINZ. #[prost(enumeration = "Provider", tag = "4")] pub provider: i32, + /// Optional release-type filter; empty means all types. + /// Example: \["album", "ep"\]. #[prost(string, repeated, tag = "5")] pub album_types: ::prost::alloc::vec::Vec<::prost::alloc::string::String>, } @@ -100,21 +134,31 @@ impl ::prost::Name for GetArtistAlbumsRequest { "/metadata.v1.GetArtistAlbumsRequest".into() } } +/// GetTrackRequest looks up a single track (recording) by identifier. #[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)] pub struct GetTrackRequest { + /// Source to resolve against. Example: PROVIDER_MUSICBRAINZ. #[prost(enumeration = "Provider", tag = "4")] pub provider: i32, + /// How to locate the track. Exactly one field must be set. #[prost(oneof = "get_track_request::Identifier", tags = "1, 2, 3")] pub identifier: ::core::option::Option, } /// Nested message and enum types in `GetTrackRequest`. pub mod get_track_request { + /// How to locate the track. Exactly one field must be set. #[derive(Clone, PartialEq, Eq, Hash, ::prost::Oneof)] pub enum Identifier { + /// Provider-native track identifier, in the ID namespace of `provider`. + /// For PROVIDER_MUSICBRAINZ this is the recording MBID. + /// Example: "b9d99e0e-1472-4a37-8b2a-2f6b0a1234ab". #[prost(string, tag = "1")] Id(::prost::alloc::string::String), + /// Identifier from a specific external source. + /// Example: {source: "musicbrainz", source_id: "b9d99e0e-..."}. #[prost(message, tag = "2")] External(super::ExternalId), + /// International Standard Recording Code. Example: "GBAYE9600477". #[prost(string, tag = "3")] Isrc(::prost::alloc::string::String), } @@ -129,10 +173,14 @@ impl ::prost::Name for GetTrackRequest { "/metadata.v1.GetTrackRequest".into() } } +/// GetAlbumTracksRequest lists the tracks belonging to an album. #[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)] pub struct GetAlbumTracksRequest { + /// Provider-native album identifier (same namespace as GetAlbumRequest.id). + /// Example: "b1392450-e666-3926-a536-22c65f834433". #[prost(string, tag = "1")] pub album_id: ::prost::alloc::string::String, + /// Source to query. Example: PROVIDER_MUSICBRAINZ. #[prost(enumeration = "Provider", tag = "2")] pub provider: i32, } @@ -146,18 +194,26 @@ impl ::prost::Name for GetAlbumTracksRequest { "/metadata.v1.GetAlbumTracksRequest".into() } } +/// SearchAlbumsRequest performs a fuzzy, paginated album search. #[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)] pub struct SearchAlbumsRequest { + /// Free-text search terms, typically the album title. Example: "ok computer". #[prost(string, tag = "1")] pub query: ::prost::alloc::string::String, + /// Optional artist name to narrow the search. Example: "radiohead". #[prost(string, tag = "2")] pub artist: ::prost::alloc::string::String, + /// Maximum number of results to return. Example: 25. #[prost(int32, tag = "3")] pub limit: i32, + /// Number of leading results to skip, for pagination. Example: 0. #[prost(int32, tag = "4")] pub offset: i32, + /// Source to search. Example: PROVIDER_MUSICBRAINZ. #[prost(enumeration = "Provider", tag = "5")] pub provider: i32, + /// Optional release-type filter; empty means all types. + /// Example: \["album"\]. #[prost(string, repeated, tag = "6")] pub album_types: ::prost::alloc::vec::Vec<::prost::alloc::string::String>, } @@ -171,19 +227,27 @@ impl ::prost::Name for SearchAlbumsRequest { "/metadata.v1.SearchAlbumsRequest".into() } } +/// SyncArtistRequest fetches an artist and their catalog from a provider and +/// persists it to the local store. #[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)] pub struct SyncArtistRequest { + /// Source to sync from. Example: PROVIDER_MUSICBRAINZ. #[prost(enumeration = "Provider", tag = "3")] pub provider: i32, + /// How to identify the artist to sync. Exactly one field must be set. #[prost(oneof = "sync_artist_request::Target", tags = "1, 2")] pub target: ::core::option::Option, } /// Nested message and enum types in `SyncArtistRequest`. pub mod sync_artist_request { + /// How to identify the artist to sync. Exactly one field must be set. #[derive(Clone, PartialEq, Eq, Hash, ::prost::Oneof)] pub enum Target { + /// Artist name to resolve via search before syncing. Example: "Radiohead". #[prost(string, tag = "1")] Name(::prost::alloc::string::String), + /// Exact external identifier of the artist to sync. + /// Example: {source: "musicbrainz", source_id: "5b11f4ce-..."}. #[prost(message, tag = "2")] External(super::ExternalId), } @@ -202,6 +266,7 @@ impl ::prost::Name for SyncArtistRequest { #[derive(Clone, PartialEq, ::prost::Message)] pub struct GetArtistResponse { + /// The resolved artist. #[prost(message, optional, tag = "1")] pub artist: ::core::option::Option, } @@ -217,8 +282,10 @@ impl ::prost::Name for GetArtistResponse { } #[derive(Clone, PartialEq, ::prost::Message)] pub struct SearchArtistsResponse { + /// Matching artists, ordered by relevance. #[prost(message, repeated, tag = "1")] pub artists: ::prost::alloc::vec::Vec, + /// Total number of matches available across all pages. Example: 137. #[prost(int32, tag = "2")] pub total: i32, } @@ -234,6 +301,7 @@ impl ::prost::Name for SearchArtistsResponse { } #[derive(Clone, PartialEq, ::prost::Message)] pub struct GetAlbumResponse { + /// The resolved album. #[prost(message, optional, tag = "1")] pub album: ::core::option::Option, } @@ -249,8 +317,10 @@ impl ::prost::Name for GetAlbumResponse { } #[derive(Clone, PartialEq, ::prost::Message)] pub struct GetArtistAlbumsResponse { + /// The artist's albums for the requested page. #[prost(message, repeated, tag = "1")] pub albums: ::prost::alloc::vec::Vec, + /// Total number of albums available across all pages. Example: 42. #[prost(int32, tag = "2")] pub total: i32, } @@ -266,6 +336,7 @@ impl ::prost::Name for GetArtistAlbumsResponse { } #[derive(Clone, PartialEq, ::prost::Message)] pub struct GetTrackResponse { + /// The resolved track. #[prost(message, optional, tag = "1")] pub track: ::core::option::Option, } @@ -281,6 +352,7 @@ impl ::prost::Name for GetTrackResponse { } #[derive(Clone, PartialEq, ::prost::Message)] pub struct GetAlbumTracksResponse { + /// The album's tracks, ordered by disc then track number. #[prost(message, repeated, tag = "1")] pub tracks: ::prost::alloc::vec::Vec, } @@ -296,8 +368,10 @@ impl ::prost::Name for GetAlbumTracksResponse { } #[derive(Clone, PartialEq, ::prost::Message)] pub struct SearchAlbumsResponse { + /// Matching albums, ordered by relevance. #[prost(message, repeated, tag = "1")] pub albums: ::prost::alloc::vec::Vec, + /// Total number of matches available across all pages. Example: 58. #[prost(int32, tag = "2")] pub total: i32, } @@ -313,10 +387,13 @@ impl ::prost::Name for SearchAlbumsResponse { } #[derive(Clone, PartialEq, ::prost::Message)] pub struct SyncArtistResponse { + /// The synced artist as persisted locally. #[prost(message, optional, tag = "1")] pub artist: ::core::option::Option, + /// Number of albums fetched and stored during the sync. Example: 12. #[prost(int32, tag = "2")] pub albums_synced: i32, + /// Number of tracks fetched and stored during the sync. Example: 148. #[prost(int32, tag = "3")] pub tracks_synced: i32, } @@ -332,28 +409,44 @@ impl ::prost::Name for SyncArtistResponse { } // Core Entities +/// Artist is a performer or group. #[derive(Clone, PartialEq, ::prost::Message)] pub struct Artist { + /// Provider-native identifier (MBID for MusicBrainz). + /// Example: "5b11f4ce-a62d-471e-81fc-a69a8278c7da". #[prost(string, tag = "1")] pub id: ::prost::alloc::string::String, + /// Display name. Example: "Radiohead". #[prost(string, tag = "2")] pub name: ::prost::alloc::string::String, + /// Name normalized for alphabetical sorting. Example: "Radiohead"; for a + /// person, "Beatles, The" or "Hendrix, Jimi". #[prost(string, tag = "3")] pub sort_name: ::prost::alloc::string::String, + /// Kind of artist. Example: "Group", "Person". #[prost(string, tag = "4")] pub artist_type: ::prost::alloc::string::String, + /// ISO 3166-1 alpha-2 country code. Example: "GB". #[prost(string, tag = "5")] pub country: ::prost::alloc::string::String, + /// Date the artist formed or was born, ISO 8601. Partial dates allowed. + /// Example: "1985" or "1985-05-01". #[prost(string, tag = "6")] pub formed_date: ::prost::alloc::string::String, + /// Date the artist disbanded or died, ISO 8601; empty if still active. + /// Example: "2011-04-30". #[prost(string, tag = "7")] pub disbanded_date: ::prost::alloc::string::String, + /// Free-text biography or annotation. #[prost(string, tag = "8")] pub description: ::prost::alloc::string::String, + /// URL of a representative image. Example: " #[prost(string, tag = "9")] pub image_url: ::prost::alloc::string::String, + /// Genres associated with the artist. #[prost(message, repeated, tag = "10")] pub genres: ::prost::alloc::vec::Vec, + /// Identifiers for this artist in external sources. #[prost(message, repeated, tag = "11")] pub external_ids: ::prost::alloc::vec::Vec, } @@ -367,30 +460,44 @@ impl ::prost::Name for Artist { "/metadata.v1.Artist".into() } } +/// Album is a release group / collection of tracks. #[derive(Clone, PartialEq, ::prost::Message)] pub struct Album { + /// Provider-native identifier (release-group MBID for MusicBrainz). + /// Example: "b1392450-e666-3926-a536-22c65f834433". #[prost(string, tag = "1")] pub id: ::prost::alloc::string::String, + /// Album title. Example: "OK Computer". #[prost(string, tag = "2")] pub title: ::prost::alloc::string::String, + /// Release type. Example: "album", "ep", "single", "compilation". #[prost(string, tag = "3")] pub album_type: ::prost::alloc::string::String, + /// Release date, ISO 8601. Partial dates allowed. Example: "1997-05-21". #[prost(string, tag = "4")] pub release_date: ::prost::alloc::string::String, + /// Universal Product Code (barcode). Example: "724385522925". #[prost(string, tag = "5")] pub upc: ::prost::alloc::string::String, + /// Number of tracks across all discs. Example: 12. #[prost(int32, tag = "6")] pub total_tracks: i32, + /// Number of discs in the release. Example: 1. #[prost(int32, tag = "7")] pub total_discs: i32, + /// URL of the cover art. Example: " #[prost(string, tag = "8")] pub cover_url: ::prost::alloc::string::String, + /// Credited artists, in credit order. #[prost(message, repeated, tag = "9")] pub artists: ::prost::alloc::vec::Vec, + /// Releasing label, if known. #[prost(message, optional, tag = "10")] pub label: ::core::option::Option