Compare commits

...

13 commits
0.9.2 ... main

Author SHA1 Message Date
8e18f7d2e5
keywords 2024-09-14 14:18:38 +02:00
61a85ca1f1
bump 2024-09-14 14:18:05 +02:00
586fb4ba28
update dependencie 2024-09-13 19:30:57 +02:00
1cab8ef246
trim class from courses name (#9) 2024-09-13 19:27:29 +02:00
b621436483
format 2024-09-13 19:23:00 +02:00
090a16433d
todo 2024-09-13 19:19:37 +02:00
8e7fdaf3c8
optional shift for td/tp (#10) 2024-09-13 19:07:18 +02:00
fabcd6dac9
start date chooser (#8) 2024-09-13 19:00:18 +02:00
b6a2fec3cb
update dependencies 2024-08-25 13:52:59 +02:00
c81b07c277
fix for M2 2024-08-25 13:47:42 +02:00
181ebf53f4
some are already defaults 2024-05-29 12:02:51 +02:00
07068a0150
update dependencies and follow more clippy advices 2024-05-28 21:19:19 +02:00
0c26ed24de
valid uri 2024-01-31 00:20:37 +01:00
8 changed files with 451 additions and 229 deletions

428
Cargo.lock generated
View file

@ -55,15 +55,16 @@ dependencies = [
[[package]] [[package]]
name = "anstream" name = "anstream"
version = "0.5.0" version = "0.6.14"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b1f58811cfac344940f1a400b6e6231ce35171f614f26439e80f8c1465c5cc0c" checksum = "418c75fa768af9c03be99d17643f93f79bbba589895012a80e3452a19ddda15b"
dependencies = [ dependencies = [
"anstyle", "anstyle",
"anstyle-parse", "anstyle-parse",
"anstyle-query", "anstyle-query",
"anstyle-wincon", "anstyle-wincon",
"colorchoice", "colorchoice",
"is_terminal_polyfill",
"utf8parse", "utf8parse",
] ]
@ -93,14 +94,20 @@ dependencies = [
[[package]] [[package]]
name = "anstyle-wincon" name = "anstyle-wincon"
version = "2.1.0" version = "3.0.3"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "58f54d10c6dfa51283a066ceab3ec1ab78d13fae00aa49243a45e4571fb79dfd" checksum = "61a38449feb7068f52bb06c12759005cf459ee52bb4adc1d5a7c4322d716fb19"
dependencies = [ dependencies = [
"anstyle", "anstyle",
"windows-sys 0.48.0", "windows-sys 0.52.0",
] ]
[[package]]
name = "atomic-waker"
version = "1.1.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1505bd5d3d116872e7271a6d4e16d81d0c8570876c8de68093a09ac269d8aac0"
[[package]] [[package]]
name = "autocfg" name = "autocfg"
version = "1.1.0" version = "1.1.0"
@ -124,9 +131,9 @@ dependencies = [
[[package]] [[package]]
name = "base64" name = "base64"
version = "0.21.3" version = "0.22.1"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "414dcefbc63d77c526a76b3afcf6fbb9b5e2791c19c3aa2297733208750c6e53" checksum = "72b3254f16251a8381aa12e40e3c4d2f0199f8c6508fbecb9d91f575e0fbb8c6"
[[package]] [[package]]
name = "bitflags" name = "bitflags"
@ -160,7 +167,7 @@ checksum = "a2bd12c1caf447e69cd4528f47f94d203fd2582878ecb9e9465484c4148a8223"
[[package]] [[package]]
name = "cal7tor" name = "cal7tor"
version = "0.9.2" version = "0.10.0"
dependencies = [ dependencies = [
"chrono", "chrono",
"clap", "clap",
@ -190,23 +197,23 @@ checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd"
[[package]] [[package]]
name = "chrono" name = "chrono"
version = "0.4.31" version = "0.4.38"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7f2c685bad3eb3d45a01354cedb7d5faa66194d1d58ba6e267a8de788f79db38" checksum = "a21f936df1771bf62b77f047b726c4625ff2e8aa607c01ec06e5a05bd8463401"
dependencies = [ dependencies = [
"android-tzdata", "android-tzdata",
"iana-time-zone", "iana-time-zone",
"js-sys", "js-sys",
"num-traits", "num-traits",
"wasm-bindgen", "wasm-bindgen",
"windows-targets 0.48.5", "windows-targets 0.52.5",
] ]
[[package]] [[package]]
name = "clap" name = "clap"
version = "4.4.2" version = "4.5.4"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6a13b88d2c62ff462f88e4a121f17a82c1af05693a2f192b5c38d14de73c19f6" checksum = "90bc066a67923782aa8515dbaea16946c5bcc5addbd668bb80af688e53e548a0"
dependencies = [ dependencies = [
"clap_builder", "clap_builder",
"clap_derive", "clap_derive",
@ -214,9 +221,9 @@ dependencies = [
[[package]] [[package]]
name = "clap_builder" name = "clap_builder"
version = "4.4.2" version = "4.5.2"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2bb9faaa7c2ef94b2743a21f5a29e6f0010dff4caa69ac8e9d6cf8b6fa74da08" checksum = "ae129e2e766ae0ec03484e609954119f123cc1fe650337e155d03b022f24f7b4"
dependencies = [ dependencies = [
"anstream", "anstream",
"anstyle", "anstyle",
@ -226,9 +233,9 @@ dependencies = [
[[package]] [[package]]
name = "clap_derive" name = "clap_derive"
version = "4.4.2" version = "4.5.4"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0862016ff20d69b84ef8247369fabf5c008a7417002411897d40ee1f4532b873" checksum = "528131438037fd55894f62d6e9f068b8f45ac57ffa77517819645d10aed04f64"
dependencies = [ dependencies = [
"heck", "heck",
"proc-macro2", "proc-macro2",
@ -238,9 +245,9 @@ dependencies = [
[[package]] [[package]]
name = "clap_lex" name = "clap_lex"
version = "0.5.1" version = "0.7.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "cd7cc57abe963c6d3b9d8be5b06ba7c8957a930305ca90304f24ef040aa6f961" checksum = "98cc8fbded0c607b7ba9dd60cd98df59af97e84d24e49c8557331cfc26d301ce"
[[package]] [[package]]
name = "colorchoice" name = "colorchoice"
@ -360,6 +367,12 @@ dependencies = [
"cfg-if", "cfg-if",
] ]
[[package]]
name = "equivalent"
version = "1.0.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5443807d6dff69373d433ab9ef5378ad8df50ca6298caf15de6e52e24aaf54d5"
[[package]] [[package]]
name = "errno" name = "errno"
version = "0.3.3" version = "0.3.3"
@ -503,15 +516,15 @@ checksum = "6fb8d784f27acf97159b40fc4db5ecd8aa23b9ad5ef69cdd136d3bc80665f0c0"
[[package]] [[package]]
name = "h2" name = "h2"
version = "0.3.21" version = "0.4.5"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "91fc23aa11be92976ef4729127f1a74adf36d8436f7816b185d18df956790833" checksum = "fa82e28a107a8cc405f0839610bdc9b15f1e25ec7d696aa5cf173edbcb1486ab"
dependencies = [ dependencies = [
"atomic-waker",
"bytes", "bytes",
"fnv", "fnv",
"futures-core", "futures-core",
"futures-sink", "futures-sink",
"futures-util",
"http", "http",
"indexmap", "indexmap",
"slab", "slab",
@ -522,41 +535,41 @@ dependencies = [
[[package]] [[package]]
name = "hashbrown" name = "hashbrown"
version = "0.12.3" version = "0.14.5"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8a9ee70c43aaf417c914396645a0fa852624801b24ebb7ae78fe8272889ac888" checksum = "e5274423e17b7c9fc20b6e7e208532f9b19825d82dfd615708b70edd83df41f1"
[[package]] [[package]]
name = "heck" name = "heck"
version = "0.4.1" version = "0.5.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "95505c38b4572b2d910cecb0281560f54b440a19336cbbcb27bf6ce6adc6f5a8" checksum = "2304e00983f87ffb38b55b444b5e3b60a884b5d30c0fca7d82fe33449bbe55ea"
[[package]] [[package]]
name = "hermit-abi" name = "hermit-abi"
version = "0.3.2" version = "0.3.9"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "443144c8cdadd93ebf52ddb4056d257f5b52c04d3c804e657d19eb73fc33668b" checksum = "d231dfb89cfffdbc30e7fc41579ed6066ad03abda9e567ccafae602b97ec5024"
[[package]] [[package]]
name = "html5ever" name = "html5ever"
version = "0.26.0" version = "0.27.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "bea68cab48b8459f17cf1c944c67ddc572d272d9f2b274140f223ecb1da4a3b7" checksum = "c13771afe0e6e846f1e67d038d4cb29998a6779f93c809212e4e9c32efd244d4"
dependencies = [ dependencies = [
"log", "log",
"mac", "mac",
"markup5ever", "markup5ever",
"proc-macro2", "proc-macro2",
"quote", "quote",
"syn 1.0.109", "syn 2.0.31",
] ]
[[package]] [[package]]
name = "http" name = "http"
version = "0.2.9" version = "1.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "bd6effc99afb63425aff9b05836f029929e345a6148a14b7ecd5ab67af944482" checksum = "21b9ddb458710bc376481b842f5da65cdf31522de232c1ca8146abce2a358258"
dependencies = [ dependencies = [
"bytes", "bytes",
"fnv", "fnv",
@ -565,12 +578,24 @@ dependencies = [
[[package]] [[package]]
name = "http-body" name = "http-body"
version = "0.4.5" version = "1.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d5f38f16d184e36f2408a55281cd658ecbd3ca05cce6d6510a176eca393e26d1" checksum = "1cac85db508abc24a2e48553ba12a996e87244a0395ce011e62b37158745d643"
dependencies = [ dependencies = [
"bytes", "bytes",
"http", "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", "pin-project-lite",
] ]
@ -580,47 +605,60 @@ version = "1.8.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d897f394bad6a705d5f4104762e116a75639e470d80901eed05a860a95cb1904" checksum = "d897f394bad6a705d5f4104762e116a75639e470d80901eed05a860a95cb1904"
[[package]]
name = "httpdate"
version = "1.0.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "df3b46402a9d5adb4c86a0cf463f42e19994e3ee891101b1841f30a545cb49a9"
[[package]] [[package]]
name = "hyper" name = "hyper"
version = "0.14.27" version = "1.3.1"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ffb1cfd654a8219eaef89881fdb3bb3b1cdc5fa75ded05d6933b2b382e395468" checksum = "fe575dd17d0862a9a33781c8c4696a55c320909004a67a00fb286ba8b1bc496d"
dependencies = [ dependencies = [
"bytes", "bytes",
"futures-channel", "futures-channel",
"futures-core",
"futures-util", "futures-util",
"h2", "h2",
"http", "http",
"http-body", "http-body",
"httparse", "httparse",
"httpdate",
"itoa", "itoa",
"pin-project-lite", "pin-project-lite",
"socket2 0.4.9", "smallvec",
"tokio", "tokio",
"tower-service",
"tracing",
"want", "want",
] ]
[[package]] [[package]]
name = "hyper-tls" name = "hyper-tls"
version = "0.5.0" version = "0.6.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d6183ddfa99b85da61a140bea0efc93fdf56ceaa041b37d553518030827f9905" checksum = "70206fc6890eaca9fde8a0bf71caa2ddfc9fe045ac9e5c70df101a7dbde866e0"
dependencies = [ dependencies = [
"bytes", "bytes",
"http-body-util",
"hyper", "hyper",
"hyper-util",
"native-tls", "native-tls",
"tokio", "tokio",
"tokio-native-tls", "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]] [[package]]
@ -664,11 +702,11 @@ dependencies = [
[[package]] [[package]]
name = "indexmap" name = "indexmap"
version = "1.9.3" version = "2.2.6"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "bd070e393353796e801d209ad339e89596eb4c8d430d18ede6a1cced8fafbd99" checksum = "168fb715dda47215e360912c096649d23d58bf392ac62f73919e831745e40f26"
dependencies = [ dependencies = [
"autocfg", "equivalent",
"hashbrown", "hashbrown",
] ]
@ -678,6 +716,12 @@ version = "2.8.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "28b29a3cd74f0f4598934efe3aeba42bae0eb4680554128851ebbecb02af14e6" checksum = "28b29a3cd74f0f4598934efe3aeba42bae0eb4680554128851ebbecb02af14e6"
[[package]]
name = "is_terminal_polyfill"
version = "1.70.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f8478577c03552c21db0e2724ffb8986a5ce7af88107e6be5d2ee6e158c12800"
[[package]] [[package]]
name = "itoa" name = "itoa"
version = "1.0.9" version = "1.0.9"
@ -735,13 +779,13 @@ checksum = "c41e0c4fef86961ac6d6f8a82609f55f31b05e4fce149ac5710e439df7619ba4"
[[package]] [[package]]
name = "markup5ever" name = "markup5ever"
version = "0.11.0" version = "0.12.1"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7a2629bb1404f3d34c2e921f21fd34ba00b206124c81f65c50b43b6aaefeb016" checksum = "16ce3abbeba692c8b8441d036ef91aea6df8da2c6b6e21c7e14d3c18e526be45"
dependencies = [ dependencies = [
"log", "log",
"phf 0.10.1", "phf 0.11.2",
"phf_codegen", "phf_codegen 0.11.2",
"string_cache", "string_cache",
"string_cache_codegen", "string_cache_codegen",
"tendril", "tendril",
@ -770,13 +814,14 @@ dependencies = [
[[package]] [[package]]
name = "mio" name = "mio"
version = "0.8.10" version = "1.0.2"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8f3d0b296e374a4e6f3c7b0a1f5a51d748a0d34c85e7dc48fc3fa9a87657fe09" checksum = "80e04d1dcff3aae0704555fe5fee3bcfaf3d1fdf8a7e521d5b9d2b42acb52cec"
dependencies = [ dependencies = [
"hermit-abi",
"libc", "libc",
"wasi", "wasi",
"windows-sys 0.48.0", "windows-sys 0.52.0",
] ]
[[package]] [[package]]
@ -812,16 +857,6 @@ dependencies = [
"autocfg", "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]] [[package]]
name = "object" name = "object"
version = "0.32.1" version = "0.32.1"
@ -833,9 +868,9 @@ dependencies = [
[[package]] [[package]]
name = "once_cell" name = "once_cell"
version = "1.18.0" version = "1.19.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "dd8b5dd2ae5ed71462c540258bedcb51965123ad7e7ccf4b9a8cafaa4a63576d" checksum = "3fdb12b2476b595f9358c5161aa467c2438859caa136dec86c26fdd2efe17b92"
[[package]] [[package]]
name = "openssl" name = "openssl"
@ -939,6 +974,16 @@ dependencies = [
"phf_shared 0.10.0", "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]] [[package]]
name = "phf_generator" name = "phf_generator"
version = "0.10.0" version = "0.10.0"
@ -990,6 +1035,26 @@ dependencies = [
"siphasher", "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]] [[package]]
name = "pin-project-lite" name = "pin-project-lite"
version = "0.2.13" version = "0.2.13"
@ -1022,9 +1087,9 @@ checksum = "925383efa346730478fb4838dbe9137d2a47675ad789c546d150a6e1dd4ab31c"
[[package]] [[package]]
name = "proc-macro2" name = "proc-macro2"
version = "1.0.66" version = "1.0.84"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "18fb31db3f9bddb2ea821cde30a9f70117e3f119938b5ee630b7403aa6e2ead9" checksum = "ec96c6a92621310b51366f1e28d05ef11489516e93be030060e5fc12024a49d6"
dependencies = [ dependencies = [
"unicode-ident", "unicode-ident",
] ]
@ -1108,9 +1173,9 @@ checksum = "c08c74e62047bb2de4ff487b251e4a92e24f48745648451635cec7d591162d9f"
[[package]] [[package]]
name = "reqwest" name = "reqwest"
version = "0.11.20" version = "0.12.4"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3e9ad3fe7488d7e34558a2033d45a0c90b72d97b4f80705666fea71472e2e6a1" checksum = "566cafdd92868e0939d3fb961bd0dc25fcfaaed179291093b3d43e6b3150ea10"
dependencies = [ dependencies = [
"base64", "base64",
"bytes", "bytes",
@ -1120,8 +1185,10 @@ dependencies = [
"h2", "h2",
"http", "http",
"http-body", "http-body",
"http-body-util",
"hyper", "hyper",
"hyper-tls", "hyper-tls",
"hyper-util",
"ipnet", "ipnet",
"js-sys", "js-sys",
"log", "log",
@ -1130,9 +1197,12 @@ dependencies = [
"once_cell", "once_cell",
"percent-encoding", "percent-encoding",
"pin-project-lite", "pin-project-lite",
"rustls-pemfile",
"serde", "serde",
"serde_json", "serde_json",
"serde_urlencoded", "serde_urlencoded",
"sync_wrapper",
"system-configuration",
"tokio", "tokio",
"tokio-native-tls", "tokio-native-tls",
"tower-service", "tower-service",
@ -1162,6 +1232,22 @@ dependencies = [
"windows-sys 0.48.0", "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]] [[package]]
name = "ryu" name = "ryu"
version = "1.0.15" version = "1.0.15"
@ -1185,9 +1271,9 @@ checksum = "94143f37725109f92c262ed2cf5e59bce7498c01bcc1502d7b9afe439a4e9f49"
[[package]] [[package]]
name = "scraper" name = "scraper"
version = "0.18.1" version = "0.20.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "585480e3719b311b78a573db1c9d9c4c1f8010c2dee4cc59c2efe58ea4dbc3e1" checksum = "b90460b31bfe1fc07be8262e42c665ad97118d4585869de9345a84d501a9eaf0"
dependencies = [ dependencies = [
"ahash", "ahash",
"cssparser", "cssparser",
@ -1235,7 +1321,7 @@ dependencies = [
"log", "log",
"new_debug_unreachable", "new_debug_unreachable",
"phf 0.10.1", "phf 0.10.1",
"phf_codegen", "phf_codegen 0.10.0",
"precomputed-hash", "precomputed-hash",
"servo_arc", "servo_arc",
"smallvec", "smallvec",
@ -1325,19 +1411,9 @@ dependencies = [
[[package]] [[package]]
name = "smallvec" name = "smallvec"
version = "1.11.0" version = "1.13.2"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "62bb4feee49fdd9f707ef802e22365a35de4b7b299de4763d44bfea899442ff9" checksum = "3c5e1a9a646d36c3599cd173a41282daf47c44583ad367b8e6837255952e5c67"
[[package]]
name = "socket2"
version = "0.4.9"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "64a4a911eed85daf18834cfaa86a79b7d266ff93ff5ba14005426219480ed662"
dependencies = [
"libc",
"winapi",
]
[[package]] [[package]]
name = "socket2" name = "socket2"
@ -1383,9 +1459,9 @@ dependencies = [
[[package]] [[package]]
name = "strsim" name = "strsim"
version = "0.10.0" version = "0.11.1"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "73473c0e59e6d5812c5dfe2a064a6444949f089e20eec9a2e5506596494e4623" checksum = "7da8b5736845d9f2fcb837ea5d9e2628564b3b043a70948a3f0b778838c5fb4f"
[[package]] [[package]]
name = "syn" name = "syn"
@ -1409,6 +1485,33 @@ dependencies = [
"unicode-ident", "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]] [[package]]
name = "tempfile" name = "tempfile"
version = "3.8.0" version = "3.8.0"
@ -1470,28 +1573,27 @@ checksum = "1f3ccbac311fea05f86f61904b462b55fb3df8837a366dfc601a0161d0532f20"
[[package]] [[package]]
name = "tokio" name = "tokio"
version = "1.35.1" 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 = "c89b4efa943be685f629b149f53829423f8f5531ea21249408e8e2f8671ec104" checksum = "e2b070231665d27ad9ec9b8df639893f46727666c6767db40317fbe920a5d998"
dependencies = [ dependencies = [
"backtrace", "backtrace",
"bytes", "bytes",
"libc", "libc",
"mio", "mio",
"num_cpus",
"parking_lot", "parking_lot",
"pin-project-lite", "pin-project-lite",
"signal-hook-registry", "signal-hook-registry",
"socket2 0.5.5", "socket2",
"tokio-macros", "tokio-macros",
"windows-sys 0.48.0", "windows-sys 0.52.0",
] ]
[[package]] [[package]]
name = "tokio-macros" name = "tokio-macros"
version = "2.2.0" version = "2.4.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5b8a1e28f2deaa14e508979454cb3a223b10b938b45af148bc0986de36f1923b" checksum = "693d596312e88961bc67d7f1f97af8a70227d9f90c31bba5806eec004978d752"
dependencies = [ dependencies = [
"proc-macro2", "proc-macro2",
"quote", "quote",
@ -1522,6 +1624,27 @@ dependencies = [
"tracing", "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]] [[package]]
name = "tower-service" name = "tower-service"
version = "0.3.2" version = "0.3.2"
@ -1606,9 +1729,9 @@ checksum = "711b9620af191e0cdc7468a8d14e709c3dcdb115b36f838e601583af800a370a"
[[package]] [[package]]
name = "uuid" name = "uuid"
version = "1.6.1" version = "1.10.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5e395fcf16a7a3d8127ec99782007af141946b4795001f876d54fb0d55978560" checksum = "81dfa00651efa65069b0b6b651f4aaa31ba9e3c3ce0137aaad053604ee7e0314"
dependencies = [ dependencies = [
"getrandom", "getrandom",
"rand", "rand",
@ -1717,28 +1840,6 @@ dependencies = [
"wasm-bindgen", "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]] [[package]]
name = "windows" name = "windows"
version = "0.48.0" version = "0.48.0"
@ -1766,6 +1867,15 @@ dependencies = [
"windows-targets 0.48.5", "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]] [[package]]
name = "windows-targets" name = "windows-targets"
version = "0.42.2" version = "0.42.2"
@ -1796,6 +1906,22 @@ dependencies = [
"windows_x86_64_msvc 0.48.5", "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]] [[package]]
name = "windows_aarch64_gnullvm" name = "windows_aarch64_gnullvm"
version = "0.42.2" version = "0.42.2"
@ -1808,6 +1934,12 @@ version = "0.48.5"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2b38e32f0abccf9987a4e3079dfb67dcd799fb61361e53e2882c3cbaf0d905d8" checksum = "2b38e32f0abccf9987a4e3079dfb67dcd799fb61361e53e2882c3cbaf0d905d8"
[[package]]
name = "windows_aarch64_gnullvm"
version = "0.52.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7088eed71e8b8dda258ecc8bac5fb1153c5cffaf2578fc8ff5d61e23578d3263"
[[package]] [[package]]
name = "windows_aarch64_msvc" name = "windows_aarch64_msvc"
version = "0.42.2" version = "0.42.2"
@ -1820,6 +1952,12 @@ version = "0.48.5"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "dc35310971f3b2dbbf3f0690a219f40e2d9afcf64f9ab7cc1be722937c26b4bc" checksum = "dc35310971f3b2dbbf3f0690a219f40e2d9afcf64f9ab7cc1be722937c26b4bc"
[[package]]
name = "windows_aarch64_msvc"
version = "0.52.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9985fd1504e250c615ca5f281c3f7a6da76213ebd5ccc9561496568a2752afb6"
[[package]] [[package]]
name = "windows_i686_gnu" name = "windows_i686_gnu"
version = "0.42.2" version = "0.42.2"
@ -1832,6 +1970,18 @@ version = "0.48.5"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a75915e7def60c94dcef72200b9a8e58e5091744960da64ec734a6c6e9b3743e" 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]] [[package]]
name = "windows_i686_msvc" name = "windows_i686_msvc"
version = "0.42.2" version = "0.42.2"
@ -1844,6 +1994,12 @@ version = "0.48.5"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8f55c233f70c4b27f66c523580f78f1004e8b5a8b659e05a4eb49d4166cca406" checksum = "8f55c233f70c4b27f66c523580f78f1004e8b5a8b659e05a4eb49d4166cca406"
[[package]]
name = "windows_i686_msvc"
version = "0.52.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "db3c2bf3d13d5b658be73463284eaf12830ac9a26a90c717b7f771dfe97487bf"
[[package]] [[package]]
name = "windows_x86_64_gnu" name = "windows_x86_64_gnu"
version = "0.42.2" version = "0.42.2"
@ -1856,6 +2012,12 @@ version = "0.48.5"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "53d40abd2583d23e4718fddf1ebec84dbff8381c07cae67ff7768bbf19c6718e" 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]] [[package]]
name = "windows_x86_64_gnullvm" name = "windows_x86_64_gnullvm"
version = "0.42.2" version = "0.42.2"
@ -1868,6 +2030,12 @@ version = "0.48.5"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0b7b52767868a23d5bab768e390dc5f5c55825b6d30b86c844ff2dc7414044cc" 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]] [[package]]
name = "windows_x86_64_msvc" name = "windows_x86_64_msvc"
version = "0.42.2" version = "0.42.2"
@ -1881,10 +2049,16 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ed94fce61571a4006852b7389a063ab983c02eb1bb37b47f8272ce92d06d9538" checksum = "ed94fce61571a4006852b7389a063ab983c02eb1bb37b47f8272ce92d06d9538"
[[package]] [[package]]
name = "winreg" name = "windows_x86_64_msvc"
version = "0.50.0" version = "0.52.5"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "524e57b2c537c0f9b1e69f1965311ec12182b4122e45035b1508cd24d2adadb1" checksum = "bec47e5bfd1bff0eeaf6d8b485cc1074891a197ab4225d504cb7a1ab88b02bf0"
[[package]]
name = "winreg"
version = "0.52.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a277a57398d4bfa075df44f501a17cfdf8542d224f0d36095a2adc7aee4ef0a5"
dependencies = [ dependencies = [
"cfg-if", "cfg-if",
"windows-sys 0.48.0", "windows-sys 0.48.0",

View file

@ -1,22 +1,25 @@
[package] [package]
name = "cal7tor" name = "cal7tor"
version = "0.9.2" version = "0.10.0"
authors = ["Mylloon"] authors = ["Mylloon"]
edition = "2021" edition = "2021"
description = "Timetable extractor for the Paris Cité master's degree in IT" description = "Timetable extractor for the Paris Cité master's degree in IT"
readme = "README.md" readme = "README.md"
repository = "https://git.mylloon.fr/Anri/cal7tor" repository = "https://git.mylloon.fr/Anri/cal7tor"
keywords = ["scrape", "calendar"] keywords = ["scrape", "calendar", "paris diderot", "paris cité"]
publish = false publish = false
license = "AGPL-3.0-or-later" license = "AGPL-3.0-or-later"
[dependencies] [dependencies]
reqwest = { version = "0.11" } reqwest = { version = "0.12" }
tokio = { version = "1.35", features = ["full"] } tokio = { version = "1.40", features = ["full"] }
scraper = "0.18" scraper = "0.20"
regex = "1.10" regex = "1.10"
chrono = "0.4.31" chrono = "0.4.38"
ics = { version = "0.5", default-features = false } ics = { version = "0.5", default-features = false }
uuid = { version = "1.6", features = ["v4", "fast-rng"] } uuid = { version = "1.10", features = ["v4", "fast-rng"] }
clap = { version = "4.4", features = ["derive"] } clap = { version = "4.5", features = ["derive"] }
dialoguer = "0.11" dialoguer = "0.11"
[lints.clippy]
pedantic = "warn"

View file

@ -34,15 +34,15 @@ fn choice(timetable: &mut Timetable) {
day.courses.iter().for_each(|course_opt| { day.courses.iter().for_each(|course_opt| {
if let Some(course) = course_opt { if let Some(course) = course_opt {
if !multiselected.contains(&course.name) { if !multiselected.contains(&course.name) {
multiselected.push(course.name.to_owned()); multiselected.push(course.name.clone());
} }
} }
}) });
}); });
let defaults = vec![true; multiselected.len()]; let defaults = vec![true; multiselected.len()];
let selections = MultiSelect::new() let selections = MultiSelect::new()
.with_prompt(format!("Choisis tes matières {}", DISCLAIMER)) .with_prompt(format!("Choisis tes matières {DISCLAIMER}"))
.items(&multiselected[..]) .items(&multiselected[..])
.defaults(&defaults[..]) .defaults(&defaults[..])
.interact() .interact()
@ -82,7 +82,7 @@ fn courses(timetable: &mut Timetable) {
if !multiselected.is_empty() { if !multiselected.is_empty() {
let defaults = vec![false; multiselected.len()]; let defaults = vec![false; multiselected.len()];
selections = MultiSelect::new() selections = MultiSelect::new()
.with_prompt(format!("Choisis tes horaires de Cours {}", DISCLAIMER)) .with_prompt(format!("Choisis tes horaires de Cours {DISCLAIMER}"))
.items(&multiselected[..]) .items(&multiselected[..])
.defaults(&defaults[..]) .defaults(&defaults[..])
.interact() .interact()
@ -107,7 +107,7 @@ fn courses(timetable: &mut Timetable) {
// Keep only chosen courses if multiple was available // Keep only chosen courses if multiple was available
for i in &selections { for i in &selections {
if get_selection(&(course, day.name.to_owned())) == multiselected[*i] { if get_selection(&(course, day.name.clone())) == multiselected[*i] {
return true; return true;
} }
} }
@ -137,7 +137,7 @@ fn tdtp(timetable: &mut Timetable, merge: bool) {
if !multiselected.is_empty() { if !multiselected.is_empty() {
let defaults = vec![false; multiselected.len()]; let defaults = vec![false; multiselected.len()];
selections = MultiSelect::new() 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[..]) .items(&multiselected[..])
.defaults(&defaults[..]) .defaults(&defaults[..])
.interact() .interact()
@ -160,7 +160,7 @@ fn tdtp(timetable: &mut Timetable, merge: bool) {
// Keep only chosen TD/TP if multiple was available // Keep only chosen TD/TP if multiple was available
for i in &selections { for i in &selections {
if get_selection(&(course, day.name.to_owned())) == multiselected[*i] { if get_selection(&(course, day.name.clone())) == multiselected[*i] {
return true; return true;
} }
} }

View file

@ -41,7 +41,7 @@ pub fn export(courses: Vec<crate::timetable::models::Course>, filename: &mut Str
// Professor's name // Professor's name
if course.professor.is_some() { if course.professor.is_some() {
let name = course.professor.unwrap(); let name = course.professor.unwrap();
let mut contact = Attendee::new(format!("mailto:{name}")); let mut contact = Attendee::new("mailto:place@holder.com");
contact.add(CN::new(name)); contact.add(CN::new(name));
contact.add(PartStat::ACCEPTED); contact.add(PartStat::ACCEPTED);
contact.add(Role::CHAIR); contact.add(Role::CHAIR);
@ -64,7 +64,7 @@ pub fn export(courses: Vec<crate::timetable::models::Course>, filename: &mut Str
let categories = course let categories = course
.category .category
.iter() .iter()
.map(|c| c.to_string()) .map(std::string::ToString::to_string)
.collect::<Arc<[String]>>() .collect::<Arc<[String]>>()
.join("/"); .join("/");
@ -86,8 +86,11 @@ pub fn export(courses: Vec<crate::timetable::models::Course>, filename: &mut Str
} }
// Add the extension if needed // Add the extension if needed
if !filename.ends_with(".ics") { if !std::path::Path::new(filename)
*filename = format!("{}.ics", filename) .extension()
.map_or(false, |ext| ext.eq_ignore_ascii_case("ics"))
{
*filename = format!("{filename}.ics");
}; };
calendar.save_file(filename).unwrap(); calendar.save_file(filename).unwrap();

View file

@ -8,12 +8,12 @@ use crate::utils::{
models::{Info, InfoList, InfoType}, models::{Info, InfoList, InfoType},
}; };
pub async fn info( pub async fn get_start_date(
level: i8, level: i8,
semester_opt: Option<i8>, semester_opt: Option<i8>,
year_opt: Option<i32>, year_opt: Option<i32>,
user_agent: &str, user_agent: &str,
) -> Info { ) -> String {
let semester = get_semester(semester_opt); let semester = get_semester(semester_opt);
let year = get_year(year_opt, semester); let year = get_year(year_opt, semester);
@ -34,7 +34,15 @@ pub async fn info(
.inner_html(); .inner_html();
let re = Regex::new(r"\d{1,2} (septembre|octobre)").unwrap(); let re = Regex::new(r"\d{1,2} (septembre|octobre)").unwrap();
let date = re.captures(&raw_data).unwrap().get(0).unwrap().as_str();
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);
// 1st semester // 1st semester
let weeks_s1_1 = 6; // Weeks before break let weeks_s1_1 = 6; // Weeks before break
@ -52,8 +60,10 @@ pub async fn info(
let cours_s1 = vec![(date_s1_1, weeks_s1_1), (date_s1_2, weeks_s1_2)]; 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 cours_s2 = vec![(date_s2_1, weeks_s2_1), (date_s2_2, weeks_s2_2)];
let tdtp_s1 = derive_from_cours(&cours_s1); let delta = i64::from(skip_week);
let tdtp_s2 = derive_from_cours(&cours_s2);
let tdtp_s1 = derive_from_cours(&cours_s1, delta);
let tdtp_s2 = derive_from_cours(&cours_s2, delta);
HashMap::from([ HashMap::from([
( (
@ -74,13 +84,16 @@ pub async fn info(
} }
/// Find TD/TP dates, based on the ones from courses /// Find TD/TP dates, based on the ones from courses
fn derive_from_cours(courses: &InfoList) -> Vec<(DateTime<Utc>, i64)> { fn derive_from_cours(courses: &InfoList, delta: i64) -> Vec<(DateTime<Utc>, i64)> {
// TD/TP start one week after courses // TD/TP start one week after courses
let before_break = courses.first().unwrap(); let before_break = courses.first().unwrap();
let after_break = courses.last().unwrap(); let after_break = courses.last().unwrap();
vec![ vec![
(before_break.0 + Duration::weeks(1), before_break.1 - 1), (
(after_break.0, after_break.1 + 1), before_break.0 + Duration::weeks(delta),
before_break.1 - delta,
),
(after_break.0, after_break.1 + delta),
] ]
} }
@ -104,7 +117,7 @@ fn anglophonization(date: &str) -> String {
// New regex of all the french month // New regex of all the french month
let re = Regex::new(&format!( let re = Regex::new(&format!(
"({})", "({})",
dico.keys().cloned().collect::<Arc<[_]>>().join("|") dico.keys().copied().collect::<Arc<[_]>>().join("|")
)) ))
.unwrap(); .unwrap();
@ -112,16 +125,16 @@ fn anglophonization(date: &str) -> String {
// Use 12:00 and UTC TZ for chrono parser // Use 12:00 and UTC TZ for chrono parser
"{} 12:00 +0000", "{} 12:00 +0000",
// Replace french by english month // Replace french by english month
re.replace_all(date, |cap: &Captures| match &cap[0] { re.replace_all(&date.to_lowercase(), |cap: &Captures| match &cap[0] {
month if dico.contains_key(month) => dico.get(month).unwrap(), month if dico.contains_key(month) => dico.get(month).unwrap(),
month => { 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> { fn get_date(date: &str) -> DateTime<Utc> {
// Use and keep UTC time, we have the hour set to 12h and // Use and keep UTC time, we have the hour set to 12h and
// Paris 7 is in France so there is no problems // Paris 7 is in France so there is no problems

View file

@ -1,4 +1,5 @@
use clap::Parser; use clap::Parser;
use dialoguer::Input;
use regex::Regex; use regex::Regex;
mod filter; mod filter;
@ -33,6 +34,14 @@ struct Args {
/// Doesn't distinguish TD from TP /// Doesn't distinguish TD from TP
#[clap(short, long)] #[clap(short, long)]
td_are_tp: bool, 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] #[tokio::main]
@ -53,27 +62,36 @@ async fn main() {
let user_agent = format!("cal7tor/{}", env!("CARGO_PKG_VERSION")); 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; let mut timetable = timetable::timetable(level, args.semester, args.year, &user_agent).await;
timetable = filter::timetable(timetable, args.td_are_tp); 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,
};
println!("Récupération des informations par rapport à l'année..."); println!("Récupération des informations par rapport à l'année...");
let info = info::info(level, args.semester, args.year, &user_agent).await; let info = info::info(args.semester, args.year, &date, args.week_skip);
if args.export.is_some() { if args.export.is_some() {
// Export the calendar // Export the calendar
let mut filename = args.export.unwrap(); 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); ics::export(builded_timetable, &mut filename);
println!("Fichier .ICS construit et exporté => {}", filename); println!("Fichier .ICS construit et exporté => {filename}");
} else { } else {
println!("\x1b[93mNOTICE: IT WON'T WORK!!!\x1b[0m"); println!("\x1b[93mNOTICE: IT WON'T WORK!!!\x1b[0m");
// Show the calendar // Show the calendar
println!("Affichage..."); 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."); println!("Vous devrez peut-être mettre votre terminal en plein écran si ce n'est pas déjà le cas.");
} }
} }

View file

@ -1,3 +1,5 @@
#![allow(clippy::cast_sign_loss)]
use chrono::{Datelike, Duration, TimeZone, Utc}; use chrono::{Datelike, Duration, TimeZone, Utc};
use regex::Regex; use regex::Regex;
use scraper::Selector; use scraper::Selector;
@ -53,8 +55,11 @@ pub async fn timetable(
let extra_data = i.select(&sel_span).next().map(|span| let extra_data = i.select(&sel_span).next().map(|span|
span.inner_html().replace("<br>", "").trim().to_owned() span.inner_html().replace("<br>", "").trim().to_owned()
); );
/* TODO: Instead of searching *_M2, just find any TD_* and TP_* */
let matches = let matches =
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>.*)\)") 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>.*)\)")
.unwrap() .unwrap()
.captures(i.value().attr("title").unwrap()) .captures(i.value().attr("title").unwrap())
.unwrap(); .unwrap();
@ -66,38 +71,44 @@ pub async fn timetable(
.capitalize(); .capitalize();
let startime = matches let startime = matches
.name("startime") .name("startime")
.unwrap() .unwrap()
.as_str(); .as_str();
let binding = i.select(&sel_b).last().unwrap().inner_html(); let binding = i.select(&sel_b).last().unwrap().inner_html();
let course = models::Course{ let course = models::Course{
category: match matches category: match matches
.name("type") .name("type")
.unwrap() .map_or("", |m| m.as_str()) {
.as_str() { /* TODO: Instead of searching *_M2, just find any TD_* and TP_* */
"COURS" => [models::Category::Cours].into(), "COURS" => [models::Category::Cours].into(),
"TP" => [models::Category::TP].into(), "TP" | "TP_M2" => [models::Category::TP].into(),
"TD" => [models::Category::TD].into(), "TD" | "TD_M2" => [models::Category::TD].into(),
"COURS_TD" => [models::Category::Cours, models::Category::TD].into(), "COURS_TD" => [models::Category::Cours, models::Category::TD].into(),
_ => panic!("Unknown type of course") _ => {
println!("Unknown type of course, falling back to 'COURS': {}", i.value().attr("title").unwrap());
[models::Category::Cours].into()
},
}, },
name: matches name: Regex::new(r"[ -][ML][1-3]$").unwrap().replace(
.name("name") matches
.unwrap() .name("name")
.as_str().to_owned(), .unwrap()
.as_str(),
""
).to_string(),
professor: if let Some(raw_prof) = i.select(&sel_small).last() { professor: if let Some(raw_prof) = i.select(&sel_small).last() {
match raw_prof.inner_html() { match raw_prof.inner_html() {
i if i.starts_with("<span") => None, i if i.starts_with("<span") => None,
i => Some(i), i => Some(i),
} }
} else { None }, } else { None },
room: Regex::new(r"(<table.*<\/table>|<br>.*?<br>.*?)?<br>(?P<location>.*?)<br>") room: Regex::new(r"(<table.*<\/table>|<br>.*?<br>.*?)?<br>(?P<location>.*?)<br>")
.unwrap() .unwrap()
.captures(&binding) .captures(&binding)
.unwrap().name("location") .unwrap().name("location")
.unwrap() .unwrap()
.as_str().to_owned(), .as_str().to_owned(),
start: schedules.iter().position(|r| r.starts_with(startime)).unwrap(), start: schedules.iter().position(|r| r.starts_with(startime)).unwrap(),
size: i.value().attr("rowspan").unwrap().parse::<usize>().unwrap(), size: i.value().attr("rowspan").unwrap().parse::<usize>().unwrap(),
dtstart: None, dtstart: None,
@ -111,7 +122,7 @@ pub async fn timetable(
} else { } else {
// Day with the name doesn't exist, create a new Day // Day with the name doesn't exist, create a new Day
timetable.push(models::Day { timetable.push(models::Day {
name: day.to_owned(), name: day.clone(),
courses: vec![Some(course)], courses: vec![Some(course)],
}); });
} }
@ -129,7 +140,7 @@ pub async fn timetable(
} }
/// Build the 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(); let mut schedules = Vec::new();
// h1 => heure de début | m1 => minute de début // h1 => heure de début | m1 => minute de début
// h2 => heure de fin | m2 => minute de fin // h2 => heure de fin | m2 => minute de fin
@ -166,16 +177,16 @@ pub fn build(timetable: models::Timetable, dates: Info) -> Vec<models::Course> {
&schedules, &schedules,
&timetable.1 .1, &timetable.1 .1,
&datetimes.course, &datetimes.course,
Some(vec![models::Category::Cours]), &Some(vec![models::Category::Cours]),
None, &None,
); );
add_courses( add_courses(
&mut semester, &mut semester,
&schedules, &schedules,
&timetable.1 .1, &timetable.1 .1,
&datetimes.td_tp, &datetimes.td_tp,
None, &None,
Some(vec![models::Category::Cours]), &Some(vec![models::Category::Cours]),
); );
semester semester
@ -194,9 +205,9 @@ fn add_courses(
// Current courses list // Current courses list
info: &InfoList, info: &InfoList,
// List of category allowed // List of category allowed
keep: Option<Vec<models::Category>>, keep: &Option<Vec<models::Category>>,
// List of category excluded // List of category excluded
exclude: Option<Vec<models::Category>>, exclude: &Option<Vec<models::Category>>,
) { ) {
let before_break = info.first().unwrap(); let before_break = info.first().unwrap();
let mut date = before_break.0; let mut date = before_break.0;
@ -213,9 +224,9 @@ fn add_courses(
// Check keep and exclude filters // Check keep and exclude filters
if keep if keep
.to_owned() .clone()
.is_some_and(|list| !course.category.iter().any(|item| list.contains(item))) .is_some_and(|list| !course.category.iter().any(|item| list.contains(item)))
|| exclude.to_owned().is_some_and(|list| { || exclude.clone().is_some_and(|list| {
course.category.iter().any(|item| list.contains(item)) course.category.iter().any(|item| list.contains(item))
}) })
{ {
@ -260,7 +271,7 @@ fn add_courses(
} }
/// Display the timetable /// 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 // Cell length for hours
let clh = 11; let clh = 11;
// Cell number // Cell number
@ -271,7 +282,7 @@ pub fn display(timetable: (Arc<[String]>, (usize, Vec<models::Day>)), cell_lengt
let sep = TabChar::Bv.val(); let sep = TabChar::Bv.val();
// Top of the tab // 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 // First empty case
print!("{}{:^clh$}{}", sep, "", sep); print!("{}{:^clh$}{}", sep, "", sep);
@ -288,13 +299,13 @@ pub fn display(timetable: (Arc<[String]>, (usize, Vec<models::Day>)), cell_lengt
// For each hours -- i the hour's number // For each hours -- i the hour's number
for (i, hour) in timetable.0.iter().enumerate() { for (i, hour) in timetable.0.iter().enumerate() {
// Draw separator line // 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 // Reset
next_skip = HashMap::new(); next_skip = HashMap::new();
// Print hour // Print hour
print!("{}{:^clh$}", sep, hour); print!("{sep}{hour:^clh$}");
// For all the days - `j` the day's number // For all the days - `j` the day's number
for (j, day) in timetable.1 .1.iter().enumerate() { for (j, day) in timetable.1 .1.iter().enumerate() {
@ -321,17 +332,17 @@ pub fn display(timetable: (Arc<[String]>, (usize, Vec<models::Day>)), cell_lengt
} }
info_slot = true; info_slot = true;
break; break;
} else {
// 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;
} }
// 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;
} }
} }
// If no course was found // If no course was found
@ -353,8 +364,8 @@ pub fn display(timetable: (Arc<[String]>, (usize, Vec<models::Day>)), cell_lengt
print!("{}{:^cell_length$}", sep, ""); print!("{}{:^cell_length$}", sep, "");
} }
} }
print!("{}", sep); print!("{sep}");
} }
// Bottom of the table // 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());
} }

View file

@ -11,7 +11,7 @@ pub mod models;
pub fn check_errors(html: &String, loc: &str) { pub fn check_errors(html: &String, loc: &str) {
let no_timetable = "Aucun créneau horaire affecté"; let no_timetable = "Aucun créneau horaire affecté";
match html { 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_hours: usize,
cell_length: usize, cell_length: usize,
number_cell: usize, number_cell: usize,
pos: models::Position, pos: &models::Position,
skip_with: std::collections::HashMap<usize, &str>, skip_with: &std::collections::HashMap<usize, &str>,
) { ) {
// Left side // Left side
let ls = match pos { let ls = match pos {
@ -60,8 +60,8 @@ pub fn line_table(
// Hours column // Hours column
match skip_with.get(&0) { match skip_with.get(&0) {
Some(_) => print!("\n{}{}{}", ls, line_h, rs_bbc), Some(_) => print!("\n{ls}{line_h}{rs_bbc}"),
None => print!("\n{}{}{}", ls, line_h, ms), None => print!("\n{ls}{line_h}{ms}"),
}; };
// Courses columns // Courses columns
@ -72,26 +72,26 @@ pub fn line_table(
if i == range - 1 { if i == range - 1 {
// Friday only // Friday only
if let Some(text) = skip_with.get(&i) { if let Some(text) = skip_with.get(&i) {
println!("{:^cell_length$}{}", text, rsbc_bbc); println!("{text:^cell_length$}{rsbc_bbc}");
last_day = true; last_day = true;
} }
} else { } else {
match skip_with.get(&i) { match skip_with.get(&i) {
Some(text) => match skip_with.get(&(i + 1)) { Some(text) => match skip_with.get(&(i + 1)) {
// Match check if the next cell will be big // Match check if the next cell will be big
Some(_) => print!("{:^cell_length$}{}", text, rsbc_bbc), Some(_) => print!("{text:^cell_length$}{rsbc_bbc}"),
None => print!("{:^cell_length$}{}", text, rsbc), None => print!("{text:^cell_length$}{rsbc}"),
}, },
None => match skip_with.get(&(i + 1)) { None => match skip_with.get(&(i + 1)) {
// Match check if the next cell will be big // Match check if the next cell will be big
Some(_) => print!("{}{}", line, rs_bbc), Some(_) => print!("{line}{rs_bbc}"),
None => print!("{}{}", line, ms), None => print!("{line}{ms}"),
}, },
} }
} }
} }
if !last_day { if !last_day {
println!("{}{}", line, rs); println!("{line}{rs}");
} }
} }
@ -119,7 +119,7 @@ pub async fn get_webpage(
year: &str, year: &str,
user_agent: &str, user_agent: &str,
) -> Result<Html, Box<dyn std::error::Error>> { ) -> Result<Html, Box<dyn std::error::Error>> {
let url = format!("https://silice.informatique.univ-paris-diderot.fr/ufr/U{}/EDT/visualiserEmploiDuTemps.php?quoi=M{},{}", year, level, semester); let url = format!("https://silice.informatique.univ-paris-diderot.fr/ufr/U{year}/EDT/visualiserEmploiDuTemps.php?quoi=M{level},{semester}");
// Use custom User-Agent // Use custom User-Agent
let client = reqwest::Client::builder().user_agent(user_agent).build()?; let client = reqwest::Client::builder().user_agent(user_agent).build()?;
@ -189,9 +189,9 @@ pub fn get_hours() -> Arc<[String]> {
let mut hours = vec![]; let mut hours = vec![];
for hour in 8..=20 { for hour in 8..=20 {
for minute in &[0, 15, 30, 45] { for minute in &[0, 15, 30, 45] {
let hour_str = format!("{}h{:02}", hour, minute); let hour_str = format!("{hour}h{minute:02}");
if let Some(last_hour) = hours.pop() { 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); hours.push(hour_str);
} }
@ -226,7 +226,7 @@ pub fn get_entry(course: &Course) -> String {
/// Entry's name used for finding duplicates, ignoring categories /// Entry's name used for finding duplicates, ignoring categories
pub fn get_entry_nocat(course: &Course) -> String { pub fn get_entry_nocat(course: &Course) -> String {
course.name.to_owned() course.name.clone()
} }
/// Returns a couple of (list of courses) and (a hashmap of how much they appears in the vector) /// Returns a couple of (list of courses) and (a hashmap of how much they appears in the vector)
@ -247,12 +247,12 @@ pub fn get_count<'a>(
.iter() .iter()
.any(|category| allowed_list.contains(category)) .any(|category| allowed_list.contains(category))
{ {
courses.push((course, day.name.to_owned())); courses.push((course, day.name.clone()));
let count = counts.entry(getter(course)).or_insert(0); let count = counts.entry(getter(course)).or_insert(0);
*count += 1; *count += 1;
} }
} }
}) });
}); });
(courses, counts) (courses, counts)