mirror of
https://github.com/FliegendeWurst/KIT-ILIAS-downloader.git
synced 2024-08-28 04:04:18 +00:00
Make OpenCast lecture update checks optional
This commit is contained in:
parent
7cc780ed18
commit
67ba34af85
14
src/main.rs
14
src/main.rs
@ -277,10 +277,12 @@ fn process(ilias: Arc<ILIAS>, mut path: PathBuf, obj: Object) -> impl Future<Out
|
|||||||
.ok_or(anyhow!("video src not found"))?
|
.ok_or(anyhow!("video src not found"))?
|
||||||
.ok_or(anyhow!("video src not string"))?;
|
.ok_or(anyhow!("video src not string"))?;
|
||||||
if let Ok(meta) = fs::metadata(&path).await {
|
if let Ok(meta) = fs::metadata(&path).await {
|
||||||
let head = ilias.client.head(url).send().await.context("HEAD request failed")?;
|
if ilias.opt.check_videos {
|
||||||
if let Some(len) = head.headers().get("content-length") {
|
let head = ilias.client.head(url).send().await.context("HEAD request failed")?;
|
||||||
if meta.len() != len.to_str()?.parse::<u64>()? {
|
if let Some(len) = head.headers().get("content-length") {
|
||||||
log!(0, "Warning: {} was updated, consider moving the outdated file", relative_path.to_string_lossy());
|
if meta.len() != len.to_str()?.parse::<u64>()? {
|
||||||
|
log!(0, "Warning: {} was updated, consider moving the outdated file", relative_path.to_string_lossy());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
log!(2, "Skipping download, file exists already");
|
log!(2, "Skipping download, file exists already");
|
||||||
@ -500,6 +502,10 @@ struct Opt {
|
|||||||
#[structopt(long)]
|
#[structopt(long)]
|
||||||
content_tree: bool,
|
content_tree: bool,
|
||||||
|
|
||||||
|
/// Re-check OpenCast lectures (slow)
|
||||||
|
#[structopt(long)]
|
||||||
|
check_videos: bool,
|
||||||
|
|
||||||
/// Verbose logging (print objects downloaded)
|
/// Verbose logging (print objects downloaded)
|
||||||
#[structopt(short, multiple = true, parse(from_occurrences))]
|
#[structopt(short, multiple = true, parse(from_occurrences))]
|
||||||
verbose: usize,
|
verbose: usize,
|
||||||
|
Loading…
Reference in New Issue
Block a user