forked from Anri/cal8tor
Compare commits
No commits in common. "main" and "0.7.0" have entirely different histories.
9 changed files with 250 additions and 510 deletions
428
Cargo.lock
generated
428
Cargo.lock
generated
|
@ -55,16 +55,15 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "anstream"
|
||||
version = "0.6.14"
|
||||
version = "0.5.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "418c75fa768af9c03be99d17643f93f79bbba589895012a80e3452a19ddda15b"
|
||||
checksum = "b1f58811cfac344940f1a400b6e6231ce35171f614f26439e80f8c1465c5cc0c"
|
||||
dependencies = [
|
||||
"anstyle",
|
||||
"anstyle-parse",
|
||||
"anstyle-query",
|
||||
"anstyle-wincon",
|
||||
"colorchoice",
|
||||
"is_terminal_polyfill",
|
||||
"utf8parse",
|
||||
]
|
||||
|
||||
|
@ -94,20 +93,14 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "anstyle-wincon"
|
||||
version = "3.0.3"
|
||||
version = "2.1.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "61a38449feb7068f52bb06c12759005cf459ee52bb4adc1d5a7c4322d716fb19"
|
||||
checksum = "58f54d10c6dfa51283a066ceab3ec1ab78d13fae00aa49243a45e4571fb79dfd"
|
||||
dependencies = [
|
||||
"anstyle",
|
||||
"windows-sys 0.52.0",
|
||||
"windows-sys 0.48.0",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "atomic-waker"
|
||||
version = "1.1.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "1505bd5d3d116872e7271a6d4e16d81d0c8570876c8de68093a09ac269d8aac0"
|
||||
|
||||
[[package]]
|
||||
name = "autocfg"
|
||||
version = "1.1.0"
|
||||
|
@ -131,9 +124,9 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "base64"
|
||||
version = "0.22.1"
|
||||
version = "0.21.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "72b3254f16251a8381aa12e40e3c4d2f0199f8c6508fbecb9d91f575e0fbb8c6"
|
||||
checksum = "414dcefbc63d77c526a76b3afcf6fbb9b5e2791c19c3aa2297733208750c6e53"
|
||||
|
||||
[[package]]
|
||||
name = "bitflags"
|
||||
|
@ -167,7 +160,7 @@ checksum = "a2bd12c1caf447e69cd4528f47f94d203fd2582878ecb9e9465484c4148a8223"
|
|||
|
||||
[[package]]
|
||||
name = "cal7tor"
|
||||
version = "0.10.0"
|
||||
version = "0.7.0"
|
||||
dependencies = [
|
||||
"chrono",
|
||||
"clap",
|
||||
|
@ -197,23 +190,23 @@ checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd"
|
|||
|
||||
[[package]]
|
||||
name = "chrono"
|
||||
version = "0.4.38"
|
||||
version = "0.4.31"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "a21f936df1771bf62b77f047b726c4625ff2e8aa607c01ec06e5a05bd8463401"
|
||||
checksum = "7f2c685bad3eb3d45a01354cedb7d5faa66194d1d58ba6e267a8de788f79db38"
|
||||
dependencies = [
|
||||
"android-tzdata",
|
||||
"iana-time-zone",
|
||||
"js-sys",
|
||||
"num-traits",
|
||||
"wasm-bindgen",
|
||||
"windows-targets 0.52.5",
|
||||
"windows-targets 0.48.5",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "clap"
|
||||
version = "4.5.4"
|
||||
version = "4.4.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "90bc066a67923782aa8515dbaea16946c5bcc5addbd668bb80af688e53e548a0"
|
||||
checksum = "6a13b88d2c62ff462f88e4a121f17a82c1af05693a2f192b5c38d14de73c19f6"
|
||||
dependencies = [
|
||||
"clap_builder",
|
||||
"clap_derive",
|
||||
|
@ -221,9 +214,9 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "clap_builder"
|
||||
version = "4.5.2"
|
||||
version = "4.4.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "ae129e2e766ae0ec03484e609954119f123cc1fe650337e155d03b022f24f7b4"
|
||||
checksum = "2bb9faaa7c2ef94b2743a21f5a29e6f0010dff4caa69ac8e9d6cf8b6fa74da08"
|
||||
dependencies = [
|
||||
"anstream",
|
||||
"anstyle",
|
||||
|
@ -233,9 +226,9 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "clap_derive"
|
||||
version = "4.5.4"
|
||||
version = "4.4.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "528131438037fd55894f62d6e9f068b8f45ac57ffa77517819645d10aed04f64"
|
||||
checksum = "0862016ff20d69b84ef8247369fabf5c008a7417002411897d40ee1f4532b873"
|
||||
dependencies = [
|
||||
"heck",
|
||||
"proc-macro2",
|
||||
|
@ -245,9 +238,9 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "clap_lex"
|
||||
version = "0.7.0"
|
||||
version = "0.5.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "98cc8fbded0c607b7ba9dd60cd98df59af97e84d24e49c8557331cfc26d301ce"
|
||||
checksum = "cd7cc57abe963c6d3b9d8be5b06ba7c8957a930305ca90304f24ef040aa6f961"
|
||||
|
||||
[[package]]
|
||||
name = "colorchoice"
|
||||
|
@ -367,12 +360,6 @@ dependencies = [
|
|||
"cfg-if",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "equivalent"
|
||||
version = "1.0.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "5443807d6dff69373d433ab9ef5378ad8df50ca6298caf15de6e52e24aaf54d5"
|
||||
|
||||
[[package]]
|
||||
name = "errno"
|
||||
version = "0.3.3"
|
||||
|
@ -516,15 +503,15 @@ checksum = "6fb8d784f27acf97159b40fc4db5ecd8aa23b9ad5ef69cdd136d3bc80665f0c0"
|
|||
|
||||
[[package]]
|
||||
name = "h2"
|
||||
version = "0.4.5"
|
||||
version = "0.3.21"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "fa82e28a107a8cc405f0839610bdc9b15f1e25ec7d696aa5cf173edbcb1486ab"
|
||||
checksum = "91fc23aa11be92976ef4729127f1a74adf36d8436f7816b185d18df956790833"
|
||||
dependencies = [
|
||||
"atomic-waker",
|
||||
"bytes",
|
||||
"fnv",
|
||||
"futures-core",
|
||||
"futures-sink",
|
||||
"futures-util",
|
||||
"http",
|
||||
"indexmap",
|
||||
"slab",
|
||||
|
@ -535,41 +522,41 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "hashbrown"
|
||||
version = "0.14.5"
|
||||
version = "0.12.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "e5274423e17b7c9fc20b6e7e208532f9b19825d82dfd615708b70edd83df41f1"
|
||||
checksum = "8a9ee70c43aaf417c914396645a0fa852624801b24ebb7ae78fe8272889ac888"
|
||||
|
||||
[[package]]
|
||||
name = "heck"
|
||||
version = "0.5.0"
|
||||
version = "0.4.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "2304e00983f87ffb38b55b444b5e3b60a884b5d30c0fca7d82fe33449bbe55ea"
|
||||
checksum = "95505c38b4572b2d910cecb0281560f54b440a19336cbbcb27bf6ce6adc6f5a8"
|
||||
|
||||
[[package]]
|
||||
name = "hermit-abi"
|
||||
version = "0.3.9"
|
||||
version = "0.3.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "d231dfb89cfffdbc30e7fc41579ed6066ad03abda9e567ccafae602b97ec5024"
|
||||
checksum = "443144c8cdadd93ebf52ddb4056d257f5b52c04d3c804e657d19eb73fc33668b"
|
||||
|
||||
[[package]]
|
||||
name = "html5ever"
|
||||
version = "0.27.0"
|
||||
version = "0.26.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "c13771afe0e6e846f1e67d038d4cb29998a6779f93c809212e4e9c32efd244d4"
|
||||
checksum = "bea68cab48b8459f17cf1c944c67ddc572d272d9f2b274140f223ecb1da4a3b7"
|
||||
dependencies = [
|
||||
"log",
|
||||
"mac",
|
||||
"markup5ever",
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn 2.0.31",
|
||||
"syn 1.0.109",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "http"
|
||||
version = "1.1.0"
|
||||
version = "0.2.9"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "21b9ddb458710bc376481b842f5da65cdf31522de232c1ca8146abce2a358258"
|
||||
checksum = "bd6effc99afb63425aff9b05836f029929e345a6148a14b7ecd5ab67af944482"
|
||||
dependencies = [
|
||||
"bytes",
|
||||
"fnv",
|
||||
|
@ -578,24 +565,12 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "http-body"
|
||||
version = "1.0.0"
|
||||
version = "0.4.5"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "1cac85db508abc24a2e48553ba12a996e87244a0395ce011e62b37158745d643"
|
||||
checksum = "d5f38f16d184e36f2408a55281cd658ecbd3ca05cce6d6510a176eca393e26d1"
|
||||
dependencies = [
|
||||
"bytes",
|
||||
"http",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "http-body-util"
|
||||
version = "0.1.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "0475f8b2ac86659c21b64320d5d653f9efe42acd2a4e560073ec61a155a34f1d"
|
||||
dependencies = [
|
||||
"bytes",
|
||||
"futures-core",
|
||||
"http",
|
||||
"http-body",
|
||||
"pin-project-lite",
|
||||
]
|
||||
|
||||
|
@ -606,59 +581,46 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
|||
checksum = "d897f394bad6a705d5f4104762e116a75639e470d80901eed05a860a95cb1904"
|
||||
|
||||
[[package]]
|
||||
name = "hyper"
|
||||
version = "1.3.1"
|
||||
name = "httpdate"
|
||||
version = "1.0.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "fe575dd17d0862a9a33781c8c4696a55c320909004a67a00fb286ba8b1bc496d"
|
||||
checksum = "df3b46402a9d5adb4c86a0cf463f42e19994e3ee891101b1841f30a545cb49a9"
|
||||
|
||||
[[package]]
|
||||
name = "hyper"
|
||||
version = "0.14.27"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "ffb1cfd654a8219eaef89881fdb3bb3b1cdc5fa75ded05d6933b2b382e395468"
|
||||
dependencies = [
|
||||
"bytes",
|
||||
"futures-channel",
|
||||
"futures-core",
|
||||
"futures-util",
|
||||
"h2",
|
||||
"http",
|
||||
"http-body",
|
||||
"httparse",
|
||||
"httpdate",
|
||||
"itoa",
|
||||
"pin-project-lite",
|
||||
"smallvec",
|
||||
"socket2 0.4.9",
|
||||
"tokio",
|
||||
"tower-service",
|
||||
"tracing",
|
||||
"want",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "hyper-tls"
|
||||
version = "0.6.0"
|
||||
version = "0.5.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "70206fc6890eaca9fde8a0bf71caa2ddfc9fe045ac9e5c70df101a7dbde866e0"
|
||||
checksum = "d6183ddfa99b85da61a140bea0efc93fdf56ceaa041b37d553518030827f9905"
|
||||
dependencies = [
|
||||
"bytes",
|
||||
"http-body-util",
|
||||
"hyper",
|
||||
"hyper-util",
|
||||
"native-tls",
|
||||
"tokio",
|
||||
"tokio-native-tls",
|
||||
"tower-service",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "hyper-util"
|
||||
version = "0.1.5"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "7b875924a60b96e5d7b9ae7b066540b1dd1cbd90d1828f54c92e02a283351c56"
|
||||
dependencies = [
|
||||
"bytes",
|
||||
"futures-channel",
|
||||
"futures-util",
|
||||
"http",
|
||||
"http-body",
|
||||
"hyper",
|
||||
"pin-project-lite",
|
||||
"socket2",
|
||||
"tokio",
|
||||
"tower",
|
||||
"tower-service",
|
||||
"tracing",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
@ -702,11 +664,11 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "indexmap"
|
||||
version = "2.2.6"
|
||||
version = "1.9.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "168fb715dda47215e360912c096649d23d58bf392ac62f73919e831745e40f26"
|
||||
checksum = "bd070e393353796e801d209ad339e89596eb4c8d430d18ede6a1cced8fafbd99"
|
||||
dependencies = [
|
||||
"equivalent",
|
||||
"autocfg",
|
||||
"hashbrown",
|
||||
]
|
||||
|
||||
|
@ -716,12 +678,6 @@ version = "2.8.0"
|
|||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "28b29a3cd74f0f4598934efe3aeba42bae0eb4680554128851ebbecb02af14e6"
|
||||
|
||||
[[package]]
|
||||
name = "is_terminal_polyfill"
|
||||
version = "1.70.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "f8478577c03552c21db0e2724ffb8986a5ce7af88107e6be5d2ee6e158c12800"
|
||||
|
||||
[[package]]
|
||||
name = "itoa"
|
||||
version = "1.0.9"
|
||||
|
@ -779,13 +735,13 @@ checksum = "c41e0c4fef86961ac6d6f8a82609f55f31b05e4fce149ac5710e439df7619ba4"
|
|||
|
||||
[[package]]
|
||||
name = "markup5ever"
|
||||
version = "0.12.1"
|
||||
version = "0.11.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "16ce3abbeba692c8b8441d036ef91aea6df8da2c6b6e21c7e14d3c18e526be45"
|
||||
checksum = "7a2629bb1404f3d34c2e921f21fd34ba00b206124c81f65c50b43b6aaefeb016"
|
||||
dependencies = [
|
||||
"log",
|
||||
"phf 0.11.2",
|
||||
"phf_codegen 0.11.2",
|
||||
"phf 0.10.1",
|
||||
"phf_codegen",
|
||||
"string_cache",
|
||||
"string_cache_codegen",
|
||||
"tendril",
|
||||
|
@ -814,14 +770,13 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "mio"
|
||||
version = "1.0.2"
|
||||
version = "0.8.10"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "80e04d1dcff3aae0704555fe5fee3bcfaf3d1fdf8a7e521d5b9d2b42acb52cec"
|
||||
checksum = "8f3d0b296e374a4e6f3c7b0a1f5a51d748a0d34c85e7dc48fc3fa9a87657fe09"
|
||||
dependencies = [
|
||||
"hermit-abi",
|
||||
"libc",
|
||||
"wasi",
|
||||
"windows-sys 0.52.0",
|
||||
"windows-sys 0.48.0",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
@ -857,6 +812,16 @@ dependencies = [
|
|||
"autocfg",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "num_cpus"
|
||||
version = "1.16.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "4161fcb6d602d4d2081af7c3a45852d875a03dd337a6bfdd6e06407b61342a43"
|
||||
dependencies = [
|
||||
"hermit-abi",
|
||||
"libc",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "object"
|
||||
version = "0.32.1"
|
||||
|
@ -868,9 +833,9 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "once_cell"
|
||||
version = "1.19.0"
|
||||
version = "1.18.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "3fdb12b2476b595f9358c5161aa467c2438859caa136dec86c26fdd2efe17b92"
|
||||
checksum = "dd8b5dd2ae5ed71462c540258bedcb51965123ad7e7ccf4b9a8cafaa4a63576d"
|
||||
|
||||
[[package]]
|
||||
name = "openssl"
|
||||
|
@ -974,16 +939,6 @@ dependencies = [
|
|||
"phf_shared 0.10.0",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "phf_codegen"
|
||||
version = "0.11.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "e8d39688d359e6b34654d328e262234662d16cc0f60ec8dcbe5e718709342a5a"
|
||||
dependencies = [
|
||||
"phf_generator 0.11.2",
|
||||
"phf_shared 0.11.2",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "phf_generator"
|
||||
version = "0.10.0"
|
||||
|
@ -1035,26 +990,6 @@ dependencies = [
|
|||
"siphasher",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "pin-project"
|
||||
version = "1.1.5"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "b6bf43b791c5b9e34c3d182969b4abb522f9343702850a2e57f460d00d09b4b3"
|
||||
dependencies = [
|
||||
"pin-project-internal",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "pin-project-internal"
|
||||
version = "1.1.5"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "2f38a4412a78282e09a2cf38d195ea5420d15ba0602cb375210efbc877243965"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn 2.0.31",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "pin-project-lite"
|
||||
version = "0.2.13"
|
||||
|
@ -1087,9 +1022,9 @@ checksum = "925383efa346730478fb4838dbe9137d2a47675ad789c546d150a6e1dd4ab31c"
|
|||
|
||||
[[package]]
|
||||
name = "proc-macro2"
|
||||
version = "1.0.84"
|
||||
version = "1.0.66"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "ec96c6a92621310b51366f1e28d05ef11489516e93be030060e5fc12024a49d6"
|
||||
checksum = "18fb31db3f9bddb2ea821cde30a9f70117e3f119938b5ee630b7403aa6e2ead9"
|
||||
dependencies = [
|
||||
"unicode-ident",
|
||||
]
|
||||
|
@ -1173,9 +1108,9 @@ checksum = "c08c74e62047bb2de4ff487b251e4a92e24f48745648451635cec7d591162d9f"
|
|||
|
||||
[[package]]
|
||||
name = "reqwest"
|
||||
version = "0.12.4"
|
||||
version = "0.11.20"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "566cafdd92868e0939d3fb961bd0dc25fcfaaed179291093b3d43e6b3150ea10"
|
||||
checksum = "3e9ad3fe7488d7e34558a2033d45a0c90b72d97b4f80705666fea71472e2e6a1"
|
||||
dependencies = [
|
||||
"base64",
|
||||
"bytes",
|
||||
|
@ -1185,10 +1120,8 @@ dependencies = [
|
|||
"h2",
|
||||
"http",
|
||||
"http-body",
|
||||
"http-body-util",
|
||||
"hyper",
|
||||
"hyper-tls",
|
||||
"hyper-util",
|
||||
"ipnet",
|
||||
"js-sys",
|
||||
"log",
|
||||
|
@ -1197,12 +1130,9 @@ dependencies = [
|
|||
"once_cell",
|
||||
"percent-encoding",
|
||||
"pin-project-lite",
|
||||
"rustls-pemfile",
|
||||
"serde",
|
||||
"serde_json",
|
||||
"serde_urlencoded",
|
||||
"sync_wrapper",
|
||||
"system-configuration",
|
||||
"tokio",
|
||||
"tokio-native-tls",
|
||||
"tower-service",
|
||||
|
@ -1232,22 +1162,6 @@ dependencies = [
|
|||
"windows-sys 0.48.0",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "rustls-pemfile"
|
||||
version = "2.1.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "29993a25686778eb88d4189742cd713c9bce943bc54251a33509dc63cbacf73d"
|
||||
dependencies = [
|
||||
"base64",
|
||||
"rustls-pki-types",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "rustls-pki-types"
|
||||
version = "1.7.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "976295e77ce332211c0d24d92c0e83e50f5c5f046d11082cea19f3df13a3562d"
|
||||
|
||||
[[package]]
|
||||
name = "ryu"
|
||||
version = "1.0.15"
|
||||
|
@ -1271,9 +1185,9 @@ checksum = "94143f37725109f92c262ed2cf5e59bce7498c01bcc1502d7b9afe439a4e9f49"
|
|||
|
||||
[[package]]
|
||||
name = "scraper"
|
||||
version = "0.20.0"
|
||||
version = "0.18.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "b90460b31bfe1fc07be8262e42c665ad97118d4585869de9345a84d501a9eaf0"
|
||||
checksum = "585480e3719b311b78a573db1c9d9c4c1f8010c2dee4cc59c2efe58ea4dbc3e1"
|
||||
dependencies = [
|
||||
"ahash",
|
||||
"cssparser",
|
||||
|
@ -1321,7 +1235,7 @@ dependencies = [
|
|||
"log",
|
||||
"new_debug_unreachable",
|
||||
"phf 0.10.1",
|
||||
"phf_codegen 0.10.0",
|
||||
"phf_codegen",
|
||||
"precomputed-hash",
|
||||
"servo_arc",
|
||||
"smallvec",
|
||||
|
@ -1411,9 +1325,19 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "smallvec"
|
||||
version = "1.13.2"
|
||||
version = "1.11.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "3c5e1a9a646d36c3599cd173a41282daf47c44583ad367b8e6837255952e5c67"
|
||||
checksum = "62bb4feee49fdd9f707ef802e22365a35de4b7b299de4763d44bfea899442ff9"
|
||||
|
||||
[[package]]
|
||||
name = "socket2"
|
||||
version = "0.4.9"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "64a4a911eed85daf18834cfaa86a79b7d266ff93ff5ba14005426219480ed662"
|
||||
dependencies = [
|
||||
"libc",
|
||||
"winapi",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "socket2"
|
||||
|
@ -1459,9 +1383,9 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "strsim"
|
||||
version = "0.11.1"
|
||||
version = "0.10.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "7da8b5736845d9f2fcb837ea5d9e2628564b3b043a70948a3f0b778838c5fb4f"
|
||||
checksum = "73473c0e59e6d5812c5dfe2a064a6444949f089e20eec9a2e5506596494e4623"
|
||||
|
||||
[[package]]
|
||||
name = "syn"
|
||||
|
@ -1485,33 +1409,6 @@ dependencies = [
|
|||
"unicode-ident",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "sync_wrapper"
|
||||
version = "0.1.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "2047c6ded9c721764247e62cd3b03c09ffc529b2ba5b10ec482ae507a4a70160"
|
||||
|
||||
[[package]]
|
||||
name = "system-configuration"
|
||||
version = "0.5.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "ba3a3adc5c275d719af8cb4272ea1c4a6d668a777f37e115f6d11ddbc1c8e0e7"
|
||||
dependencies = [
|
||||
"bitflags 1.3.2",
|
||||
"core-foundation",
|
||||
"system-configuration-sys",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "system-configuration-sys"
|
||||
version = "0.5.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "a75fb188eb626b924683e3b95e3a48e63551fcfb51949de2f06a9d91dbee93c9"
|
||||
dependencies = [
|
||||
"core-foundation-sys",
|
||||
"libc",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "tempfile"
|
||||
version = "3.8.0"
|
||||
|
@ -1573,27 +1470,28 @@ checksum = "1f3ccbac311fea05f86f61904b462b55fb3df8837a366dfc601a0161d0532f20"
|
|||
|
||||
[[package]]
|
||||
name = "tokio"
|
||||
version = "1.40.0"
|
||||
version = "1.35.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "e2b070231665d27ad9ec9b8df639893f46727666c6767db40317fbe920a5d998"
|
||||
checksum = "c89b4efa943be685f629b149f53829423f8f5531ea21249408e8e2f8671ec104"
|
||||
dependencies = [
|
||||
"backtrace",
|
||||
"bytes",
|
||||
"libc",
|
||||
"mio",
|
||||
"num_cpus",
|
||||
"parking_lot",
|
||||
"pin-project-lite",
|
||||
"signal-hook-registry",
|
||||
"socket2",
|
||||
"socket2 0.5.5",
|
||||
"tokio-macros",
|
||||
"windows-sys 0.52.0",
|
||||
"windows-sys 0.48.0",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "tokio-macros"
|
||||
version = "2.4.0"
|
||||
version = "2.2.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "693d596312e88961bc67d7f1f97af8a70227d9f90c31bba5806eec004978d752"
|
||||
checksum = "5b8a1e28f2deaa14e508979454cb3a223b10b938b45af148bc0986de36f1923b"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
|
@ -1624,27 +1522,6 @@ dependencies = [
|
|||
"tracing",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "tower"
|
||||
version = "0.4.13"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "b8fa9be0de6cf49e536ce1851f987bd21a43b771b09473c3549a6c853db37c1c"
|
||||
dependencies = [
|
||||
"futures-core",
|
||||
"futures-util",
|
||||
"pin-project",
|
||||
"pin-project-lite",
|
||||
"tokio",
|
||||
"tower-layer",
|
||||
"tower-service",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "tower-layer"
|
||||
version = "0.3.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "c20c8dbed6283a09604c3e69b4b7eeb54e298b8a600d4d5ecb5ad39de609f1d0"
|
||||
|
||||
[[package]]
|
||||
name = "tower-service"
|
||||
version = "0.3.2"
|
||||
|
@ -1729,9 +1606,9 @@ checksum = "711b9620af191e0cdc7468a8d14e709c3dcdb115b36f838e601583af800a370a"
|
|||
|
||||
[[package]]
|
||||
name = "uuid"
|
||||
version = "1.10.0"
|
||||
version = "1.6.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "81dfa00651efa65069b0b6b651f4aaa31ba9e3c3ce0137aaad053604ee7e0314"
|
||||
checksum = "5e395fcf16a7a3d8127ec99782007af141946b4795001f876d54fb0d55978560"
|
||||
dependencies = [
|
||||
"getrandom",
|
||||
"rand",
|
||||
|
@ -1840,6 +1717,28 @@ dependencies = [
|
|||
"wasm-bindgen",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "winapi"
|
||||
version = "0.3.9"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "5c839a674fcd7a98952e593242ea400abe93992746761e38641405d28b00f419"
|
||||
dependencies = [
|
||||
"winapi-i686-pc-windows-gnu",
|
||||
"winapi-x86_64-pc-windows-gnu",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "winapi-i686-pc-windows-gnu"
|
||||
version = "0.4.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6"
|
||||
|
||||
[[package]]
|
||||
name = "winapi-x86_64-pc-windows-gnu"
|
||||
version = "0.4.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f"
|
||||
|
||||
[[package]]
|
||||
name = "windows"
|
||||
version = "0.48.0"
|
||||
|
@ -1867,15 +1766,6 @@ dependencies = [
|
|||
"windows-targets 0.48.5",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "windows-sys"
|
||||
version = "0.52.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "282be5f36a8ce781fad8c8ae18fa3f9beff57ec1b52cb3de0789201425d9a33d"
|
||||
dependencies = [
|
||||
"windows-targets 0.52.5",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "windows-targets"
|
||||
version = "0.42.2"
|
||||
|
@ -1906,22 +1796,6 @@ dependencies = [
|
|||
"windows_x86_64_msvc 0.48.5",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "windows-targets"
|
||||
version = "0.52.5"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "6f0713a46559409d202e70e28227288446bf7841d3211583a4b53e3f6d96e7eb"
|
||||
dependencies = [
|
||||
"windows_aarch64_gnullvm 0.52.5",
|
||||
"windows_aarch64_msvc 0.52.5",
|
||||
"windows_i686_gnu 0.52.5",
|
||||
"windows_i686_gnullvm",
|
||||
"windows_i686_msvc 0.52.5",
|
||||
"windows_x86_64_gnu 0.52.5",
|
||||
"windows_x86_64_gnullvm 0.52.5",
|
||||
"windows_x86_64_msvc 0.52.5",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "windows_aarch64_gnullvm"
|
||||
version = "0.42.2"
|
||||
|
@ -1934,12 +1808,6 @@ version = "0.48.5"
|
|||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "2b38e32f0abccf9987a4e3079dfb67dcd799fb61361e53e2882c3cbaf0d905d8"
|
||||
|
||||
[[package]]
|
||||
name = "windows_aarch64_gnullvm"
|
||||
version = "0.52.5"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "7088eed71e8b8dda258ecc8bac5fb1153c5cffaf2578fc8ff5d61e23578d3263"
|
||||
|
||||
[[package]]
|
||||
name = "windows_aarch64_msvc"
|
||||
version = "0.42.2"
|
||||
|
@ -1952,12 +1820,6 @@ version = "0.48.5"
|
|||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "dc35310971f3b2dbbf3f0690a219f40e2d9afcf64f9ab7cc1be722937c26b4bc"
|
||||
|
||||
[[package]]
|
||||
name = "windows_aarch64_msvc"
|
||||
version = "0.52.5"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "9985fd1504e250c615ca5f281c3f7a6da76213ebd5ccc9561496568a2752afb6"
|
||||
|
||||
[[package]]
|
||||
name = "windows_i686_gnu"
|
||||
version = "0.42.2"
|
||||
|
@ -1970,18 +1832,6 @@ version = "0.48.5"
|
|||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "a75915e7def60c94dcef72200b9a8e58e5091744960da64ec734a6c6e9b3743e"
|
||||
|
||||
[[package]]
|
||||
name = "windows_i686_gnu"
|
||||
version = "0.52.5"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "88ba073cf16d5372720ec942a8ccbf61626074c6d4dd2e745299726ce8b89670"
|
||||
|
||||
[[package]]
|
||||
name = "windows_i686_gnullvm"
|
||||
version = "0.52.5"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "87f4261229030a858f36b459e748ae97545d6f1ec60e5e0d6a3d32e0dc232ee9"
|
||||
|
||||
[[package]]
|
||||
name = "windows_i686_msvc"
|
||||
version = "0.42.2"
|
||||
|
@ -1994,12 +1844,6 @@ version = "0.48.5"
|
|||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "8f55c233f70c4b27f66c523580f78f1004e8b5a8b659e05a4eb49d4166cca406"
|
||||
|
||||
[[package]]
|
||||
name = "windows_i686_msvc"
|
||||
version = "0.52.5"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "db3c2bf3d13d5b658be73463284eaf12830ac9a26a90c717b7f771dfe97487bf"
|
||||
|
||||
[[package]]
|
||||
name = "windows_x86_64_gnu"
|
||||
version = "0.42.2"
|
||||
|
@ -2012,12 +1856,6 @@ version = "0.48.5"
|
|||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "53d40abd2583d23e4718fddf1ebec84dbff8381c07cae67ff7768bbf19c6718e"
|
||||
|
||||
[[package]]
|
||||
name = "windows_x86_64_gnu"
|
||||
version = "0.52.5"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "4e4246f76bdeff09eb48875a0fd3e2af6aada79d409d33011886d3e1581517d9"
|
||||
|
||||
[[package]]
|
||||
name = "windows_x86_64_gnullvm"
|
||||
version = "0.42.2"
|
||||
|
@ -2030,12 +1868,6 @@ version = "0.48.5"
|
|||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "0b7b52767868a23d5bab768e390dc5f5c55825b6d30b86c844ff2dc7414044cc"
|
||||
|
||||
[[package]]
|
||||
name = "windows_x86_64_gnullvm"
|
||||
version = "0.52.5"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "852298e482cd67c356ddd9570386e2862b5673c85bd5f88df9ab6802b334c596"
|
||||
|
||||
[[package]]
|
||||
name = "windows_x86_64_msvc"
|
||||
version = "0.42.2"
|
||||
|
@ -2048,17 +1880,11 @@ version = "0.48.5"
|
|||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "ed94fce61571a4006852b7389a063ab983c02eb1bb37b47f8272ce92d06d9538"
|
||||
|
||||
[[package]]
|
||||
name = "windows_x86_64_msvc"
|
||||
version = "0.52.5"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "bec47e5bfd1bff0eeaf6d8b485cc1074891a197ab4225d504cb7a1ab88b02bf0"
|
||||
|
||||
[[package]]
|
||||
name = "winreg"
|
||||
version = "0.52.0"
|
||||
version = "0.50.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "a277a57398d4bfa075df44f501a17cfdf8542d224f0d36095a2adc7aee4ef0a5"
|
||||
checksum = "524e57b2c537c0f9b1e69f1965311ec12182b4122e45035b1508cd24d2adadb1"
|
||||
dependencies = [
|
||||
"cfg-if",
|
||||
"windows-sys 0.48.0",
|
||||
|
|
21
Cargo.toml
21
Cargo.toml
|
@ -1,25 +1,22 @@
|
|||
[package]
|
||||
name = "cal7tor"
|
||||
version = "0.10.0"
|
||||
version = "0.7.0"
|
||||
authors = ["Mylloon"]
|
||||
edition = "2021"
|
||||
description = "Timetable extractor for the Paris Cité master's degree in IT"
|
||||
readme = "README.md"
|
||||
repository = "https://git.mylloon.fr/Anri/cal7tor"
|
||||
keywords = ["scrape", "calendar", "paris diderot", "paris cité"]
|
||||
keywords = ["scrape", "calendar"]
|
||||
publish = false
|
||||
license = "AGPL-3.0-or-later"
|
||||
|
||||
[dependencies]
|
||||
reqwest = { version = "0.12" }
|
||||
tokio = { version = "1.40", features = ["full"] }
|
||||
scraper = "0.20"
|
||||
reqwest = { version = "0.11" }
|
||||
tokio = { version = "1.35", features = ["full"] }
|
||||
scraper = "0.18"
|
||||
regex = "1.10"
|
||||
chrono = "0.4.38"
|
||||
ics = { version = "0.5", default-features = false }
|
||||
uuid = { version = "1.10", features = ["v4", "fast-rng"] }
|
||||
clap = { version = "4.5", features = ["derive"] }
|
||||
chrono = "0.4.31"
|
||||
ics = "0.5"
|
||||
uuid = { version = "1.6", features = ["v4", "fast-rng"] }
|
||||
clap = { version = "4.4", features = ["derive"] }
|
||||
dialoguer = "0.11"
|
||||
|
||||
[lints.clippy]
|
||||
pedantic = "warn"
|
||||
|
|
|
@ -4,13 +4,12 @@ use crate::timetable::models::Category;
|
|||
use crate::timetable::models::Timetable;
|
||||
use crate::utils::get_count;
|
||||
use crate::utils::get_entry;
|
||||
use crate::utils::get_entry_nocat;
|
||||
use crate::utils::get_selection;
|
||||
|
||||
const DISCLAIMER: &str = "(selection avec ESPACE, ENTRER pour valider)";
|
||||
|
||||
/// Filter the timetable
|
||||
pub fn timetable(timetable: Timetable, merge_td_tp: bool) -> Timetable {
|
||||
pub fn timetable(timetable: Timetable) -> Timetable {
|
||||
let mut my_timetable = timetable;
|
||||
|
||||
/* Note on Cours/TD:
|
||||
|
@ -22,7 +21,7 @@ pub fn timetable(timetable: Timetable, merge_td_tp: bool) -> Timetable {
|
|||
|
||||
choice(&mut my_timetable);
|
||||
courses(&mut my_timetable);
|
||||
tdtp(&mut my_timetable, merge_td_tp);
|
||||
tdtp(&mut my_timetable);
|
||||
|
||||
my_timetable
|
||||
}
|
||||
|
@ -34,15 +33,15 @@ fn choice(timetable: &mut Timetable) {
|
|||
day.courses.iter().for_each(|course_opt| {
|
||||
if let Some(course) = course_opt {
|
||||
if !multiselected.contains(&course.name) {
|
||||
multiselected.push(course.name.clone());
|
||||
multiselected.push(course.name.to_owned());
|
||||
}
|
||||
}
|
||||
});
|
||||
})
|
||||
});
|
||||
|
||||
let defaults = vec![true; multiselected.len()];
|
||||
let selections = MultiSelect::new()
|
||||
.with_prompt(format!("Choisis tes matières {DISCLAIMER}"))
|
||||
.with_prompt(format!("Choisis tes matières {}", DISCLAIMER))
|
||||
.items(&multiselected[..])
|
||||
.defaults(&defaults[..])
|
||||
.interact()
|
||||
|
@ -66,14 +65,12 @@ fn choice(timetable: &mut Timetable) {
|
|||
|
||||
/// Filter the multiple courses
|
||||
fn courses(timetable: &mut Timetable) {
|
||||
let entry_getter = get_entry;
|
||||
|
||||
// List of courses and Counter of how much they appears
|
||||
// to know if multiples slots are available
|
||||
let (mut courses, counts) = get_count(timetable, &[Category::Cours], entry_getter);
|
||||
let (mut courses, counts) = get_count(timetable, &[Category::Cours]);
|
||||
|
||||
// Keep only elements who have multiples slots
|
||||
courses.retain(|course| *counts.get(&entry_getter(course.0)).unwrap() > 1);
|
||||
courses.retain(|course| *counts.get(&get_entry(course.0)).unwrap() > 1);
|
||||
|
||||
let mut multiselected: Vec<String> = courses.iter().map(get_selection).collect();
|
||||
multiselected.sort();
|
||||
|
@ -82,7 +79,7 @@ fn courses(timetable: &mut Timetable) {
|
|||
if !multiselected.is_empty() {
|
||||
let defaults = vec![false; multiselected.len()];
|
||||
selections = MultiSelect::new()
|
||||
.with_prompt(format!("Choisis tes horaires de Cours {DISCLAIMER}"))
|
||||
.with_prompt(format!("Choisis tes horaires de Cours {}", DISCLAIMER))
|
||||
.items(&multiselected[..])
|
||||
.defaults(&defaults[..])
|
||||
.interact()
|
||||
|
@ -101,13 +98,13 @@ fn courses(timetable: &mut Timetable) {
|
|||
}
|
||||
|
||||
// Keep if only one slot is available
|
||||
if *counts.get(&entry_getter(course)).unwrap() == 1 {
|
||||
if *counts.get(&get_entry(course)).unwrap() == 1 {
|
||||
return true;
|
||||
}
|
||||
|
||||
// Keep only chosen courses if multiple was available
|
||||
for i in &selections {
|
||||
if get_selection(&(course, day.name.clone())) == multiselected[*i] {
|
||||
if get_selection(&(course, day.name.to_owned())) == multiselected[*i] {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
@ -119,16 +116,13 @@ fn courses(timetable: &mut Timetable) {
|
|||
}
|
||||
|
||||
/// Filter the multiples TD/TP
|
||||
fn tdtp(timetable: &mut Timetable, merge: bool) {
|
||||
// If we differentiate TD from TP
|
||||
let entry_getter = if merge { get_entry_nocat } else { get_entry };
|
||||
|
||||
fn tdtp(timetable: &mut Timetable) {
|
||||
// List of TP/TD and Counter of how much they appears
|
||||
// to know if multiples slots are available
|
||||
let (mut td_or_tp, counts) = get_count(timetable, &[Category::TD, Category::TP], entry_getter);
|
||||
let (mut td_or_tp, counts) = get_count(timetable, &[Category::TD, Category::TP]);
|
||||
|
||||
// Keep only elements who have multiples TD/TP
|
||||
td_or_tp.retain(|course| *counts.get(&entry_getter(course.0)).unwrap() > 1);
|
||||
td_or_tp.retain(|course| *counts.get(&get_entry(course.0)).unwrap() > 1);
|
||||
|
||||
let mut multiselected: Vec<String> = td_or_tp.iter().map(get_selection).collect();
|
||||
multiselected.sort();
|
||||
|
@ -137,7 +131,7 @@ fn tdtp(timetable: &mut Timetable, merge: bool) {
|
|||
if !multiselected.is_empty() {
|
||||
let defaults = vec![false; multiselected.len()];
|
||||
selections = MultiSelect::new()
|
||||
.with_prompt(format!("Choisis tes horaires de TD/TP {DISCLAIMER}"))
|
||||
.with_prompt(format!("Choisis tes horaires de TD/TP {}", DISCLAIMER))
|
||||
.items(&multiselected[..])
|
||||
.defaults(&defaults[..])
|
||||
.interact()
|
||||
|
@ -154,13 +148,13 @@ fn tdtp(timetable: &mut Timetable, merge: bool) {
|
|||
}
|
||||
|
||||
// Keep if only one slot is available of the TD/TP
|
||||
if *counts.get(&entry_getter(course)).unwrap() == 1 {
|
||||
if *counts.get(&get_entry(course)).unwrap() == 1 {
|
||||
return true;
|
||||
}
|
||||
|
||||
// Keep only chosen TD/TP if multiple was available
|
||||
for i in &selections {
|
||||
if get_selection(&(course, day.name.clone())) == multiselected[*i] {
|
||||
if get_selection(&(course, day.name.to_owned())) == multiselected[*i] {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
35
src/ics.rs
35
src/ics.rs
|
@ -2,15 +2,13 @@ use std::sync::Arc;
|
|||
|
||||
use chrono::TimeZone;
|
||||
use ics::{
|
||||
parameters::{Language, PartStat, Role, TzIDParam, CN},
|
||||
properties::{
|
||||
Attendee, Categories, Class, Description, DtEnd, DtStart, Location, Summary, Transp,
|
||||
},
|
||||
parameters,
|
||||
properties::{Categories, Class, Description, DtEnd, DtStart, Location, Summary, Transp},
|
||||
Event, ICalendar, Standard,
|
||||
};
|
||||
|
||||
pub fn export(courses: Vec<crate::timetable::models::Course>, filename: &mut String) {
|
||||
let mut calendar = ICalendar::new("2.0", "cal7tor");
|
||||
let mut calendar = ICalendar::new("2.0", "cal8tor");
|
||||
|
||||
// Add Europe/Paris timezone
|
||||
let timezone_name = "Europe/Paris";
|
||||
|
@ -40,22 +38,17 @@ pub fn export(courses: Vec<crate::timetable::models::Course>, filename: &mut Str
|
|||
|
||||
// Professor's name
|
||||
if course.professor.is_some() {
|
||||
let name = course.professor.unwrap();
|
||||
let mut contact = Attendee::new("mailto:place@holder.com");
|
||||
contact.add(CN::new(name));
|
||||
contact.add(PartStat::ACCEPTED);
|
||||
contact.add(Role::CHAIR);
|
||||
event.push(contact);
|
||||
event.push(Description::new(course.professor.unwrap()));
|
||||
}
|
||||
|
||||
// Start time of the course
|
||||
let mut date_start = DtStart::new(dt_ical(course.dtstart.unwrap()));
|
||||
date_start.add(TzIDParam::new(timezone_name));
|
||||
date_start.append(parameters!("TZID" => timezone_name));
|
||||
event.push(date_start);
|
||||
|
||||
// End time of the course
|
||||
let mut date_end = DtEnd::new(dt_ical(course.dtend.unwrap()));
|
||||
date_end.add(TzIDParam::new(timezone_name));
|
||||
date_end.append(parameters!("TZID" => timezone_name));
|
||||
event.push(date_end);
|
||||
|
||||
// Room location
|
||||
|
@ -64,33 +57,25 @@ pub fn export(courses: Vec<crate::timetable::models::Course>, filename: &mut Str
|
|||
let categories = course
|
||||
.category
|
||||
.iter()
|
||||
.map(std::string::ToString::to_string)
|
||||
.map(|c| c.to_string())
|
||||
.collect::<Arc<[String]>>()
|
||||
.join("/");
|
||||
|
||||
// Course's name
|
||||
let mut course_name = Summary::new(format!("{} - {}", categories, course.name));
|
||||
course_name.add(Language::new("fr"));
|
||||
course_name.append(parameters!("LANGUAGE" => "fr"));
|
||||
event.push(course_name);
|
||||
|
||||
// Course's category
|
||||
event.push(Categories::new(categories));
|
||||
|
||||
// Course extra data
|
||||
if course.data.is_some() {
|
||||
event.push(Description::new(course.data.unwrap()));
|
||||
}
|
||||
|
||||
// Add the course to the calendar
|
||||
calendar.add_event(event);
|
||||
}
|
||||
|
||||
// Add the extension if needed
|
||||
if !std::path::Path::new(filename)
|
||||
.extension()
|
||||
.map_or(false, |ext| ext.eq_ignore_ascii_case("ics"))
|
||||
{
|
||||
*filename = format!("{filename}.ics");
|
||||
if !filename.ends_with(".ics") {
|
||||
*filename = format!("{}.ics", filename)
|
||||
};
|
||||
|
||||
calendar.save_file(filename).unwrap();
|
||||
|
|
37
src/info.rs
37
src/info.rs
|
@ -8,12 +8,12 @@ use crate::utils::{
|
|||
models::{Info, InfoList, InfoType},
|
||||
};
|
||||
|
||||
pub async fn get_start_date(
|
||||
pub async fn info(
|
||||
level: i8,
|
||||
semester_opt: Option<i8>,
|
||||
year_opt: Option<i32>,
|
||||
user_agent: &str,
|
||||
) -> String {
|
||||
) -> Info {
|
||||
let semester = get_semester(semester_opt);
|
||||
let year = get_year(year_opt, semester);
|
||||
|
||||
|
@ -34,15 +34,7 @@ pub async fn get_start_date(
|
|||
.inner_html();
|
||||
|
||||
let re = Regex::new(r"\d{1,2} (septembre|octobre)").unwrap();
|
||||
|
||||
re.captures(&raw_data)
|
||||
.and_then(|caps| caps.get(0))
|
||||
.map_or("1 septembre".to_owned(), |m| m.as_str().to_owned())
|
||||
}
|
||||
|
||||
pub fn info(semester_opt: Option<i8>, year_opt: Option<i32>, date: &str, skip_week: bool) -> Info {
|
||||
let semester = get_semester(semester_opt);
|
||||
let year = get_year(year_opt, semester);
|
||||
let date = re.captures(&raw_data).unwrap().get(0).unwrap().as_str();
|
||||
|
||||
// 1st semester
|
||||
let weeks_s1_1 = 6; // Weeks before break
|
||||
|
@ -60,10 +52,8 @@ pub fn info(semester_opt: Option<i8>, year_opt: Option<i32>, date: &str, skip_we
|
|||
let cours_s1 = vec![(date_s1_1, weeks_s1_1), (date_s1_2, weeks_s1_2)];
|
||||
let cours_s2 = vec![(date_s2_1, weeks_s2_1), (date_s2_2, weeks_s2_2)];
|
||||
|
||||
let delta = i64::from(skip_week);
|
||||
|
||||
let tdtp_s1 = derive_from_cours(&cours_s1, delta);
|
||||
let tdtp_s2 = derive_from_cours(&cours_s2, delta);
|
||||
let tdtp_s1 = derive_from_cours(&cours_s1);
|
||||
let tdtp_s2 = derive_from_cours(&cours_s2);
|
||||
|
||||
HashMap::from([
|
||||
(
|
||||
|
@ -84,16 +74,13 @@ pub fn info(semester_opt: Option<i8>, year_opt: Option<i32>, date: &str, skip_we
|
|||
}
|
||||
|
||||
/// Find TD/TP dates, based on the ones from courses
|
||||
fn derive_from_cours(courses: &InfoList, delta: i64) -> Vec<(DateTime<Utc>, i64)> {
|
||||
fn derive_from_cours(courses: &InfoList) -> Vec<(DateTime<Utc>, i64)> {
|
||||
// TD/TP start one week after courses
|
||||
let before_break = courses.first().unwrap();
|
||||
let after_break = courses.last().unwrap();
|
||||
vec![
|
||||
(
|
||||
before_break.0 + Duration::weeks(delta),
|
||||
before_break.1 - delta,
|
||||
),
|
||||
(after_break.0, after_break.1 + delta),
|
||||
(before_break.0 + Duration::weeks(1), before_break.1 - 1),
|
||||
(after_break.0, after_break.1 + 1),
|
||||
]
|
||||
}
|
||||
|
||||
|
@ -117,7 +104,7 @@ fn anglophonization(date: &str) -> String {
|
|||
// New regex of all the french month
|
||||
let re = Regex::new(&format!(
|
||||
"({})",
|
||||
dico.keys().copied().collect::<Arc<[_]>>().join("|")
|
||||
dico.keys().cloned().collect::<Arc<[_]>>().join("|")
|
||||
))
|
||||
.unwrap();
|
||||
|
||||
|
@ -125,16 +112,16 @@ fn anglophonization(date: &str) -> String {
|
|||
// Use 12:00 and UTC TZ for chrono parser
|
||||
"{} 12:00 +0000",
|
||||
// Replace french by english month
|
||||
re.replace_all(&date.to_lowercase(), |cap: &Captures| match &cap[0] {
|
||||
re.replace_all(date, |cap: &Captures| match &cap[0] {
|
||||
month if dico.contains_key(month) => dico.get(month).unwrap(),
|
||||
month => {
|
||||
panic!("Unknown month: {month}")
|
||||
panic!("Unknown month: {}", month)
|
||||
}
|
||||
})
|
||||
)
|
||||
}
|
||||
|
||||
/// Turn a string to a `DateTime`
|
||||
/// Turn a string to a DateTime
|
||||
fn get_date(date: &str) -> DateTime<Utc> {
|
||||
// Use and keep UTC time, we have the hour set to 12h and
|
||||
// Paris 7 is in France so there is no problems
|
||||
|
|
42
src/main.rs
42
src/main.rs
|
@ -1,5 +1,4 @@
|
|||
use clap::Parser;
|
||||
use dialoguer::Input;
|
||||
use regex::Regex;
|
||||
|
||||
mod filter;
|
||||
|
@ -11,15 +10,15 @@ mod utils;
|
|||
#[derive(Parser)]
|
||||
#[clap(version, about, long_about = None)]
|
||||
struct Args {
|
||||
/// The class you want to get the timetable, i.e.: M1
|
||||
/// The class you want to get the timetable, i.e.: M1-LP
|
||||
#[clap(value_parser)]
|
||||
class: String,
|
||||
|
||||
/// The semester you want (1 or 2), default to current semester
|
||||
/// The semester you want (1 or 2)
|
||||
#[clap(short, long, value_parser, value_name = "SEMESTER NUMBER")]
|
||||
semester: Option<i8>,
|
||||
|
||||
/// The year, default to current year
|
||||
/// The year, default to the current year
|
||||
#[clap(short, long, value_parser, value_name = "YEAR")]
|
||||
year: Option<i32>,
|
||||
|
||||
|
@ -27,21 +26,9 @@ struct Args {
|
|||
#[clap(short, long, value_name = "FILE NAME")]
|
||||
export: Option<String>,
|
||||
|
||||
/// Size of cell of the timetable (irrelevant when exporting)
|
||||
/// Size of cell of the timetable (irrelevant when exporting the timetable)
|
||||
#[clap(short, long, value_name = "CELL LENGTH", default_value_t = 35)]
|
||||
cl: usize,
|
||||
|
||||
/// Doesn't distinguish TD from TP
|
||||
#[clap(short, long)]
|
||||
td_are_tp: bool,
|
||||
|
||||
/// First day of your year
|
||||
#[clap(short, long)]
|
||||
first_day: Option<String>,
|
||||
|
||||
/// If TD/TP start a week after courses
|
||||
#[clap(short, long)]
|
||||
week_skip: bool,
|
||||
}
|
||||
|
||||
#[tokio::main]
|
||||
|
@ -62,36 +49,27 @@ async fn main() {
|
|||
|
||||
let user_agent = format!("cal7tor/{}", env!("CARGO_PKG_VERSION"));
|
||||
|
||||
println!("Récupération de l'emploi du temps des M{level}...");
|
||||
println!("Récupération de l'emploi du temps des M{}...", level,);
|
||||
let mut timetable = timetable::timetable(level, args.semester, args.year, &user_agent).await;
|
||||
|
||||
timetable = filter::timetable(timetable, args.td_are_tp);
|
||||
|
||||
let date = match args.first_day {
|
||||
None => Input::new()
|
||||
.with_prompt("Début des cours de l'année")
|
||||
.default(info::get_start_date(level, args.semester, args.year, &user_agent).await)
|
||||
.interact_text()
|
||||
.unwrap(),
|
||||
Some(day) => day,
|
||||
};
|
||||
timetable = filter::timetable(timetable);
|
||||
|
||||
println!("Récupération des informations par rapport à l'année...");
|
||||
let info = info::info(args.semester, args.year, &date, args.week_skip);
|
||||
let info = info::info(level, args.semester, args.year, &user_agent).await;
|
||||
|
||||
if args.export.is_some() {
|
||||
// Export the calendar
|
||||
let mut filename = args.export.unwrap();
|
||||
|
||||
let builded_timetable = timetable::build(&timetable, &info);
|
||||
let builded_timetable = timetable::build(timetable, info);
|
||||
ics::export(builded_timetable, &mut filename);
|
||||
|
||||
println!("Fichier .ICS construit et exporté => {filename}");
|
||||
println!("Fichier .ICS construit et exporté => {}", filename);
|
||||
} else {
|
||||
println!("\x1b[93mNOTICE: IT WON'T WORK!!!\x1b[0m");
|
||||
// Show the calendar
|
||||
println!("Affichage...");
|
||||
timetable::display(&timetable, args.cl);
|
||||
timetable::display(timetable, args.cl);
|
||||
println!("Vous devrez peut-être mettre votre terminal en plein écran si ce n'est pas déjà le cas.");
|
||||
}
|
||||
}
|
||||
|
|
114
src/timetable.rs
114
src/timetable.rs
|
@ -1,5 +1,3 @@
|
|||
#![allow(clippy::cast_sign_loss)]
|
||||
|
||||
use chrono::{Datelike, Duration, TimeZone, Utc};
|
||||
use regex::Regex;
|
||||
use scraper::Selector;
|
||||
|
@ -36,7 +34,6 @@ pub async fn timetable(
|
|||
let sel_td = Selector::parse("td").unwrap();
|
||||
let sel_small = Selector::parse("small").unwrap();
|
||||
let sel_b = Selector::parse("b").unwrap();
|
||||
let sel_span = Selector::parse("span").unwrap();
|
||||
|
||||
// Find the timetable
|
||||
let raw_timetable = document.select(&sel_table).next().unwrap();
|
||||
|
@ -52,14 +49,8 @@ pub async fn timetable(
|
|||
.select(&sel_td)
|
||||
.filter(|element| element.value().attr("title").is_some())
|
||||
.for_each(|i| {
|
||||
let extra_data = i.select(&sel_span).next().map(|span|
|
||||
span.inner_html().replace("<br>", "").trim().to_owned()
|
||||
);
|
||||
|
||||
/* TODO: Instead of searching *_M2, just find any TD_* and TP_* */
|
||||
let matches =
|
||||
Regex::new(
|
||||
r"(?P<type>COURS|COURS_TD|TD|TD_M2|TP|TP_M2)? (?P<name>.*) : (?P<day>(lundi|mardi|mercredi|jeudi|vendredi)) (?P<startime>.*) \(durée : (?P<duration>.*)\)")
|
||||
Regex::new(r"(?P<type>COURS|TD|TP|COURS_TD) (?P<name>.*) : (?P<day>(lundi|mardi|mercredi|jeudi|vendredi)) (?P<startime>.*) \(durée : (?P<duration>.*)\)")
|
||||
.unwrap()
|
||||
.captures(i.value().attr("title").unwrap())
|
||||
.unwrap();
|
||||
|
@ -71,49 +62,42 @@ pub async fn timetable(
|
|||
.capitalize();
|
||||
|
||||
let startime = matches
|
||||
.name("startime")
|
||||
.unwrap()
|
||||
.as_str();
|
||||
.name("startime")
|
||||
.unwrap()
|
||||
.as_str();
|
||||
|
||||
let binding = i.select(&sel_b).last().unwrap().inner_html();
|
||||
let course = models::Course{
|
||||
category: match matches
|
||||
.name("type")
|
||||
.map_or("", |m| m.as_str()) {
|
||||
/* TODO: Instead of searching *_M2, just find any TD_* and TP_* */
|
||||
.unwrap()
|
||||
.as_str() {
|
||||
"COURS" => [models::Category::Cours].into(),
|
||||
"TP" | "TP_M2" => [models::Category::TP].into(),
|
||||
"TD" | "TD_M2" => [models::Category::TD].into(),
|
||||
"TP" => [models::Category::TP].into(),
|
||||
"TD" => [models::Category::TD].into(),
|
||||
"COURS_TD" => [models::Category::Cours, models::Category::TD].into(),
|
||||
_ => {
|
||||
println!("Unknown type of course, falling back to 'COURS': {}", i.value().attr("title").unwrap());
|
||||
[models::Category::Cours].into()
|
||||
},
|
||||
_ => panic!("Unknown type of course")
|
||||
},
|
||||
name: Regex::new(r"[ -][ML][1-3]$").unwrap().replace(
|
||||
matches
|
||||
.name("name")
|
||||
.unwrap()
|
||||
.as_str(),
|
||||
""
|
||||
).to_string(),
|
||||
name: matches
|
||||
.name("name")
|
||||
.unwrap()
|
||||
.as_str().to_owned(),
|
||||
professor: if let Some(raw_prof) = i.select(&sel_small).last() {
|
||||
match raw_prof.inner_html() {
|
||||
i if i.starts_with("<span") => None,
|
||||
i => Some(i),
|
||||
}
|
||||
} else { None },
|
||||
match raw_prof.inner_html() {
|
||||
i if i.starts_with("<span") => None,
|
||||
i => Some(i),
|
||||
}
|
||||
} else { None },
|
||||
room: Regex::new(r"(<table.*<\/table>|<br>.*?<br>.*?)?<br>(?P<location>.*?)<br>")
|
||||
.unwrap()
|
||||
.captures(&binding)
|
||||
.unwrap().name("location")
|
||||
.unwrap()
|
||||
.as_str().to_owned(),
|
||||
.unwrap()
|
||||
.captures(&binding)
|
||||
.unwrap().name("location")
|
||||
.unwrap()
|
||||
.as_str().to_owned(),
|
||||
start: schedules.iter().position(|r| r.starts_with(startime)).unwrap(),
|
||||
size: i.value().attr("rowspan").unwrap().parse::<usize>().unwrap(),
|
||||
dtstart: None,
|
||||
dtend: None,
|
||||
data: extra_data,
|
||||
};
|
||||
|
||||
// Search for the day in the timetable
|
||||
|
@ -122,7 +106,7 @@ pub async fn timetable(
|
|||
} else {
|
||||
// Day with the name doesn't exist, create a new Day
|
||||
timetable.push(models::Day {
|
||||
name: day.clone(),
|
||||
name: day.to_owned(),
|
||||
courses: vec![Some(course)],
|
||||
});
|
||||
}
|
||||
|
@ -140,7 +124,7 @@ pub async fn timetable(
|
|||
}
|
||||
|
||||
/// Build the timetable
|
||||
pub fn build(timetable: &models::Timetable, dates: &Info) -> Vec<models::Course> {
|
||||
pub fn build(timetable: models::Timetable, dates: Info) -> Vec<models::Course> {
|
||||
let mut schedules = Vec::new();
|
||||
// h1 => heure de début | m1 => minute de début
|
||||
// h2 => heure de fin | m2 => minute de fin
|
||||
|
@ -177,16 +161,16 @@ pub fn build(timetable: &models::Timetable, dates: &Info) -> Vec<models::Course>
|
|||
&schedules,
|
||||
&timetable.1 .1,
|
||||
&datetimes.course,
|
||||
&Some(vec![models::Category::Cours]),
|
||||
&None,
|
||||
Some(vec![models::Category::Cours]),
|
||||
None,
|
||||
);
|
||||
add_courses(
|
||||
&mut semester,
|
||||
&schedules,
|
||||
&timetable.1 .1,
|
||||
&datetimes.td_tp,
|
||||
&None,
|
||||
&Some(vec![models::Category::Cours]),
|
||||
None,
|
||||
Some(vec![models::Category::Cours]),
|
||||
);
|
||||
|
||||
semester
|
||||
|
@ -205,9 +189,9 @@ fn add_courses(
|
|||
// Current courses list
|
||||
info: &InfoList,
|
||||
// List of category allowed
|
||||
keep: &Option<Vec<models::Category>>,
|
||||
keep: Option<Vec<models::Category>>,
|
||||
// List of category excluded
|
||||
exclude: &Option<Vec<models::Category>>,
|
||||
exclude: Option<Vec<models::Category>>,
|
||||
) {
|
||||
let before_break = info.first().unwrap();
|
||||
let mut date = before_break.0;
|
||||
|
@ -224,10 +208,10 @@ fn add_courses(
|
|||
|
||||
// Check keep and exclude filters
|
||||
if keep
|
||||
.clone()
|
||||
.to_owned()
|
||||
.is_some_and(|list| !course.category.iter().any(|item| list.contains(item)))
|
||||
|| exclude.clone().is_some_and(|list| {
|
||||
course.category.iter().any(|item| list.contains(item))
|
||||
|| exclude.to_owned().is_some_and(|list| {
|
||||
course.category.iter().all(|item| list.contains(item))
|
||||
})
|
||||
{
|
||||
continue;
|
||||
|
@ -271,7 +255,7 @@ fn add_courses(
|
|||
}
|
||||
|
||||
/// Display the timetable
|
||||
pub fn display(timetable: &(Arc<[String]>, (usize, Vec<models::Day>)), cell_length: usize) {
|
||||
pub fn display(timetable: (Arc<[String]>, (usize, Vec<models::Day>)), cell_length: usize) {
|
||||
// Cell length for hours
|
||||
let clh = 11;
|
||||
// Cell number
|
||||
|
@ -282,7 +266,7 @@ pub fn display(timetable: &(Arc<[String]>, (usize, Vec<models::Day>)), cell_leng
|
|||
let sep = TabChar::Bv.val();
|
||||
|
||||
// Top of the tab
|
||||
utils::line_table(clh, cell_length, cn, &Position::Top, &HashMap::new());
|
||||
utils::line_table(clh, cell_length, cn, Position::Top, HashMap::new());
|
||||
|
||||
// First empty case
|
||||
print!("{}{:^clh$}{}", sep, "", sep);
|
||||
|
@ -299,13 +283,13 @@ pub fn display(timetable: &(Arc<[String]>, (usize, Vec<models::Day>)), cell_leng
|
|||
// For each hours -- i the hour's number
|
||||
for (i, hour) in timetable.0.iter().enumerate() {
|
||||
// Draw separator line
|
||||
utils::line_table(clh, cell_length, cn, &Position::Middle, &next_skip);
|
||||
utils::line_table(clh, cell_length, cn, Position::Middle, next_skip);
|
||||
|
||||
// Reset
|
||||
next_skip = HashMap::new();
|
||||
|
||||
// Print hour
|
||||
print!("{sep}{hour:^clh$}");
|
||||
print!("{}{:^clh$}", sep, hour);
|
||||
|
||||
// For all the days - `j` the day's number
|
||||
for (j, day) in timetable.1 .1.iter().enumerate() {
|
||||
|
@ -332,17 +316,17 @@ pub fn display(timetable: &(Arc<[String]>, (usize, Vec<models::Day>)), cell_leng
|
|||
}
|
||||
info_slot = true;
|
||||
break;
|
||||
}
|
||||
|
||||
// Else simply print the course
|
||||
// If the data is too long
|
||||
if course.name.len() > quarter {
|
||||
print!("{}{:^cell_length$}", sep, utils::etc_str(&course.name));
|
||||
} else {
|
||||
print!("{}{:^cell_length$}", sep, &course.name);
|
||||
// Else simply print the course
|
||||
// If the data is too long
|
||||
if course.name.len() > quarter {
|
||||
print!("{}{:^cell_length$}", sep, utils::etc_str(&course.name));
|
||||
} else {
|
||||
print!("{}{:^cell_length$}", sep, &course.name);
|
||||
}
|
||||
info_slot = true;
|
||||
break;
|
||||
}
|
||||
info_slot = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
// If no course was found
|
||||
|
@ -364,8 +348,8 @@ pub fn display(timetable: &(Arc<[String]>, (usize, Vec<models::Day>)), cell_leng
|
|||
print!("{}{:^cell_length$}", sep, "");
|
||||
}
|
||||
}
|
||||
print!("{sep}");
|
||||
print!("{}", sep);
|
||||
}
|
||||
// Bottom of the table
|
||||
utils::line_table(clh, cell_length, cn, &Position::Bottom, &HashMap::new());
|
||||
utils::line_table(clh, cell_length, cn, Position::Bottom, HashMap::new());
|
||||
}
|
||||
|
|
|
@ -43,9 +43,6 @@ pub struct Course {
|
|||
/// Datetime when the course end
|
||||
/// Filled only when building for the ICS
|
||||
pub dtend: Option<chrono::DateTime<chrono::Utc>>,
|
||||
|
||||
/// Extra data
|
||||
pub data: Option<String>,
|
||||
}
|
||||
|
||||
#[derive(Debug)]
|
||||
|
|
42
src/utils.rs
42
src/utils.rs
|
@ -11,7 +11,7 @@ pub mod models;
|
|||
pub fn check_errors(html: &String, loc: &str) {
|
||||
let no_timetable = "Aucun créneau horaire affecté";
|
||||
match html {
|
||||
t if t.contains(no_timetable) => panic!("URL: {loc} • {no_timetable}"),
|
||||
t if t.contains(no_timetable) => panic!("URL: {} • {}", loc, no_timetable),
|
||||
_ => (),
|
||||
}
|
||||
}
|
||||
|
@ -21,8 +21,8 @@ pub fn line_table(
|
|||
cell_length_hours: usize,
|
||||
cell_length: usize,
|
||||
number_cell: usize,
|
||||
pos: &models::Position,
|
||||
skip_with: &std::collections::HashMap<usize, &str>,
|
||||
pos: models::Position,
|
||||
skip_with: std::collections::HashMap<usize, &str>,
|
||||
) {
|
||||
// Left side
|
||||
let ls = match pos {
|
||||
|
@ -60,8 +60,8 @@ pub fn line_table(
|
|||
|
||||
// Hours column
|
||||
match skip_with.get(&0) {
|
||||
Some(_) => print!("\n{ls}{line_h}{rs_bbc}"),
|
||||
None => print!("\n{ls}{line_h}{ms}"),
|
||||
Some(_) => print!("\n{}{}{}", ls, line_h, rs_bbc),
|
||||
None => print!("\n{}{}{}", ls, line_h, ms),
|
||||
};
|
||||
|
||||
// Courses columns
|
||||
|
@ -72,26 +72,26 @@ pub fn line_table(
|
|||
if i == range - 1 {
|
||||
// Friday only
|
||||
if let Some(text) = skip_with.get(&i) {
|
||||
println!("{text:^cell_length$}{rsbc_bbc}");
|
||||
println!("{:^cell_length$}{}", text, rsbc_bbc);
|
||||
last_day = true;
|
||||
}
|
||||
} else {
|
||||
match skip_with.get(&i) {
|
||||
Some(text) => match skip_with.get(&(i + 1)) {
|
||||
// Match check if the next cell will be big
|
||||
Some(_) => print!("{text:^cell_length$}{rsbc_bbc}"),
|
||||
None => print!("{text:^cell_length$}{rsbc}"),
|
||||
Some(_) => print!("{:^cell_length$}{}", text, rsbc_bbc),
|
||||
None => print!("{:^cell_length$}{}", text, rsbc),
|
||||
},
|
||||
None => match skip_with.get(&(i + 1)) {
|
||||
// Match check if the next cell will be big
|
||||
Some(_) => print!("{line}{rs_bbc}"),
|
||||
None => print!("{line}{ms}"),
|
||||
Some(_) => print!("{}{}", line, rs_bbc),
|
||||
None => print!("{}{}", line, ms),
|
||||
},
|
||||
}
|
||||
}
|
||||
}
|
||||
if !last_day {
|
||||
println!("{line}{rs}");
|
||||
println!("{}{}", line, rs);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -119,7 +119,7 @@ pub async fn get_webpage(
|
|||
year: &str,
|
||||
user_agent: &str,
|
||||
) -> Result<Html, Box<dyn std::error::Error>> {
|
||||
let url = format!("https://silice.informatique.univ-paris-diderot.fr/ufr/U{year}/EDT/visualiserEmploiDuTemps.php?quoi=M{level},{semester}");
|
||||
let url = format!("https://silice.informatique.univ-paris-diderot.fr/ufr/U{}/EDT/visualiserEmploiDuTemps.php?quoi=M{},{}", year, level, semester);
|
||||
|
||||
// Use custom User-Agent
|
||||
let client = reqwest::Client::builder().user_agent(user_agent).build()?;
|
||||
|
@ -184,14 +184,13 @@ impl Capitalize for str {
|
|||
}
|
||||
}
|
||||
|
||||
/// Get all hours used the source, from 08:00 to at least 20:00
|
||||
pub fn get_hours() -> Arc<[String]> {
|
||||
let mut hours = vec![];
|
||||
for hour in 8..=20 {
|
||||
for minute in &[0, 15, 30, 45] {
|
||||
let hour_str = format!("{hour}h{minute:02}");
|
||||
let hour_str = format!("{}h{:02}", hour, minute);
|
||||
if let Some(last_hour) = hours.pop() {
|
||||
hours.push(format!("{last_hour}-{hour_str}"));
|
||||
hours.push(format!("{}-{}", last_hour, hour_str));
|
||||
}
|
||||
hours.push(hour_str);
|
||||
}
|
||||
|
@ -224,16 +223,9 @@ pub fn get_entry(course: &Course) -> String {
|
|||
format!("{} - {:?}", course.name, course.category)
|
||||
}
|
||||
|
||||
/// Entry's name used for finding duplicates, ignoring categories
|
||||
pub fn get_entry_nocat(course: &Course) -> String {
|
||||
course.name.clone()
|
||||
}
|
||||
|
||||
/// Returns a couple of (list of courses) and (a hashmap of how much they appears in the vector)
|
||||
pub fn get_count<'a>(
|
||||
timetable: &'a mut Timetable,
|
||||
allowed_list: &'a [Category],
|
||||
getter: fn(&Course) -> String,
|
||||
) -> (Vec<(&'a Course, String)>, HashMap<String, i32>) {
|
||||
// List of courses who will be courses
|
||||
let mut courses = vec![];
|
||||
|
@ -247,12 +239,12 @@ pub fn get_count<'a>(
|
|||
.iter()
|
||||
.any(|category| allowed_list.contains(category))
|
||||
{
|
||||
courses.push((course, day.name.clone()));
|
||||
let count = counts.entry(getter(course)).or_insert(0);
|
||||
courses.push((course, day.name.to_owned()));
|
||||
let count = counts.entry(get_entry(course)).or_insert(0);
|
||||
*count += 1;
|
||||
}
|
||||
}
|
||||
});
|
||||
})
|
||||
});
|
||||
|
||||
(courses, counts)
|
||||
|
|
Loading…
Reference in a new issue