You've already forked flix
Update all libraries to the new database format
This commit is contained in:
@@ -5,3 +5,7 @@
|
|||||||
|
|
||||||
# Rust
|
# Rust
|
||||||
/target
|
/target
|
||||||
|
|
||||||
|
# Flix
|
||||||
|
flix.db
|
||||||
|
flix.redb
|
||||||
|
|||||||
Generated
+163
-150
@@ -8,7 +8,7 @@ version = "0.7.8"
|
|||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "891477e0c6a8957309ee5c45a6368af3ae14bb510732d2684ffa19af310920f9"
|
checksum = "891477e0c6a8957309ee5c45a6368af3ae14bb510732d2684ffa19af310920f9"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"getrandom 0.2.16",
|
"getrandom 0.2.17",
|
||||||
"once_cell",
|
"once_cell",
|
||||||
"version_check",
|
"version_check",
|
||||||
]
|
]
|
||||||
@@ -124,7 +124,7 @@ checksum = "c7c24de15d275a1ecfd47a380fb4d5ec9bfe0933f309ed5e705b775596a3574d"
|
|||||||
dependencies = [
|
dependencies = [
|
||||||
"proc-macro2",
|
"proc-macro2",
|
||||||
"quote",
|
"quote",
|
||||||
"syn 2.0.113",
|
"syn 2.0.114",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
@@ -135,7 +135,7 @@ checksum = "9035ad2d096bed7955a320ee7e2230574d28fd3c3a0f186cbea1ff3c7eed5dbb"
|
|||||||
dependencies = [
|
dependencies = [
|
||||||
"proc-macro2",
|
"proc-macro2",
|
||||||
"quote",
|
"quote",
|
||||||
"syn 2.0.113",
|
"syn 2.0.114",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
@@ -161,9 +161,9 @@ checksum = "c08606f8c3cbf4ce6ec8e28fb0014a2c086708fe954eaa885384a6165172e7e8"
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "aws-lc-rs"
|
name = "aws-lc-rs"
|
||||||
version = "1.15.2"
|
version = "1.15.3"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "6a88aab2464f1f25453baa7a07c84c5b7684e274054ba06817f382357f77a288"
|
checksum = "e84ce723ab67259cfeb9877c6a639ee9eb7a27b28123abd71db7f0d5d0cc9d86"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"aws-lc-sys",
|
"aws-lc-sys",
|
||||||
"zeroize",
|
"zeroize",
|
||||||
@@ -171,9 +171,9 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "aws-lc-sys"
|
name = "aws-lc-sys"
|
||||||
version = "0.35.0"
|
version = "0.36.0"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "b45afffdee1e7c9126814751f88dddc747f41d91da16c9551a0f1e8a11e788a1"
|
checksum = "43a442ece363113bd4bd4c8b18977a7798dd4d3c3383f34fb61936960e8f4ad8"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"cc",
|
"cc",
|
||||||
"cmake",
|
"cmake",
|
||||||
@@ -189,9 +189,9 @@ checksum = "72b3254f16251a8381aa12e40e3c4d2f0199f8c6508fbecb9d91f575e0fbb8c6"
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "base64ct"
|
name = "base64ct"
|
||||||
version = "1.8.2"
|
version = "1.8.3"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "7d809780667f4410e7c41b07f52439b94d2bdf8528eeedc287fa38d3b7f95d82"
|
checksum = "2af50177e190e07a26ab74f8b1efbfe2ef87da2116221318cb1c2e82baf7de06"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "bigdecimal"
|
name = "bigdecimal"
|
||||||
@@ -257,7 +257,7 @@ dependencies = [
|
|||||||
"proc-macro-crate",
|
"proc-macro-crate",
|
||||||
"proc-macro2",
|
"proc-macro2",
|
||||||
"quote",
|
"quote",
|
||||||
"syn 2.0.113",
|
"syn 2.0.114",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
@@ -302,9 +302,9 @@ checksum = "b35204fbdc0b3f4446b89fc1ac2cf84a8a68971995d0bf2e925ec7cd960f9cb3"
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "cc"
|
name = "cc"
|
||||||
version = "1.2.51"
|
version = "1.2.53"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "7a0aeaff4ff1a90589618835a598e545176939b97874f7abc7851caa0618f203"
|
checksum = "755d2fce177175ffca841e9a06afdb2c4ab0f593d53b4dee48147dfaade85932"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"find-msvc-tools",
|
"find-msvc-tools",
|
||||||
"jobserver",
|
"jobserver",
|
||||||
@@ -332,9 +332,9 @@ checksum = "613afe47fcd5fac7ccf1db93babcb082c5994d996f20b8b159f2ad1658eb5724"
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "chrono"
|
name = "chrono"
|
||||||
version = "0.4.42"
|
version = "0.4.43"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "145052bdd345b87320e369255277e3fb5152762ad123a901ef5c262dd38fe8d2"
|
checksum = "fac4744fb15ae8337dc853fee7fb3f4e48c0fbaa23d0afe49c447b4fab126118"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"iana-time-zone",
|
"iana-time-zone",
|
||||||
"num-traits",
|
"num-traits",
|
||||||
@@ -373,14 +373,14 @@ dependencies = [
|
|||||||
"heck 0.5.0",
|
"heck 0.5.0",
|
||||||
"proc-macro2",
|
"proc-macro2",
|
||||||
"quote",
|
"quote",
|
||||||
"syn 2.0.113",
|
"syn 2.0.114",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "clap_lex"
|
name = "clap_lex"
|
||||||
version = "0.7.6"
|
version = "0.7.7"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "a1d728cc89cf3aee9ff92b05e62b19ee65a02b5702cff7d5a377e32c6ae29d8d"
|
checksum = "c3e64b0cc0439b12df2fa678eae89a1c56a529fd067a9115f7827f1fffd22b32"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "cmake"
|
name = "cmake"
|
||||||
@@ -507,7 +507,7 @@ dependencies = [
|
|||||||
"ident_case",
|
"ident_case",
|
||||||
"proc-macro2",
|
"proc-macro2",
|
||||||
"quote",
|
"quote",
|
||||||
"syn 2.0.113",
|
"syn 2.0.114",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
@@ -518,7 +518,7 @@ checksum = "fc34b93ccb385b40dc71c6fceac4b2ad23662c7eeb248cf10d529b7e055b6ead"
|
|||||||
dependencies = [
|
dependencies = [
|
||||||
"darling_core",
|
"darling_core",
|
||||||
"quote",
|
"quote",
|
||||||
"syn 2.0.113",
|
"syn 2.0.114",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
@@ -560,7 +560,7 @@ dependencies = [
|
|||||||
"proc-macro2",
|
"proc-macro2",
|
||||||
"quote",
|
"quote",
|
||||||
"rustc_version",
|
"rustc_version",
|
||||||
"syn 2.0.113",
|
"syn 2.0.114",
|
||||||
"unicode-xid",
|
"unicode-xid",
|
||||||
]
|
]
|
||||||
|
|
||||||
@@ -584,7 +584,7 @@ checksum = "97369cbbc041bc366949bc74d34658d6cda5621039731c6310521892a3a20ae0"
|
|||||||
dependencies = [
|
dependencies = [
|
||||||
"proc-macro2",
|
"proc-macro2",
|
||||||
"quote",
|
"quote",
|
||||||
"syn 2.0.113",
|
"syn 2.0.114",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
@@ -638,13 +638,13 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "find-msvc-tools"
|
name = "find-msvc-tools"
|
||||||
version = "0.1.6"
|
version = "0.1.8"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "645cbb3a84e60b7531617d5ae4e57f7e27308f6445f5abf653209ea76dec8dff"
|
checksum = "8591b0bcc8a98a64310a2fae1bb3e9b8564dd10e381e6e28010fde8e8e8568db"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "flix"
|
name = "flix"
|
||||||
version = "0.0.16"
|
version = "0.0.17"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"flix-db",
|
"flix-db",
|
||||||
"flix-fs",
|
"flix-fs",
|
||||||
@@ -654,7 +654,7 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "flix-cli"
|
name = "flix-cli"
|
||||||
version = "0.0.16"
|
version = "0.0.17"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"anyhow",
|
"anyhow",
|
||||||
"chrono",
|
"chrono",
|
||||||
@@ -671,7 +671,7 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "flix-db"
|
name = "flix-db"
|
||||||
version = "0.0.16"
|
version = "0.0.17"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"chrono",
|
"chrono",
|
||||||
"flix-model",
|
"flix-model",
|
||||||
@@ -684,39 +684,43 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "flix-fs"
|
name = "flix-fs"
|
||||||
version = "0.0.16"
|
version = "0.0.17"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"async-stream",
|
"async-stream",
|
||||||
|
"either",
|
||||||
"flix-model",
|
"flix-model",
|
||||||
"regex",
|
"regex",
|
||||||
"thiserror 2.0.17",
|
"thiserror 2.0.18",
|
||||||
"tokio",
|
"tokio",
|
||||||
"tokio-stream",
|
"tokio-stream",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "flix-model"
|
name = "flix-model"
|
||||||
version = "0.0.16"
|
version = "0.0.17"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"itertools",
|
"itertools",
|
||||||
"seamantic",
|
"seamantic",
|
||||||
"serde",
|
"serde",
|
||||||
"thiserror 2.0.17",
|
"thiserror 2.0.18",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "flix-tmdb"
|
name = "flix-tmdb"
|
||||||
version = "0.0.16"
|
version = "0.0.17"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
|
"bytes",
|
||||||
"chrono",
|
"chrono",
|
||||||
"flix-model",
|
"flix-model",
|
||||||
"governor",
|
"governor",
|
||||||
"nonzero_ext",
|
"nonzero_ext",
|
||||||
|
"redb",
|
||||||
"reqwest",
|
"reqwest",
|
||||||
"sea-orm",
|
"sea-orm",
|
||||||
"serde",
|
"serde",
|
||||||
|
"serde_json",
|
||||||
"serde_test",
|
"serde_test",
|
||||||
"thiserror 2.0.17",
|
"thiserror 2.0.18",
|
||||||
"url",
|
"url",
|
||||||
"url-macro",
|
"url-macro",
|
||||||
]
|
]
|
||||||
@@ -875,9 +879,9 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "getrandom"
|
name = "getrandom"
|
||||||
version = "0.2.16"
|
version = "0.2.17"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "335ff9f135e4384c8150d6f27c6daed433577f86b4750418338c01a1a2528592"
|
checksum = "ff2abc00be7fca6ebc474524697ae276ad847ad0a6b3faa4bcb027e9a4614ad0"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"cfg-if",
|
"cfg-if",
|
||||||
"js-sys",
|
"js-sys",
|
||||||
@@ -1246,9 +1250,9 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "indexmap"
|
name = "indexmap"
|
||||||
version = "2.12.1"
|
version = "2.13.0"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "0ad4bb2b565bca0645f4d68c5c9af97fba094e9791da685bf83cb5f3ce74acf2"
|
checksum = "7714e70437a7dc3ac8eb7e6f8df75fd8eb422675fc7678aff7364301092b1017"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"equivalent",
|
"equivalent",
|
||||||
"hashbrown 0.16.1",
|
"hashbrown 0.16.1",
|
||||||
@@ -1271,7 +1275,7 @@ checksum = "c727f80bfa4a6c6e2508d2f05b6f4bfce242030bd88ed15ae5331c5b5d30fba7"
|
|||||||
dependencies = [
|
dependencies = [
|
||||||
"proc-macro2",
|
"proc-macro2",
|
||||||
"quote",
|
"quote",
|
||||||
"syn 2.0.113",
|
"syn 2.0.114",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
@@ -1354,9 +1358,9 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "js-sys"
|
name = "js-sys"
|
||||||
version = "0.3.83"
|
version = "0.3.85"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "464a3709c7f55f1f721e5389aa6ea4e3bc6aba669353300af094b29ffbdde1d8"
|
checksum = "8c942ebf8e95485ca0d52d97da7c5a2c387d0e7f0ba4c35e93bfcaee045955b3"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"once_cell",
|
"once_cell",
|
||||||
"wasm-bindgen",
|
"wasm-bindgen",
|
||||||
@@ -1373,9 +1377,9 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "libc"
|
name = "libc"
|
||||||
version = "0.2.179"
|
version = "0.2.180"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "c5a2d376baa530d1238d133232d15e239abad80d05838b4b59354e5268af431f"
|
checksum = "bcc35a38544a891a5f7c865aca548a982ccb3b8650a5b06d0fd33a10283c56fc"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "libm"
|
name = "libm"
|
||||||
@@ -1584,7 +1588,7 @@ dependencies = [
|
|||||||
"proc-macro2",
|
"proc-macro2",
|
||||||
"proc-macro2-diagnostics",
|
"proc-macro2-diagnostics",
|
||||||
"quote",
|
"quote",
|
||||||
"syn 2.0.113",
|
"syn 2.0.114",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
@@ -1747,14 +1751,14 @@ dependencies = [
|
|||||||
"proc-macro-error-attr2",
|
"proc-macro-error-attr2",
|
||||||
"proc-macro2",
|
"proc-macro2",
|
||||||
"quote",
|
"quote",
|
||||||
"syn 2.0.113",
|
"syn 2.0.114",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "proc-macro2"
|
name = "proc-macro2"
|
||||||
version = "1.0.104"
|
version = "1.0.105"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "9695f8df41bb4f3d222c95a67532365f569318332d03d5f3f67f37b20e6ebdf0"
|
checksum = "535d180e0ecab6268a3e718bb9fd44db66bbbc256257165fc699dadf70d16fe7"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"unicode-ident",
|
"unicode-ident",
|
||||||
]
|
]
|
||||||
@@ -1767,7 +1771,7 @@ checksum = "af066a9c399a26e020ada66a034357a868728e72cd426f3adcd35f80d88d88c8"
|
|||||||
dependencies = [
|
dependencies = [
|
||||||
"proc-macro2",
|
"proc-macro2",
|
||||||
"quote",
|
"quote",
|
||||||
"syn 2.0.113",
|
"syn 2.0.114",
|
||||||
"version_check",
|
"version_check",
|
||||||
"yansi",
|
"yansi",
|
||||||
]
|
]
|
||||||
@@ -1806,7 +1810,7 @@ dependencies = [
|
|||||||
"rustc-hash",
|
"rustc-hash",
|
||||||
"rustls",
|
"rustls",
|
||||||
"socket2",
|
"socket2",
|
||||||
"thiserror 2.0.17",
|
"thiserror 2.0.18",
|
||||||
"tokio",
|
"tokio",
|
||||||
"tracing",
|
"tracing",
|
||||||
"web-time",
|
"web-time",
|
||||||
@@ -1828,7 +1832,7 @@ dependencies = [
|
|||||||
"rustls",
|
"rustls",
|
||||||
"rustls-pki-types",
|
"rustls-pki-types",
|
||||||
"slab",
|
"slab",
|
||||||
"thiserror 2.0.17",
|
"thiserror 2.0.18",
|
||||||
"tinyvec",
|
"tinyvec",
|
||||||
"tracing",
|
"tracing",
|
||||||
"web-time",
|
"web-time",
|
||||||
@@ -1850,9 +1854,9 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "quote"
|
name = "quote"
|
||||||
version = "1.0.42"
|
version = "1.0.43"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "a338cc41d27e6cc6dce6cefc13a0729dfbb81c262b1f519331575dd80ef3067f"
|
checksum = "dc74d9a594b72ae6656596548f56f667211f8a97b3d4c3d467150794690dc40a"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"proc-macro2",
|
"proc-macro2",
|
||||||
]
|
]
|
||||||
@@ -1887,7 +1891,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
|||||||
checksum = "6db2770f06117d490610c7488547d543617b21bfa07796d7a12f6f1bd53850d1"
|
checksum = "6db2770f06117d490610c7488547d543617b21bfa07796d7a12f6f1bd53850d1"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"rand_chacha 0.9.0",
|
"rand_chacha 0.9.0",
|
||||||
"rand_core 0.9.3",
|
"rand_core 0.9.5",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
@@ -1907,7 +1911,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
|||||||
checksum = "d3022b5f1df60f26e1ffddd6c66e8aa15de382ae63b3a0c1bfc0e4d3e3f325cb"
|
checksum = "d3022b5f1df60f26e1ffddd6c66e8aa15de382ae63b3a0c1bfc0e4d3e3f325cb"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"ppv-lite86",
|
"ppv-lite86",
|
||||||
"rand_core 0.9.3",
|
"rand_core 0.9.5",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
@@ -1916,18 +1920,27 @@ version = "0.6.4"
|
|||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "ec0be4795e2f6a28069bec0b5ff3e2ac9bafc99e6a9a7dc3547996c5c816922c"
|
checksum = "ec0be4795e2f6a28069bec0b5ff3e2ac9bafc99e6a9a7dc3547996c5c816922c"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"getrandom 0.2.16",
|
"getrandom 0.2.17",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "rand_core"
|
name = "rand_core"
|
||||||
version = "0.9.3"
|
version = "0.9.5"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "99d9a13982dcf210057a8a78572b2217b667c3beacbf3a0d8b454f6f82837d38"
|
checksum = "76afc826de14238e6e8c374ddcc1fa19e374fd8dd986b0d2af0d02377261d83c"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"getrandom 0.3.4",
|
"getrandom 0.3.4",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "redb"
|
||||||
|
version = "3.1.0"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "ae323eb086579a3769daa2c753bb96deb95993c534711e0dbe881b5192906a06"
|
||||||
|
dependencies = [
|
||||||
|
"libc",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "redox_syscall"
|
name = "redox_syscall"
|
||||||
version = "0.5.18"
|
version = "0.5.18"
|
||||||
@@ -2008,7 +2021,6 @@ dependencies = [
|
|||||||
"rustls-pki-types",
|
"rustls-pki-types",
|
||||||
"rustls-platform-verifier",
|
"rustls-platform-verifier",
|
||||||
"serde",
|
"serde",
|
||||||
"serde_json",
|
|
||||||
"serde_urlencoded",
|
"serde_urlencoded",
|
||||||
"sync_wrapper",
|
"sync_wrapper",
|
||||||
"tokio",
|
"tokio",
|
||||||
@@ -2030,7 +2042,7 @@ checksum = "a4689e6c2294d81e88dc6261c768b63bc4fcdb852be6d1352498b114f61383b7"
|
|||||||
dependencies = [
|
dependencies = [
|
||||||
"cc",
|
"cc",
|
||||||
"cfg-if",
|
"cfg-if",
|
||||||
"getrandom 0.2.16",
|
"getrandom 0.2.17",
|
||||||
"libc",
|
"libc",
|
||||||
"untrusted",
|
"untrusted",
|
||||||
"windows-sys 0.52.0",
|
"windows-sys 0.52.0",
|
||||||
@@ -2038,9 +2050,9 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "rkyv"
|
name = "rkyv"
|
||||||
version = "0.7.45"
|
version = "0.7.46"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "9008cd6385b9e161d8229e1f6549dd23c3d022f132a2ea37ac3a10ac4935779b"
|
checksum = "2297bf9c81a3f0dc96bc9521370b88f054168c29826a75e89c55ff196e7ed6a1"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"bitvec",
|
"bitvec",
|
||||||
"bytecheck",
|
"bytecheck",
|
||||||
@@ -2056,9 +2068,9 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "rkyv_derive"
|
name = "rkyv_derive"
|
||||||
version = "0.7.45"
|
version = "0.7.46"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "503d1d27590a2b0a3a4ca4c94755aa2875657196ecbf401a42eff41d7de532c0"
|
checksum = "84d7b42d4b8d06048d3ac8db0eb31bcb942cbeb709f0b5f2b2ebde398d3038f5"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"proc-macro2",
|
"proc-macro2",
|
||||||
"quote",
|
"quote",
|
||||||
@@ -2067,9 +2079,9 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "rsa"
|
name = "rsa"
|
||||||
version = "0.9.9"
|
version = "0.9.10"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "40a0376c50d0358279d9d643e4bf7b7be212f1f4ff1da9070a7b54d22ef75c88"
|
checksum = "b8573f03f5883dcaebdfcf4725caa1ecb9c15b2ef50c43a07b816e06799bb12d"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"const-oid",
|
"const-oid",
|
||||||
"digest",
|
"digest",
|
||||||
@@ -2087,9 +2099,9 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "rust_decimal"
|
name = "rust_decimal"
|
||||||
version = "1.39.0"
|
version = "1.40.0"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "35affe401787a9bd846712274d97654355d21b2a2c092a3139aabe31e9022282"
|
checksum = "61f703d19852dbf87cbc513643fa81428361eb6940f1ac14fd58155d295a3eb0"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"arrayvec",
|
"arrayvec",
|
||||||
"borsh",
|
"borsh",
|
||||||
@@ -2118,9 +2130,9 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "rustls"
|
name = "rustls"
|
||||||
version = "0.23.35"
|
version = "0.23.36"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "533f54bc6a7d4f647e46ad909549eda97bf5afc1585190ef692b4286b198bd8f"
|
checksum = "c665f33d38cea657d9614f766881e4d510e0eda4239891eea56b4cadcf01801b"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"aws-lc-rs",
|
"aws-lc-rs",
|
||||||
"once_cell",
|
"once_cell",
|
||||||
@@ -2145,9 +2157,9 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "rustls-pki-types"
|
name = "rustls-pki-types"
|
||||||
version = "1.13.2"
|
version = "1.14.0"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "21e6f2ab2928ca4291b86736a8bd920a277a399bba1589409d72154ff87c1282"
|
checksum = "be040f8b0a225e40375822a563fa9524378b9d63112f53e19ffff34df5d33fdd"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"web-time",
|
"web-time",
|
||||||
"zeroize",
|
"zeroize",
|
||||||
@@ -2182,9 +2194,9 @@ checksum = "f87165f0995f63a9fbeea62b64d10b4d9d8e78ec6d7d51fb2125fda7bb36788f"
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "rustls-webpki"
|
name = "rustls-webpki"
|
||||||
version = "0.103.8"
|
version = "0.103.9"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "2ffdfa2f5286e2247234e03f680868ac2815974dc39e00ea15adc445d0aafe52"
|
checksum = "d7df23109aa6c1567d1c575b9952556388da57401e4ace1d15f79eedad0d8f53"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"aws-lc-rs",
|
"aws-lc-rs",
|
||||||
"ring",
|
"ring",
|
||||||
@@ -2238,14 +2250,14 @@ dependencies = [
|
|||||||
"proc-macro-error2",
|
"proc-macro-error2",
|
||||||
"proc-macro2",
|
"proc-macro2",
|
||||||
"quote",
|
"quote",
|
||||||
"syn 2.0.113",
|
"syn 2.0.114",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "sea-orm"
|
name = "sea-orm"
|
||||||
version = "2.0.0-rc.27"
|
version = "2.0.0-rc.28"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "25c0efc234bdf1f073cc9b448da21a22ed0ac7ff0958a0b3bc4994041dc059df"
|
checksum = "7fe6e5203d25568227d8dfbbfb362051e1ccac66bd5200538ed0f50f763cd980"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"async-stream",
|
"async-stream",
|
||||||
"async-trait",
|
"async-trait",
|
||||||
@@ -2267,7 +2279,7 @@ dependencies = [
|
|||||||
"serde_json",
|
"serde_json",
|
||||||
"sqlx",
|
"sqlx",
|
||||||
"strum",
|
"strum",
|
||||||
"thiserror 2.0.17",
|
"thiserror 2.0.18",
|
||||||
"time",
|
"time",
|
||||||
"tracing",
|
"tracing",
|
||||||
"url",
|
"url",
|
||||||
@@ -2276,9 +2288,9 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "sea-orm-cli"
|
name = "sea-orm-cli"
|
||||||
version = "2.0.0-rc.27"
|
version = "2.0.0-rc.28"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "f50ae78e4442db69930949a8bcf3b82b0e992c8ea389ae2b1d80504029adab5d"
|
checksum = "ebedf30b59f3f7ee88baabb157d824fd30c32ce3c8ff2512196848ba00e049f0"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"chrono",
|
"chrono",
|
||||||
"glob",
|
"glob",
|
||||||
@@ -2294,24 +2306,24 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "sea-orm-macros"
|
name = "sea-orm-macros"
|
||||||
version = "2.0.0-rc.27"
|
version = "2.0.0-rc.28"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "35b6ce0ae263925930d4e0f95e24a5a8b069dccc61a1ef68da26338470d94929"
|
checksum = "719c5ba754a5cb517f9ac6fc9f581bfb791ed1aabfc4e72faa9ab810922b87ad"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"heck 0.5.0",
|
"heck 0.5.0",
|
||||||
"pluralizer",
|
"pluralizer",
|
||||||
"proc-macro2",
|
"proc-macro2",
|
||||||
"quote",
|
"quote",
|
||||||
"sea-bae",
|
"sea-bae",
|
||||||
"syn 2.0.113",
|
"syn 2.0.114",
|
||||||
"unicode-ident",
|
"unicode-ident",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "sea-orm-migration"
|
name = "sea-orm-migration"
|
||||||
version = "2.0.0-rc.27"
|
version = "2.0.0-rc.28"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "433fa69cd3f8dc754a2dc51106aee10262fec84ac5195ff7d9966dd1c0d467bd"
|
checksum = "bf48f4281089ce7440f30a6617e0b7083e70f248a9bc1c46ab06ba113b5f41bb"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"async-trait",
|
"async-trait",
|
||||||
"sea-orm",
|
"sea-orm",
|
||||||
@@ -2347,8 +2359,8 @@ dependencies = [
|
|||||||
"heck 0.4.1",
|
"heck 0.4.1",
|
||||||
"proc-macro2",
|
"proc-macro2",
|
||||||
"quote",
|
"quote",
|
||||||
"syn 2.0.113",
|
"syn 2.0.114",
|
||||||
"thiserror 2.0.17",
|
"thiserror 2.0.18",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
@@ -2388,7 +2400,7 @@ dependencies = [
|
|||||||
"heck 0.4.1",
|
"heck 0.4.1",
|
||||||
"proc-macro2",
|
"proc-macro2",
|
||||||
"quote",
|
"quote",
|
||||||
"syn 2.0.113",
|
"syn 2.0.114",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
@@ -2399,9 +2411,9 @@ checksum = "1c107b6f4780854c8b126e228ea8869f4d7b71260f962fefb57b996b8959ba6b"
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "seamantic"
|
name = "seamantic"
|
||||||
version = "0.0.11"
|
version = "0.0.12"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "bc098b9f7e30531297bc6d38a6ee3fbffb43bcf584d87c95bc6a97413a8f9b8c"
|
checksum = "8aef218aa414c7e80eb2da413630109e87b2472e3fd41a1fd00b6283919034a6"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"sea-orm",
|
"sea-orm",
|
||||||
"sea-orm-migration",
|
"sea-orm-migration",
|
||||||
@@ -2463,14 +2475,14 @@ checksum = "d540f220d3187173da220f885ab66608367b6574e925011a9353e4badda91d79"
|
|||||||
dependencies = [
|
dependencies = [
|
||||||
"proc-macro2",
|
"proc-macro2",
|
||||||
"quote",
|
"quote",
|
||||||
"syn 2.0.113",
|
"syn 2.0.114",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "serde_json"
|
name = "serde_json"
|
||||||
version = "1.0.148"
|
version = "1.0.149"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "3084b546a1dd6289475996f182a22aba973866ea8e8b02c51d9f46b1336a22da"
|
checksum = "83fc039473c5595ace860d8c4fafa220ff474b3fc6bfdb4293327f1a37e94d86"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"itoa",
|
"itoa",
|
||||||
"memchr",
|
"memchr",
|
||||||
@@ -2658,7 +2670,7 @@ dependencies = [
|
|||||||
"serde_json",
|
"serde_json",
|
||||||
"sha2",
|
"sha2",
|
||||||
"smallvec",
|
"smallvec",
|
||||||
"thiserror 2.0.17",
|
"thiserror 2.0.18",
|
||||||
"time",
|
"time",
|
||||||
"tokio",
|
"tokio",
|
||||||
"tokio-stream",
|
"tokio-stream",
|
||||||
@@ -2678,7 +2690,7 @@ dependencies = [
|
|||||||
"quote",
|
"quote",
|
||||||
"sqlx-core",
|
"sqlx-core",
|
||||||
"sqlx-macros-core",
|
"sqlx-macros-core",
|
||||||
"syn 2.0.113",
|
"syn 2.0.114",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
@@ -2701,7 +2713,7 @@ dependencies = [
|
|||||||
"sqlx-mysql",
|
"sqlx-mysql",
|
||||||
"sqlx-postgres",
|
"sqlx-postgres",
|
||||||
"sqlx-sqlite",
|
"sqlx-sqlite",
|
||||||
"syn 2.0.113",
|
"syn 2.0.114",
|
||||||
"tokio",
|
"tokio",
|
||||||
"url",
|
"url",
|
||||||
]
|
]
|
||||||
@@ -2745,7 +2757,7 @@ dependencies = [
|
|||||||
"smallvec",
|
"smallvec",
|
||||||
"sqlx-core",
|
"sqlx-core",
|
||||||
"stringprep",
|
"stringprep",
|
||||||
"thiserror 2.0.17",
|
"thiserror 2.0.18",
|
||||||
"time",
|
"time",
|
||||||
"tracing",
|
"tracing",
|
||||||
"uuid",
|
"uuid",
|
||||||
@@ -2786,7 +2798,7 @@ dependencies = [
|
|||||||
"smallvec",
|
"smallvec",
|
||||||
"sqlx-core",
|
"sqlx-core",
|
||||||
"stringprep",
|
"stringprep",
|
||||||
"thiserror 2.0.17",
|
"thiserror 2.0.18",
|
||||||
"time",
|
"time",
|
||||||
"tracing",
|
"tracing",
|
||||||
"uuid",
|
"uuid",
|
||||||
@@ -2813,7 +2825,7 @@ dependencies = [
|
|||||||
"serde",
|
"serde",
|
||||||
"serde_urlencoded",
|
"serde_urlencoded",
|
||||||
"sqlx-core",
|
"sqlx-core",
|
||||||
"thiserror 2.0.17",
|
"thiserror 2.0.18",
|
||||||
"time",
|
"time",
|
||||||
"tracing",
|
"tracing",
|
||||||
"url",
|
"url",
|
||||||
@@ -2874,9 +2886,9 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "syn"
|
name = "syn"
|
||||||
version = "2.0.113"
|
version = "2.0.114"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "678faa00651c9eb72dd2020cbdf275d92eccb2400d568e419efdd64838145cb4"
|
checksum = "d4d107df263a3013ef9b1879b0df87d706ff80f65a86ea879bd9c31f9b307c2a"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"proc-macro2",
|
"proc-macro2",
|
||||||
"quote",
|
"quote",
|
||||||
@@ -2900,7 +2912,7 @@ checksum = "728a70f3dbaf5bab7f0c4b1ac8d7ae5ea60a4b5549c8a5914361c99147a709d2"
|
|||||||
dependencies = [
|
dependencies = [
|
||||||
"proc-macro2",
|
"proc-macro2",
|
||||||
"quote",
|
"quote",
|
||||||
"syn 2.0.113",
|
"syn 2.0.114",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
@@ -2920,11 +2932,11 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "thiserror"
|
name = "thiserror"
|
||||||
version = "2.0.17"
|
version = "2.0.18"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "f63587ca0f12b72a0600bcba1d40081f830876000bb46dd2337a3051618f4fc8"
|
checksum = "4288b5bcbc7920c07a1149a35cf9590a2aa808e0bc1eafaade0b80947865fbc4"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"thiserror-impl 2.0.17",
|
"thiserror-impl 2.0.18",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
@@ -2935,18 +2947,18 @@ checksum = "4fee6c4efc90059e10f81e6d42c60a18f76588c3d74cb83a0b242a2b6c7504c1"
|
|||||||
dependencies = [
|
dependencies = [
|
||||||
"proc-macro2",
|
"proc-macro2",
|
||||||
"quote",
|
"quote",
|
||||||
"syn 2.0.113",
|
"syn 2.0.114",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "thiserror-impl"
|
name = "thiserror-impl"
|
||||||
version = "2.0.17"
|
version = "2.0.18"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "3ff15c8ecd7de3849db632e14d18d2571fa09dfc5ed93479bc4485c7a517c913"
|
checksum = "ebc4ee7f67670e9b64d05fa4253e753e016c6c95ff35b89b7941d6b856dec1d5"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"proc-macro2",
|
"proc-macro2",
|
||||||
"quote",
|
"quote",
|
||||||
"syn 2.0.113",
|
"syn 2.0.114",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
@@ -2960,30 +2972,30 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "time"
|
name = "time"
|
||||||
version = "0.3.44"
|
version = "0.3.45"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "91e7d9e3bb61134e77bde20dd4825b97c010155709965fedf0f49bb138e52a9d"
|
checksum = "f9e442fc33d7fdb45aa9bfeb312c095964abdf596f7567261062b2a7107aaabd"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"deranged",
|
"deranged",
|
||||||
"itoa",
|
"itoa",
|
||||||
"num-conv",
|
"num-conv",
|
||||||
"powerfmt",
|
"powerfmt",
|
||||||
"serde",
|
"serde_core",
|
||||||
"time-core",
|
"time-core",
|
||||||
"time-macros",
|
"time-macros",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "time-core"
|
name = "time-core"
|
||||||
version = "0.1.6"
|
version = "0.1.7"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "40868e7c1d2f0b8d73e4a8c7f0ff63af4f6d19be117e90bd73eb1d62cf831c6b"
|
checksum = "8b36ee98fd31ec7426d599183e8fe26932a8dc1fb76ddb6214d05493377d34ca"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "time-macros"
|
name = "time-macros"
|
||||||
version = "0.2.24"
|
version = "0.2.25"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "30cfb0125f12d9c277f35663a0a33f8c30190f4e4574868a330595412d34ebf3"
|
checksum = "71e552d1249bf61ac2a52db88179fd0673def1e1ad8243a00d9ec9ed71fee3dd"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"num-conv",
|
"num-conv",
|
||||||
"time-core",
|
"time-core",
|
||||||
@@ -3037,7 +3049,7 @@ checksum = "af407857209536a95c8e56f8231ef2c2e2aff839b22e07a1ffcbc617e9db9fa5"
|
|||||||
dependencies = [
|
dependencies = [
|
||||||
"proc-macro2",
|
"proc-macro2",
|
||||||
"quote",
|
"quote",
|
||||||
"syn 2.0.113",
|
"syn 2.0.114",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
@@ -3063,9 +3075,9 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "toml"
|
name = "toml"
|
||||||
version = "0.9.10+spec-1.1.0"
|
version = "0.9.11+spec-1.1.0"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "0825052159284a1a8b4d6c0c86cbc801f2da5afd2b225fa548c72f2e74002f48"
|
checksum = "f3afc9a848309fe1aaffaed6e1546a7a14de1f935dc9d89d32afd9a44bab7c46"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"serde_core",
|
"serde_core",
|
||||||
"serde_spanned",
|
"serde_spanned",
|
||||||
@@ -3106,9 +3118,9 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "tower"
|
name = "tower"
|
||||||
version = "0.5.2"
|
version = "0.5.3"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "d039ad9159c98b70ecfd540b2573b97f7f52c3e8d9f8ad57a24b916a536975f9"
|
checksum = "ebe5ef63511595f1344e2d5cfa636d973292adc0eec1f0ad45fae9f0851ab1d4"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"futures-core",
|
"futures-core",
|
||||||
"futures-util",
|
"futures-util",
|
||||||
@@ -3169,7 +3181,7 @@ checksum = "7490cfa5ec963746568740651ac6781f701c9c5ea257c58e057f3ba8cf69e8da"
|
|||||||
dependencies = [
|
dependencies = [
|
||||||
"proc-macro2",
|
"proc-macro2",
|
||||||
"quote",
|
"quote",
|
||||||
"syn 2.0.113",
|
"syn 2.0.114",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
@@ -3249,9 +3261,9 @@ checksum = "8ecb6da28b8a351d773b68d5825ac39017e680750f980f3a1a85cd8dd28a47c1"
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "url"
|
name = "url"
|
||||||
version = "2.5.7"
|
version = "2.5.8"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "08bc136a29a3d1758e07a9cca267be308aeebf5cfd5a10f3f67ab2097683ef5b"
|
checksum = "ff67a8a4397373c3ef660812acab3268222035010ab8680ec4215f38ba3d0eed"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"form_urlencoded",
|
"form_urlencoded",
|
||||||
"idna",
|
"idna",
|
||||||
@@ -3330,9 +3342,9 @@ checksum = "ccf3ec651a847eb01de73ccad15eb7d99f80485de043efb2f370cd654f4ea44b"
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "wasip2"
|
name = "wasip2"
|
||||||
version = "1.0.1+wasi-0.2.4"
|
version = "1.0.2+wasi-0.2.9"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "0562428422c63773dad2c345a1882263bbf4d65cf3f42e90921f787ef5ad58e7"
|
checksum = "9517f9239f02c069db75e65f174b3da828fe5f5b945c4dd26bd25d89c03ebcf5"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"wit-bindgen",
|
"wit-bindgen",
|
||||||
]
|
]
|
||||||
@@ -3345,9 +3357,9 @@ checksum = "b8dad83b4f25e74f184f64c43b150b91efe7647395b42289f38e50566d82855b"
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "wasm-bindgen"
|
name = "wasm-bindgen"
|
||||||
version = "0.2.106"
|
version = "0.2.108"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "0d759f433fa64a2d763d1340820e46e111a7a5ab75f993d1852d70b03dbb80fd"
|
checksum = "64024a30ec1e37399cf85a7ffefebdb72205ca1c972291c51512360d90bd8566"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"cfg-if",
|
"cfg-if",
|
||||||
"once_cell",
|
"once_cell",
|
||||||
@@ -3358,11 +3370,12 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "wasm-bindgen-futures"
|
name = "wasm-bindgen-futures"
|
||||||
version = "0.4.56"
|
version = "0.4.58"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "836d9622d604feee9e5de25ac10e3ea5f2d65b41eac0d9ce72eb5deae707ce7c"
|
checksum = "70a6e77fd0ae8029c9ea0063f87c46fde723e7d887703d74ad2616d792e51e6f"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"cfg-if",
|
"cfg-if",
|
||||||
|
"futures-util",
|
||||||
"js-sys",
|
"js-sys",
|
||||||
"once_cell",
|
"once_cell",
|
||||||
"wasm-bindgen",
|
"wasm-bindgen",
|
||||||
@@ -3371,9 +3384,9 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "wasm-bindgen-macro"
|
name = "wasm-bindgen-macro"
|
||||||
version = "0.2.106"
|
version = "0.2.108"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "48cb0d2638f8baedbc542ed444afc0644a29166f1595371af4fecf8ce1e7eeb3"
|
checksum = "008b239d9c740232e71bd39e8ef6429d27097518b6b30bdf9086833bd5b6d608"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"quote",
|
"quote",
|
||||||
"wasm-bindgen-macro-support",
|
"wasm-bindgen-macro-support",
|
||||||
@@ -3381,31 +3394,31 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "wasm-bindgen-macro-support"
|
name = "wasm-bindgen-macro-support"
|
||||||
version = "0.2.106"
|
version = "0.2.108"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "cefb59d5cd5f92d9dcf80e4683949f15ca4b511f4ac0a6e14d4e1ac60c6ecd40"
|
checksum = "5256bae2d58f54820e6490f9839c49780dff84c65aeab9e772f15d5f0e913a55"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"bumpalo",
|
"bumpalo",
|
||||||
"proc-macro2",
|
"proc-macro2",
|
||||||
"quote",
|
"quote",
|
||||||
"syn 2.0.113",
|
"syn 2.0.114",
|
||||||
"wasm-bindgen-shared",
|
"wasm-bindgen-shared",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "wasm-bindgen-shared"
|
name = "wasm-bindgen-shared"
|
||||||
version = "0.2.106"
|
version = "0.2.108"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "cbc538057e648b67f72a982e708d485b2efa771e1ac05fec311f9f63e5800db4"
|
checksum = "1f01b580c9ac74c8d8f0c0e4afb04eeef2acf145458e52c03845ee9cd23e3d12"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"unicode-ident",
|
"unicode-ident",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "web-sys"
|
name = "web-sys"
|
||||||
version = "0.3.83"
|
version = "0.3.85"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "9b32828d774c412041098d182a8b38b16ea816958e07cf40eec2bc080ae137ac"
|
checksum = "312e32e551d92129218ea9a2452120f4aabc03529ef03e4d0d82fb2780608598"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"js-sys",
|
"js-sys",
|
||||||
"wasm-bindgen",
|
"wasm-bindgen",
|
||||||
@@ -3488,7 +3501,7 @@ checksum = "053e2e040ab57b9dc951b72c264860db7eb3b0200ba345b4e4c3b14f67855ddf"
|
|||||||
dependencies = [
|
dependencies = [
|
||||||
"proc-macro2",
|
"proc-macro2",
|
||||||
"quote",
|
"quote",
|
||||||
"syn 2.0.113",
|
"syn 2.0.114",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
@@ -3499,7 +3512,7 @@ checksum = "3f316c4a2570ba26bbec722032c4099d8c8bc095efccdc15688708623367e358"
|
|||||||
dependencies = [
|
dependencies = [
|
||||||
"proc-macro2",
|
"proc-macro2",
|
||||||
"quote",
|
"quote",
|
||||||
"syn 2.0.113",
|
"syn 2.0.114",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
@@ -3825,9 +3838,9 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "wit-bindgen"
|
name = "wit-bindgen"
|
||||||
version = "0.46.0"
|
version = "0.51.0"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "f17a85883d4e6d00e8a97c586de764dabcc06133f7f1d55dce5cdc070ad7fe59"
|
checksum = "d7249219f66ced02969388cf2bb044a09756a083d0fab1e566056b04d9fbcaa5"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "writeable"
|
name = "writeable"
|
||||||
@@ -3869,28 +3882,28 @@ checksum = "b659052874eb698efe5b9e8cf382204678a0086ebf46982b79d6ca3182927e5d"
|
|||||||
dependencies = [
|
dependencies = [
|
||||||
"proc-macro2",
|
"proc-macro2",
|
||||||
"quote",
|
"quote",
|
||||||
"syn 2.0.113",
|
"syn 2.0.114",
|
||||||
"synstructure",
|
"synstructure",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "zerocopy"
|
name = "zerocopy"
|
||||||
version = "0.8.31"
|
version = "0.8.33"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "fd74ec98b9250adb3ca554bdde269adf631549f51d8a8f8f0a10b50f1cb298c3"
|
checksum = "668f5168d10b9ee831de31933dc111a459c97ec93225beb307aed970d1372dfd"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"zerocopy-derive",
|
"zerocopy-derive",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "zerocopy-derive"
|
name = "zerocopy-derive"
|
||||||
version = "0.8.31"
|
version = "0.8.33"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "d8a8d209fdf45cf5138cbb5a506f6b52522a25afccc534d1475dad8e31105c6a"
|
checksum = "2c7962b26b0a8685668b671ee4b54d007a67d4eaf05fda79ac0ecf41e32270f1"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"proc-macro2",
|
"proc-macro2",
|
||||||
"quote",
|
"quote",
|
||||||
"syn 2.0.113",
|
"syn 2.0.114",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
@@ -3910,7 +3923,7 @@ checksum = "d71e5d6e06ab090c67b5e44993ec16b72dcbaabc526db883a360057678b48502"
|
|||||||
dependencies = [
|
dependencies = [
|
||||||
"proc-macro2",
|
"proc-macro2",
|
||||||
"quote",
|
"quote",
|
||||||
"syn 2.0.113",
|
"syn 2.0.114",
|
||||||
"synstructure",
|
"synstructure",
|
||||||
]
|
]
|
||||||
|
|
||||||
@@ -3950,11 +3963,11 @@ checksum = "eadce39539ca5cb3985590102671f2567e659fca9666581ad3411d59207951f3"
|
|||||||
dependencies = [
|
dependencies = [
|
||||||
"proc-macro2",
|
"proc-macro2",
|
||||||
"quote",
|
"quote",
|
||||||
"syn 2.0.113",
|
"syn 2.0.114",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "zmij"
|
name = "zmij"
|
||||||
version = "1.0.10"
|
version = "1.0.15"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "30e0d8dffbae3d840f64bda38e28391faef673a7b5a6017840f2a106c8145868"
|
checksum = "94f63c051f4fe3c1509da62131a678643c5b6fbdc9273b2b79d4378ebda003d2"
|
||||||
|
|||||||
+12
-8
@@ -4,30 +4,34 @@ members = ["crates/*"]
|
|||||||
|
|
||||||
[workspace.package]
|
[workspace.package]
|
||||||
edition = "2024"
|
edition = "2024"
|
||||||
rust-version = "1.87.0"
|
rust-version = "1.89.0"
|
||||||
license-file = "LICENSE.md"
|
license-file = "LICENSE.md"
|
||||||
|
|
||||||
[workspace.dependencies]
|
[workspace.dependencies]
|
||||||
anyhow = { version = "^1", default-features = false }
|
anyhow = { version = "^1", default-features = false }
|
||||||
async-stream = { version = "^0.3", default-features = false }
|
async-stream = { version = "^0.3", default-features = false }
|
||||||
|
bytes = { version = "^1", default-features = false }
|
||||||
chrono = { version = "^0.4", default-features = false }
|
chrono = { version = "^0.4", default-features = false }
|
||||||
clap = { version = "^4", default-features = false }
|
clap = { version = "^4", default-features = false }
|
||||||
flix = { path = "crates/flix", version = "=0.0.16", default-features = false }
|
either = { version = "^1", default-features = false }
|
||||||
flix-cli = { path = "crates/cli", version = "=0.0.16", default-features = false }
|
flix = { path = "crates/flix", version = "=0.0.17", default-features = false }
|
||||||
flix-db = { path = "crates/db", version = "=0.0.16", default-features = false }
|
flix-cli = { path = "crates/cli", version = "=0.0.17", default-features = false }
|
||||||
flix-fs = { path = "crates/fs", version = "=0.0.16", default-features = false }
|
flix-db = { path = "crates/db", version = "=0.0.17", default-features = false }
|
||||||
flix-model = { path = "crates/model", version = "=0.0.16", default-features = false }
|
flix-fs = { path = "crates/fs", version = "=0.0.17", default-features = false }
|
||||||
flix-tmdb = { path = "crates/tmdb", version = "=0.0.16", default-features = false }
|
flix-model = { path = "crates/model", version = "=0.0.17", default-features = false }
|
||||||
|
flix-tmdb = { path = "crates/tmdb", version = "=0.0.17", default-features = false }
|
||||||
futures = { version = "^0.3", default-features = false }
|
futures = { version = "^0.3", default-features = false }
|
||||||
governor = { version = "^0.10", default-features = false }
|
governor = { version = "^0.10", default-features = false }
|
||||||
itertools = { version = "^0.14", default-features = false }
|
itertools = { version = "^0.14", default-features = false }
|
||||||
nonzero_ext = { version = "^0.3", default-features = false }
|
nonzero_ext = { version = "^0.3", default-features = false }
|
||||||
|
redb = { version = "^3", default-features = false }
|
||||||
regex = { version = "^1", default-features = false }
|
regex = { version = "^1", default-features = false }
|
||||||
reqwest = { version = "^0.13", default-features = false }
|
reqwest = { version = "^0.13", default-features = false }
|
||||||
sea-orm = { version = "2.0.0-rc.27", default-features = false }
|
sea-orm = { version = "2.0.0-rc.27", default-features = false }
|
||||||
sea-orm-migration = { version = "2.0.0-rc.27", default-features = false }
|
sea-orm-migration = { version = "2.0.0-rc.27", default-features = false }
|
||||||
seamantic = { version = "^0.0.11", default-features = false }
|
seamantic = { version = "^0.0.12", default-features = false }
|
||||||
serde = { version = "^1", default-features = false }
|
serde = { version = "^1", default-features = false }
|
||||||
|
serde_json = { version = "^1", default-features = false }
|
||||||
serde_test = { version = "^1", default-features = false }
|
serde_test = { version = "^1", default-features = false }
|
||||||
thiserror = { version = "^2", default-features = false }
|
thiserror = { version = "^2", default-features = false }
|
||||||
tokio = { version = "^1", default-features = false }
|
tokio = { version = "^1", default-features = false }
|
||||||
|
|||||||
@@ -7,9 +7,13 @@ Libraries and tools for dealing with media metadata
|
|||||||
- build: `cargo hack --feature-powerset build`
|
- build: `cargo hack --feature-powerset build`
|
||||||
- clippy: `cargo hack --feature-powerset clippy -- -D warnings`
|
- clippy: `cargo hack --feature-powerset clippy -- -D warnings`
|
||||||
- test: `cargo hack --feature-powerset test`
|
- test: `cargo hack --feature-powerset test`
|
||||||
- test old: `cargo +1.87 hack --feature-powerset test`
|
- test old: `cargo +1.89 hack --feature-powerset test`
|
||||||
- fmt: `cargo fmt --check`
|
- fmt: `cargo fmt --check`
|
||||||
- docs: `RUSTDOCFLAGS="--cfg docsrs" cargo +nightly doc --all-features`
|
- docs: `RUSTDOCFLAGS="--cfg docsrs" cargo +nightly doc --all-features`
|
||||||
- install: `cargo install --path crates/cli`
|
- install: `cargo install --path crates/cli`
|
||||||
- semver: `cargo semver-checks --all-features`
|
- semver: `cargo semver-checks --all-features`
|
||||||
- publish: `cargo publish --dry-run --workspace`
|
- publish: `cargo publish --dry-run --workspace`
|
||||||
|
|
||||||
|
## Building flix.db
|
||||||
|
|
||||||
|
`./flix.sh`
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
[package]
|
[package]
|
||||||
name = "flix-cli"
|
name = "flix-cli"
|
||||||
version = "0.0.16"
|
version = "0.0.17"
|
||||||
edition.workspace = true
|
edition.workspace = true
|
||||||
rust-version.workspace = true
|
rust-version.workspace = true
|
||||||
description = "CLI for interacting with a flix database"
|
description = "CLI for interacting with a flix database"
|
||||||
|
|||||||
@@ -1,12 +1,30 @@
|
|||||||
|
use flix::model::numbers::{EpisodeNumber, SeasonNumber};
|
||||||
|
|
||||||
|
use chrono::NaiveDate;
|
||||||
use clap::Subcommand;
|
use clap::Subcommand;
|
||||||
|
|
||||||
#[derive(Subcommand)]
|
#[derive(Subcommand)]
|
||||||
pub enum AddCommand {
|
pub enum AddCommand {
|
||||||
/// Process a flix collection
|
/// Add a flix collection
|
||||||
Collection {
|
Collection {
|
||||||
#[arg(value_name = "TITLE")]
|
#[arg(value_name = "TITLE")]
|
||||||
title: String,
|
title: String,
|
||||||
#[arg(value_name = "OVERVIEW")]
|
#[arg(value_name = "OVERVIEW")]
|
||||||
overview: String,
|
overview: String,
|
||||||
},
|
},
|
||||||
|
/// Add a flix episode
|
||||||
|
Episode {
|
||||||
|
#[arg(value_name = "SHOW_WEB_SLUG")]
|
||||||
|
show_slug: String,
|
||||||
|
#[arg(value_name = "NUMBER")]
|
||||||
|
season_number: SeasonNumber,
|
||||||
|
#[arg(value_name = "NUMBER")]
|
||||||
|
episode_number: EpisodeNumber,
|
||||||
|
#[arg(value_name = "TITLE")]
|
||||||
|
title: String,
|
||||||
|
#[arg(value_name = "OVERVIEW")]
|
||||||
|
overview: String,
|
||||||
|
#[arg(value_name = "DATE")]
|
||||||
|
air_date: NaiveDate,
|
||||||
|
},
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
use std::path::PathBuf;
|
use std::path::{Path, PathBuf};
|
||||||
|
|
||||||
use anyhow::{Result, anyhow};
|
use anyhow::{Result, anyhow};
|
||||||
use clap::{Parser, Subcommand};
|
use clap::{Args, Parser, Subcommand};
|
||||||
|
|
||||||
pub mod flix;
|
pub mod flix;
|
||||||
pub mod tmdb;
|
pub mod tmdb;
|
||||||
@@ -13,8 +13,12 @@ pub struct Cli {
|
|||||||
#[arg(short, long, value_name = "FILE", default_value = "~/.flix")]
|
#[arg(short, long, value_name = "FILE", default_value = "~/.flix")]
|
||||||
config: PathBuf,
|
config: PathBuf,
|
||||||
|
|
||||||
|
/// Use a custom cache file
|
||||||
|
#[arg(short = 'C', long, value_name = "FILE", default_value = "./flix.redb")]
|
||||||
|
cache: PathBuf,
|
||||||
|
|
||||||
/// Use a custom database file
|
/// Use a custom database file
|
||||||
#[arg(short, long, value_name = "DATABASE", default_value = "./flix.db")]
|
#[arg(short, long, value_name = "FILE", default_value = "./flix.db")]
|
||||||
database: PathBuf,
|
database: PathBuf,
|
||||||
|
|
||||||
/// Enable tracing
|
/// Enable tracing
|
||||||
@@ -38,6 +42,10 @@ impl Cli {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub fn cache_path(&self) -> &Path {
|
||||||
|
&self.cache
|
||||||
|
}
|
||||||
|
|
||||||
pub fn database_path(&self) -> Result<String> {
|
pub fn database_path(&self) -> Result<String> {
|
||||||
self.database
|
self.database
|
||||||
.as_os_str()
|
.as_os_str()
|
||||||
@@ -51,12 +59,26 @@ impl Cli {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[derive(Args)]
|
||||||
|
pub struct AddOverrides {
|
||||||
|
#[arg(long)]
|
||||||
|
pub title: Option<String>,
|
||||||
|
#[arg(long)]
|
||||||
|
pub sort_title: Option<String>,
|
||||||
|
#[arg(long)]
|
||||||
|
pub fs_slug: Option<String>,
|
||||||
|
#[arg(long)]
|
||||||
|
pub web_slug: Option<String>,
|
||||||
|
}
|
||||||
|
|
||||||
#[derive(Subcommand)]
|
#[derive(Subcommand)]
|
||||||
pub enum Command {
|
pub enum Command {
|
||||||
/// Initialize a new database
|
/// Initialize a new database
|
||||||
Init,
|
Init,
|
||||||
/// Add new items to the database
|
/// Add new items to the database
|
||||||
Add {
|
Add {
|
||||||
|
#[command(flatten)]
|
||||||
|
overrides: AddOverrides,
|
||||||
#[command(subcommand)]
|
#[command(subcommand)]
|
||||||
command: AddCommand,
|
command: AddCommand,
|
||||||
},
|
},
|
||||||
|
|||||||
+20
-6
@@ -1,6 +1,7 @@
|
|||||||
use std::path::PathBuf;
|
use std::path::PathBuf;
|
||||||
|
use std::rc::Rc;
|
||||||
|
|
||||||
use flix::tmdb::Client;
|
use flix::tmdb::{self, CachePolicy, Client, RedbCache};
|
||||||
|
|
||||||
use anyhow::{Context, Result};
|
use anyhow::{Context, Result};
|
||||||
use clap::Parser;
|
use clap::Parser;
|
||||||
@@ -12,6 +13,8 @@ use cli::{AddCommand, Cli, Command, DeleteCommand, UpdateCommand};
|
|||||||
mod config;
|
mod config;
|
||||||
use config::Config;
|
use config::Config;
|
||||||
|
|
||||||
|
use crate::cli::AddOverrides;
|
||||||
|
|
||||||
mod db;
|
mod db;
|
||||||
mod run;
|
mod run;
|
||||||
|
|
||||||
@@ -26,7 +29,11 @@ async fn main() -> Result<()> {
|
|||||||
|
|
||||||
let database_path = cli.database_path()?;
|
let database_path = cli.database_path()?;
|
||||||
|
|
||||||
let client = Client::new(config.tmdb().bearer_token().to_owned());
|
let client = Client::new(
|
||||||
|
tmdb::Config::new(config.tmdb().bearer_token().to_owned()),
|
||||||
|
Rc::new(RedbCache::new(cli.cache_path())?),
|
||||||
|
CachePolicy::Full,
|
||||||
|
);
|
||||||
|
|
||||||
if cli.trace {
|
if cli.trace {
|
||||||
tracing_subscriber::fmt()
|
tracing_subscriber::fmt()
|
||||||
@@ -37,7 +44,9 @@ async fn main() -> Result<()> {
|
|||||||
|
|
||||||
match cli.command() {
|
match cli.command() {
|
||||||
Command::Init => exec_init(database_path).await?,
|
Command::Init => exec_init(database_path).await?,
|
||||||
Command::Add { command } => exec_add(client, database_path, command).await?,
|
Command::Add { command, overrides } => {
|
||||||
|
exec_add(client, database_path, command, overrides).await?
|
||||||
|
}
|
||||||
Command::Update { command } => exec_update(client, database_path, command).await?,
|
Command::Update { command } => exec_update(client, database_path, command).await?,
|
||||||
Command::Delete { command } => exec_delete(client, database_path, command).await?,
|
Command::Delete { command } => exec_delete(client, database_path, command).await?,
|
||||||
Command::Backup { output } => exec_backup(database_path, output).await?,
|
Command::Backup { output } => exec_backup(database_path, output).await?,
|
||||||
@@ -53,15 +62,20 @@ async fn exec_init(database_path: String) -> Result<()> {
|
|||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
async fn exec_add(client: Client, database_path: String, command: AddCommand) -> Result<()> {
|
async fn exec_add(
|
||||||
|
client: Client,
|
||||||
|
database_path: String,
|
||||||
|
command: AddCommand,
|
||||||
|
overrides: AddOverrides,
|
||||||
|
) -> Result<()> {
|
||||||
let database = db::open(database_path).await?;
|
let database = db::open(database_path).await?;
|
||||||
|
|
||||||
match command {
|
match command {
|
||||||
AddCommand::Flix { command } => {
|
AddCommand::Flix { command } => {
|
||||||
run::flix::add(database.as_ref(), command).await?;
|
run::flix::add(database.as_ref(), command, overrides).await?;
|
||||||
}
|
}
|
||||||
AddCommand::Tmdb { command } => {
|
AddCommand::Tmdb { command } => {
|
||||||
run::tmdb::add(client, database.as_ref(), command).await?;
|
run::tmdb::add(client, database.as_ref(), command, overrides).await?;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,23 +1,35 @@
|
|||||||
use flix::db::entity;
|
use flix::db::entity;
|
||||||
use flix::model::id::CollectionId;
|
use flix::model::id::{CollectionId, ShowId};
|
||||||
|
use flix::model::numbers::{EpisodeNumber, SeasonNumber};
|
||||||
use flix::model::text;
|
use flix::model::text;
|
||||||
|
|
||||||
use anyhow::Result;
|
use anyhow::Result;
|
||||||
use sea_orm::ActiveValue::{NotSet, Set};
|
use sea_orm::ActiveValue::{NotSet, Set};
|
||||||
use sea_orm::{ActiveModelTrait, DatabaseConnection, DbErr, TransactionError, TransactionTrait};
|
use sea_orm::{ActiveModelTrait, DatabaseConnection, DbErr, TransactionError, TransactionTrait};
|
||||||
|
|
||||||
|
use crate::cli::AddOverrides;
|
||||||
use crate::cli::flix::AddCommand;
|
use crate::cli::flix::AddCommand;
|
||||||
|
|
||||||
pub async fn add(db: &DatabaseConnection, command: AddCommand) -> Result<()> {
|
pub async fn add(
|
||||||
|
db: &DatabaseConnection,
|
||||||
|
command: AddCommand,
|
||||||
|
overrides: AddOverrides,
|
||||||
|
) -> Result<()> {
|
||||||
match command {
|
match command {
|
||||||
AddCommand::Collection { title, overview } => {
|
AddCommand::Collection { title, overview } => {
|
||||||
let result: Result<CollectionId, TransactionError<DbErr>> = db
|
let result: Result<CollectionId, TransactionError<DbErr>> = db
|
||||||
.transaction(|txn| {
|
.transaction(|txn| {
|
||||||
let title = title.clone();
|
let title = overrides.title.unwrap_or_else(|| title.clone());
|
||||||
|
|
||||||
let sort_title = text::make_sortable_title(&title);
|
let sort_title = overrides
|
||||||
let fs_slug = text::make_fs_slug(&title);
|
.sort_title
|
||||||
let web_slug = text::make_web_slug(&title);
|
.unwrap_or_else(|| text::make_sortable_title(&title));
|
||||||
|
let fs_slug = overrides
|
||||||
|
.fs_slug
|
||||||
|
.unwrap_or_else(|| text::make_fs_slug(&title));
|
||||||
|
let web_slug = overrides
|
||||||
|
.web_slug
|
||||||
|
.unwrap_or_else(|| text::make_web_slug(&title));
|
||||||
|
|
||||||
Box::pin(async move {
|
Box::pin(async move {
|
||||||
let flix = entity::info::collections::ActiveModel {
|
let flix = entity::info::collections::ActiveModel {
|
||||||
@@ -43,6 +55,57 @@ pub async fn add(db: &DatabaseConnection, command: AddCommand) -> Result<()> {
|
|||||||
};
|
};
|
||||||
println!("Created Collection: {} [{}]", title, flix_id.into_raw());
|
println!("Created Collection: {} [{}]", title, flix_id.into_raw());
|
||||||
|
|
||||||
|
Ok(())
|
||||||
|
}
|
||||||
|
AddCommand::Episode {
|
||||||
|
show_slug,
|
||||||
|
season_number,
|
||||||
|
episode_number,
|
||||||
|
title,
|
||||||
|
overview,
|
||||||
|
air_date,
|
||||||
|
} => {
|
||||||
|
let result: Result<(ShowId, SeasonNumber, EpisodeNumber), TransactionError<DbErr>> = db
|
||||||
|
.transaction(|txn| {
|
||||||
|
let title = overrides.title.unwrap_or_else(|| title.clone());
|
||||||
|
|
||||||
|
Box::pin(async move {
|
||||||
|
let show = entity::info::shows::Entity::find_by_web_slug(&show_slug)
|
||||||
|
.one(txn)
|
||||||
|
.await?
|
||||||
|
.ok_or_else(|| {
|
||||||
|
DbErr::Custom(format!("show '{}' does not exist", show_slug))
|
||||||
|
})?;
|
||||||
|
|
||||||
|
let flix = entity::info::episodes::ActiveModel {
|
||||||
|
show_id: Set(show.id),
|
||||||
|
season_number: Set(season_number),
|
||||||
|
episode_number: Set(episode_number),
|
||||||
|
title: Set(title),
|
||||||
|
overview: Set(overview),
|
||||||
|
date: Set(air_date),
|
||||||
|
}
|
||||||
|
.insert(txn)
|
||||||
|
.await?;
|
||||||
|
|
||||||
|
Ok((flix.show_id, flix.season_number, flix.episode_number))
|
||||||
|
})
|
||||||
|
})
|
||||||
|
.await;
|
||||||
|
|
||||||
|
let (flix_show, season_number, episode_number) = match result {
|
||||||
|
Ok(id) => id,
|
||||||
|
Err(TransactionError::Connection(err)) => Err(err)?,
|
||||||
|
Err(TransactionError::Transaction(err)) => Err(err)?,
|
||||||
|
};
|
||||||
|
println!(
|
||||||
|
"Created Episode: {} [{} S{} E{}]",
|
||||||
|
title,
|
||||||
|
flix_show.into_raw(),
|
||||||
|
season_number,
|
||||||
|
episode_number
|
||||||
|
);
|
||||||
|
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+45
-18
@@ -16,9 +16,15 @@ use sea_orm::{
|
|||||||
ActiveModelTrait, DatabaseConnection, DbErr, EntityTrait, TransactionError, TransactionTrait,
|
ActiveModelTrait, DatabaseConnection, DbErr, EntityTrait, TransactionError, TransactionTrait,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
use crate::cli::AddOverrides;
|
||||||
use crate::cli::tmdb::Command;
|
use crate::cli::tmdb::Command;
|
||||||
|
|
||||||
pub async fn add(client: Client, db: &DatabaseConnection, command: Command) -> Result<()> {
|
pub async fn add(
|
||||||
|
client: Client,
|
||||||
|
db: &DatabaseConnection,
|
||||||
|
command: Command,
|
||||||
|
overrides: AddOverrides,
|
||||||
|
) -> Result<()> {
|
||||||
match command {
|
match command {
|
||||||
Command::Collection { id } => {
|
Command::Collection { id } => {
|
||||||
let id = TmdbCollectionId::from_raw(id);
|
let id = TmdbCollectionId::from_raw(id);
|
||||||
@@ -36,18 +42,25 @@ pub async fn add(client: Client, db: &DatabaseConnection, command: Command) -> R
|
|||||||
.await
|
.await
|
||||||
.with_context(|| format!("collections().get_details({})", id.into_raw()))?;
|
.with_context(|| format!("collections().get_details({})", id.into_raw()))?;
|
||||||
|
|
||||||
let title = collection.title.clone();
|
let title = overrides.title.unwrap_or(collection.title);
|
||||||
|
|
||||||
let sort_title = text::make_sortable_title(&title);
|
let sort_title = overrides
|
||||||
let fs_slug = text::make_fs_slug(&title);
|
.sort_title
|
||||||
let web_slug = text::make_web_slug(&title);
|
.unwrap_or_else(|| text::make_sortable_title(&title));
|
||||||
|
let fs_slug = overrides
|
||||||
|
.fs_slug
|
||||||
|
.unwrap_or_else(|| text::make_fs_slug(&title));
|
||||||
|
let web_slug = overrides
|
||||||
|
.web_slug
|
||||||
|
.unwrap_or_else(|| text::make_web_slug(&title));
|
||||||
|
|
||||||
let result: Result<CollectionId, TransactionError<DbErr>> = db
|
let result: Result<CollectionId, TransactionError<DbErr>> = db
|
||||||
.transaction(|txn| {
|
.transaction(|txn| {
|
||||||
|
let title = title.clone();
|
||||||
Box::pin(async move {
|
Box::pin(async move {
|
||||||
let flix = entity::info::collections::ActiveModel {
|
let flix = entity::info::collections::ActiveModel {
|
||||||
id: NotSet,
|
id: NotSet,
|
||||||
title: Set(collection.title),
|
title: Set(title),
|
||||||
overview: Set(collection.overview),
|
overview: Set(collection.overview),
|
||||||
sort_title: Set(sort_title),
|
sort_title: Set(sort_title),
|
||||||
fs_slug: Set(fs_slug),
|
fs_slug: Set(fs_slug),
|
||||||
@@ -93,19 +106,26 @@ pub async fn add(client: Client, db: &DatabaseConnection, command: Command) -> R
|
|||||||
.await
|
.await
|
||||||
.with_context(|| format!("movies().get_details({})", id.into_raw()))?;
|
.with_context(|| format!("movies().get_details({})", id.into_raw()))?;
|
||||||
|
|
||||||
let title = movie.title.clone();
|
let title = overrides.title.unwrap_or(movie.title);
|
||||||
let year = movie.release_date.year();
|
let year = movie.release_date.year();
|
||||||
|
|
||||||
let sort_title = text::make_sortable_title(&title);
|
let sort_title = overrides
|
||||||
let fs_slug = text::make_fs_slug_year(&title, year);
|
.sort_title
|
||||||
let web_slug = text::make_web_slug_year(&title, year);
|
.unwrap_or_else(|| text::make_sortable_title(&title));
|
||||||
|
let fs_slug = overrides
|
||||||
|
.fs_slug
|
||||||
|
.unwrap_or_else(|| text::make_fs_slug_year(&title, year));
|
||||||
|
let web_slug = overrides
|
||||||
|
.web_slug
|
||||||
|
.unwrap_or_else(|| text::make_web_slug_year(&title, year));
|
||||||
|
|
||||||
let result: Result<MovieId, TransactionError<DbErr>> = db
|
let result: Result<MovieId, TransactionError<DbErr>> = db
|
||||||
.transaction(|txn| {
|
.transaction(|txn| {
|
||||||
|
let title = title.clone();
|
||||||
Box::pin(async move {
|
Box::pin(async move {
|
||||||
let flix = entity::info::movies::ActiveModel {
|
let flix = entity::info::movies::ActiveModel {
|
||||||
id: NotSet,
|
id: NotSet,
|
||||||
title: Set(movie.title),
|
title: Set(title),
|
||||||
tagline: Set(movie.tagline),
|
tagline: Set(movie.tagline),
|
||||||
overview: Set(movie.overview),
|
overview: Set(movie.overview),
|
||||||
date: Set(movie.release_date),
|
date: Set(movie.release_date),
|
||||||
@@ -161,9 +181,6 @@ pub async fn add(client: Client, db: &DatabaseConnection, command: Command) -> R
|
|||||||
let mut seasons = Vec::new();
|
let mut seasons = Vec::new();
|
||||||
let mut episodes = HashMap::new();
|
let mut episodes = HashMap::new();
|
||||||
|
|
||||||
let title = show.title.clone();
|
|
||||||
let year = show.first_air_date.year();
|
|
||||||
|
|
||||||
for season in 1..=show.number_of_seasons {
|
for season in 1..=show.number_of_seasons {
|
||||||
let season = SeasonNumber::new(season);
|
let season = SeasonNumber::new(season);
|
||||||
let season = match client
|
let season = match client
|
||||||
@@ -218,16 +235,26 @@ pub async fn add(client: Client, db: &DatabaseConnection, command: Command) -> R
|
|||||||
seasons.push(season);
|
seasons.push(season);
|
||||||
}
|
}
|
||||||
|
|
||||||
let sort_title = text::make_sortable_title(&show.title);
|
let title = overrides.title.unwrap_or(show.title);
|
||||||
let fs_slug = text::make_fs_slug_year(&show.title, show.first_air_date.year());
|
let year = show.first_air_date.year();
|
||||||
let web_slug = text::make_web_slug_year(&show.title, show.first_air_date.year());
|
|
||||||
|
let sort_title = overrides
|
||||||
|
.sort_title
|
||||||
|
.unwrap_or_else(|| text::make_sortable_title(&title));
|
||||||
|
let fs_slug = overrides
|
||||||
|
.fs_slug
|
||||||
|
.unwrap_or_else(|| text::make_fs_slug_year(&title, year));
|
||||||
|
let web_slug = overrides
|
||||||
|
.web_slug
|
||||||
|
.unwrap_or_else(|| text::make_web_slug_year(&title, year));
|
||||||
|
|
||||||
let result: Result<ShowId, TransactionError<DbErr>> = db
|
let result: Result<ShowId, TransactionError<DbErr>> = db
|
||||||
.transaction(|txn| {
|
.transaction(|txn| {
|
||||||
|
let title = title.clone();
|
||||||
Box::pin(async move {
|
Box::pin(async move {
|
||||||
let flix = entity::info::shows::ActiveModel {
|
let flix = entity::info::shows::ActiveModel {
|
||||||
id: NotSet,
|
id: NotSet,
|
||||||
title: Set(show.title),
|
title: Set(title),
|
||||||
tagline: Set(show.tagline),
|
tagline: Set(show.tagline),
|
||||||
overview: Set(show.overview),
|
overview: Set(show.overview),
|
||||||
date: Set(show.first_air_date),
|
date: Set(show.first_air_date),
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
[package]
|
[package]
|
||||||
name = "flix-db"
|
name = "flix-db"
|
||||||
version = "0.0.16"
|
version = "0.0.17"
|
||||||
edition.workspace = true
|
edition.workspace = true
|
||||||
rust-version.workspace = true
|
rust-version.workspace = true
|
||||||
description = "Types for storing persistent data about media"
|
description = "Types for storing persistent data about media"
|
||||||
|
|||||||
@@ -7,6 +7,8 @@ pub mod collections {
|
|||||||
|
|
||||||
use sea_orm::entity::prelude::*;
|
use sea_orm::entity::prelude::*;
|
||||||
|
|
||||||
|
use crate::entity;
|
||||||
|
|
||||||
/// The database representation of a flix collection
|
/// The database representation of a flix collection
|
||||||
#[sea_orm::model]
|
#[sea_orm::model]
|
||||||
#[derive(Debug, Clone, DeriveEntityModel)]
|
#[derive(Debug, Clone, DeriveEntityModel)]
|
||||||
@@ -29,6 +31,10 @@ pub mod collections {
|
|||||||
/// The url-safe slug
|
/// The url-safe slug
|
||||||
#[sea_orm(indexed, unique)]
|
#[sea_orm(indexed, unique)]
|
||||||
pub web_slug: String,
|
pub web_slug: String,
|
||||||
|
|
||||||
|
/// Potential content for this collection
|
||||||
|
#[sea_orm(has_one)]
|
||||||
|
pub content: HasOne<entity::content::collections::Entity>,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl ActiveModelBehavior for ActiveModel {}
|
impl ActiveModelBehavior for ActiveModel {}
|
||||||
@@ -41,6 +47,8 @@ pub mod movies {
|
|||||||
use chrono::NaiveDate;
|
use chrono::NaiveDate;
|
||||||
use sea_orm::entity::prelude::*;
|
use sea_orm::entity::prelude::*;
|
||||||
|
|
||||||
|
use crate::entity;
|
||||||
|
|
||||||
/// The database representation of a flix movie
|
/// The database representation of a flix movie
|
||||||
#[sea_orm::model]
|
#[sea_orm::model]
|
||||||
#[derive(Debug, Clone, DeriveEntityModel)]
|
#[derive(Debug, Clone, DeriveEntityModel)]
|
||||||
@@ -68,6 +76,10 @@ pub mod movies {
|
|||||||
/// The url-safe slug
|
/// The url-safe slug
|
||||||
#[sea_orm(indexed, unique)]
|
#[sea_orm(indexed, unique)]
|
||||||
pub web_slug: String,
|
pub web_slug: String,
|
||||||
|
|
||||||
|
/// Potential content for this movie
|
||||||
|
#[sea_orm(has_one)]
|
||||||
|
pub content: HasOne<entity::content::movies::Entity>,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl ActiveModelBehavior for ActiveModel {}
|
impl ActiveModelBehavior for ActiveModel {}
|
||||||
@@ -80,6 +92,8 @@ pub mod shows {
|
|||||||
use chrono::NaiveDate;
|
use chrono::NaiveDate;
|
||||||
use sea_orm::entity::prelude::*;
|
use sea_orm::entity::prelude::*;
|
||||||
|
|
||||||
|
use crate::entity;
|
||||||
|
|
||||||
/// The database representation of a flix show
|
/// The database representation of a flix show
|
||||||
#[sea_orm::model]
|
#[sea_orm::model]
|
||||||
#[derive(Debug, Clone, DeriveEntityModel)]
|
#[derive(Debug, Clone, DeriveEntityModel)]
|
||||||
@@ -114,6 +128,10 @@ pub mod shows {
|
|||||||
/// Episodes that are part of this show
|
/// Episodes that are part of this show
|
||||||
#[sea_orm(has_many)]
|
#[sea_orm(has_many)]
|
||||||
pub episodes: HasMany<super::episodes::Entity>,
|
pub episodes: HasMany<super::episodes::Entity>,
|
||||||
|
|
||||||
|
/// Potential content for this show
|
||||||
|
#[sea_orm(has_one)]
|
||||||
|
pub content: HasOne<entity::content::shows::Entity>,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl ActiveModelBehavior for ActiveModel {}
|
impl ActiveModelBehavior for ActiveModel {}
|
||||||
@@ -127,6 +145,8 @@ pub mod seasons {
|
|||||||
use chrono::NaiveDate;
|
use chrono::NaiveDate;
|
||||||
use sea_orm::entity::prelude::*;
|
use sea_orm::entity::prelude::*;
|
||||||
|
|
||||||
|
use crate::entity;
|
||||||
|
|
||||||
/// The database representation of a flix season
|
/// The database representation of a flix season
|
||||||
#[sea_orm::model]
|
#[sea_orm::model]
|
||||||
#[derive(Debug, Clone, DeriveEntityModel)]
|
#[derive(Debug, Clone, DeriveEntityModel)]
|
||||||
@@ -158,6 +178,10 @@ pub mod seasons {
|
|||||||
/// Episodes that are part of this season
|
/// Episodes that are part of this season
|
||||||
#[sea_orm(has_many)]
|
#[sea_orm(has_many)]
|
||||||
pub episodes: HasMany<super::episodes::Entity>,
|
pub episodes: HasMany<super::episodes::Entity>,
|
||||||
|
|
||||||
|
/// Potential content for this season
|
||||||
|
#[sea_orm(has_one)]
|
||||||
|
pub content: HasOne<entity::content::seasons::Entity>,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl ActiveModelBehavior for ActiveModel {}
|
impl ActiveModelBehavior for ActiveModel {}
|
||||||
@@ -171,6 +195,8 @@ pub mod episodes {
|
|||||||
use chrono::NaiveDate;
|
use chrono::NaiveDate;
|
||||||
use sea_orm::entity::prelude::*;
|
use sea_orm::entity::prelude::*;
|
||||||
|
|
||||||
|
use crate::entity;
|
||||||
|
|
||||||
/// The database representation of a flix episode
|
/// The database representation of a flix episode
|
||||||
#[sea_orm::model]
|
#[sea_orm::model]
|
||||||
#[derive(Debug, Clone, DeriveEntityModel)]
|
#[derive(Debug, Clone, DeriveEntityModel)]
|
||||||
@@ -211,6 +237,10 @@ pub mod episodes {
|
|||||||
on_delete = "Cascade"
|
on_delete = "Cascade"
|
||||||
)]
|
)]
|
||||||
pub season: HasOne<super::seasons::Entity>,
|
pub season: HasOne<super::seasons::Entity>,
|
||||||
|
|
||||||
|
/// Potential content for this episode
|
||||||
|
#[sea_orm(has_one)]
|
||||||
|
pub content: HasOne<entity::content::episodes::Entity>,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl ActiveModelBehavior for ActiveModel {}
|
impl ActiveModelBehavior for ActiveModel {}
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
[package]
|
[package]
|
||||||
name = "flix"
|
name = "flix"
|
||||||
version = "0.0.16"
|
version = "0.0.17"
|
||||||
edition.workspace = true
|
edition.workspace = true
|
||||||
rust-version.workspace = true
|
rust-version.workspace = true
|
||||||
description = "Mechanisms for interacting with flix media"
|
description = "Mechanisms for interacting with flix media"
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
[package]
|
[package]
|
||||||
name = "flix-fs"
|
name = "flix-fs"
|
||||||
version = "0.0.16"
|
version = "0.0.17"
|
||||||
edition.workspace = true
|
edition.workspace = true
|
||||||
rust-version.workspace = true
|
rust-version.workspace = true
|
||||||
description = "Filesystem scanner for flix media"
|
description = "Filesystem scanner for flix media"
|
||||||
@@ -14,6 +14,7 @@ rustdoc-args = ["--cfg", "docsrs"]
|
|||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
async-stream = { workspace = true }
|
async-stream = { workspace = true }
|
||||||
|
either = { workspace = true }
|
||||||
flix-model = { workspace = true }
|
flix-model = { workspace = true }
|
||||||
regex = { workspace = true, features = ["perf", "std"] }
|
regex = { workspace = true, features = ["perf", "std"] }
|
||||||
thiserror = { workspace = true }
|
thiserror = { workspace = true }
|
||||||
|
|||||||
@@ -4,8 +4,7 @@ use core::pin::Pin;
|
|||||||
use std::ffi::OsStr;
|
use std::ffi::OsStr;
|
||||||
use std::path::Path;
|
use std::path::Path;
|
||||||
|
|
||||||
use flix_model::id::{CollectionId, MovieId, ShowId};
|
use flix_model::id::CollectionId;
|
||||||
use flix_model::numbers::{EpisodeNumbers, SeasonNumber};
|
|
||||||
|
|
||||||
use async_stream::stream;
|
use async_stream::stream;
|
||||||
use tokio::fs;
|
use tokio::fs;
|
||||||
@@ -14,7 +13,9 @@ use tokio_stream::wrappers::ReadDirStream;
|
|||||||
|
|
||||||
use crate::Error;
|
use crate::Error;
|
||||||
use crate::macros::is_image_extension;
|
use crate::macros::is_image_extension;
|
||||||
use crate::scanner::{generic, movie, show};
|
use crate::scanner::{
|
||||||
|
CollectionScan, EpisodeScan, MediaRef, MovieScan, SeasonScan, ShowScan, generic, movie, show,
|
||||||
|
};
|
||||||
|
|
||||||
/// A collection item
|
/// A collection item
|
||||||
pub type Item = crate::Item<Scanner>;
|
pub type Item = crate::Item<Scanner>;
|
||||||
@@ -22,74 +23,21 @@ pub type Item = crate::Item<Scanner>;
|
|||||||
/// The scanner for collections
|
/// The scanner for collections
|
||||||
pub enum Scanner {
|
pub enum Scanner {
|
||||||
/// A scanned collection
|
/// A scanned collection
|
||||||
Collection {
|
Collection(CollectionScan),
|
||||||
/// The ID of the parent collection (if any)
|
|
||||||
parent: Option<CollectionId>,
|
|
||||||
/// The ID of the collection
|
|
||||||
id: CollectionId,
|
|
||||||
/// The file name of the poster file
|
|
||||||
poster_file_name: Option<String>,
|
|
||||||
},
|
|
||||||
|
|
||||||
/// A scanned movie
|
/// A scanned movie
|
||||||
Movie {
|
Movie(MovieScan),
|
||||||
/// The ID of the parent collection (if any)
|
|
||||||
parent: Option<CollectionId>,
|
|
||||||
/// The ID of the movie
|
|
||||||
id: MovieId,
|
|
||||||
/// The file name of the media file
|
|
||||||
media_file_name: String,
|
|
||||||
/// The file name of the poster file
|
|
||||||
poster_file_name: Option<String>,
|
|
||||||
},
|
|
||||||
|
|
||||||
/// A scanned show
|
/// A scanned show
|
||||||
Show {
|
Show(ShowScan),
|
||||||
/// The ID of the parent collection (if any)
|
|
||||||
parent: Option<CollectionId>,
|
|
||||||
/// The ID of the show
|
|
||||||
id: ShowId,
|
|
||||||
/// The file name of the poster file
|
|
||||||
poster_file_name: Option<String>,
|
|
||||||
},
|
|
||||||
/// A scanned episode
|
/// A scanned episode
|
||||||
Season {
|
Season(SeasonScan),
|
||||||
/// The ID of the show this season belongs to
|
|
||||||
show: ShowId,
|
|
||||||
/// The number of this season
|
|
||||||
season: SeasonNumber,
|
|
||||||
/// The file name of the poster file
|
|
||||||
poster_file_name: Option<String>,
|
|
||||||
},
|
|
||||||
/// A scanned episode
|
/// A scanned episode
|
||||||
Episode {
|
Episode(EpisodeScan),
|
||||||
/// The ID of the show this episode belongs to
|
|
||||||
show: ShowId,
|
|
||||||
/// The season this episode belongs to
|
|
||||||
season: SeasonNumber,
|
|
||||||
/// The number(s) of this episode
|
|
||||||
episode: EpisodeNumbers,
|
|
||||||
/// The file name of the media file
|
|
||||||
media_file_name: String,
|
|
||||||
/// The file name of the poster file
|
|
||||||
poster_file_name: Option<String>,
|
|
||||||
},
|
|
||||||
}
|
}
|
||||||
|
|
||||||
impl From<movie::Scanner> for Scanner {
|
impl From<movie::Scanner> for Scanner {
|
||||||
fn from(value: movie::Scanner) -> Self {
|
fn from(value: movie::Scanner) -> Self {
|
||||||
match value {
|
match value {
|
||||||
movie::Scanner::Movie {
|
movie::Scanner::Movie(m) => Self::Movie(m),
|
||||||
parent,
|
|
||||||
id,
|
|
||||||
media_file_name,
|
|
||||||
poster_file_name,
|
|
||||||
} => Self::Movie {
|
|
||||||
parent,
|
|
||||||
id,
|
|
||||||
media_file_name,
|
|
||||||
poster_file_name,
|
|
||||||
},
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -97,37 +45,9 @@ impl From<movie::Scanner> for Scanner {
|
|||||||
impl From<show::Scanner> for Scanner {
|
impl From<show::Scanner> for Scanner {
|
||||||
fn from(value: show::Scanner) -> Self {
|
fn from(value: show::Scanner) -> Self {
|
||||||
match value {
|
match value {
|
||||||
show::Scanner::Show {
|
show::Scanner::Show(s) => Self::Show(s),
|
||||||
parent,
|
show::Scanner::Season(s) => Self::Season(s),
|
||||||
id,
|
show::Scanner::Episode(e) => Self::Episode(e),
|
||||||
poster_file_name,
|
|
||||||
} => Self::Show {
|
|
||||||
parent,
|
|
||||||
id,
|
|
||||||
poster_file_name,
|
|
||||||
},
|
|
||||||
show::Scanner::Season {
|
|
||||||
show,
|
|
||||||
season,
|
|
||||||
poster_file_name,
|
|
||||||
} => Self::Season {
|
|
||||||
show,
|
|
||||||
season,
|
|
||||||
poster_file_name,
|
|
||||||
},
|
|
||||||
show::Scanner::Episode {
|
|
||||||
show,
|
|
||||||
season,
|
|
||||||
episode,
|
|
||||||
media_file_name,
|
|
||||||
poster_file_name,
|
|
||||||
} => Self::Episode {
|
|
||||||
show,
|
|
||||||
season,
|
|
||||||
episode,
|
|
||||||
media_file_name,
|
|
||||||
poster_file_name,
|
|
||||||
},
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -135,57 +55,11 @@ impl From<show::Scanner> for Scanner {
|
|||||||
impl From<generic::Scanner> for Scanner {
|
impl From<generic::Scanner> for Scanner {
|
||||||
fn from(value: generic::Scanner) -> Self {
|
fn from(value: generic::Scanner) -> Self {
|
||||||
match value {
|
match value {
|
||||||
generic::Scanner::Collection {
|
generic::Scanner::Collection(c) => Self::Collection(c),
|
||||||
parent,
|
generic::Scanner::Movie(m) => Self::Movie(m),
|
||||||
id,
|
generic::Scanner::Show(s) => Self::Show(s),
|
||||||
poster_file_name,
|
generic::Scanner::Season(s) => Self::Season(s),
|
||||||
} => Self::Collection {
|
generic::Scanner::Episode(e) => Self::Episode(e),
|
||||||
parent,
|
|
||||||
id,
|
|
||||||
poster_file_name,
|
|
||||||
},
|
|
||||||
generic::Scanner::Movie {
|
|
||||||
parent,
|
|
||||||
id,
|
|
||||||
media_file_name,
|
|
||||||
poster_file_name,
|
|
||||||
} => Self::Movie {
|
|
||||||
parent,
|
|
||||||
id,
|
|
||||||
media_file_name,
|
|
||||||
poster_file_name,
|
|
||||||
},
|
|
||||||
generic::Scanner::Show {
|
|
||||||
parent,
|
|
||||||
id,
|
|
||||||
poster_file_name,
|
|
||||||
} => Self::Show {
|
|
||||||
parent,
|
|
||||||
id,
|
|
||||||
poster_file_name,
|
|
||||||
},
|
|
||||||
generic::Scanner::Season {
|
|
||||||
show,
|
|
||||||
season,
|
|
||||||
poster_file_name,
|
|
||||||
} => Self::Season {
|
|
||||||
show,
|
|
||||||
season,
|
|
||||||
poster_file_name,
|
|
||||||
},
|
|
||||||
generic::Scanner::Episode {
|
|
||||||
show,
|
|
||||||
season,
|
|
||||||
episode,
|
|
||||||
media_file_name,
|
|
||||||
poster_file_name,
|
|
||||||
} => Self::Episode {
|
|
||||||
show,
|
|
||||||
season,
|
|
||||||
episode,
|
|
||||||
media_file_name,
|
|
||||||
poster_file_name,
|
|
||||||
},
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -194,8 +68,8 @@ impl Scanner {
|
|||||||
/// Scan a folder for a collection
|
/// Scan a folder for a collection
|
||||||
pub fn scan_collection(
|
pub fn scan_collection(
|
||||||
path: &Path,
|
path: &Path,
|
||||||
parent: Option<CollectionId>,
|
parent_ref: Option<MediaRef<CollectionId>>,
|
||||||
id: CollectionId,
|
id_ref: MediaRef<CollectionId>,
|
||||||
) -> Pin<Box<impl Stream<Item = Item>>> {
|
) -> Pin<Box<impl Stream<Item = Item>>> {
|
||||||
Box::pin(stream!({
|
Box::pin(stream!({
|
||||||
let dirs = match fs::read_dir(path).await {
|
let dirs = match fs::read_dir(path).await {
|
||||||
@@ -266,15 +140,17 @@ impl Scanner {
|
|||||||
|
|
||||||
yield Item {
|
yield Item {
|
||||||
path: path.to_owned(),
|
path: path.to_owned(),
|
||||||
event: Ok(Self::Collection {
|
event: Ok(Self::Collection(CollectionScan {
|
||||||
parent,
|
parent_ref,
|
||||||
id,
|
id_ref: id_ref.clone(),
|
||||||
poster_file_name,
|
poster_file_name,
|
||||||
}),
|
})),
|
||||||
};
|
};
|
||||||
|
|
||||||
for subdir in subdirs_to_scan {
|
for subdir in subdirs_to_scan {
|
||||||
for await event in generic::Scanner::scan_detect_folder(&subdir, Some(id)) {
|
for await event in
|
||||||
|
generic::Scanner::scan_detect_folder(&subdir, Some(id_ref.clone()))
|
||||||
|
{
|
||||||
yield event.map(|e| e.into());
|
yield event.map(|e| e.into());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -13,6 +13,7 @@ use tokio_stream::wrappers::ReadDirStream;
|
|||||||
|
|
||||||
use crate::Error;
|
use crate::Error;
|
||||||
use crate::macros::{is_image_extension, is_media_extension};
|
use crate::macros::{is_image_extension, is_media_extension};
|
||||||
|
use crate::scanner::{EpisodeScan, MediaRef};
|
||||||
|
|
||||||
/// An episode item
|
/// An episode item
|
||||||
pub type Item = crate::Item<Scanner>;
|
pub type Item = crate::Item<Scanner>;
|
||||||
@@ -20,25 +21,14 @@ pub type Item = crate::Item<Scanner>;
|
|||||||
/// The scanner for epispdes
|
/// The scanner for epispdes
|
||||||
pub enum Scanner {
|
pub enum Scanner {
|
||||||
/// A scanned episode
|
/// A scanned episode
|
||||||
Episode {
|
Episode(EpisodeScan),
|
||||||
/// The ID of the show this episode belongs to
|
|
||||||
show: ShowId,
|
|
||||||
/// The season this episode belongs to
|
|
||||||
season: SeasonNumber,
|
|
||||||
/// The number(s) of this episode
|
|
||||||
episode: EpisodeNumbers,
|
|
||||||
/// The file name of the media file
|
|
||||||
media_file_name: String,
|
|
||||||
/// The file name of the poster file
|
|
||||||
poster_file_name: Option<String>,
|
|
||||||
},
|
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Scanner {
|
impl Scanner {
|
||||||
/// Scan a folder for an episode
|
/// Scan a folder for an episode
|
||||||
pub fn scan_episode(
|
pub fn scan_episode(
|
||||||
path: &Path,
|
path: &Path,
|
||||||
show: ShowId,
|
show_ref: MediaRef<ShowId>,
|
||||||
season: SeasonNumber,
|
season: SeasonNumber,
|
||||||
episode: EpisodeNumbers,
|
episode: EpisodeNumbers,
|
||||||
) -> impl Stream<Item = Item> {
|
) -> impl Stream<Item = Item> {
|
||||||
@@ -135,13 +125,13 @@ impl Scanner {
|
|||||||
|
|
||||||
yield Item {
|
yield Item {
|
||||||
path: path.to_owned(),
|
path: path.to_owned(),
|
||||||
event: Ok(Self::Episode {
|
event: Ok(Self::Episode(EpisodeScan {
|
||||||
show,
|
show_ref,
|
||||||
season,
|
season,
|
||||||
episode,
|
episode,
|
||||||
media_file_name,
|
media_file_name,
|
||||||
poster_file_name,
|
poster_file_name,
|
||||||
}),
|
})),
|
||||||
};
|
};
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,16 +6,18 @@ use std::path::Path;
|
|||||||
use std::sync::OnceLock;
|
use std::sync::OnceLock;
|
||||||
|
|
||||||
use flix_model::id::{CollectionId, MovieId, RawId, ShowId};
|
use flix_model::id::{CollectionId, MovieId, RawId, ShowId};
|
||||||
use flix_model::numbers::{EpisodeNumbers, SeasonNumber};
|
|
||||||
|
|
||||||
use async_stream::stream;
|
use async_stream::stream;
|
||||||
|
use either::Either;
|
||||||
use regex::Regex;
|
use regex::Regex;
|
||||||
use tokio::fs;
|
use tokio::fs;
|
||||||
use tokio_stream::Stream;
|
use tokio_stream::Stream;
|
||||||
use tokio_stream::wrappers::ReadDirStream;
|
use tokio_stream::wrappers::ReadDirStream;
|
||||||
|
|
||||||
use crate::Error;
|
use crate::Error;
|
||||||
use crate::scanner::{collection, movie, show};
|
use crate::scanner::{
|
||||||
|
CollectionScan, EpisodeScan, MediaRef, MovieScan, SeasonScan, ShowScan, collection, movie, show,
|
||||||
|
};
|
||||||
|
|
||||||
static MEDIA_FOLDER_REGEX: OnceLock<Regex> = OnceLock::new();
|
static MEDIA_FOLDER_REGEX: OnceLock<Regex> = OnceLock::new();
|
||||||
static SEASON_FOLDER_REGEX: OnceLock<Regex> = OnceLock::new();
|
static SEASON_FOLDER_REGEX: OnceLock<Regex> = OnceLock::new();
|
||||||
@@ -24,116 +26,28 @@ static SEASON_FOLDER_REGEX: OnceLock<Regex> = OnceLock::new();
|
|||||||
pub type Item = crate::Item<Scanner>;
|
pub type Item = crate::Item<Scanner>;
|
||||||
|
|
||||||
/// The scanner for collections
|
/// The scanner for collections
|
||||||
|
#[derive(Debug)]
|
||||||
pub enum Scanner {
|
pub enum Scanner {
|
||||||
/// A scanned collection
|
/// A scanned collection
|
||||||
Collection {
|
Collection(CollectionScan),
|
||||||
/// The ID of the parent collection (if any)
|
|
||||||
parent: Option<CollectionId>,
|
|
||||||
/// The ID of the collection
|
|
||||||
id: CollectionId,
|
|
||||||
/// The file name of the poster file
|
|
||||||
poster_file_name: Option<String>,
|
|
||||||
},
|
|
||||||
|
|
||||||
/// A scanned movie
|
/// A scanned movie
|
||||||
Movie {
|
Movie(MovieScan),
|
||||||
/// The ID of the parent collection (if any)
|
|
||||||
parent: Option<CollectionId>,
|
|
||||||
/// The ID of the movie
|
|
||||||
id: MovieId,
|
|
||||||
/// The file name of the media file
|
|
||||||
media_file_name: String,
|
|
||||||
/// The file name of the poster file
|
|
||||||
poster_file_name: Option<String>,
|
|
||||||
},
|
|
||||||
|
|
||||||
/// A scanned show
|
/// A scanned show
|
||||||
Show {
|
Show(ShowScan),
|
||||||
/// The ID of the parent collection (if any)
|
|
||||||
parent: Option<CollectionId>,
|
|
||||||
/// The ID of the show
|
|
||||||
id: ShowId,
|
|
||||||
/// The file name of the poster file
|
|
||||||
poster_file_name: Option<String>,
|
|
||||||
},
|
|
||||||
/// A scanned episode
|
/// A scanned episode
|
||||||
Season {
|
Season(SeasonScan),
|
||||||
/// The ID of the show this season belongs to
|
|
||||||
show: ShowId,
|
|
||||||
/// The season this episode belongs to
|
|
||||||
season: SeasonNumber,
|
|
||||||
/// The file name of the poster file
|
|
||||||
poster_file_name: Option<String>,
|
|
||||||
},
|
|
||||||
/// A scanned episode
|
/// A scanned episode
|
||||||
Episode {
|
Episode(EpisodeScan),
|
||||||
/// The ID of the show this episode belongs to
|
|
||||||
show: ShowId,
|
|
||||||
/// The season this episode belongs to
|
|
||||||
season: SeasonNumber,
|
|
||||||
/// The number(s) of this episode
|
|
||||||
episode: EpisodeNumbers,
|
|
||||||
/// The file name of the media file
|
|
||||||
media_file_name: String,
|
|
||||||
/// The file name of the poster file
|
|
||||||
poster_file_name: Option<String>,
|
|
||||||
},
|
|
||||||
}
|
}
|
||||||
|
|
||||||
impl From<collection::Scanner> for Scanner {
|
impl From<collection::Scanner> for Scanner {
|
||||||
fn from(value: collection::Scanner) -> Self {
|
fn from(value: collection::Scanner) -> Self {
|
||||||
match value {
|
match value {
|
||||||
collection::Scanner::Collection {
|
collection::Scanner::Collection(c) => Self::Collection(c),
|
||||||
parent,
|
collection::Scanner::Movie(m) => Self::Movie(m),
|
||||||
id,
|
collection::Scanner::Show(s) => Self::Show(s),
|
||||||
poster_file_name,
|
collection::Scanner::Season(s) => Self::Season(s),
|
||||||
} => Self::Collection {
|
collection::Scanner::Episode(e) => Self::Episode(e),
|
||||||
parent,
|
|
||||||
id,
|
|
||||||
poster_file_name,
|
|
||||||
},
|
|
||||||
collection::Scanner::Movie {
|
|
||||||
parent,
|
|
||||||
id,
|
|
||||||
media_file_name,
|
|
||||||
poster_file_name,
|
|
||||||
} => Self::Movie {
|
|
||||||
parent,
|
|
||||||
id,
|
|
||||||
media_file_name,
|
|
||||||
poster_file_name,
|
|
||||||
},
|
|
||||||
collection::Scanner::Show {
|
|
||||||
parent,
|
|
||||||
id,
|
|
||||||
poster_file_name,
|
|
||||||
} => Self::Show {
|
|
||||||
parent,
|
|
||||||
id,
|
|
||||||
poster_file_name,
|
|
||||||
},
|
|
||||||
collection::Scanner::Season {
|
|
||||||
show,
|
|
||||||
season,
|
|
||||||
poster_file_name,
|
|
||||||
} => Self::Season {
|
|
||||||
show,
|
|
||||||
season,
|
|
||||||
poster_file_name,
|
|
||||||
},
|
|
||||||
collection::Scanner::Episode {
|
|
||||||
show,
|
|
||||||
season,
|
|
||||||
episode,
|
|
||||||
media_file_name,
|
|
||||||
poster_file_name,
|
|
||||||
} => Self::Episode {
|
|
||||||
show,
|
|
||||||
season,
|
|
||||||
episode,
|
|
||||||
media_file_name,
|
|
||||||
poster_file_name,
|
|
||||||
},
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -141,17 +55,7 @@ impl From<collection::Scanner> for Scanner {
|
|||||||
impl From<movie::Scanner> for Scanner {
|
impl From<movie::Scanner> for Scanner {
|
||||||
fn from(value: movie::Scanner) -> Self {
|
fn from(value: movie::Scanner) -> Self {
|
||||||
match value {
|
match value {
|
||||||
movie::Scanner::Movie {
|
movie::Scanner::Movie(m) => Self::Movie(m),
|
||||||
parent,
|
|
||||||
id,
|
|
||||||
media_file_name,
|
|
||||||
poster_file_name,
|
|
||||||
} => Self::Movie {
|
|
||||||
parent,
|
|
||||||
id,
|
|
||||||
media_file_name,
|
|
||||||
poster_file_name,
|
|
||||||
},
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -159,42 +63,22 @@ impl From<movie::Scanner> for Scanner {
|
|||||||
impl From<show::Scanner> for Scanner {
|
impl From<show::Scanner> for Scanner {
|
||||||
fn from(value: show::Scanner) -> Self {
|
fn from(value: show::Scanner) -> Self {
|
||||||
match value {
|
match value {
|
||||||
show::Scanner::Show {
|
show::Scanner::Show(s) => Self::Show(s),
|
||||||
parent,
|
show::Scanner::Season(s) => Self::Season(s),
|
||||||
id,
|
show::Scanner::Episode(e) => Self::Episode(e),
|
||||||
poster_file_name,
|
|
||||||
} => Self::Show {
|
|
||||||
parent,
|
|
||||||
id,
|
|
||||||
poster_file_name,
|
|
||||||
},
|
|
||||||
show::Scanner::Season {
|
|
||||||
show,
|
|
||||||
season,
|
|
||||||
poster_file_name,
|
|
||||||
} => Self::Season {
|
|
||||||
show,
|
|
||||||
season,
|
|
||||||
poster_file_name,
|
|
||||||
},
|
|
||||||
show::Scanner::Episode {
|
|
||||||
show,
|
|
||||||
season,
|
|
||||||
episode,
|
|
||||||
media_file_name,
|
|
||||||
poster_file_name,
|
|
||||||
} => Self::Episode {
|
|
||||||
show,
|
|
||||||
season,
|
|
||||||
episode,
|
|
||||||
media_file_name,
|
|
||||||
poster_file_name,
|
|
||||||
},
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Scanner {
|
impl Scanner {
|
||||||
|
/// Helper function for stripping allowed numerical prefixes for sorting ("01 - ")
|
||||||
|
fn strip_numeric_prefix(mut s: &str) -> &str {
|
||||||
|
while let Some('0'..='9') = s.chars().next() {
|
||||||
|
s = &s[1..]
|
||||||
|
}
|
||||||
|
s.strip_prefix(" - ").unwrap_or(s)
|
||||||
|
}
|
||||||
|
|
||||||
/// Detect the type of a folder and call the correct scanner. Use
|
/// Detect the type of a folder and call the correct scanner. Use
|
||||||
/// this only for detecting possibly ambiguous media:
|
/// this only for detecting possibly ambiguous media:
|
||||||
/// - Collections
|
/// - Collections
|
||||||
@@ -202,7 +86,7 @@ impl Scanner {
|
|||||||
/// - Shows
|
/// - Shows
|
||||||
pub fn scan_detect_folder(
|
pub fn scan_detect_folder(
|
||||||
path: &Path,
|
path: &Path,
|
||||||
parent: Option<CollectionId>,
|
parent: Option<MediaRef<CollectionId>>,
|
||||||
) -> impl Stream<Item = Item> {
|
) -> impl Stream<Item = Item> {
|
||||||
enum MediaType {
|
enum MediaType {
|
||||||
Collection,
|
Collection,
|
||||||
@@ -211,7 +95,7 @@ impl Scanner {
|
|||||||
}
|
}
|
||||||
|
|
||||||
let media_folder_re = MEDIA_FOLDER_REGEX.get_or_init(|| {
|
let media_folder_re = MEDIA_FOLDER_REGEX.get_or_init(|| {
|
||||||
Regex::new(r"^[[[:alnum:]]' -]+ \([[:digit:]]+\) \[[[:digit:]]+\]$")
|
Regex::new(r"^[[[:alnum:]]' -]+ \([[:digit:]]+\)( \[[[:digit:]]+\])?$")
|
||||||
.unwrap_or_else(|err| panic!("regex is invalid: {err}"))
|
.unwrap_or_else(|err| panic!("regex is invalid: {err}"))
|
||||||
});
|
});
|
||||||
let season_folder_re = SEASON_FOLDER_REGEX.get_or_init(|| {
|
let season_folder_re = SEASON_FOLDER_REGEX.get_or_init(|| {
|
||||||
@@ -227,17 +111,24 @@ impl Scanner {
|
|||||||
return;
|
return;
|
||||||
};
|
};
|
||||||
|
|
||||||
let Some(Ok(id)) = dir_name
|
let dir_name = Self::strip_numeric_prefix(dir_name);
|
||||||
|
|
||||||
|
// Use the explicit ID ("[X]") if it exists, otherwise parse the folder name
|
||||||
|
let media_id = if let Some((id_str, _)) = dir_name
|
||||||
.split_once('[')
|
.split_once('[')
|
||||||
.and_then(|(_, s)| s.split_once(']'))
|
.and_then(|(_, s)| s.split_once(']'))
|
||||||
.map(|(s, _)| s.parse::<RawId>())
|
{
|
||||||
else {
|
let Ok(id) = id_str.parse::<RawId>() else {
|
||||||
yield Item {
|
yield Item {
|
||||||
path: path.to_owned(),
|
path: path.to_owned(),
|
||||||
event: Err(Error::UnexpectedFolder),
|
event: Err(Error::UnexpectedFolder),
|
||||||
};
|
};
|
||||||
return;
|
return;
|
||||||
};
|
};
|
||||||
|
Either::Left(id)
|
||||||
|
} else {
|
||||||
|
Either::Right(flix_model::text::normalize_fs_name(dir_name))
|
||||||
|
};
|
||||||
|
|
||||||
let media_type: MediaType;
|
let media_type: MediaType;
|
||||||
if media_folder_re.is_match(dir_name) {
|
if media_folder_re.is_match(dir_name) {
|
||||||
@@ -306,24 +197,32 @@ impl Scanner {
|
|||||||
|
|
||||||
match media_type {
|
match media_type {
|
||||||
MediaType::Collection => {
|
MediaType::Collection => {
|
||||||
for await event in collection::Scanner::scan_collection(
|
let id = match media_id {
|
||||||
path,
|
Either::Left(raw) => MediaRef::Id(CollectionId::from_raw(raw)),
|
||||||
parent,
|
Either::Right(slug) => MediaRef::Slug(slug),
|
||||||
CollectionId::from_raw(id),
|
};
|
||||||
) {
|
|
||||||
|
for await event in collection::Scanner::scan_collection(path, parent, id) {
|
||||||
yield event.map(|e| e.into());
|
yield event.map(|e| e.into());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
MediaType::Movie => {
|
MediaType::Movie => {
|
||||||
for await event in
|
let id = match media_id {
|
||||||
movie::Scanner::scan_movie(path, parent, MovieId::from_raw(id))
|
Either::Left(raw) => MediaRef::Id(MovieId::from_raw(raw)),
|
||||||
{
|
Either::Right(slug) => MediaRef::Slug(slug),
|
||||||
|
};
|
||||||
|
|
||||||
|
for await event in movie::Scanner::scan_movie(path, parent, id) {
|
||||||
yield event.map(|e| e.into());
|
yield event.map(|e| e.into());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
MediaType::Show => {
|
MediaType::Show => {
|
||||||
for await event in show::Scanner::scan_show(path, parent, ShowId::from_raw(id))
|
let id = match media_id {
|
||||||
{
|
Either::Left(raw) => MediaRef::Id(ShowId::from_raw(raw)),
|
||||||
|
Either::Right(slug) => MediaRef::Slug(slug),
|
||||||
|
};
|
||||||
|
|
||||||
|
for await event in show::Scanner::scan_show(path, parent, id) {
|
||||||
yield event.map(|e| e.into());
|
yield event.map(|e| e.into());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,6 +3,9 @@
|
|||||||
//! The most common scanner to use is [generic::Scanner] which will
|
//! The most common scanner to use is [generic::Scanner] which will
|
||||||
//! automatically detect and use the appropriate scanner.
|
//! automatically detect and use the appropriate scanner.
|
||||||
|
|
||||||
|
use flix_model::id::{CollectionId, MovieId, ShowId};
|
||||||
|
use flix_model::numbers::{EpisodeNumbers, SeasonNumber};
|
||||||
|
|
||||||
pub mod library;
|
pub mod library;
|
||||||
|
|
||||||
pub mod generic;
|
pub mod generic;
|
||||||
@@ -14,3 +17,73 @@ pub mod movie;
|
|||||||
pub mod episode;
|
pub mod episode;
|
||||||
pub mod season;
|
pub mod season;
|
||||||
pub mod show;
|
pub mod show;
|
||||||
|
|
||||||
|
/// A reference to a piece of media
|
||||||
|
#[derive(Debug, Clone)]
|
||||||
|
pub enum MediaRef<ID> {
|
||||||
|
/// An explicit ID
|
||||||
|
Id(ID),
|
||||||
|
/// A filesystem slug
|
||||||
|
Slug(String),
|
||||||
|
}
|
||||||
|
|
||||||
|
/// A scanned collection
|
||||||
|
#[derive(Debug)]
|
||||||
|
pub struct CollectionScan {
|
||||||
|
/// The ID of the parent collection (if any)
|
||||||
|
pub parent_ref: Option<MediaRef<CollectionId>>,
|
||||||
|
/// The ID of the collection
|
||||||
|
pub id_ref: MediaRef<CollectionId>,
|
||||||
|
/// The file name of the poster file
|
||||||
|
pub poster_file_name: Option<String>,
|
||||||
|
}
|
||||||
|
|
||||||
|
/// A scanned movie
|
||||||
|
#[derive(Debug)]
|
||||||
|
pub struct MovieScan {
|
||||||
|
/// The ID of the parent collection (if any)
|
||||||
|
pub parent_ref: Option<MediaRef<CollectionId>>,
|
||||||
|
/// The ID of the movie
|
||||||
|
pub id_ref: MediaRef<MovieId>,
|
||||||
|
/// The file name of the media file
|
||||||
|
pub media_file_name: String,
|
||||||
|
/// The file name of the poster file
|
||||||
|
pub poster_file_name: Option<String>,
|
||||||
|
}
|
||||||
|
|
||||||
|
/// A scanned show
|
||||||
|
#[derive(Debug)]
|
||||||
|
pub struct ShowScan {
|
||||||
|
/// The ID of the parent collection (if any)
|
||||||
|
pub parent_ref: Option<MediaRef<CollectionId>>,
|
||||||
|
/// The ID of the show
|
||||||
|
pub id_ref: MediaRef<ShowId>,
|
||||||
|
/// The file name of the poster file
|
||||||
|
pub poster_file_name: Option<String>,
|
||||||
|
}
|
||||||
|
|
||||||
|
/// A scanned season
|
||||||
|
#[derive(Debug)]
|
||||||
|
pub struct SeasonScan {
|
||||||
|
/// The ID of the show this season belongs to
|
||||||
|
pub show_ref: MediaRef<ShowId>,
|
||||||
|
/// The season this episode belongs to
|
||||||
|
pub season: SeasonNumber,
|
||||||
|
/// The file name of the poster file
|
||||||
|
pub poster_file_name: Option<String>,
|
||||||
|
}
|
||||||
|
|
||||||
|
/// A scanned episode
|
||||||
|
#[derive(Debug)]
|
||||||
|
pub struct EpisodeScan {
|
||||||
|
/// The ID of the show this episode belongs to
|
||||||
|
pub show_ref: MediaRef<ShowId>,
|
||||||
|
/// The season this episode belongs to
|
||||||
|
pub season: SeasonNumber,
|
||||||
|
/// The number(s) of this episode
|
||||||
|
pub episode: EpisodeNumbers,
|
||||||
|
/// The file name of the media file
|
||||||
|
pub media_file_name: String,
|
||||||
|
/// The file name of the poster file
|
||||||
|
pub poster_file_name: Option<String>,
|
||||||
|
}
|
||||||
|
|||||||
@@ -12,6 +12,7 @@ use tokio_stream::wrappers::ReadDirStream;
|
|||||||
|
|
||||||
use crate::Error;
|
use crate::Error;
|
||||||
use crate::macros::{is_image_extension, is_media_extension};
|
use crate::macros::{is_image_extension, is_media_extension};
|
||||||
|
use crate::scanner::{MediaRef, MovieScan};
|
||||||
|
|
||||||
/// An movie item
|
/// An movie item
|
||||||
pub type Item = crate::Item<Scanner>;
|
pub type Item = crate::Item<Scanner>;
|
||||||
@@ -19,24 +20,15 @@ pub type Item = crate::Item<Scanner>;
|
|||||||
/// The scanner for movies
|
/// The scanner for movies
|
||||||
pub enum Scanner {
|
pub enum Scanner {
|
||||||
/// A scanned movie
|
/// A scanned movie
|
||||||
Movie {
|
Movie(MovieScan),
|
||||||
/// The ID of the parent collection (if any)
|
|
||||||
parent: Option<CollectionId>,
|
|
||||||
/// The ID of the movie
|
|
||||||
id: MovieId,
|
|
||||||
/// The file name of the media file
|
|
||||||
media_file_name: String,
|
|
||||||
/// The file name of the poster file
|
|
||||||
poster_file_name: Option<String>,
|
|
||||||
},
|
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Scanner {
|
impl Scanner {
|
||||||
/// Scan a folder for a movie
|
/// Scan a folder for a movie
|
||||||
pub fn scan_movie(
|
pub fn scan_movie(
|
||||||
path: &Path,
|
path: &Path,
|
||||||
parent: Option<CollectionId>,
|
parent_ref: Option<MediaRef<CollectionId>>,
|
||||||
id: MovieId,
|
id_ref: MediaRef<MovieId>,
|
||||||
) -> impl Stream<Item = Item> {
|
) -> impl Stream<Item = Item> {
|
||||||
stream!({
|
stream!({
|
||||||
let dirs = match fs::read_dir(path).await {
|
let dirs = match fs::read_dir(path).await {
|
||||||
@@ -131,12 +123,12 @@ impl Scanner {
|
|||||||
|
|
||||||
yield Item {
|
yield Item {
|
||||||
path: path.to_owned(),
|
path: path.to_owned(),
|
||||||
event: Ok(Self::Movie {
|
event: Ok(Self::Movie(MovieScan {
|
||||||
parent,
|
parent_ref,
|
||||||
id,
|
id_ref,
|
||||||
media_file_name,
|
media_file_name,
|
||||||
poster_file_name,
|
poster_file_name,
|
||||||
}),
|
})),
|
||||||
};
|
};
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -13,53 +13,23 @@ use tokio_stream::wrappers::ReadDirStream;
|
|||||||
|
|
||||||
use crate::Error;
|
use crate::Error;
|
||||||
use crate::macros::is_image_extension;
|
use crate::macros::is_image_extension;
|
||||||
use crate::scanner::episode;
|
use crate::scanner::{EpisodeScan, MediaRef, SeasonScan, episode};
|
||||||
|
|
||||||
/// A season item
|
/// A season item
|
||||||
pub type Item = crate::Item<Scanner>;
|
pub type Item = crate::Item<Scanner>;
|
||||||
|
|
||||||
/// The scanner for seasons
|
/// The scanner for seasons
|
||||||
pub enum Scanner {
|
pub enum Scanner {
|
||||||
|
/// A scanned season
|
||||||
|
Season(SeasonScan),
|
||||||
/// A scanned episode
|
/// A scanned episode
|
||||||
Season {
|
Episode(EpisodeScan),
|
||||||
/// The ID of the show this season belongs to
|
|
||||||
show: ShowId,
|
|
||||||
/// The season this episode belongs to
|
|
||||||
season: SeasonNumber,
|
|
||||||
/// The file name of the poster file
|
|
||||||
poster_file_name: Option<String>,
|
|
||||||
},
|
|
||||||
/// A scanned episode
|
|
||||||
Episode {
|
|
||||||
/// The ID of the show this episode belongs to
|
|
||||||
show: ShowId,
|
|
||||||
/// The season this episode belongs to
|
|
||||||
season: SeasonNumber,
|
|
||||||
/// The number(s) of this episode
|
|
||||||
episode: EpisodeNumbers,
|
|
||||||
/// The file name of the media file
|
|
||||||
media_file_name: String,
|
|
||||||
/// The file name of the poster file
|
|
||||||
poster_file_name: Option<String>,
|
|
||||||
},
|
|
||||||
}
|
}
|
||||||
|
|
||||||
impl From<episode::Scanner> for Scanner {
|
impl From<episode::Scanner> for Scanner {
|
||||||
fn from(value: episode::Scanner) -> Self {
|
fn from(value: episode::Scanner) -> Self {
|
||||||
match value {
|
match value {
|
||||||
episode::Scanner::Episode {
|
episode::Scanner::Episode(e) => Self::Episode(e),
|
||||||
show,
|
|
||||||
season,
|
|
||||||
episode,
|
|
||||||
media_file_name,
|
|
||||||
poster_file_name,
|
|
||||||
} => Self::Episode {
|
|
||||||
show,
|
|
||||||
season,
|
|
||||||
episode,
|
|
||||||
media_file_name,
|
|
||||||
poster_file_name,
|
|
||||||
},
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -68,7 +38,7 @@ impl Scanner {
|
|||||||
/// Scan a folder for a season and its episodes
|
/// Scan a folder for a season and its episodes
|
||||||
pub fn scan_season(
|
pub fn scan_season(
|
||||||
path: &Path,
|
path: &Path,
|
||||||
show: ShowId,
|
show_ref: MediaRef<ShowId>,
|
||||||
season: SeasonNumber,
|
season: SeasonNumber,
|
||||||
) -> impl Stream<Item = Item> {
|
) -> impl Stream<Item = Item> {
|
||||||
stream!({
|
stream!({
|
||||||
@@ -140,11 +110,11 @@ impl Scanner {
|
|||||||
|
|
||||||
yield Item {
|
yield Item {
|
||||||
path: path.to_owned(),
|
path: path.to_owned(),
|
||||||
event: Ok(Self::Season {
|
event: Ok(Self::Season(SeasonScan {
|
||||||
show,
|
show_ref: show_ref.clone(),
|
||||||
season,
|
season,
|
||||||
poster_file_name,
|
poster_file_name,
|
||||||
}),
|
})),
|
||||||
};
|
};
|
||||||
|
|
||||||
for episode_dir in episode_dirs_to_scan {
|
for episode_dir in episode_dirs_to_scan {
|
||||||
@@ -207,7 +177,7 @@ impl Scanner {
|
|||||||
|
|
||||||
for await event in episode::Scanner::scan_episode(
|
for await event in episode::Scanner::scan_episode(
|
||||||
&episode_dir,
|
&episode_dir,
|
||||||
show,
|
show_ref.clone(),
|
||||||
season_number,
|
season_number,
|
||||||
episode_numbers,
|
episode_numbers,
|
||||||
) {
|
) {
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ use std::ffi::OsStr;
|
|||||||
use std::path::Path;
|
use std::path::Path;
|
||||||
|
|
||||||
use flix_model::id::{CollectionId, ShowId};
|
use flix_model::id::{CollectionId, ShowId};
|
||||||
use flix_model::numbers::{EpisodeNumbers, SeasonNumber};
|
use flix_model::numbers::SeasonNumber;
|
||||||
|
|
||||||
use async_stream::stream;
|
use async_stream::stream;
|
||||||
use tokio::fs;
|
use tokio::fs;
|
||||||
@@ -13,7 +13,7 @@ use tokio_stream::wrappers::ReadDirStream;
|
|||||||
|
|
||||||
use crate::Error;
|
use crate::Error;
|
||||||
use crate::macros::is_image_extension;
|
use crate::macros::is_image_extension;
|
||||||
use crate::scanner::season;
|
use crate::scanner::{EpisodeScan, MediaRef, SeasonScan, ShowScan, season};
|
||||||
|
|
||||||
/// A show item
|
/// A show item
|
||||||
pub type Item = crate::Item<Scanner>;
|
pub type Item = crate::Item<Scanner>;
|
||||||
@@ -21,63 +21,18 @@ pub type Item = crate::Item<Scanner>;
|
|||||||
/// The scanner for shows
|
/// The scanner for shows
|
||||||
pub enum Scanner {
|
pub enum Scanner {
|
||||||
/// A scanned show
|
/// A scanned show
|
||||||
Show {
|
Show(ShowScan),
|
||||||
/// The ID of the parent collection (if any)
|
/// A scanned season
|
||||||
parent: Option<CollectionId>,
|
Season(SeasonScan),
|
||||||
/// The ID of the show
|
|
||||||
id: ShowId,
|
|
||||||
/// The file name of the poster file
|
|
||||||
poster_file_name: Option<String>,
|
|
||||||
},
|
|
||||||
/// A scanned episode
|
/// A scanned episode
|
||||||
Season {
|
Episode(EpisodeScan),
|
||||||
/// The ID of the show this season belongs to
|
|
||||||
show: ShowId,
|
|
||||||
/// The season this episode belongs to
|
|
||||||
season: SeasonNumber,
|
|
||||||
/// The file name of the poster file
|
|
||||||
poster_file_name: Option<String>,
|
|
||||||
},
|
|
||||||
/// A scanned episode
|
|
||||||
Episode {
|
|
||||||
/// The ID of the show this episode belongs to
|
|
||||||
show: ShowId,
|
|
||||||
/// The season this episode belongs to
|
|
||||||
season: SeasonNumber,
|
|
||||||
/// The number(s) of this episode
|
|
||||||
episode: EpisodeNumbers,
|
|
||||||
/// The file name of the media file
|
|
||||||
media_file_name: String,
|
|
||||||
/// The file name of the poster file
|
|
||||||
poster_file_name: Option<String>,
|
|
||||||
},
|
|
||||||
}
|
}
|
||||||
|
|
||||||
impl From<season::Scanner> for Scanner {
|
impl From<season::Scanner> for Scanner {
|
||||||
fn from(value: season::Scanner) -> Self {
|
fn from(value: season::Scanner) -> Self {
|
||||||
match value {
|
match value {
|
||||||
season::Scanner::Season {
|
season::Scanner::Season(s) => Self::Season(s),
|
||||||
show,
|
season::Scanner::Episode(e) => Self::Episode(e),
|
||||||
season,
|
|
||||||
poster_file_name,
|
|
||||||
} => Self::Season {
|
|
||||||
show,
|
|
||||||
season,
|
|
||||||
poster_file_name,
|
|
||||||
},
|
|
||||||
season::Scanner::Episode {
|
|
||||||
show,
|
|
||||||
season,
|
|
||||||
episode,
|
|
||||||
media_file_name,
|
|
||||||
poster_file_name,
|
|
||||||
} => Self::Episode {
|
|
||||||
show,
|
|
||||||
season,
|
|
||||||
episode,
|
|
||||||
media_file_name,
|
|
||||||
poster_file_name,
|
|
||||||
},
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -86,8 +41,8 @@ impl Scanner {
|
|||||||
/// Scan a folder for a show and its seasons/episodes
|
/// Scan a folder for a show and its seasons/episodes
|
||||||
pub fn scan_show(
|
pub fn scan_show(
|
||||||
path: &Path,
|
path: &Path,
|
||||||
parent: Option<CollectionId>,
|
parent_ref: Option<MediaRef<CollectionId>>,
|
||||||
id: ShowId,
|
id_ref: MediaRef<ShowId>,
|
||||||
) -> impl Stream<Item = Item> {
|
) -> impl Stream<Item = Item> {
|
||||||
stream!({
|
stream!({
|
||||||
let dirs = match fs::read_dir(path).await {
|
let dirs = match fs::read_dir(path).await {
|
||||||
@@ -158,11 +113,11 @@ impl Scanner {
|
|||||||
|
|
||||||
yield Item {
|
yield Item {
|
||||||
path: path.to_owned(),
|
path: path.to_owned(),
|
||||||
event: Ok(Self::Show {
|
event: Ok(Self::Show(ShowScan {
|
||||||
parent,
|
parent_ref,
|
||||||
id,
|
id_ref: id_ref.clone(),
|
||||||
poster_file_name,
|
poster_file_name,
|
||||||
}),
|
})),
|
||||||
};
|
};
|
||||||
|
|
||||||
for season_dir in season_dirs_to_scan {
|
for season_dir in season_dirs_to_scan {
|
||||||
@@ -185,7 +140,9 @@ impl Scanner {
|
|||||||
continue;
|
continue;
|
||||||
};
|
};
|
||||||
|
|
||||||
for await event in season::Scanner::scan_season(&season_dir, id, season_number) {
|
for await event in
|
||||||
|
season::Scanner::scan_season(&season_dir, id_ref.clone(), season_number)
|
||||||
|
{
|
||||||
yield event.map(|e| e.into());
|
yield event.map(|e| e.into());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
[package]
|
[package]
|
||||||
name = "flix-model"
|
name = "flix-model"
|
||||||
version = "0.0.16"
|
version = "0.0.17"
|
||||||
edition.workspace = true
|
edition.workspace = true
|
||||||
rust-version.workspace = true
|
rust-version.workspace = true
|
||||||
description = "Core types for flix data"
|
description = "Core types for flix data"
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
[package]
|
[package]
|
||||||
name = "flix-tmdb"
|
name = "flix-tmdb"
|
||||||
version = "0.0.16"
|
version = "0.0.17"
|
||||||
edition.workspace = true
|
edition.workspace = true
|
||||||
rust-version.workspace = true
|
rust-version.workspace = true
|
||||||
description = "Clients and models for fetching data from TMDB"
|
description = "Clients and models for fetching data from TMDB"
|
||||||
@@ -13,13 +13,16 @@ all-features = true
|
|||||||
rustdoc-args = ["--cfg", "docsrs"]
|
rustdoc-args = ["--cfg", "docsrs"]
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
|
bytes = { workspace = true }
|
||||||
chrono = { workspace = true, features = ["serde"] }
|
chrono = { workspace = true, features = ["serde"] }
|
||||||
flix-model = { workspace = true, features = ["serde"] }
|
flix-model = { workspace = true, features = ["serde"] }
|
||||||
governor = { workspace = true, features = ["jitter", "std"] }
|
governor = { workspace = true, features = ["jitter", "std"] }
|
||||||
nonzero_ext = { workspace = true }
|
nonzero_ext = { workspace = true }
|
||||||
reqwest = { workspace = true, features = ["json", "query", "rustls"] }
|
redb = { workspace = true }
|
||||||
|
reqwest = { workspace = true, features = ["query", "rustls"] }
|
||||||
sea-orm = { workspace = true, optional = true }
|
sea-orm = { workspace = true, optional = true }
|
||||||
serde = { workspace = true, features = ["derive"] }
|
serde = { workspace = true, features = ["derive"] }
|
||||||
|
serde_json = { workspace = true }
|
||||||
thiserror = { workspace = true }
|
thiserror = { workspace = true }
|
||||||
url = { workspace = true }
|
url = { workspace = true }
|
||||||
url-macro = { workspace = true }
|
url-macro = { workspace = true }
|
||||||
|
|||||||
@@ -1,25 +1,30 @@
|
|||||||
//! Collections API
|
//! Collections API
|
||||||
|
|
||||||
use core::time::Duration;
|
|
||||||
use std::rc::Rc;
|
use std::rc::Rc;
|
||||||
|
use std::sync::RwLock;
|
||||||
|
|
||||||
use governor::Jitter;
|
use crate::api::exec_request;
|
||||||
|
|
||||||
use crate::Config;
|
|
||||||
use crate::model::Collection;
|
use crate::model::Collection;
|
||||||
use crate::model::id::CollectionId;
|
use crate::model::id::CollectionId;
|
||||||
|
use crate::{Cache, CachePolicy, Config};
|
||||||
|
|
||||||
use super::{Error, make_request};
|
use super::{Error, make_request};
|
||||||
|
|
||||||
/// TMDB Collections API client
|
/// TMDB Collections API client
|
||||||
pub struct Client {
|
pub struct Client {
|
||||||
config: Rc<Config>,
|
config: Rc<Config>,
|
||||||
|
cache: Rc<dyn Cache>,
|
||||||
|
policy: Rc<RwLock<CachePolicy>>,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Client {
|
impl Client {
|
||||||
/// Create a new client with the given configuration
|
/// Create a new client with the given configuration
|
||||||
pub fn new(config: Rc<Config>) -> Self {
|
pub fn new(config: Rc<Config>, cache: Rc<dyn Cache>, policy: Rc<RwLock<CachePolicy>>) -> Self {
|
||||||
Self { config }
|
Self {
|
||||||
|
config,
|
||||||
|
cache,
|
||||||
|
policy,
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -30,25 +35,11 @@ impl Client {
|
|||||||
id: impl Into<CollectionId>,
|
id: impl Into<CollectionId>,
|
||||||
language: Option<&str>,
|
language: Option<&str>,
|
||||||
) -> Result<Collection, Error> {
|
) -> Result<Collection, Error> {
|
||||||
self.config
|
let request = make_request(
|
||||||
.limiter
|
|
||||||
.until_ready_with_jitter(Jitter::new(
|
|
||||||
Duration::from_millis(0),
|
|
||||||
Duration::from_millis(50),
|
|
||||||
))
|
|
||||||
.await;
|
|
||||||
|
|
||||||
Ok(self
|
|
||||||
.config
|
|
||||||
.client
|
|
||||||
.execute(make_request(
|
|
||||||
&self.config,
|
&self.config,
|
||||||
&format!("/3/collection/{}", id.into().into_raw()),
|
&format!("/3/collection/{}", id.into().into_raw()),
|
||||||
language,
|
language,
|
||||||
)?)
|
)?;
|
||||||
.await?
|
exec_request(&self.config, &*self.cache, &self.policy, request).await
|
||||||
.error_for_status()?
|
|
||||||
.json()
|
|
||||||
.await?)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,27 +1,32 @@
|
|||||||
//! Episodes API
|
//! Episodes API
|
||||||
|
|
||||||
use core::time::Duration;
|
|
||||||
use std::rc::Rc;
|
use std::rc::Rc;
|
||||||
|
use std::sync::RwLock;
|
||||||
|
|
||||||
use flix_model::numbers::{EpisodeNumber, SeasonNumber};
|
use flix_model::numbers::{EpisodeNumber, SeasonNumber};
|
||||||
|
|
||||||
use governor::Jitter;
|
use crate::api::exec_request;
|
||||||
|
|
||||||
use crate::Config;
|
|
||||||
use crate::model::Episode;
|
use crate::model::Episode;
|
||||||
use crate::model::id::ShowId;
|
use crate::model::id::ShowId;
|
||||||
|
use crate::{Cache, CachePolicy, Config};
|
||||||
|
|
||||||
use super::{Error, make_request};
|
use super::{Error, make_request};
|
||||||
|
|
||||||
/// TMDB Episodes API client
|
/// TMDB Episodes API client
|
||||||
pub struct Client {
|
pub struct Client {
|
||||||
config: Rc<Config>,
|
config: Rc<Config>,
|
||||||
|
cache: Rc<dyn Cache>,
|
||||||
|
policy: Rc<RwLock<CachePolicy>>,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Client {
|
impl Client {
|
||||||
/// Create a new client with the given configuration
|
/// Create a new client with the given configuration
|
||||||
pub fn new(config: Rc<Config>) -> Self {
|
pub fn new(config: Rc<Config>, cache: Rc<dyn Cache>, policy: Rc<RwLock<CachePolicy>>) -> Self {
|
||||||
Self { config }
|
Self {
|
||||||
|
config,
|
||||||
|
cache,
|
||||||
|
policy,
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -34,18 +39,7 @@ impl Client {
|
|||||||
episode: impl Into<EpisodeNumber>,
|
episode: impl Into<EpisodeNumber>,
|
||||||
language: Option<&str>,
|
language: Option<&str>,
|
||||||
) -> Result<Episode, Error> {
|
) -> Result<Episode, Error> {
|
||||||
self.config
|
let request = make_request(
|
||||||
.limiter
|
|
||||||
.until_ready_with_jitter(Jitter::new(
|
|
||||||
Duration::from_millis(0),
|
|
||||||
Duration::from_millis(50),
|
|
||||||
))
|
|
||||||
.await;
|
|
||||||
|
|
||||||
Ok(self
|
|
||||||
.config
|
|
||||||
.client
|
|
||||||
.execute(make_request(
|
|
||||||
&self.config,
|
&self.config,
|
||||||
&format!(
|
&format!(
|
||||||
"/3/tv/{}/season/{}/episode/{}",
|
"/3/tv/{}/season/{}/episode/{}",
|
||||||
@@ -54,10 +48,7 @@ impl Client {
|
|||||||
episode.into()
|
episode.into()
|
||||||
),
|
),
|
||||||
language,
|
language,
|
||||||
)?)
|
)?;
|
||||||
.await?
|
exec_request(&self.config, &*self.cache, &self.policy, request).await
|
||||||
.error_for_status()?
|
|
||||||
.json()
|
|
||||||
.await?)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,9 +1,15 @@
|
|||||||
//! TMDB API clients
|
//! TMDB API clients
|
||||||
|
|
||||||
|
use core::ops::Deref;
|
||||||
|
use core::time::Duration;
|
||||||
|
use std::sync::RwLock;
|
||||||
|
|
||||||
|
use governor::Jitter;
|
||||||
use reqwest::Request;
|
use reqwest::Request;
|
||||||
use reqwest::header;
|
use reqwest::header;
|
||||||
|
use serde::de::DeserializeOwned;
|
||||||
|
|
||||||
use crate::Config;
|
use crate::{Cache, CachePolicy, Config};
|
||||||
|
|
||||||
pub mod collections;
|
pub mod collections;
|
||||||
pub mod episodes;
|
pub mod episodes;
|
||||||
@@ -20,6 +26,9 @@ pub enum Error {
|
|||||||
/// Reqwest error wrapper
|
/// Reqwest error wrapper
|
||||||
#[error("reqwest error: {0}")]
|
#[error("reqwest error: {0}")]
|
||||||
Reqwest(#[from] reqwest::Error),
|
Reqwest(#[from] reqwest::Error),
|
||||||
|
/// Json error wrapper
|
||||||
|
#[error("json error: {0}")]
|
||||||
|
Json(#[from] serde_json::Error),
|
||||||
}
|
}
|
||||||
|
|
||||||
fn make_request(config: &Config, path: &str, language: Option<&str>) -> Result<Request, Error> {
|
fn make_request(config: &Config, path: &str, language: Option<&str>) -> Result<Request, Error> {
|
||||||
@@ -38,3 +47,58 @@ fn make_request(config: &Config, path: &str, language: Option<&str>) -> Result<R
|
|||||||
|
|
||||||
Ok(builder.build()?)
|
Ok(builder.build()?)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
async fn exec_request<T: DeserializeOwned>(
|
||||||
|
config: &Config,
|
||||||
|
cache: &dyn Cache,
|
||||||
|
policy: &RwLock<CachePolicy>,
|
||||||
|
request: Request,
|
||||||
|
) -> Result<T, Error> {
|
||||||
|
let (read_cache, write_cache) = if let Ok(guard) = policy.read() {
|
||||||
|
match guard.deref() {
|
||||||
|
CachePolicy::None => (None, None),
|
||||||
|
CachePolicy::Full => (Some(cache), Some(cache)),
|
||||||
|
CachePolicy::Read => (Some(cache), None),
|
||||||
|
CachePolicy::Update => (None, Some(cache)),
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
(None, None)
|
||||||
|
};
|
||||||
|
|
||||||
|
let path = request.url().path().to_owned();
|
||||||
|
|
||||||
|
// read the cache and fall back to reqwest
|
||||||
|
let mut response = None;
|
||||||
|
if let Some(cache) = read_cache {
|
||||||
|
response = cache.get(&path);
|
||||||
|
}
|
||||||
|
let needs_cache_write = response.is_none();
|
||||||
|
let response = match response {
|
||||||
|
Some(response) => response,
|
||||||
|
None => {
|
||||||
|
config
|
||||||
|
.limiter
|
||||||
|
.until_ready_with_jitter(Jitter::new(
|
||||||
|
Duration::from_millis(0),
|
||||||
|
Duration::from_millis(50),
|
||||||
|
))
|
||||||
|
.await;
|
||||||
|
config
|
||||||
|
.client
|
||||||
|
.execute(request)
|
||||||
|
.await?
|
||||||
|
.error_for_status()?
|
||||||
|
.bytes()
|
||||||
|
.await?
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
// write to the cache if needed
|
||||||
|
if let Some(cache) = write_cache
|
||||||
|
&& needs_cache_write
|
||||||
|
{
|
||||||
|
cache.set(&path, &response);
|
||||||
|
}
|
||||||
|
|
||||||
|
Ok(serde_json::from_slice(&response)?)
|
||||||
|
}
|
||||||
|
|||||||
@@ -1,25 +1,30 @@
|
|||||||
//! Movies API
|
//! Movies API
|
||||||
|
|
||||||
use core::time::Duration;
|
|
||||||
use std::rc::Rc;
|
use std::rc::Rc;
|
||||||
|
use std::sync::RwLock;
|
||||||
|
|
||||||
use governor::Jitter;
|
use crate::api::exec_request;
|
||||||
|
|
||||||
use crate::Config;
|
|
||||||
use crate::model::Movie;
|
use crate::model::Movie;
|
||||||
use crate::model::id::MovieId;
|
use crate::model::id::MovieId;
|
||||||
|
use crate::{Cache, CachePolicy, Config};
|
||||||
|
|
||||||
use super::{Error, make_request};
|
use super::{Error, make_request};
|
||||||
|
|
||||||
/// TMDB Movies API client
|
/// TMDB Movies API client
|
||||||
pub struct Client {
|
pub struct Client {
|
||||||
config: Rc<Config>,
|
config: Rc<Config>,
|
||||||
|
cache: Rc<dyn Cache>,
|
||||||
|
policy: Rc<RwLock<CachePolicy>>,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Client {
|
impl Client {
|
||||||
/// Create a new client with the given configuration
|
/// Create a new client with the given configuration
|
||||||
pub fn new(config: Rc<Config>) -> Self {
|
pub fn new(config: Rc<Config>, cache: Rc<dyn Cache>, policy: Rc<RwLock<CachePolicy>>) -> Self {
|
||||||
Self { config }
|
Self {
|
||||||
|
config,
|
||||||
|
cache,
|
||||||
|
policy,
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -30,25 +35,11 @@ impl Client {
|
|||||||
id: impl Into<MovieId>,
|
id: impl Into<MovieId>,
|
||||||
language: Option<&str>,
|
language: Option<&str>,
|
||||||
) -> Result<Movie, Error> {
|
) -> Result<Movie, Error> {
|
||||||
self.config
|
let request = make_request(
|
||||||
.limiter
|
|
||||||
.until_ready_with_jitter(Jitter::new(
|
|
||||||
Duration::from_millis(0),
|
|
||||||
Duration::from_millis(50),
|
|
||||||
))
|
|
||||||
.await;
|
|
||||||
|
|
||||||
Ok(self
|
|
||||||
.config
|
|
||||||
.client
|
|
||||||
.execute(make_request(
|
|
||||||
&self.config,
|
&self.config,
|
||||||
&format!("/3/movie/{}", id.into().into_raw()),
|
&format!("/3/movie/{}", id.into().into_raw()),
|
||||||
language,
|
language,
|
||||||
)?)
|
)?;
|
||||||
.await?
|
exec_request(&self.config, &*self.cache, &self.policy, request).await
|
||||||
.error_for_status()?
|
|
||||||
.json()
|
|
||||||
.await?)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,27 +1,32 @@
|
|||||||
//! Seasons API
|
//! Seasons API
|
||||||
|
|
||||||
use core::time::Duration;
|
|
||||||
use std::rc::Rc;
|
use std::rc::Rc;
|
||||||
|
use std::sync::RwLock;
|
||||||
|
|
||||||
use flix_model::numbers::SeasonNumber;
|
use flix_model::numbers::SeasonNumber;
|
||||||
|
|
||||||
use governor::Jitter;
|
use crate::api::exec_request;
|
||||||
|
|
||||||
use crate::Config;
|
|
||||||
use crate::model::Season;
|
use crate::model::Season;
|
||||||
use crate::model::id::ShowId;
|
use crate::model::id::ShowId;
|
||||||
|
use crate::{Cache, CachePolicy, Config};
|
||||||
|
|
||||||
use super::{Error, make_request};
|
use super::{Error, make_request};
|
||||||
|
|
||||||
/// TMDB Seasons API client
|
/// TMDB Seasons API client
|
||||||
pub struct Client {
|
pub struct Client {
|
||||||
config: Rc<Config>,
|
config: Rc<Config>,
|
||||||
|
cache: Rc<dyn Cache>,
|
||||||
|
policy: Rc<RwLock<CachePolicy>>,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Client {
|
impl Client {
|
||||||
/// Create a new client with the given configuration
|
/// Create a new client with the given configuration
|
||||||
pub fn new(config: Rc<Config>) -> Self {
|
pub fn new(config: Rc<Config>, cache: Rc<dyn Cache>, policy: Rc<RwLock<CachePolicy>>) -> Self {
|
||||||
Self { config }
|
Self {
|
||||||
|
config,
|
||||||
|
cache,
|
||||||
|
policy,
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -33,25 +38,11 @@ impl Client {
|
|||||||
season: impl Into<SeasonNumber>,
|
season: impl Into<SeasonNumber>,
|
||||||
language: Option<&str>,
|
language: Option<&str>,
|
||||||
) -> Result<Season, Error> {
|
) -> Result<Season, Error> {
|
||||||
self.config
|
let request = make_request(
|
||||||
.limiter
|
|
||||||
.until_ready_with_jitter(Jitter::new(
|
|
||||||
Duration::from_millis(0),
|
|
||||||
Duration::from_millis(50),
|
|
||||||
))
|
|
||||||
.await;
|
|
||||||
|
|
||||||
Ok(self
|
|
||||||
.config
|
|
||||||
.client
|
|
||||||
.execute(make_request(
|
|
||||||
&self.config,
|
&self.config,
|
||||||
&format!("/3/tv/{}/season/{}", id.into().into_raw(), season.into()),
|
&format!("/3/tv/{}/season/{}", id.into().into_raw(), season.into()),
|
||||||
language,
|
language,
|
||||||
)?)
|
)?;
|
||||||
.await?
|
exec_request(&self.config, &*self.cache, &self.policy, request).await
|
||||||
.error_for_status()?
|
|
||||||
.json()
|
|
||||||
.await?)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,25 +1,30 @@
|
|||||||
//! Shows API
|
//! Shows API
|
||||||
|
|
||||||
use core::time::Duration;
|
|
||||||
use std::rc::Rc;
|
use std::rc::Rc;
|
||||||
|
use std::sync::RwLock;
|
||||||
|
|
||||||
use governor::Jitter;
|
use crate::api::exec_request;
|
||||||
|
|
||||||
use crate::Config;
|
|
||||||
use crate::model::Show;
|
use crate::model::Show;
|
||||||
use crate::model::id::ShowId;
|
use crate::model::id::ShowId;
|
||||||
|
use crate::{Cache, CachePolicy, Config};
|
||||||
|
|
||||||
use super::{Error, make_request};
|
use super::{Error, make_request};
|
||||||
|
|
||||||
/// TMDB Shows API client
|
/// TMDB Shows API client
|
||||||
pub struct Client {
|
pub struct Client {
|
||||||
config: Rc<Config>,
|
config: Rc<Config>,
|
||||||
|
cache: Rc<dyn Cache>,
|
||||||
|
policy: Rc<RwLock<CachePolicy>>,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Client {
|
impl Client {
|
||||||
/// Create a new client with the given configuration
|
/// Create a new client with the given configuration
|
||||||
pub fn new(config: Rc<Config>) -> Self {
|
pub fn new(config: Rc<Config>, cache: Rc<dyn Cache>, policy: Rc<RwLock<CachePolicy>>) -> Self {
|
||||||
Self { config }
|
Self {
|
||||||
|
config,
|
||||||
|
cache,
|
||||||
|
policy,
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -30,25 +35,11 @@ impl Client {
|
|||||||
id: impl Into<ShowId>,
|
id: impl Into<ShowId>,
|
||||||
language: Option<&str>,
|
language: Option<&str>,
|
||||||
) -> Result<Show, Error> {
|
) -> Result<Show, Error> {
|
||||||
self.config
|
let request = make_request(
|
||||||
.limiter
|
|
||||||
.until_ready_with_jitter(Jitter::new(
|
|
||||||
Duration::from_millis(0),
|
|
||||||
Duration::from_millis(50),
|
|
||||||
))
|
|
||||||
.await;
|
|
||||||
|
|
||||||
Ok(self
|
|
||||||
.config
|
|
||||||
.client
|
|
||||||
.execute(make_request(
|
|
||||||
&self.config,
|
&self.config,
|
||||||
&format!("/3/tv/{}", id.into().into_raw()),
|
&format!("/3/tv/{}", id.into().into_raw()),
|
||||||
language,
|
language,
|
||||||
)?)
|
)?;
|
||||||
.await?
|
exec_request(&self.config, &*self.cache, &self.policy, request).await
|
||||||
.error_for_status()?
|
|
||||||
.json()
|
|
||||||
.await?)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,83 @@
|
|||||||
|
use std::path::Path;
|
||||||
|
use std::time::{SystemTime, UNIX_EPOCH};
|
||||||
|
|
||||||
|
use bytes::Bytes;
|
||||||
|
use redb::{Database, DatabaseError, ReadableDatabase, TableDefinition};
|
||||||
|
|
||||||
|
/// The client cache policy
|
||||||
|
pub enum CachePolicy {
|
||||||
|
/// Do not use a cache
|
||||||
|
None,
|
||||||
|
/// Use and update the cache
|
||||||
|
Full,
|
||||||
|
/// Use the cache but don't update it
|
||||||
|
Read,
|
||||||
|
/// Ignore the cache but update it
|
||||||
|
Update,
|
||||||
|
}
|
||||||
|
|
||||||
|
/// The trait representing a caching backend
|
||||||
|
pub trait Cache {
|
||||||
|
/// Get a cached value, or None
|
||||||
|
fn get(&self, query: &str) -> Option<Bytes>;
|
||||||
|
/// Set a value in the cache
|
||||||
|
fn set(&self, query: &str, response: &Bytes);
|
||||||
|
}
|
||||||
|
|
||||||
|
const TABLE: TableDefinition<&str, (u64, &[u8])> = TableDefinition::new("tmdb_responses");
|
||||||
|
|
||||||
|
/// A [Cache] implementation using [redb] as the backend
|
||||||
|
pub struct RedbCache {
|
||||||
|
db: Database,
|
||||||
|
}
|
||||||
|
|
||||||
|
impl RedbCache {
|
||||||
|
/// Create/open a [redb] database at the path
|
||||||
|
pub fn new(path: &Path) -> Result<Self, DatabaseError> {
|
||||||
|
Ok(Self {
|
||||||
|
db: Database::create(path)?,
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Helper function allowing for `.ok()?`
|
||||||
|
fn write(&self, timestamp: u64, query: &str, response: &Bytes) -> Option<()> {
|
||||||
|
let write_txn = self.db.begin_write().ok()?;
|
||||||
|
{
|
||||||
|
let mut table = write_txn.open_table(TABLE).ok()?;
|
||||||
|
table
|
||||||
|
.insert(query, (timestamp, response.iter().as_slice()))
|
||||||
|
.ok()?;
|
||||||
|
}
|
||||||
|
write_txn.commit().ok()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
impl Cache for RedbCache {
|
||||||
|
fn get(&self, query: &str) -> Option<Bytes> {
|
||||||
|
let read_txn = self.db.begin_read().ok()?;
|
||||||
|
let table = read_txn.open_table(TABLE).ok()?;
|
||||||
|
|
||||||
|
let result = table.get(query).ok()??;
|
||||||
|
let (timestamp, data) = result.value();
|
||||||
|
|
||||||
|
let now = SystemTime::now()
|
||||||
|
.duration_since(UNIX_EPOCH)
|
||||||
|
.map(|d| d.as_secs())
|
||||||
|
.unwrap_or(0);
|
||||||
|
|
||||||
|
if now.saturating_sub(timestamp) >= 60 * 60 * 24 * 30 * 6 {
|
||||||
|
None
|
||||||
|
} else {
|
||||||
|
Some(Bytes::copy_from_slice(data))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fn set(&self, query: &str, response: &Bytes) {
|
||||||
|
let now = SystemTime::now()
|
||||||
|
.duration_since(UNIX_EPOCH)
|
||||||
|
.map(|d| d.as_secs())
|
||||||
|
.unwrap_or(0);
|
||||||
|
|
||||||
|
self.write(now, query, response);
|
||||||
|
}
|
||||||
|
}
|
||||||
+33
-13
@@ -1,6 +1,7 @@
|
|||||||
use std::rc::Rc;
|
use std::rc::Rc;
|
||||||
|
use std::sync::RwLock;
|
||||||
|
|
||||||
use crate::{Config, api};
|
use crate::{Cache, CachePolicy, Config, api};
|
||||||
|
|
||||||
/// The primary client that references all other clients
|
/// The primary client that references all other clients
|
||||||
pub struct Client {
|
pub struct Client {
|
||||||
@@ -9,23 +10,42 @@ pub struct Client {
|
|||||||
shows: api::shows::Client,
|
shows: api::shows::Client,
|
||||||
seasons: api::seasons::Client,
|
seasons: api::seasons::Client,
|
||||||
episodes: api::episodes::Client,
|
episodes: api::episodes::Client,
|
||||||
|
|
||||||
|
cache_policy: Rc<RwLock<CachePolicy>>,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Client {
|
impl Client {
|
||||||
/// Create a new client from a default configuration using the bearer token
|
/// Create a new client with the given configuration
|
||||||
pub fn new(bearer_token: String) -> Self {
|
pub fn new(config: Config, cache: Rc<dyn Cache>, cache_policy: CachePolicy) -> Self {
|
||||||
Self::new_with_config(Config::new(bearer_token))
|
let config = Rc::new(config);
|
||||||
|
let cache_policy = Rc::new(RwLock::new(cache_policy));
|
||||||
|
Self {
|
||||||
|
collections: api::collections::Client::new(
|
||||||
|
config.clone(),
|
||||||
|
cache.clone(),
|
||||||
|
cache_policy.clone(),
|
||||||
|
),
|
||||||
|
movies: api::movies::Client::new(config.clone(), cache.clone(), cache_policy.clone()),
|
||||||
|
shows: api::shows::Client::new(config.clone(), cache.clone(), cache_policy.clone()),
|
||||||
|
seasons: api::seasons::Client::new(config.clone(), cache.clone(), cache_policy.clone()),
|
||||||
|
episodes: api::episodes::Client::new(
|
||||||
|
config.clone(),
|
||||||
|
cache.clone(),
|
||||||
|
cache_policy.clone(),
|
||||||
|
),
|
||||||
|
|
||||||
|
cache_policy,
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Create a new client with the given configuration
|
/// Modify the [CachePolicy]
|
||||||
pub fn new_with_config(config: Config) -> Self {
|
pub fn set_cache_policy(&self, new_policy: CachePolicy) {
|
||||||
let config = Rc::new(config);
|
match self.cache_policy.write() {
|
||||||
Self {
|
Ok(mut policy) => *policy = new_policy,
|
||||||
collections: api::collections::Client::new(config.clone()),
|
Err(mut poison) => {
|
||||||
movies: api::movies::Client::new(config.clone()),
|
**poison.get_mut() = new_policy;
|
||||||
shows: api::shows::Client::new(config.clone()),
|
self.cache_policy.clear_poison();
|
||||||
seasons: api::seasons::Client::new(config.clone()),
|
}
|
||||||
episodes: api::episodes::Client::new(config.clone()),
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -5,6 +5,9 @@
|
|||||||
pub mod api;
|
pub mod api;
|
||||||
pub mod model;
|
pub mod model;
|
||||||
|
|
||||||
|
mod cache;
|
||||||
|
pub use cache::{Cache, CachePolicy, RedbCache};
|
||||||
|
|
||||||
mod client;
|
mod client;
|
||||||
pub use client::Client;
|
pub use client::Client;
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,146 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
cd "$(dirname "$0")"
|
||||||
|
|
||||||
|
# Init database
|
||||||
|
rm flix.db
|
||||||
|
cargo run -- init
|
||||||
|
|
||||||
|
|
||||||
|
###############
|
||||||
|
# Collections #
|
||||||
|
###############
|
||||||
|
|
||||||
|
# DC
|
||||||
|
cargo run -- add flix collection "DC Collection" ""
|
||||||
|
cargo run -- add tmdb show 60708 # Gotham (2014)
|
||||||
|
|
||||||
|
# DCEU
|
||||||
|
cargo run -- add --sort-title "dceu" flix collection "Worlds of DC" "American media franchise and shared universe that is centered on a series of superhero films, distributed by Warner Bros. Pictures and based on characters that appear in American comic books by DC Comics."
|
||||||
|
cargo run -- add tmdb collection 573693 # Aquaman Collection
|
||||||
|
cargo run -- add tmdb movie 297802 # Aquaman (2018)
|
||||||
|
cargo run -- add tmdb movie 572802 # Aquaman and the Lost Kingdom (2023)
|
||||||
|
|
||||||
|
# Marvel
|
||||||
|
cargo run -- add --sort-title "marvel" flix collection "In Association With Marvel" "Movies based on Marvel Comics properties not produced by Marvel Studios"
|
||||||
|
cargo run -- add --fs-slug "cloak and dagger (2018)" --web-slug "cloak-and-dagger-2018" tmdb show 66190 # Marvel's Cloak & Dagger (2018)
|
||||||
|
cargo run -- add --fs-slug "daredevil (2015)" --web-slug "daredevil-2015" tmdb show 61889 # Marvel's Daredevil (2015)
|
||||||
|
cargo run -- add --fs-slug "inhumans (2017)" --web-slug "inhumans-2017" tmdb show 68716 # Marvel's Inhumans (2017)
|
||||||
|
cargo run -- add --fs-slug "iron fist (2017)" --web-slug "iron-fist-2017" tmdb show 62127 # Marvel's Iron Fist (2017)
|
||||||
|
cargo run -- add --fs-slug "jessica jones (2015)" --web-slug "jessica-jones-2015" tmdb show 38472 # Marvel's Jessica Jones (2015)
|
||||||
|
cargo run -- add --fs-slug "luke cage (2016)" --web-slug "luke-cage-2016" tmdb show 62126 # Marvel's Luke Cage (2016)
|
||||||
|
cargo run -- add --fs-slug "runaways (2017)" --web-slug "runaways-2017" tmdb show 67466 # Marvel's Runaways (2017)
|
||||||
|
cargo run -- add --fs-slug "defenders (2017)" --web-slug "defenders-2017" tmdb show 62285 # Marvel's The Defenders (2017)
|
||||||
|
cargo run -- add --fs-slug "punisher (2017)" --web-slug "punisher-2017" tmdb show 67178 # Marvel's The Punisher (2017)
|
||||||
|
|
||||||
|
# Marvel Cinematic Universe
|
||||||
|
cargo run -- add flix collection "Marvel Cinematic Universe" ""
|
||||||
|
cargo run -- add tmdb show 84958 # Loki (2021)
|
||||||
|
cargo run -- add --fs-slug "agent carter (2015)" --web-slug "agent-carter-2015" tmdb show 61550 # Marvel's Agent Carter (2015)
|
||||||
|
cargo run -- add --fs-slug "agents of shield (2013)" --web-slug "agents-of-shield-2013" tmdb show 1403 # Marvel's Agents of S.H.I.E.L.D. (2013)
|
||||||
|
|
||||||
|
# Star Wars
|
||||||
|
cargo run -- add tmdb collection 10 # Star Wars Collection
|
||||||
|
cargo run -- add --title "Star Wars: Episode I - The Phantom Menace" --sort-title "star wars 1 - the phantom menace" --fs-slug "the phantom menace (1999)" --web-slug "star-wars-the-phantom-menace-1999" tmdb movie 1893 # Star Wars: Episode I - The Phantom Menace (1999)
|
||||||
|
cargo run -- add --title "Star Wars: Episode II - Attack of the Clones" --sort-title "star wars 2 - attack of the clones" --fs-slug "attack of the clones (2002)" --web-slug "star-wars-attack-of-the-clones-2002" tmdb movie 1894 # Star Wars: Episode II - Attack of the Clones (2002)
|
||||||
|
cargo run -- add --title "Star Wars: Episode III - Revenge of the Sith" --sort-title "star wars 3 - revenge of the sith" --fs-slug "revenge of the sith (2005)" --web-slug "star-wars-revenge-of-the-sith-2005" tmdb movie 1895 # Star Wars: Episode III - Revenge of the Sith (2005)
|
||||||
|
cargo run -- add --title "Star Wars: Episode IV - A New Hope" --sort-title "star wars 4 - a new hope" --fs-slug "a new hope (1977)" --web-slug "star-wars-a-new-hope-1977" tmdb movie 11 # Star Wars (1977)
|
||||||
|
cargo run -- add --title "Star Wars: Episode V - The Empire Strikes Back" --sort-title "star wars 5 - the empire strikes back" --fs-slug "the empire strikes back (1980)" --web-slug "star-wars-the-empire-strikes-back-1980" tmdb movie 1891 # The Empire Strikes Back (1980)
|
||||||
|
cargo run -- add --title "Star Wars: Episode VI - Return of the Jedi" --sort-title "star wars 6 - return of the jedi" --fs-slug "return of the jedi (1983)" --web-slug "star-wars-return-of-the-jedi-1983" tmdb movie 1892 # Return of the Jedi (1983)
|
||||||
|
cargo run -- add --title "Star Wars: Episode VII - The Force Awakens" --sort-title "star wars 7 - the force awakens" --fs-slug "the force awakens (2015)" --web-slug "star-wars-the-force-awakens-2015" tmdb movie 140607 # Star Wars: The Force Awakens (2015)
|
||||||
|
cargo run -- add --title "Star Wars: Episode VIII - The Last Jedi" --sort-title "star wars 8 - the last jedi" --fs-slug "the last jedi (2017)" --web-slug "star-wars-the-last-jedi-2017" tmdb movie 181808 # Star Wars: The Last Jedi (2017)
|
||||||
|
cargo run -- add --title "Star Wars: Episode IX - The Rise of Skywalker" --sort-title "star wars 9 - the rise of skywalker" --fs-slug "the rise of skywalker (2019)" --web-slug "star-wars-the-rise-of-skywalker-2019" tmdb movie 181812 # Star Wars: The Rise of Skywalker (2019)
|
||||||
|
cargo run -- add tmdb show 82856 # The Mandalorian (2019)
|
||||||
|
|
||||||
|
# Twin Peaks
|
||||||
|
cargo run -- add flix collection "Twin Peaks Collection" ""
|
||||||
|
cargo run -- add tmdb show 1920 # Twin Peaks (1990)
|
||||||
|
|
||||||
|
|
||||||
|
#####################
|
||||||
|
# Movie Collections #
|
||||||
|
#####################
|
||||||
|
|
||||||
|
# Disney Live-Action Remakes
|
||||||
|
cargo run -- add flix collection "Disney Live-Action Remakes" "Live-action or photorealistic remakes produced by Walt Disney Pictures of its animated films."
|
||||||
|
cargo run -- add tmdb movie 447273 # Snow White (2025)
|
||||||
|
|
||||||
|
# Happy Gilmore
|
||||||
|
cargo run -- add tmdb collection 1263259 # Happy Gilmore Collection
|
||||||
|
cargo run -- add tmdb movie 9614 # Happy Gilmore (1996)
|
||||||
|
cargo run -- add tmdb movie 1263256 # Happy Gilmore 2 (2025)
|
||||||
|
|
||||||
|
# Minecraft
|
||||||
|
cargo run -- add tmdb collection 1461530 # The Minecraft Movie Collection
|
||||||
|
cargo run -- add tmdb movie 950387 # A Minecraft Movie (2025)
|
||||||
|
|
||||||
|
|
||||||
|
####################
|
||||||
|
# Show Collections #
|
||||||
|
####################
|
||||||
|
|
||||||
|
# Arrowverse
|
||||||
|
cargo run -- add flix collection "Arrowverse" "A television franchise that is based on characters that appear in publications by DC Comics."
|
||||||
|
cargo run -- add tmdb show 1412 # Arrow (2012)
|
||||||
|
cargo run -- add tmdb show 89247 # Batwoman (2019)
|
||||||
|
cargo run -- add tmdb show 71663 # Black Lightning (2018)
|
||||||
|
cargo run -- add tmdb show 60735 # The Flash (2014)
|
||||||
|
cargo run -- add --fs-slug "legends of tomorrow (2016)" --web-slug "legends-of-tomorrow-2016" tmdb show 62643
|
||||||
|
cargo run -- add tmdb show 62688 # Supergirl (2015)
|
||||||
|
|
||||||
|
# Avatar Universe
|
||||||
|
cargo run -- add flix collection "Avatar Universe" "Avatar: The Last Airbender is set in an Asiatic-like world in which some people can manipulate the classical elements with psychokinetic variants of the Chinese martial arts known as 'bending'."
|
||||||
|
cargo run -- add tmdb show 246 # Avatar: The Last Airbender (2005)
|
||||||
|
cargo run -- add tmdb show 33880 # The Legend of Korra (2012)
|
||||||
|
|
||||||
|
# Breaking Bad
|
||||||
|
cargo run -- add flix collection "Breaking Bad Collection" "Collection containing the original Breaking Bad show along with a documentary chronicling the process of making the final season, a sequel movie and prequel show."
|
||||||
|
cargo run -- add tmdb show 1396 # Breaking Bad (2008)
|
||||||
|
|
||||||
|
# Buffyverse
|
||||||
|
cargo run -- add flix collection "Buffyverse" "The Buffyverse is a setting in which supernatural phenomena exist, and supernatural evil can be challenged by people willing to fight against such forces."
|
||||||
|
cargo run -- add tmdb show 2426 # Angel (1999)
|
||||||
|
cargo run -- add tmdb show 95 # Buffy the Vampire Slayer (1997)
|
||||||
|
|
||||||
|
|
||||||
|
##########
|
||||||
|
# Movies #
|
||||||
|
##########
|
||||||
|
cargo run -- add tmdb movie 940551 # Migration (2023)
|
||||||
|
|
||||||
|
|
||||||
|
#########
|
||||||
|
# Shows #
|
||||||
|
#########
|
||||||
|
cargo run -- add tmdb show 62110 # Assassination Classroom (2015)
|
||||||
|
cargo run -- add tmdb show 1429 # Attack on Titan (2013)
|
||||||
|
cargo run -- add tmdb show 42009 # Black Mirror (2011)
|
||||||
|
cargo run -- add tmdb show 1911 # Bones (2005)
|
||||||
|
cargo run -- add tmdb show 48891 # Brooklyn Nine-Nine (2013)
|
||||||
|
cargo run -- add flix episode "brooklyn-nine-nine-2013" 8 10 "The Last Day (Part 2)" "The squad takes stock of its eight years together and looks toward the future." "2021-09-16"
|
||||||
|
cargo run -- add tmdb show 3787 # Chaotic (2006)
|
||||||
|
cargo run -- add tmdb show 2557 # Class of the Titans (2006)
|
||||||
|
cargo run -- add tmdb show 13916 # Death Note (2006)
|
||||||
|
cargo run -- add tmdb show 1405 # Dexter (2006)
|
||||||
|
cargo run -- add tmdb show 1399 # Game of Thrones (2011)
|
||||||
|
cargo run -- add tmdb show 40075 # Gravity Falls (2012)
|
||||||
|
cargo run -- add tmdb show 1639 # Heroes (2006)
|
||||||
|
cargo run -- add tmdb show 60858 # Heroes Reborn (2015)
|
||||||
|
cargo run -- add tmdb show 71340 # Krypton (2018)
|
||||||
|
cargo run -- add tmdb show 62687 # Limitless (2015)
|
||||||
|
cargo run -- add tmdb show 60846 # Log Horizon (2013)
|
||||||
|
cargo run -- add tmdb show 64432 # The Magicians (2015)
|
||||||
|
cargo run -- add tmdb show 5920 # The Mentalist (2008)
|
||||||
|
cargo run -- add tmdb show 12786 # Murdoch Mysteries (2008)
|
||||||
|
cargo run -- add tmdb show 65930 # My Hero Academia (2016)
|
||||||
|
cargo run -- add tmdb show 2288 # Prison Break (2005)
|
||||||
|
cargo run -- add tmdb show 95396 # Severance (2022)
|
||||||
|
cargo run -- add tmdb show 60573 # Silicon Valley (2014)
|
||||||
|
cargo run -- add tmdb show 37680 # Suits (2011)
|
||||||
|
cargo run -- add tmdb show 45782 # Sword Art Online (2012)
|
||||||
|
cargo run -- add tmdb show 48860 # The Tomorrow People (2013)
|
||||||
|
cargo run -- add tmdb show 46331 # Under the Dome (2013)
|
||||||
|
cargo run -- add tmdb show 1432 # Veronica Mars (2004)
|
||||||
|
cargo run -- add tmdb show 186 # Weeds (2005)
|
||||||
|
cargo run -- add tmdb show 63247 # Westworld (2016)
|
||||||
|
cargo run -- add tmdb show 71912 # The Witcher (2019)
|
||||||
Reference in New Issue
Block a user