commit 90c7b9d654a21219db92b78561a3f9a84da4fde4 Author: David Skrundz Date: Sat May 3 15:19:56 2025 -0600 Initial commit diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..32be835 --- /dev/null +++ b/.gitignore @@ -0,0 +1,7 @@ +# OS Files +*~ +._* +.DS_Store + +# Rust +/target diff --git a/.rustfmt.toml b/.rustfmt.toml new file mode 100644 index 0000000..5e7f9e2 --- /dev/null +++ b/.rustfmt.toml @@ -0,0 +1,2 @@ +hard_tabs = true +wrap_comments = true diff --git a/.vscode/extensions.json b/.vscode/extensions.json new file mode 100644 index 0000000..c70ed43 --- /dev/null +++ b/.vscode/extensions.json @@ -0,0 +1,9 @@ +{ + "recommendations": [ + "vadimcn.vscode-lldb", + "barbosshack.crates-io", + "usernamehw.errorlens", + "tamasfe.even-better-toml", + "rust-lang.rust-analyzer", + ] +} diff --git a/.vscode/settings.json b/.vscode/settings.json new file mode 100644 index 0000000..2f432d8 --- /dev/null +++ b/.vscode/settings.json @@ -0,0 +1,33 @@ +{ + // VSCode + "editor.detectIndentation": false, + "editor.insertSpaces": false, + "editor.tabSize": 4, + "files.exclude": { + "**/target": true, + "**/Cargo.lock": true, + }, + "files.insertFinalNewline": true, + "files.trimFinalNewlines": true, + "files.trimTrailingWhitespace": true, + "files.watcherExclude": { + "**/.git/**": true, + "**/target/**": true, + }, + // Extensions + "crates.listPreReleases": true, + "evenBetterToml.formatter.alignComments": true, + "evenBetterToml.formatter.alignEntries": false, + "evenBetterToml.formatter.allowedBlankLines": 1, + "evenBetterToml.formatter.arrayAutoExpand": true, + "evenBetterToml.formatter.arrayTrailingComma": true, + "evenBetterToml.formatter.columnWidth": 80, + "evenBetterToml.formatter.reorderKeys": true, + "evenBetterToml.formatter.trailingNewline": true, + "rust-analyzer.imports.granularity.enforce": true, + "rust-analyzer.imports.granularity.group": "module", + "rust-analyzer.imports.group.enable": true, + "rust-analyzer.imports.merge.glob": false, + "rust-analyzer.imports.preferNoStd": true, + "rust-analyzer.showUnlinkedFileNotification": false, +} diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md new file mode 100644 index 0000000..2f4b83c --- /dev/null +++ b/CONTRIBUTING.md @@ -0,0 +1,6 @@ +How to Contribute +================= + +We'd love to accept your patches and contributions to this project. +We just need you to follow the Contributor License Agreement outlined +in the latest v0.0.x of https://github.com/Skrunix/license diff --git a/Cargo.lock b/Cargo.lock new file mode 100644 index 0000000..e4eac6a --- /dev/null +++ b/Cargo.lock @@ -0,0 +1,1743 @@ +# This file is automatically @generated by Cargo. +# It is not intended for manual editing. +version = 4 + +[[package]] +name = "addr2line" +version = "0.24.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dfbe277e56a376000877090da837660b4427aad530e3028d44e0bffe4f89a1c1" +dependencies = [ + "gimli", +] + +[[package]] +name = "adler2" +version = "2.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "512761e0bb2578dd7380c6baaa0f4ce03e84f95e960231d1dec8bf4d7d6e2627" + +[[package]] +name = "anstream" +version = "0.6.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8acc5369981196006228e28809f761875c0327210a891e941f4c683b3a99529b" +dependencies = [ + "anstyle", + "anstyle-parse", + "anstyle-query", + "anstyle-wincon", + "colorchoice", + "is_terminal_polyfill", + "utf8parse", +] + +[[package]] +name = "anstyle" +version = "1.0.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "55cc3b69f167a1ef2e161439aa98aed94e6028e5f9a59be9a6ffb47aef1651f9" + +[[package]] +name = "anstyle-parse" +version = "0.2.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3b2d16507662817a6a20a9ea92df6652ee4f94f914589377d69f3b21bc5798a9" +dependencies = [ + "utf8parse", +] + +[[package]] +name = "anstyle-query" +version = "1.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "79947af37f4177cfead1110013d678905c37501914fba0efea834c3fe9a8d60c" +dependencies = [ + "windows-sys 0.59.0", +] + +[[package]] +name = "anstyle-wincon" +version = "3.0.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ca3534e77181a9cc07539ad51f2141fe32f6c3ffd4df76db8ad92346b003ae4e" +dependencies = [ + "anstyle", + "once_cell", + "windows-sys 0.59.0", +] + +[[package]] +name = "anyhow" +version = "1.0.98" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e16d2d3311acee920a9eb8d33b8cbc1787ce4a264e85f964c2404b969bdcd487" + +[[package]] +name = "autocfg" +version = "1.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ace50bade8e6234aa140d9a2f552bbee1db4d353f69b8217bc503490fc1a9f26" + +[[package]] +name = "backtrace" +version = "0.3.74" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8d82cb332cdfaed17ae235a638438ac4d4839913cc2af585c3c6746e8f8bee1a" +dependencies = [ + "addr2line", + "cfg-if", + "libc", + "miniz_oxide", + "object", + "rustc-demangle", + "windows-targets 0.52.6", +] + +[[package]] +name = "base64" +version = "0.22.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "72b3254f16251a8381aa12e40e3c4d2f0199f8c6508fbecb9d91f575e0fbb8c6" + +[[package]] +name = "bitflags" +version = "2.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5c8214115b7bf84099f1309324e63141d4c5d7cc26862f97a0a857dbefe165bd" + +[[package]] +name = "bumpalo" +version = "3.17.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1628fb46dfa0b37568d12e5edd512553eccf6a22a78e8bde00bb4aed84d5bdbf" + +[[package]] +name = "bytes" +version = "1.10.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d71b6127be86fdcfddb610f7182ac57211d4b18a3e9c82eb2d17662f2227ad6a" + +[[package]] +name = "cc" +version = "1.2.21" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8691782945451c1c383942c4874dbe63814f61cb57ef773cda2972682b7bb3c0" +dependencies = [ + "shlex", +] + +[[package]] +name = "cfg-if" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" + +[[package]] +name = "cfg_aliases" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "613afe47fcd5fac7ccf1db93babcb082c5994d996f20b8b159f2ad1658eb5724" + +[[package]] +name = "chrono" +version = "0.4.41" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c469d952047f47f91b68d1cba3f10d63c11d73e4636f24f08daf0278abf01c4d" +dependencies = [ + "num-traits", + "serde", +] + +[[package]] +name = "clap" +version = "4.5.37" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "eccb054f56cbd38340b380d4a8e69ef1f02f1af43db2f0cc817a4774d80ae071" +dependencies = [ + "clap_builder", + "clap_derive", +] + +[[package]] +name = "clap_builder" +version = "4.5.37" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "efd9466fac8543255d3b1fcad4762c5e116ffe808c8a3043d4263cd4fd4862a2" +dependencies = [ + "anstream", + "anstyle", + "clap_lex", + "strsim", +] + +[[package]] +name = "clap_derive" +version = "4.5.32" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "09176aae279615badda0765c0c0b3f6ed53f4709118af73cf4655d85d1530cd7" +dependencies = [ + "heck", + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "clap_lex" +version = "0.7.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f46ad14479a25103f283c0f10005961cf086d8dc42205bb44c46ac563475dca6" + +[[package]] +name = "colorchoice" +version = "1.0.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5b63caa9aa9397e2d9480a9b13673856c78d8ac123288526c37d7839f2a86990" + +[[package]] +name = "displaydoc" +version = "0.2.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "97369cbbc041bc366949bc74d34658d6cda5621039731c6310521892a3a20ae0" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "equivalent" +version = "1.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "877a4ace8713b0bcf2a4e7eec82529c029f1d0619886d18145fea96c3ffe5c0f" + +[[package]] +name = "flix" +version = "0.0.1" +dependencies = [ + "chrono", + "flix-tmdb", + "serde", + "thiserror", +] + +[[package]] +name = "flix-cli" +version = "0.0.1" +dependencies = [ + "anyhow", + "clap", + "flix", + "flix-tmdb", + "home", + "serde", + "tokio", + "toml", +] + +[[package]] +name = "flix-tmdb" +version = "0.0.1" +dependencies = [ + "chrono", + "reqwest", + "serde", + "thiserror", + "url", + "url-macro", +] + +[[package]] +name = "fnv" +version = "1.0.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1" + +[[package]] +name = "form_urlencoded" +version = "1.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e13624c2627564efccf4934284bdd98cbaa14e79b0b5a141218e507b3a823456" +dependencies = [ + "percent-encoding", +] + +[[package]] +name = "futures-channel" +version = "0.3.31" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2dff15bf788c671c1934e366d07e30c1814a8ef514e1af724a602e8a2fbe1b10" +dependencies = [ + "futures-core", +] + +[[package]] +name = "futures-core" +version = "0.3.31" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "05f29059c0c2090612e8d742178b0580d2dc940c837851ad723096f87af6663e" + +[[package]] +name = "futures-task" +version = "0.3.31" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f90f7dce0722e95104fcb095585910c0977252f286e354b5e3bd38902cd99988" + +[[package]] +name = "futures-util" +version = "0.3.31" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9fa08315bb612088cc391249efdc3bc77536f16c91f6cf495e6fbe85b20a4a81" +dependencies = [ + "futures-core", + "futures-task", + "pin-project-lite", + "pin-utils", +] + +[[package]] +name = "getrandom" +version = "0.2.16" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "335ff9f135e4384c8150d6f27c6daed433577f86b4750418338c01a1a2528592" +dependencies = [ + "cfg-if", + "js-sys", + "libc", + "wasi 0.11.0+wasi-snapshot-preview1", + "wasm-bindgen", +] + +[[package]] +name = "getrandom" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "73fea8450eea4bac3940448fb7ae50d91f034f941199fcd9d909a5a07aa455f0" +dependencies = [ + "cfg-if", + "js-sys", + "libc", + "r-efi", + "wasi 0.14.2+wasi-0.2.4", + "wasm-bindgen", +] + +[[package]] +name = "gimli" +version = "0.31.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "07e28edb80900c19c28f1072f2e8aeca7fa06b23cd4169cefe1af5aa3260783f" + +[[package]] +name = "hashbrown" +version = "0.15.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "84b26c544d002229e640969970a2e74021aadf6e2f96372b9c58eff97de08eb3" + +[[package]] +name = "heck" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2304e00983f87ffb38b55b444b5e3b60a884b5d30c0fca7d82fe33449bbe55ea" + +[[package]] +name = "home" +version = "0.5.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "589533453244b0995c858700322199b2becb13b627df2851f64a2775d024abcf" +dependencies = [ + "windows-sys 0.59.0", +] + +[[package]] +name = "http" +version = "1.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f4a85d31aea989eead29a3aaf9e1115a180df8282431156e533de47660892565" +dependencies = [ + "bytes", + "fnv", + "itoa", +] + +[[package]] +name = "http-body" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1efedce1fb8e6913f23e0c92de8e62cd5b772a67e7b3946df930a62566c93184" +dependencies = [ + "bytes", + "http", +] + +[[package]] +name = "http-body-util" +version = "0.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b021d93e26becf5dc7e1b75b1bed1fd93124b374ceb73f43d4d4eafec896a64a" +dependencies = [ + "bytes", + "futures-core", + "http", + "http-body", + "pin-project-lite", +] + +[[package]] +name = "httparse" +version = "1.10.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6dbf3de79e51f3d586ab4cb9d5c3e2c14aa28ed23d180cf89b4df0454a69cc87" + +[[package]] +name = "hyper" +version = "1.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cc2b571658e38e0c01b1fdca3bbbe93c00d3d71693ff2770043f8c29bc7d6f80" +dependencies = [ + "bytes", + "futures-channel", + "futures-util", + "http", + "http-body", + "httparse", + "itoa", + "pin-project-lite", + "smallvec", + "tokio", + "want", +] + +[[package]] +name = "hyper-rustls" +version = "0.27.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2d191583f3da1305256f22463b9bb0471acad48a4e534a5218b9963e9c1f59b2" +dependencies = [ + "futures-util", + "http", + "hyper", + "hyper-util", + "rustls", + "rustls-pki-types", + "tokio", + "tokio-rustls", + "tower-service", + "webpki-roots", +] + +[[package]] +name = "hyper-util" +version = "0.1.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "497bbc33a26fdd4af9ed9c70d63f61cf56a938375fbb32df34db9b1cd6d643f2" +dependencies = [ + "bytes", + "futures-channel", + "futures-util", + "http", + "http-body", + "hyper", + "libc", + "pin-project-lite", + "socket2", + "tokio", + "tower-service", + "tracing", +] + +[[package]] +name = "icu_collections" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "db2fa452206ebee18c4b5c2274dbf1de17008e874b4dc4f0aea9d01ca79e4526" +dependencies = [ + "displaydoc", + "yoke", + "zerofrom", + "zerovec", +] + +[[package]] +name = "icu_locid" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "13acbb8371917fc971be86fc8057c41a64b521c184808a698c02acc242dbf637" +dependencies = [ + "displaydoc", + "litemap", + "tinystr", + "writeable", + "zerovec", +] + +[[package]] +name = "icu_locid_transform" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "01d11ac35de8e40fdeda00d9e1e9d92525f3f9d887cdd7aa81d727596788b54e" +dependencies = [ + "displaydoc", + "icu_locid", + "icu_locid_transform_data", + "icu_provider", + "tinystr", + "zerovec", +] + +[[package]] +name = "icu_locid_transform_data" +version = "1.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7515e6d781098bf9f7205ab3fc7e9709d34554ae0b21ddbcb5febfa4bc7df11d" + +[[package]] +name = "icu_normalizer" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "19ce3e0da2ec68599d193c93d088142efd7f9c5d6fc9b803774855747dc6a84f" +dependencies = [ + "displaydoc", + "icu_collections", + "icu_normalizer_data", + "icu_properties", + "icu_provider", + "smallvec", + "utf16_iter", + "utf8_iter", + "write16", + "zerovec", +] + +[[package]] +name = "icu_normalizer_data" +version = "1.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c5e8338228bdc8ab83303f16b797e177953730f601a96c25d10cb3ab0daa0cb7" + +[[package]] +name = "icu_properties" +version = "1.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "93d6020766cfc6302c15dbbc9c8778c37e62c14427cb7f6e601d849e092aeef5" +dependencies = [ + "displaydoc", + "icu_collections", + "icu_locid_transform", + "icu_properties_data", + "icu_provider", + "tinystr", + "zerovec", +] + +[[package]] +name = "icu_properties_data" +version = "1.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "85fb8799753b75aee8d2a21d7c14d9f38921b54b3dbda10f5a3c7a7b82dba5e2" + +[[package]] +name = "icu_provider" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6ed421c8a8ef78d3e2dbc98a973be2f3770cb42b606e3ab18d6237c4dfde68d9" +dependencies = [ + "displaydoc", + "icu_locid", + "icu_provider_macros", + "stable_deref_trait", + "tinystr", + "writeable", + "yoke", + "zerofrom", + "zerovec", +] + +[[package]] +name = "icu_provider_macros" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1ec89e9337638ecdc08744df490b221a7399bf8d164eb52a665454e60e075ad6" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "idna" +version = "1.0.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "686f825264d630750a544639377bae737628043f20d38bbc029e8f29ea968a7e" +dependencies = [ + "idna_adapter", + "smallvec", + "utf8_iter", +] + +[[package]] +name = "idna_adapter" +version = "1.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "daca1df1c957320b2cf139ac61e7bd64fed304c5040df000a745aa1de3b4ef71" +dependencies = [ + "icu_normalizer", + "icu_properties", +] + +[[package]] +name = "indexmap" +version = "2.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cea70ddb795996207ad57735b50c5982d8844f38ba9ee5f1aedcfb708a2aa11e" +dependencies = [ + "equivalent", + "hashbrown", +] + +[[package]] +name = "ipnet" +version = "2.11.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "469fb0b9cefa57e3ef31275ee7cacb78f2fdca44e4765491884a2b119d4eb130" + +[[package]] +name = "is_terminal_polyfill" +version = "1.70.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7943c866cc5cd64cbc25b2e01621d07fa8eb2a1a23160ee81ce38704e97b8ecf" + +[[package]] +name = "itoa" +version = "1.0.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4a5f13b858c8d314ee3e8f639011f7ccefe71f97f96e50151fb991f267928e2c" + +[[package]] +name = "js-sys" +version = "0.3.77" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1cfaf33c695fc6e08064efbc1f72ec937429614f25eef83af942d0e227c3a28f" +dependencies = [ + "once_cell", + "wasm-bindgen", +] + +[[package]] +name = "libc" +version = "0.2.172" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d750af042f7ef4f724306de029d18836c26c1765a54a6a3f094cbd23a7267ffa" + +[[package]] +name = "litemap" +version = "0.7.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "23fb14cb19457329c82206317a5663005a4d404783dc74f4252769b0d5f42856" + +[[package]] +name = "log" +version = "0.4.27" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "13dc2df351e3202783a1fe0d44375f7295ffb4049267b0f3018346dc122a1d94" + +[[package]] +name = "memchr" +version = "2.7.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "78ca9ab1a0babb1e7d5695e3530886289c18cf2f87ec19a575a0abdce112e3a3" + +[[package]] +name = "mime" +version = "0.3.17" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6877bb514081ee2a7ff5ef9de3281f14a4dd4bceac4c09388074a6b5df8a139a" + +[[package]] +name = "miniz_oxide" +version = "0.8.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3be647b768db090acb35d5ec5db2b0e1f1de11133ca123b9eacf5137868f892a" +dependencies = [ + "adler2", +] + +[[package]] +name = "mio" +version = "1.0.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2886843bf800fba2e3377cff24abf6379b4c4d5c6681eaf9ea5b0d15090450bd" +dependencies = [ + "libc", + "wasi 0.11.0+wasi-snapshot-preview1", + "windows-sys 0.52.0", +] + +[[package]] +name = "num-traits" +version = "0.2.19" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "071dfc062690e90b734c0b2273ce72ad0ffa95f0c74596bc250dcfd960262841" +dependencies = [ + "autocfg", +] + +[[package]] +name = "object" +version = "0.36.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "62948e14d923ea95ea2c7c86c71013138b66525b86bdc08d2dcc262bdb497b87" +dependencies = [ + "memchr", +] + +[[package]] +name = "once_cell" +version = "1.21.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "42f5e15c9953c5e4ccceeb2e7382a716482c34515315f7b03532b8b4e8393d2d" + +[[package]] +name = "percent-encoding" +version = "2.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e3148f5046208a5d56bcfc03053e3ca6334e51da8dfb19b6cdc8b306fae3283e" + +[[package]] +name = "pin-project-lite" +version = "0.2.16" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3b3cff922bd51709b605d9ead9aa71031d81447142d828eb4a6eba76fe619f9b" + +[[package]] +name = "pin-utils" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8b870d8c151b6f2fb93e84a13146138f05d02ed11c7e7c54f8826aaaf7c9f184" + +[[package]] +name = "ppv-lite86" +version = "0.2.21" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "85eae3c4ed2f50dcfe72643da4befc30deadb458a9b590d720cde2f2b1e97da9" +dependencies = [ + "zerocopy", +] + +[[package]] +name = "proc-macro2" +version = "1.0.95" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "02b3e5e68a3a1a02aad3ec490a98007cbc13c37cbe84a3cd7b8e406d76e7f778" +dependencies = [ + "unicode-ident", +] + +[[package]] +name = "quinn" +version = "0.11.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c3bd15a6f2967aef83887dcb9fec0014580467e33720d073560cf015a5683012" +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.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bcbafbbdbb0f638fe3f35f3c56739f77a8a1d070cb25603226c83339b391472b" +dependencies = [ + "bytes", + "getrandom 0.3.2", + "rand", + "ring", + "rustc-hash", + "rustls", + "rustls-pki-types", + "slab", + "thiserror", + "tinyvec", + "tracing", + "web-time", +] + +[[package]] +name = "quinn-udp" +version = "0.5.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ee4e529991f949c5e25755532370b8af5d114acae52326361d68d47af64aa842" +dependencies = [ + "cfg_aliases", + "libc", + "once_cell", + "socket2", + "tracing", + "windows-sys 0.59.0", +] + +[[package]] +name = "quote" +version = "1.0.40" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1885c039570dc00dcb4ff087a89e185fd56bae234ddc7f056a945bf36467248d" +dependencies = [ + "proc-macro2", +] + +[[package]] +name = "r-efi" +version = "5.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "74765f6d916ee2faa39bc8e68e4f3ed8949b48cccdac59983d287a7cb71ce9c5" + +[[package]] +name = "rand" +version = "0.9.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9fbfd9d094a40bf3ae768db9361049ace4c0e04a4fd6b359518bd7b73a73dd97" +dependencies = [ + "rand_chacha", + "rand_core", +] + +[[package]] +name = "rand_chacha" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d3022b5f1df60f26e1ffddd6c66e8aa15de382ae63b3a0c1bfc0e4d3e3f325cb" +dependencies = [ + "ppv-lite86", + "rand_core", +] + +[[package]] +name = "rand_core" +version = "0.9.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "99d9a13982dcf210057a8a78572b2217b667c3beacbf3a0d8b454f6f82837d38" +dependencies = [ + "getrandom 0.3.2", +] + +[[package]] +name = "reqwest" +version = "0.12.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d19c46a6fdd48bc4dab94b6103fccc55d34c67cc0ad04653aad4ea2a07cd7bbb" +dependencies = [ + "base64", + "bytes", + "futures-core", + "futures-util", + "http", + "http-body", + "http-body-util", + "hyper", + "hyper-rustls", + "hyper-util", + "ipnet", + "js-sys", + "log", + "mime", + "once_cell", + "percent-encoding", + "pin-project-lite", + "quinn", + "rustls", + "rustls-pemfile", + "rustls-pki-types", + "serde", + "serde_json", + "serde_urlencoded", + "sync_wrapper", + "tokio", + "tokio-rustls", + "tower", + "tower-service", + "url", + "wasm-bindgen", + "wasm-bindgen-futures", + "web-sys", + "webpki-roots", + "windows-registry", +] + +[[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.16", + "libc", + "untrusted", + "windows-sys 0.52.0", +] + +[[package]] +name = "rustc-demangle" +version = "0.1.24" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "719b953e2095829ee67db738b3bfa9fa368c94900df327b3f07fe6e794d2fe1f" + +[[package]] +name = "rustc-hash" +version = "2.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "357703d41365b4b27c590e3ed91eabb1b663f07c4c084095e60cbed4362dff0d" + +[[package]] +name = "rustls" +version = "0.23.26" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "df51b5869f3a441595eac5e8ff14d486ff285f7b8c0df8770e49c3b56351f0f0" +dependencies = [ + "once_cell", + "ring", + "rustls-pki-types", + "rustls-webpki", + "subtle", + "zeroize", +] + +[[package]] +name = "rustls-pemfile" +version = "2.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dce314e5fee3f39953d46bb63bb8a46d40c2f8fb7cc5a3b6cab2bde9721d6e50" +dependencies = [ + "rustls-pki-types", +] + +[[package]] +name = "rustls-pki-types" +version = "1.11.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "917ce264624a4b4db1c364dcc35bfca9ded014d0a958cd47ad3e960e988ea51c" +dependencies = [ + "web-time", +] + +[[package]] +name = "rustls-webpki" +version = "0.103.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fef8b8769aaccf73098557a87cd1816b4f9c7c16811c9c77142aa695c16f2c03" +dependencies = [ + "ring", + "rustls-pki-types", + "untrusted", +] + +[[package]] +name = "rustversion" +version = "1.0.20" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "eded382c5f5f786b989652c49544c4877d9f015cc22e145a5ea8ea66c2921cd2" + +[[package]] +name = "ryu" +version = "1.0.20" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "28d3b2b1366ec20994f1fd18c3c594f05c5dd4bc44d8bb0c1c632c8d6829481f" + +[[package]] +name = "serde" +version = "1.0.219" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5f0e2c6ed6606019b4e29e69dbaba95b11854410e5347d525002456dbbb786b6" +dependencies = [ + "serde_derive", +] + +[[package]] +name = "serde_derive" +version = "1.0.219" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5b0276cf7f2c73365f7157c8123c21cd9a50fbbd844757af28ca1f5925fc2a00" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "serde_json" +version = "1.0.140" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "20068b6e96dc6c9bd23e01df8827e6c7e1f2fddd43c21810382803c136b99373" +dependencies = [ + "itoa", + "memchr", + "ryu", + "serde", +] + +[[package]] +name = "serde_spanned" +version = "0.6.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "87607cb1398ed59d48732e575a4c28a7a8ebf2454b964fe3f224f2afc07909e1" +dependencies = [ + "serde", +] + +[[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 = "1.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0fda2ff0d084019ba4d7c6f371c95d8fd75ce3524c3cb8fb653a3023f6323e64" + +[[package]] +name = "slab" +version = "0.4.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8f92a496fb766b417c996b9c5e57daf2f7ad3b0bebe1ccfca4856390e3d3bb67" +dependencies = [ + "autocfg", +] + +[[package]] +name = "smallvec" +version = "1.15.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8917285742e9f3e1683f0a9c4e6b57960b7314d0b08d30d1ecd426713ee2eee9" + +[[package]] +name = "socket2" +version = "0.5.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4f5fd57c80058a56cf5c777ab8a126398ece8e442983605d280a44ce79d0edef" +dependencies = [ + "libc", + "windows-sys 0.52.0", +] + +[[package]] +name = "stable_deref_trait" +version = "1.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a8f112729512f8e442d81f95a8a7ddf2b7c6b8a1a6f509a95864142b30cab2d3" + +[[package]] +name = "strsim" +version = "0.11.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7da8b5736845d9f2fcb837ea5d9e2628564b3b043a70948a3f0b778838c5fb4f" + +[[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.101" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8ce2b7fc941b3a24138a0a7cf8e858bfc6a992e7978a068a5c760deb0ed43caf" +dependencies = [ + "proc-macro2", + "quote", + "unicode-ident", +] + +[[package]] +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 = "thiserror" +version = "2.0.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "567b8a2dae586314f7be2a752ec7474332959c6460e02bde30d702a66d488708" +dependencies = [ + "thiserror-impl", +] + +[[package]] +name = "thiserror-impl" +version = "2.0.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7f7cf42b4507d8ea322120659672cf1b9dbb93f8f2d4ecfd6e51350ff5b17a1d" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "tinystr" +version = "0.7.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9117f5d4db391c1cf6927e7bea3db74b9a1c1add8f7eda9ffd5364f40f57b82f" +dependencies = [ + "displaydoc", + "zerovec", +] + +[[package]] +name = "tinyvec" +version = "1.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "09b3661f17e86524eccd4371ab0429194e0d7c008abb45f7a7495b1719463c71" +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.44.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e6b88822cbe49de4185e3a4cbf8321dd487cf5fe0c5c65695fef6346371e9c48" +dependencies = [ + "backtrace", + "bytes", + "libc", + "mio", + "pin-project-lite", + "socket2", + "tokio-macros", + "windows-sys 0.52.0", +] + +[[package]] +name = "tokio-macros" +version = "2.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6e06d43f1345a3bcd39f6a56dbb7dcab2ba47e68e8ac134855e7e2bdbaf8cab8" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "tokio-rustls" +version = "0.26.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8e727b36a1a0e8b74c376ac2211e40c2c8af09fb4013c60d910495810f008e9b" +dependencies = [ + "rustls", + "tokio", +] + +[[package]] +name = "toml" +version = "0.8.22" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "05ae329d1f08c4d17a59bed7ff5b5a769d062e64a62d34a3261b219e62cd5aae" +dependencies = [ + "serde", + "serde_spanned", + "toml_datetime", + "toml_edit", +] + +[[package]] +name = "toml_datetime" +version = "0.6.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3da5db5a963e24bc68be8b17b6fa82814bb22ee8660f192bb182771d498f09a3" +dependencies = [ + "serde", +] + +[[package]] +name = "toml_edit" +version = "0.22.26" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "310068873db2c5b3e7659d2cc35d21855dbafa50d1ce336397c666e3cb08137e" +dependencies = [ + "indexmap", + "serde", + "serde_spanned", + "toml_datetime", + "toml_write", + "winnow", +] + +[[package]] +name = "toml_write" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bfb942dfe1d8e29a7ee7fcbde5bd2b9a25fb89aa70caea2eba3bee836ff41076" + +[[package]] +name = "tower" +version = "0.5.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d039ad9159c98b70ecfd540b2573b97f7f52c3e8d9f8ad57a24b916a536975f9" +dependencies = [ + "futures-core", + "futures-util", + "pin-project-lite", + "sync_wrapper", + "tokio", + "tower-layer", + "tower-service", +] + +[[package]] +name = "tower-layer" +version = "0.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "121c2a6cda46980bb0fcd1647ffaf6cd3fc79a013de288782836f6df9c48780e" + +[[package]] +name = "tower-service" +version = "0.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8df9b6e13f2d32c91b9bd719c00d1958837bc7dec474d94952798cc8e69eeec3" + +[[package]] +name = "tracing" +version = "0.1.41" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "784e0ac535deb450455cbfa28a6f0df145ea1bb7ae51b821cf5e7927fdcfbdd0" +dependencies = [ + "pin-project-lite", + "tracing-core", +] + +[[package]] +name = "tracing-core" +version = "0.1.33" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e672c95779cf947c5311f83787af4fa8fffd12fb27e4993211a84bdfd9610f9c" +dependencies = [ + "once_cell", +] + +[[package]] +name = "try-lock" +version = "0.2.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e421abadd41a4225275504ea4d6566923418b7f05506fbc9c0fe86ba7396114b" + +[[package]] +name = "unicode-ident" +version = "1.0.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5a5f39404a5da50712a4c1eecf25e90dd62b613502b7e925fd4e4d19b5c96512" + +[[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.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "32f8b686cadd1473f4bd0117a5d28d36b1ade384ea9b5069a1c40aefed7fda60" +dependencies = [ + "form_urlencoded", + "idna", + "percent-encoding", +] + +[[package]] +name = "url-macro" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c0f1c96f9093a012822c49bd933852d5dfb8bff6d1cce079d3ba4ac5cc59e3e7" +dependencies = [ + "url", +] + +[[package]] +name = "utf16_iter" +version = "1.0.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c8232dd3cdaed5356e0f716d285e4b40b932ac434100fe9b7e0e8e935b9e6246" + +[[package]] +name = "utf8_iter" +version = "1.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b6c140620e7ffbb22c2dee59cafe6084a59b5ffc27a8859a5f0d494b5d52b6be" + +[[package]] +name = "utf8parse" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "06abde3611657adf66d383f00b093d7faecc7fa57071cce2578660c9f1010821" + +[[package]] +name = "want" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bfa7760aed19e106de2c7c0b581b509f2f25d3dacaf737cb82ac61bc6d760b0e" +dependencies = [ + "try-lock", +] + +[[package]] +name = "wasi" +version = "0.11.0+wasi-snapshot-preview1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423" + +[[package]] +name = "wasi" +version = "0.14.2+wasi-0.2.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9683f9a5a998d873c0d21fcbe3c083009670149a8fab228644b8bd36b2c48cb3" +dependencies = [ + "wit-bindgen-rt", +] + +[[package]] +name = "wasm-bindgen" +version = "0.2.100" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1edc8929d7499fc4e8f0be2262a241556cfc54a0bea223790e71446f2aab1ef5" +dependencies = [ + "cfg-if", + "once_cell", + "rustversion", + "wasm-bindgen-macro", +] + +[[package]] +name = "wasm-bindgen-backend" +version = "0.2.100" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2f0a0651a5c2bc21487bde11ee802ccaf4c51935d0d3d42a6101f98161700bc6" +dependencies = [ + "bumpalo", + "log", + "proc-macro2", + "quote", + "syn", + "wasm-bindgen-shared", +] + +[[package]] +name = "wasm-bindgen-futures" +version = "0.4.50" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "555d470ec0bc3bb57890405e5d4322cc9ea83cebb085523ced7be4144dac1e61" +dependencies = [ + "cfg-if", + "js-sys", + "once_cell", + "wasm-bindgen", + "web-sys", +] + +[[package]] +name = "wasm-bindgen-macro" +version = "0.2.100" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7fe63fc6d09ed3792bd0897b314f53de8e16568c2b3f7982f468c0bf9bd0b407" +dependencies = [ + "quote", + "wasm-bindgen-macro-support", +] + +[[package]] +name = "wasm-bindgen-macro-support" +version = "0.2.100" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8ae87ea40c9f689fc23f209965b6fb8a99ad69aeeb0231408be24920604395de" +dependencies = [ + "proc-macro2", + "quote", + "syn", + "wasm-bindgen-backend", + "wasm-bindgen-shared", +] + +[[package]] +name = "wasm-bindgen-shared" +version = "0.2.100" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1a05d73b933a847d6cccdda8f838a22ff101ad9bf93e33684f39c1f5f0eece3d" +dependencies = [ + "unicode-ident", +] + +[[package]] +name = "web-sys" +version = "0.3.77" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "33b6dd2ef9186f1f2072e409e99cd22a975331a6b3591b12c764e0e55c60d5d2" +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-roots" +version = "0.26.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "37493cadf42a2a939ed404698ded7fb378bf301b5011f973361779a3a74f8c93" +dependencies = [ + "rustls-pki-types", +] + +[[package]] +name = "windows-link" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "76840935b766e1b0a05c0066835fb9ec80071d4c09a16f6bd5f7e655e3c14c38" + +[[package]] +name = "windows-registry" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4286ad90ddb45071efd1a66dfa43eb02dd0dfbae1545ad6cc3c51cf34d7e8ba3" +dependencies = [ + "windows-result", + "windows-strings", + "windows-targets 0.53.0", +] + +[[package]] +name = "windows-result" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c64fd11a4fd95df68efcfee5f44a294fe71b8bc6a91993e2791938abcc712252" +dependencies = [ + "windows-link", +] + +[[package]] +name = "windows-strings" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "87fa48cc5d406560701792be122a10132491cff9d0aeb23583cc2dcafc847319" +dependencies = [ + "windows-link", +] + +[[package]] +name = "windows-sys" +version = "0.52.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "282be5f36a8ce781fad8c8ae18fa3f9beff57ec1b52cb3de0789201425d9a33d" +dependencies = [ + "windows-targets 0.52.6", +] + +[[package]] +name = "windows-sys" +version = "0.59.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1e38bc4d79ed67fd075bcc251a1c39b32a1776bbe92e5bef1f0bf1f8c531853b" +dependencies = [ + "windows-targets 0.52.6", +] + +[[package]] +name = "windows-targets" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9b724f72796e036ab90c1021d4780d4d3d648aca59e491e6b98e725b84e99973" +dependencies = [ + "windows_aarch64_gnullvm 0.52.6", + "windows_aarch64_msvc 0.52.6", + "windows_i686_gnu 0.52.6", + "windows_i686_gnullvm 0.52.6", + "windows_i686_msvc 0.52.6", + "windows_x86_64_gnu 0.52.6", + "windows_x86_64_gnullvm 0.52.6", + "windows_x86_64_msvc 0.52.6", +] + +[[package]] +name = "windows-targets" +version = "0.53.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b1e4c7e8ceaaf9cb7d7507c974735728ab453b67ef8f18febdd7c11fe59dca8b" +dependencies = [ + "windows_aarch64_gnullvm 0.53.0", + "windows_aarch64_msvc 0.53.0", + "windows_i686_gnu 0.53.0", + "windows_i686_gnullvm 0.53.0", + "windows_i686_msvc 0.53.0", + "windows_x86_64_gnu 0.53.0", + "windows_x86_64_gnullvm 0.53.0", + "windows_x86_64_msvc 0.53.0", +] + +[[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_gnullvm" +version = "0.53.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "86b8d5f90ddd19cb4a147a5fa63ca848db3df085e25fee3cc10b39b6eebae764" + +[[package]] +name = "windows_aarch64_msvc" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "09ec2a7bb152e2252b53fa7803150007879548bc709c039df7627cabbd05d469" + +[[package]] +name = "windows_aarch64_msvc" +version = "0.53.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c7651a1f62a11b8cbd5e0d42526e55f2c99886c77e007179efff86c2b137e66c" + +[[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_gnu" +version = "0.53.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c1dc67659d35f387f5f6c479dc4e28f1d4bb90ddd1a5d3da2e5d97b42d6272c3" + +[[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_gnullvm" +version = "0.53.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9ce6ccbdedbf6d6354471319e781c0dfef054c81fbc7cf83f338a4296c0cae11" + +[[package]] +name = "windows_i686_msvc" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "240948bc05c5e7c6dabba28bf89d89ffce3e303022809e73deaefe4f6ec56c66" + +[[package]] +name = "windows_i686_msvc" +version = "0.53.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "581fee95406bb13382d2f65cd4a908ca7b1e4c2f1917f143ba16efe98a589b5d" + +[[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_gnu" +version = "0.53.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2e55b5ac9ea33f2fc1716d1742db15574fd6fc8dadc51caab1c16a3d3b4190ba" + +[[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_gnullvm" +version = "0.53.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0a6e035dd0599267ce1ee132e51c27dd29437f63325753051e71dd9e42406c57" + +[[package]] +name = "windows_x86_64_msvc" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "589f6da84c646204747d1270a2a5661ea66ed1cced2631d546fdfb155959f9ec" + +[[package]] +name = "windows_x86_64_msvc" +version = "0.53.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "271414315aff87387382ec3d271b52d7ae78726f5d44ac98b4f4030c91880486" + +[[package]] +name = "winnow" +version = "0.7.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d9fb597c990f03753e08d3c29efbfcf2019a003b4bf4ba19225c158e1549f0f3" +dependencies = [ + "memchr", +] + +[[package]] +name = "wit-bindgen-rt" +version = "0.39.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6f42320e61fe2cfd34354ecb597f86f413484a798ba44a8ca1165c58d42da6c1" +dependencies = [ + "bitflags", +] + +[[package]] +name = "write16" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d1890f4022759daae28ed4fe62859b1236caebfc61ede2f63ed4e695f3f6d936" + +[[package]] +name = "writeable" +version = "0.5.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1e9df38ee2d2c3c5948ea468a8406ff0db0b29ae1ffde1bcf20ef305bcc95c51" + +[[package]] +name = "yoke" +version = "0.7.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "120e6aef9aa629e3d4f52dc8cc43a015c7724194c97dfaf45180d2daf2b77f40" +dependencies = [ + "serde", + "stable_deref_trait", + "yoke-derive", + "zerofrom", +] + +[[package]] +name = "yoke-derive" +version = "0.7.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2380878cad4ac9aac1e2435f3eb4020e8374b5f13c296cb75b4620ff8e229154" +dependencies = [ + "proc-macro2", + "quote", + "syn", + "synstructure", +] + +[[package]] +name = "zerocopy" +version = "0.8.25" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a1702d9583232ddb9174e01bb7c15a2ab8fb1bc6f227aa1233858c351a3ba0cb" +dependencies = [ + "zerocopy-derive", +] + +[[package]] +name = "zerocopy-derive" +version = "0.8.25" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "28a6e20d751156648aa063f3800b706ee209a32c0b4d9f24be3d980b01be55ef" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "zerofrom" +version = "0.1.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "50cc42e0333e05660c3587f3bf9d0478688e15d870fab3346451ce7f8c9fbea5" +dependencies = [ + "zerofrom-derive", +] + +[[package]] +name = "zerofrom-derive" +version = "0.1.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d71e5d6e06ab090c67b5e44993ec16b72dcbaabc526db883a360057678b48502" +dependencies = [ + "proc-macro2", + "quote", + "syn", + "synstructure", +] + +[[package]] +name = "zeroize" +version = "1.8.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ced3678a2879b30306d323f4542626697a464a97c0a07c9aebf7ebca65cd4dde" + +[[package]] +name = "zerovec" +version = "0.10.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "aa2b893d79df23bfb12d5461018d408ea19dfafe76c2c7ef6d4eba614f8ff079" +dependencies = [ + "yoke", + "zerofrom", + "zerovec-derive", +] + +[[package]] +name = "zerovec-derive" +version = "0.10.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6eafa6dfb17584ea3e2bd6e76e0cc15ad7af12b09abdd1ca55961bed9b1063c6" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] diff --git a/Cargo.toml b/Cargo.toml new file mode 100644 index 0000000..7b746d3 --- /dev/null +++ b/Cargo.toml @@ -0,0 +1,50 @@ +[workspace] +members = ["crates/*"] +resolver = "2" + +[workspace.package] +authors = [] +edition = "2024" +license-file = "LICENSE.md" +rust-version = "1.85.0" + +[workspace.lints.rust] +arithmetic_overflow = "forbid" +missing_docs = "forbid" +unsafe_code = "forbid" + +[workspace.lints.clippy] +arithmetic_side_effects = "forbid" +as_conversions = "forbid" +checked_conversions = "forbid" +default_union_representation = "forbid" +expect_used = "forbid" +indexing_slicing = "forbid" +integer_division = "forbid" +integer_division_remainder_used = "forbid" +transmute_undefined_repr = "forbid" +unchecked_duration_subtraction = "forbid" +unwrap_used = "forbid" + +[profile.release] +codegen-units = 1 +lto = "fat" +opt-level = 3 +overflow-checks = true +strip = "debuginfo" + +[workspace.dependencies] +flix = { path = "crates/flix", version = "=0.0.1", default-features = false } +flix-tmdb = { path = "crates/tmdb", version = "=0.0.1", default-features = false } + +anyhow = { version = "^1", default-features = false } +chrono = { version = "^0.4", default-features = false } +clap = { version = "^4", default-features = false, features = ["std"] } +home = { version = "^0.5", default-features = false } +reqwest = { version = "^0.12", default-features = false } +serde = { version = "^1", default-features = false } +thiserror = { version = "^2", default-features = false } +tokio = { version = "^1", default-features = false } +toml = { version = "^0.8", default-features = false } +url = { version = "^2", default-features = false } +url-macro = { version = "^0.2", default-features = false } diff --git a/LICENSE.md b/LICENSE.md new file mode 100644 index 0000000..161d3b0 --- /dev/null +++ b/LICENSE.md @@ -0,0 +1,7 @@ +Skrunix Software License +======================== + +Permission to use, copy, modify, and/or distribute this software is +outlined in the latest v0.0.x of https://github.com/Skrunix/license + +THE SOFTWARE IS PROVIDED "AS IS" diff --git a/README.md b/README.md new file mode 100644 index 0000000..e9b0f07 --- /dev/null +++ b/README.md @@ -0,0 +1,14 @@ +# Flix + +Libraries and tools for dealing with media metadata + +## Various builds + +- build: `cargo hack --feature-powerset build` +- clippy: `cargo hack --feature-powerset clippy -- -D warnings` +- fmt: `cargo fmt --check` +- docs: `RUSTDOCFLAGS="--cfg docsrs" cargo +nightly doc --all-features` +- install: `cargo install --path crates/cli` +- publish: `cargo publish --dry-run -p flix-tmdb` +- publish: `cargo publish --dry-run -p flix` +- publish: `cargo publish --dry-run -p flix-cli` diff --git a/crates/cli/Cargo.toml b/crates/cli/Cargo.toml new file mode 100644 index 0000000..5cbc143 --- /dev/null +++ b/crates/cli/Cargo.toml @@ -0,0 +1,52 @@ +[package] +name = "flix-cli" +version = "0.0.1" + +categories = ["command-line-utilities"] +description = "CLI for interacting with flix media" +repository = "https://github.com/QuantumShade/flix" + +authors.workspace = true +edition.workspace = true +license-file.workspace = true +rust-version.workspace = true + +[[bin]] +doc = false +name = "flix" +path = "src/main.rs" + +[lints.rust] +arithmetic_overflow = "forbid" +unsafe_code = "forbid" + +[lints.clippy] +arithmetic_side_effects = "deny" +as_conversions = "deny" +checked_conversions = "deny" +default_union_representation = "deny" +expect_used = "deny" +indexing_slicing = "deny" +integer_division = "deny" +integer_division_remainder_used = "deny" +transmute_undefined_repr = "deny" +unchecked_duration_subtraction = "deny" +unwrap_used = "deny" + +[dependencies] +flix = { workspace = true, features = ["tmdb"] } +flix-tmdb = { workspace = true } + +anyhow = { workspace = true } +clap = { workspace = true, features = [ + "derive", + "color", + "error-context", + "help", + "suggestions", + "usage", +] } +home = { workspace = true } +serde = { workspace = true, features = ["derive"] } +tokio = { workspace = true, features = ["rt", "fs", "macros"] } +toml = { workspace = true, features = ["display", "parse"] } diff --git a/crates/cli/README.md b/crates/cli/README.md new file mode 100644 index 0000000..27b13f6 --- /dev/null +++ b/crates/cli/README.md @@ -0,0 +1,5 @@ +# flix-cli + +[![Crates Version](https://img.shields.io/crates/v/flix-cli.svg)](https://crates.io/crates/flix-cli) + +CLI for interacting with flix media diff --git a/crates/cli/src/cli/mod.rs b/crates/cli/src/cli/mod.rs new file mode 100644 index 0000000..8782a5f --- /dev/null +++ b/crates/cli/src/cli/mod.rs @@ -0,0 +1,68 @@ +use std::path::PathBuf; + +use clap::{Parser, Subcommand}; + +pub mod tmdb; + +#[derive(Parser)] +#[command(version, about, long_about = None)] +pub struct Cli { + /// Use a custom config file [default: ~/.flix] + #[arg(short, long, value_name = "FILE")] + config: Option, + + #[command(subcommand)] + command: Command, +} + +impl Cli { + pub fn config_path(&self) -> PathBuf { + match self.config.as_ref() { + Some(path) => match path.strip_prefix("~/") { + Ok(path) => expect_home_dir().join(path), + Err(_) => path.to_owned(), + }, + None => expect_home_dir().join(".flix"), + } + } + + pub fn command(&self) -> &Command { + &self.command + } +} + +#[derive(Subcommand)] +pub enum Command { + /// Print a flix manifest + Print { + #[command(subcommand)] + command: BackendCommand, + }, + /// Write a flix manifest if the destination does not exist + Write { + /// Overwrite the destination + #[arg(short, long, default_value_t = false)] + force: bool, + + /// Change the destination + #[arg(short, long, value_name = "FILE")] + output: Option, + + #[command(subcommand)] + command: BackendCommand, + }, +} + +#[derive(Subcommand)] +pub enum BackendCommand { + /// Use the TMDB backend + Tmdb { + #[command(subcommand)] + command: tmdb::Command, + }, +} + +fn expect_home_dir() -> PathBuf { + #[allow(clippy::expect_used)] + home::home_dir().expect("you do not have a home directory") +} diff --git a/crates/cli/src/cli/tmdb.rs b/crates/cli/src/cli/tmdb.rs new file mode 100644 index 0000000..8f8017f --- /dev/null +++ b/crates/cli/src/cli/tmdb.rs @@ -0,0 +1,36 @@ +use clap::Subcommand; + +#[derive(Subcommand)] +pub enum Command { + /// Process a TMDB collection + Collection { + #[arg(value_name = "TMDB_ID")] + id: i32, + }, + /// Process a TMDB movie + Movie { + #[arg(value_name = "TMDB_ID")] + id: i32, + }, + /// Process a TMDB show + Show { + #[arg(value_name = "TMDB_ID")] + id: i32, + }, + /// Process a TMDB season + Season { + #[arg(value_name = "TMDB_ID")] + id: i32, + #[arg(value_name = "SEASON_NUM")] + season: i32, + }, + /// Process a TMDB episode + Episode { + #[arg(value_name = "TMDB_ID")] + id: i32, + #[arg(value_name = "SEASON_NUM")] + season: i32, + #[arg(value_name = "EPISODE_NUM")] + episode: i32, + }, +} diff --git a/crates/cli/src/config.rs b/crates/cli/src/config.rs new file mode 100644 index 0000000..af3febf --- /dev/null +++ b/crates/cli/src/config.rs @@ -0,0 +1,21 @@ +#[derive(serde::Deserialize)] +pub struct Config { + tmdb: TmdbConfig, +} + +#[derive(serde::Deserialize)] +pub struct TmdbConfig { + bearer_token: String, +} + +impl Config { + pub fn tmdb(&self) -> &TmdbConfig { + &self.tmdb + } +} + +impl TmdbConfig { + pub fn bearer_token(&self) -> &str { + &self.bearer_token + } +} diff --git a/crates/cli/src/main.rs b/crates/cli/src/main.rs new file mode 100644 index 0000000..ce3a877 --- /dev/null +++ b/crates/cli/src/main.rs @@ -0,0 +1,65 @@ +use flix_tmdb::Client; + +use anyhow::{Context, Result}; +use clap::Parser; +use tokio::fs; + +mod cli; +use cli::{BackendCommand, Cli, Command}; + +mod config; +use config::Config; +use tokio::io::AsyncWriteExt; + +mod run; + +#[tokio::main(flavor = "current_thread")] +async fn main() -> Result<()> { + let cli = Cli::parse(); + let config = fs::read_to_string(cli.config_path()) + .await + .with_context(|| format!("could not read config: {:?}", cli.config_path()))?; + let config: Config = toml::from_str(config.as_str()) + .with_context(|| format!("could not parse config: {:?}", cli.config_path()))?; + + let client = Client::new(config.tmdb().bearer_token().to_owned()); + + match cli.command() { + Command::Print { command } => match command { + BackendCommand::Tmdb { command } => { + let object = run::tmdb::TmdbObject::fetch(&client, command).await?; + println!("{}", object.serialize().context("failed to serialize")?) + } + }, + Command::Write { + force, + output, + command, + } => match command { + BackendCommand::Tmdb { command } => { + let object = run::tmdb::TmdbObject::fetch(&client, command).await?; + let output = output + .as_ref() + .map(|p| p.as_path()) + .unwrap_or(object.default_filename()); + + let mut file = if *force { + fs::File::create(output).await + } else { + fs::File::create_new(output).await + } + .with_context(|| format!("could not create file at path {}", output.display()))?; + file.write_all( + object + .serialize() + .context("failed to serialize tmdb object")? + .as_bytes(), + ) + .await + .with_context(|| format!("could not write to file at path {}", output.display()))?; + } + }, + } + + Ok(()) +} diff --git a/crates/cli/src/run/mod.rs b/crates/cli/src/run/mod.rs new file mode 100644 index 0000000..93cfeb6 --- /dev/null +++ b/crates/cli/src/run/mod.rs @@ -0,0 +1 @@ +pub mod tmdb; diff --git a/crates/cli/src/run/tmdb.rs b/crates/cli/src/run/tmdb.rs new file mode 100644 index 0000000..90761dd --- /dev/null +++ b/crates/cli/src/run/tmdb.rs @@ -0,0 +1,134 @@ +use std::path::Path; + +use flix::model::{ + Collection, Episode, GenericCollection, GenericEpisode, GenericMovie, GenericSeason, + GenericShow, Movie, Season, Show, TmdbCollection, TmdbMovie, TmdbShow, +}; +use flix_tmdb::Client; +use flix_tmdb::model::{ + Collection as TCollection, Episode as TEpisode, Movie as TMovie, Season as TSeason, + Show as TShow, +}; + +use anyhow::{Context, Result}; + +use crate::cli::tmdb::Command; + +pub enum TmdbObject { + Collection(TCollection), + Movie(TMovie), + Show(TShow), + Season(TSeason), + Episode(TEpisode), +} + +impl TmdbObject { + pub fn default_filename(&self) -> &'static Path { + Path::new(match self { + TmdbObject::Collection(_) => "collection.toml", + TmdbObject::Movie(_) => "movie.toml", + TmdbObject::Show(_) => "show.toml", + TmdbObject::Season(_) => "season.toml", + TmdbObject::Episode(_) => "episode.toml", + }) + } + + pub fn serialize(self) -> Result { + Ok(match self { + TmdbObject::Collection(tmdb) => toml::to_string(&Collection { + collection: GenericCollection { + name: tmdb.name, + overview: tmdb.overview, + }, + tmdb: Some(TmdbCollection { id: tmdb.id }), + })?, + TmdbObject::Movie(tmdb) => toml::to_string(&Movie { + movie: GenericMovie { + title: tmdb.title, + overview: tmdb.overview, + release_date: tmdb.release_date, + }, + tmdb: Some(TmdbMovie { + id: tmdb.id, + collection: tmdb.collection.map(|c| c.id), + genres: tmdb.genres.iter().map(|g| g.id).collect(), + }), + })?, + TmdbObject::Show(tmdb) => toml::to_string(&Show { + show: GenericShow { + name: tmdb.name, + overview: tmdb.overview, + air_date: tmdb.first_air_date, + }, + tmdb: Some(TmdbShow { + id: tmdb.id, + genres: tmdb.genres.iter().map(|g| g.id).collect(), + }), + })?, + TmdbObject::Season(tmdb) => toml::to_string(&Season { + season: GenericSeason { + number: tmdb.season_number, + name: tmdb.name, + overview: tmdb.overview, + air_date: tmdb.air_date, + }, + })?, + TmdbObject::Episode(tmdb) => toml::to_string(&Episode { + episode: GenericEpisode { + number: tmdb.episode_number, + name: tmdb.name, + overview: tmdb.overview, + air_date: tmdb.air_date, + }, + })?, + }) + } +} + +impl TmdbObject { + pub async fn fetch(client: &Client, command: &Command) -> Result { + Ok(match *command { + Command::Collection { id } => Self::Collection( + client + .collections() + .get_details(id, None) + .await + .with_context(|| format!("could not get collection details for '{id}'"))?, + ), + Command::Movie { id } => Self::Movie( + client + .movies() + .get_details(id, None) + .await + .with_context(|| format!("could not get movie details for '{id}'"))?, + ), + Command::Show { id } => Self::Show( + client + .shows() + .get_details(id, None) + .await + .with_context(|| format!("could not get show details for '{id}'"))?, + ), + Command::Season { id, season } => Self::Season( + client + .seasons() + .get_details(id, season, None) + .await + .with_context(|| format!("could not get show details for '{id}' S{season}"))?, + ), + Command::Episode { + id, + season, + episode, + } => Self::Episode( + client + .episodes() + .get_details(id, season, episode, None) + .await + .with_context(|| { + format!("could not get show details for '{id}' S{season}E{episode}") + })?, + ), + }) + } +} diff --git a/crates/flix/Cargo.toml b/crates/flix/Cargo.toml new file mode 100644 index 0000000..f92654c --- /dev/null +++ b/crates/flix/Cargo.toml @@ -0,0 +1,26 @@ +[package] +name = "flix" +version = "0.0.1" + +categories = [] +description = "Types for storing persistent data about media" +repository = "https://github.com/QuantumShade/flix" + +authors.workspace = true +edition.workspace = true +license-file.workspace = true +rust-version.workspace = true + +[lints] +workspace = true + +[features] +default = [] +tmdb = ["dep:flix-tmdb"] + +[dependencies] +flix-tmdb = { workspace = true, optional = true } + +chrono = { workspace = true, features = ["serde"] } +serde = { workspace = true, features = ["std", "derive"] } +thiserror = { workspace = true } diff --git a/crates/flix/README.md b/crates/flix/README.md new file mode 100644 index 0000000..1779eae --- /dev/null +++ b/crates/flix/README.md @@ -0,0 +1,5 @@ +# flix + +[![Crates Version](https://img.shields.io/crates/v/flix.svg)](https://crates.io/crates/flix) + +A library providing types for storing persistent data about media diff --git a/crates/flix/src/lib.rs b/crates/flix/src/lib.rs new file mode 100644 index 0000000..56c7823 --- /dev/null +++ b/crates/flix/src/lib.rs @@ -0,0 +1,4 @@ +//! flix provides types for storing persistent data about media + +/// flix types +pub mod model; diff --git a/crates/flix/src/model/collection.rs b/crates/flix/src/model/collection.rs new file mode 100644 index 0000000..a3cc388 --- /dev/null +++ b/crates/flix/src/model/collection.rs @@ -0,0 +1,30 @@ +#[cfg(feature = "tmdb")] +use flix_tmdb::model::CollectionId; + +/// A Collection container +#[derive(Debug, serde::Serialize, serde::Deserialize)] +pub struct Collection { + /// Generic collection data + pub collection: GenericCollection, + + /// TMDB collection data + #[cfg(feature = "tmdb")] + pub tmdb: Option, +} + +/// The generic collection data +#[derive(Debug, serde::Serialize, serde::Deserialize)] +pub struct GenericCollection { + /// The collection's name + pub name: String, + /// The collection's overview + pub overview: String, +} + +/// The TMDB collection data +#[cfg(feature = "tmdb")] +#[derive(Debug, serde::Serialize, serde::Deserialize)] +pub struct TmdbCollection { + /// The collection's TMDB ID + pub id: CollectionId, +} diff --git a/crates/flix/src/model/episode.rs b/crates/flix/src/model/episode.rs new file mode 100644 index 0000000..dc1c5ed --- /dev/null +++ b/crates/flix/src/model/episode.rs @@ -0,0 +1,21 @@ +use chrono::NaiveDate; + +/// An Episode container +#[derive(Debug, serde::Serialize, serde::Deserialize)] +pub struct Episode { + /// The generic episode data + pub episode: GenericEpisode, +} + +/// The generic episode data +#[derive(Debug, serde::Serialize, serde::Deserialize)] +pub struct GenericEpisode { + /// The episode's number + pub number: i32, + /// The episode's name + pub name: String, + /// The episode's overview + pub overview: String, + /// The episode's air date + pub air_date: NaiveDate, +} diff --git a/crates/flix/src/model/mod.rs b/crates/flix/src/model/mod.rs new file mode 100644 index 0000000..cf4a661 --- /dev/null +++ b/crates/flix/src/model/mod.rs @@ -0,0 +1,13 @@ +mod collection; +mod episode; +mod movie; +mod season; +mod show; +mod verse; + +pub use collection::*; +pub use episode::*; +pub use movie::*; +pub use season::*; +pub use show::*; +pub use verse::*; diff --git a/crates/flix/src/model/movie.rs b/crates/flix/src/model/movie.rs new file mode 100644 index 0000000..b000b77 --- /dev/null +++ b/crates/flix/src/model/movie.rs @@ -0,0 +1,38 @@ +#[cfg(feature = "tmdb")] +use flix_tmdb::model::{CollectionId, MovieGenreId, MovieId}; + +use chrono::NaiveDate; + +/// A Movie container +#[derive(Debug, serde::Serialize, serde::Deserialize)] +pub struct Movie { + /// The generic movie data + pub movie: GenericMovie, + + /// The TMDB movie data + #[cfg(feature = "tmdb")] + pub tmdb: Option, +} + +/// The generic movie data +#[derive(Debug, serde::Serialize, serde::Deserialize)] +pub struct GenericMovie { + /// The movie's title + pub title: String, + /// The movie's overview + pub overview: String, + /// The movie's release date + pub release_date: NaiveDate, +} + +/// The TMDB movie data +#[cfg(feature = "tmdb")] +#[derive(Debug, serde::Serialize, serde::Deserialize)] +pub struct TmdbMovie { + /// The movie's TMDB ID + pub id: MovieId, + /// The movie's collection's TMDB ID + pub collection: Option, + /// The list of genre TMDB IDs that the movie is associated with + pub genres: Vec, +} diff --git a/crates/flix/src/model/season.rs b/crates/flix/src/model/season.rs new file mode 100644 index 0000000..29b89ce --- /dev/null +++ b/crates/flix/src/model/season.rs @@ -0,0 +1,21 @@ +use chrono::NaiveDate; + +/// A Season container +#[derive(Debug, serde::Serialize, serde::Deserialize)] +pub struct Season { + /// The generic season data + pub season: GenericSeason, +} + +/// The generic season data +#[derive(Debug, serde::Serialize, serde::Deserialize)] +pub struct GenericSeason { + /// The season's number + pub number: i32, + /// The season's name + pub name: String, + /// The season's overview + pub overview: String, + /// The season's air date + pub air_date: NaiveDate, +} diff --git a/crates/flix/src/model/show.rs b/crates/flix/src/model/show.rs new file mode 100644 index 0000000..f0c9cef --- /dev/null +++ b/crates/flix/src/model/show.rs @@ -0,0 +1,36 @@ +#[cfg(feature = "tmdb")] +use flix_tmdb::model::{ShowGenreId, ShowId}; + +use chrono::NaiveDate; + +/// A Show container +#[derive(Debug, serde::Serialize, serde::Deserialize)] +pub struct Show { + /// The generic show data + pub show: GenericShow, + + /// The TMDB show data + #[cfg(feature = "tmdb")] + pub tmdb: Option, +} + +/// The generic show data +#[derive(Debug, serde::Serialize, serde::Deserialize)] +pub struct GenericShow { + /// The show's name + pub name: String, + /// The show's overview + pub overview: String, + /// The show's air date + pub air_date: NaiveDate, +} + +/// The TMDB show data +#[cfg(feature = "tmdb")] +#[derive(Debug, serde::Serialize, serde::Deserialize)] +pub struct TmdbShow { + /// The show's TMDB ID + pub id: ShowId, + /// The list of genre TMDB IDs that the movie is associated with + pub genres: Vec, +} diff --git a/crates/flix/src/model/verse.rs b/crates/flix/src/model/verse.rs new file mode 100644 index 0000000..b1cd4b3 --- /dev/null +++ b/crates/flix/src/model/verse.rs @@ -0,0 +1,32 @@ +#[cfg(feature = "tmdb")] +use flix_tmdb::model::{MovieId, ShowId}; + +/// A Verse container +#[derive(Debug, serde::Serialize, serde::Deserialize)] +pub struct Verse { + /// The generic verse data + pub verse: GenericVerse, + + /// The TMDB verse data + #[cfg(feature = "tmdb")] + pub tmdb: Option, +} + +/// The generic verse data +#[derive(Debug, serde::Serialize, serde::Deserialize)] +pub struct GenericVerse { + /// The verse's name + pub name: String, + /// The verse's overview + pub overview: String, +} + +/// The TMDB verse data +#[cfg(feature = "tmdb")] +#[derive(Debug, serde::Serialize, serde::Deserialize)] +pub struct TmdbVerse { + /// The list of movie TMDB IDs in the verse + pub movies: Vec, + /// The list of show TMDB IDs in the verse + pub shows: Vec, +} diff --git a/crates/tmdb/Cargo.toml b/crates/tmdb/Cargo.toml new file mode 100644 index 0000000..c6bc2c7 --- /dev/null +++ b/crates/tmdb/Cargo.toml @@ -0,0 +1,23 @@ +[package] +name = "flix-tmdb" +version = "0.0.1" + +categories = [] +description = "Clients and models for fetching data from TMDB" +repository = "https://github.com/QuantumShade/flix" + +authors.workspace = true +edition.workspace = true +license-file.workspace = true +rust-version.workspace = true + +[lints] +workspace = true + +[dependencies] +chrono = { workspace = true, features = ["serde"] } +reqwest = { workspace = true, features = ["json", "rustls-tls"] } +serde = { workspace = true, features = ["derive"] } +thiserror = { workspace = true } +url = { workspace = true } +url-macro = { workspace = true } diff --git a/crates/tmdb/README.md b/crates/tmdb/README.md new file mode 100644 index 0000000..c3e07ec --- /dev/null +++ b/crates/tmdb/README.md @@ -0,0 +1,5 @@ +# flix + +[![Crates Version](https://img.shields.io/crates/v/flix.svg)](https://crates.io/crates/flix) + +A library providing clients and models for fetching data from TMDB diff --git a/crates/tmdb/src/api/collections.rs b/crates/tmdb/src/api/collections.rs new file mode 100644 index 0000000..f632d3b --- /dev/null +++ b/crates/tmdb/src/api/collections.rs @@ -0,0 +1,40 @@ +use std::rc::Rc; + +use crate::Config; +use crate::model::{Collection, CollectionId}; + +use super::{Error, make_request}; + +/// TMDB Collections API client +pub struct Client { + config: Rc, +} + +impl Client { + /// Create a new client with the given configuration + pub fn new(config: Rc) -> Self { + Self { config } + } +} + +impl Client { + /// Fetch the details of the collection refered to by ID + pub async fn get_details( + &self, + id: impl Into, + language: Option<&str>, + ) -> Result { + Ok(self + .config + .client + .execute(make_request( + &self.config, + &format!("/3/collection/{}", id.into()), + language, + )?) + .await? + .error_for_status()? + .json() + .await?) + } +} diff --git a/crates/tmdb/src/api/episodes.rs b/crates/tmdb/src/api/episodes.rs new file mode 100644 index 0000000..9cc91b6 --- /dev/null +++ b/crates/tmdb/src/api/episodes.rs @@ -0,0 +1,47 @@ +use std::rc::Rc; + +use crate::Config; +use crate::model::{Episode, ShowId}; + +use super::{Error, make_request}; + +/// TMDB Episodes API client +pub struct Client { + config: Rc, +} + +impl Client { + /// Create a new client with the given configuration + pub fn new(config: Rc) -> Self { + Self { config } + } +} + +impl Client { + /// Fetch the details of the episode refered to by ID, season number and episode number + pub async fn get_details( + &self, + id: impl Into, + season: impl Into, + episode: impl Into, + language: Option<&str>, + ) -> Result { + Ok(self + .config + .client + .execute(make_request( + &self.config, + &format!( + "/3/tv/{}/season/{}/episode/{}", + id.into(), + season.into(), + episode.into() + ), + language, + )?) + .await? + .error_for_status()? + .json() + .await?) + } +} diff --git a/crates/tmdb/src/api/genres.rs b/crates/tmdb/src/api/genres.rs new file mode 100644 index 0000000..c5cc653 --- /dev/null +++ b/crates/tmdb/src/api/genres.rs @@ -0,0 +1,58 @@ +use std::rc::Rc; + +use crate::Config; +use crate::model::{MovieGenre, ShowGenre}; + +use super::{Error, make_request}; + +/// TMDB Genre API client +pub struct Client { + config: Rc, +} + +impl Client { + /// Create a new client with the given configuration + pub fn new(config: Rc) -> Self { + Self { config } + } +} + +impl Client { + /// Fetch the list of all valid movie genres + pub async fn get_movie_genres(&self, language: Option<&str>) -> Result, Error> { + #[derive(Debug, serde::Deserialize)] + struct Genres { + genres: Vec, + } + + let genres: Genres = self + .config + .client + .execute(make_request(&self.config, "/3/genre/movie/list", language)?) + .await? + .error_for_status()? + .json() + .await?; + + Ok(genres.genres) + } + + /// Fetch the list of all valid show genres + pub async fn get_tv_genres(&self, language: Option<&str>) -> Result, Error> { + #[derive(Debug, serde::Deserialize)] + struct Genres { + genres: Vec, + } + + let genres: Genres = self + .config + .client + .execute(make_request(&self.config, "/3/genre/tv/list", language)?) + .await? + .error_for_status()? + .json() + .await?; + + Ok(genres.genres) + } +} diff --git a/crates/tmdb/src/api/mod.rs b/crates/tmdb/src/api/mod.rs new file mode 100644 index 0000000..4b7fcd0 --- /dev/null +++ b/crates/tmdb/src/api/mod.rs @@ -0,0 +1,45 @@ +use reqwest::Request; +use reqwest::header; + +use crate::Config; + +/// Collections API +pub mod collections; +/// Episodes API +pub mod episodes; +/// Genres API +pub mod genres; +/// Movies API +pub mod movies; +/// Seasons API +pub mod seasons; +/// Shows API +pub mod shows; + +/// A generic error wrapping Url and Reqwest errors +#[derive(Debug, thiserror::Error)] +pub enum Error { + /// Url error wrapper + #[error("url parse error: {0}")] + Url(#[from] url::ParseError), + /// Reqwest error wrapper + #[error("reqwest error: {0}")] + Reqwest(#[from] reqwest::Error), +} + +fn make_request(config: &Config, path: &str, language: Option<&str>) -> Result { + let url = config.base_url.join(path)?; + + let mut builder = config.client.get(url).header( + header::AUTHORIZATION, + format!("Bearer {}", config.bearer_token), + ); + if let Some(ref user_agent) = config.user_agent { + builder = builder.header(header::USER_AGENT, user_agent); + } + if let Some(language) = language { + builder = builder.query(&[("language", language)]); + } + + Ok(builder.build()?) +} diff --git a/crates/tmdb/src/api/movies.rs b/crates/tmdb/src/api/movies.rs new file mode 100644 index 0000000..21f2f5c --- /dev/null +++ b/crates/tmdb/src/api/movies.rs @@ -0,0 +1,40 @@ +use std::rc::Rc; + +use crate::Config; +use crate::model::{Movie, MovieId}; + +use super::{Error, make_request}; + +/// TMDB Movies API client +pub struct Client { + config: Rc, +} + +impl Client { + /// Create a new client with the given configuration + pub fn new(config: Rc) -> Self { + Self { config } + } +} + +impl Client { + /// Fetch the details of the movie refered to by ID + pub async fn get_details( + &self, + id: impl Into, + language: Option<&str>, + ) -> Result { + Ok(self + .config + .client + .execute(make_request( + &self.config, + &format!("/3/movie/{}", id.into()), + language, + )?) + .await? + .error_for_status()? + .json() + .await?) + } +} diff --git a/crates/tmdb/src/api/seasons.rs b/crates/tmdb/src/api/seasons.rs new file mode 100644 index 0000000..9fc48fb --- /dev/null +++ b/crates/tmdb/src/api/seasons.rs @@ -0,0 +1,41 @@ +use std::rc::Rc; + +use crate::Config; +use crate::model::{Season, ShowId}; + +use super::{Error, make_request}; + +/// TMDB Seasons API client +pub struct Client { + config: Rc, +} + +impl Client { + /// Create a new client with the given configuration + pub fn new(config: Rc) -> Self { + Self { config } + } +} + +impl Client { + /// Fetch the details of the season refered to by ID and season number + pub async fn get_details( + &self, + id: impl Into, + season: impl Into, + language: Option<&str>, + ) -> Result { + Ok(self + .config + .client + .execute(make_request( + &self.config, + &format!("/3/tv/{}/season/{}", id.into(), season.into()), + language, + )?) + .await? + .error_for_status()? + .json() + .await?) + } +} diff --git a/crates/tmdb/src/api/shows.rs b/crates/tmdb/src/api/shows.rs new file mode 100644 index 0000000..8bf9301 --- /dev/null +++ b/crates/tmdb/src/api/shows.rs @@ -0,0 +1,40 @@ +use std::rc::Rc; + +use crate::Config; +use crate::model::{Show, ShowId}; + +use super::{Error, make_request}; + +/// TMDB Shows API client +pub struct Client { + config: Rc, +} + +impl Client { + /// Create a new client with the given configuration + pub fn new(config: Rc) -> Self { + Self { config } + } +} + +impl Client { + /// Fetch the details of the show refered to by ID + pub async fn get_details( + &self, + id: impl Into, + language: Option<&str>, + ) -> Result { + Ok(self + .config + .client + .execute(make_request( + &self.config, + &format!("/3/tv/{}", id.into()), + language, + )?) + .await? + .error_for_status()? + .json() + .await?) + } +} diff --git a/crates/tmdb/src/client.rs b/crates/tmdb/src/client.rs new file mode 100644 index 0000000..dccdaa8 --- /dev/null +++ b/crates/tmdb/src/client.rs @@ -0,0 +1,65 @@ +use std::rc::Rc; + +use crate::{Config, api}; + +/// The primary client that references all other clients +pub struct Client { + genres: api::genres::Client, + collections: api::collections::Client, + movies: api::movies::Client, + shows: api::shows::Client, + seasons: api::seasons::Client, + episodes: api::episodes::Client, +} + +impl Client { + /// Create a new client from a default configuration using the bearer token + pub fn new(bearer_token: String) -> Self { + Self::new_with_config(Config::new(bearer_token)) + } + + /// Create a new client with the given configuration + pub fn new_with_config(config: Config) -> Self { + let config = Rc::new(config); + Self { + genres: api::genres::Client::new(config.clone()), + collections: api::collections::Client::new(config.clone()), + movies: api::movies::Client::new(config.clone()), + shows: api::shows::Client::new(config.clone()), + seasons: api::seasons::Client::new(config.clone()), + episodes: api::episodes::Client::new(config.clone()), + } + } +} + +impl Client { + /// Access the Genres API + pub fn genres(&self) -> &api::genres::Client { + &self.genres + } + + /// Access the Collections API + pub fn collections(&self) -> &api::collections::Client { + &self.collections + } + + /// Access the Movies API + pub fn movies(&self) -> &api::movies::Client { + &self.movies + } + + /// Access the Shows API + pub fn shows(&self) -> &api::shows::Client { + &self.shows + } + + /// Access the Seasons API + pub fn seasons(&self) -> &api::seasons::Client { + &self.seasons + } + + /// Access the Episodes API + pub fn episodes(&self) -> &api::episodes::Client { + &self.episodes + } +} diff --git a/crates/tmdb/src/config.rs b/crates/tmdb/src/config.rs new file mode 100644 index 0000000..09eaa6d --- /dev/null +++ b/crates/tmdb/src/config.rs @@ -0,0 +1,26 @@ +use url::Url; +use url_macro::url; + +/// The client configuration +pub struct Config { + /// The base URL of the API + pub base_url: Url, + /// The reqwest client that is used for every request + pub client: reqwest::Client, + /// The bearer token for readonly access to the API + pub bearer_token: String, + /// An optional user agent string to provide to the API + pub user_agent: Option, +} + +impl Config { + /// Create a new configuration using the provided bearer token + pub fn new(bearer_token: String) -> Self { + Self { + base_url: url!("https://api.themoviedb.org"), + client: reqwest::Client::new(), + bearer_token, + user_agent: None, + } + } +} diff --git a/crates/tmdb/src/lib.rs b/crates/tmdb/src/lib.rs new file mode 100644 index 0000000..bb1c515 --- /dev/null +++ b/crates/tmdb/src/lib.rs @@ -0,0 +1,12 @@ +//! flix-tmdb provides clients and models for fetching data from TMDB + +/// TMDB API clients +pub mod api; +/// Deserializable types from the TMDB API +pub mod model; + +mod client; +pub use client::Client; + +mod config; +pub use config::Config; diff --git a/crates/tmdb/src/model/collection.rs b/crates/tmdb/src/model/collection.rs new file mode 100644 index 0000000..358295c --- /dev/null +++ b/crates/tmdb/src/model/collection.rs @@ -0,0 +1,22 @@ +use super::{CollectionId, MovieId}; + +/// A deserialized Collection from the TMDB API +#[derive(Debug, serde::Deserialize)] +pub struct Collection { + /// The collection's TMDB ID + pub id: CollectionId, + /// The collection's name + pub name: String, + /// The collection's overview + pub overview: String, + /// The list of movies that are part of this collection + #[serde(rename = "parts")] + pub movies: Vec, +} + +/// A deserialized collection item from the TMDB API +#[derive(Debug, serde::Deserialize)] +pub struct Item { + /// The movie's TMDB ID + pub id: MovieId, +} diff --git a/crates/tmdb/src/model/episode.rs b/crates/tmdb/src/model/episode.rs new file mode 100644 index 0000000..9e0ca6c --- /dev/null +++ b/crates/tmdb/src/model/episode.rs @@ -0,0 +1,14 @@ +use chrono::NaiveDate; + +/// A deserialized Episode from the TMDB API +#[derive(Debug, serde::Deserialize)] +pub struct Episode { + /// The episode's number + pub episode_number: i32, + /// The episode's name + pub name: String, + /// The episode's overview + pub overview: String, + /// The episode's air date + pub air_date: NaiveDate, +} diff --git a/crates/tmdb/src/model/genre.rs b/crates/tmdb/src/model/genre.rs new file mode 100644 index 0000000..1075335 --- /dev/null +++ b/crates/tmdb/src/model/genre.rs @@ -0,0 +1,19 @@ +use super::id::{MovieGenreId, ShowGenreId}; + +/// A deserialized movie Genre from the TMDB API +#[derive(Debug, serde::Deserialize)] +pub struct MovieGenre { + /// The genre's TMDB ID + pub id: MovieGenreId, + /// The genre's name + pub name: String, +} + +/// A deserialized show Genre from the TMDB API +#[derive(Debug, serde::Deserialize)] +pub struct ShowGenre { + /// The genre's TMDB ID + pub id: ShowGenreId, + /// The genre's name + pub name: String, +} diff --git a/crates/tmdb/src/model/id.rs b/crates/tmdb/src/model/id.rs new file mode 100644 index 0000000..d820b40 --- /dev/null +++ b/crates/tmdb/src/model/id.rs @@ -0,0 +1,79 @@ +use core::fmt; +use core::marker::PhantomData; + +/// The TMDB ID type of a movie genre +pub type MovieGenreId = TmdbId; +/// The TMDB ID type of a show genre +pub type ShowGenreId = TmdbId; +/// The TMDB ID type of a collection +pub type CollectionId = TmdbId; +/// The TMDB ID type of a movie +pub type MovieId = TmdbId; +/// The TMDB ID type of a show +pub type ShowId = TmdbId; + +pub enum MovieGenre {} +pub enum ShowGenre {} +pub enum Collection {} +pub enum Movie {} +pub enum Show {} + +type Inner = i32; + +#[derive(serde::Serialize, serde::Deserialize)] +#[serde(transparent)] +#[repr(transparent)] +pub struct TmdbId { + inner: Inner, + #[serde(skip_serializing, default)] + _phantom: PhantomData, +} + +impl TmdbId { + pub fn inner(&self) -> Inner { + self.inner + } +} + +impl From for TmdbId { + fn from(value: Inner) -> Self { + Self { + inner: value, + _phantom: PhantomData, + } + } +} + +impl From> for Inner { + fn from(value: TmdbId) -> Self { + value.inner + } +} + +impl fmt::Debug for TmdbId { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { + self.inner.fmt(f) + } +} + +impl fmt::Display for TmdbId { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { + self.inner.fmt(f) + } +} + +impl Clone for TmdbId { + fn clone(&self) -> Self { + *self + } +} + +impl Copy for TmdbId {} + +impl PartialEq for TmdbId { + fn eq(&self, other: &Self) -> bool { + self.inner == other.inner + } +} + +impl Eq for TmdbId {} diff --git a/crates/tmdb/src/model/mod.rs b/crates/tmdb/src/model/mod.rs new file mode 100644 index 0000000..f85a906 --- /dev/null +++ b/crates/tmdb/src/model/mod.rs @@ -0,0 +1,17 @@ +mod collection; +mod episode; +mod genre; +mod id; +mod movie; +mod season; +mod show; + +pub use collection::*; +pub use episode::*; +pub use genre::*; +pub use movie::*; +pub use season::*; +pub use serde::*; +pub use show::*; + +pub use id::{CollectionId, MovieGenreId, MovieId, ShowGenreId, ShowId}; diff --git a/crates/tmdb/src/model/movie.rs b/crates/tmdb/src/model/movie.rs new file mode 100644 index 0000000..176eca8 --- /dev/null +++ b/crates/tmdb/src/model/movie.rs @@ -0,0 +1,53 @@ +use chrono::NaiveDate; + +use super::{CollectionId, MovieGenre, MovieId}; + +/// A deserialized Movie from the TMDB API +#[derive(Debug, serde::Deserialize)] +pub struct Movie { + /// The movie's TMDB ID + pub id: MovieId, + /// The movie's collection, if it exists + #[serde(rename = "belongs_to_collection")] + pub collection: Option, + /// The movie's title + pub title: String, + /// The movie's overview + pub overview: String, + /// The list of genres the movie belongs to + pub genres: Vec, + /// The movie's release date + pub release_date: NaiveDate, + /// The movie's status + pub status: MovieStatus, +} + +/// A deserialized movie's collection from the TMDB API +#[derive(Debug, serde::Deserialize)] +pub struct InCollection { + /// The collection's TMDB ID + pub id: CollectionId, +} + +/// A deserialized movie status from the TMDB API +#[derive(Debug, serde::Deserialize)] +pub enum MovieStatus { + /// The movie was cancelled + #[serde(rename = "Canceled")] + Canceled, + /// The movie is in production + #[serde(rename = "In Production")] + InProduction, + /// The movie is planned + #[serde(rename = "Planned")] + Planned, + /// The movie is in post production + #[serde(rename = "Post Production")] + PostProduction, + /// The movie is released + #[serde(rename = "Released")] + Released, + /// The movie is rumored + #[serde(rename = "Rumored")] + Rumored, +} diff --git a/crates/tmdb/src/model/season.rs b/crates/tmdb/src/model/season.rs new file mode 100644 index 0000000..388ece4 --- /dev/null +++ b/crates/tmdb/src/model/season.rs @@ -0,0 +1,18 @@ +use chrono::NaiveDate; + +use super::Episode; + +/// A deserialized Season from the TMDB API +#[derive(Debug, serde::Deserialize)] +pub struct Season { + /// The season's number + pub season_number: i32, + /// The season's name + pub name: String, + /// The season's overview + pub overview: String, + /// The season's air date + pub air_date: NaiveDate, + /// The list of episodes in this season + pub episodes: Vec, +} diff --git a/crates/tmdb/src/model/show.rs b/crates/tmdb/src/model/show.rs new file mode 100644 index 0000000..d8ce31e --- /dev/null +++ b/crates/tmdb/src/model/show.rs @@ -0,0 +1,47 @@ +use chrono::NaiveDate; + +use super::{ShowGenre, ShowId}; + +/// A deserialized Show from the TMDB API +#[derive(Debug, serde::Deserialize)] +pub struct Show { + /// The show's TMDB ID + pub id: ShowId, + /// The show's name + pub name: String, + /// The show's overview + pub overview: String, + /// The list of genres this show belongs to + pub genres: Vec, + /// The show's first air date + pub first_air_date: NaiveDate, + /// The show's last air date + pub last_air_date: NaiveDate, + /// The number of seasons in this show + pub number_of_seasons: i32, + /// The show's status + pub status: ShowStatus, +} + +/// A deserialized show Status from the TMDB API +#[derive(Debug, serde::Deserialize)] +pub enum ShowStatus { + /// The show is returning + #[serde(rename = "Returning Series")] + Returning, + /// The show is planned + #[serde(rename = "Planned")] + Planned, + /// The show is in procuction + #[serde(rename = "In Production")] + InProduction, + /// The show has ended + #[serde(rename = "Ended")] + Ended, + /// The show is canceled + #[serde(rename = "Canceled")] + Canceled, + /// The show only released a pilot + #[serde(rename = "Pilot")] + Pilot, +} diff --git a/rust-toolchain.toml b/rust-toolchain.toml new file mode 100644 index 0000000..292fe49 --- /dev/null +++ b/rust-toolchain.toml @@ -0,0 +1,2 @@ +[toolchain] +channel = "stable"