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
@ -277,12 +277,14 @@ 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 {
|
||||||
|
if ilias.opt.check_videos {
|
||||||
let head = ilias.client.head(url).send().await.context("HEAD request failed")?;
|
let head = ilias.client.head(url).send().await.context("HEAD request failed")?;
|
||||||
if let Some(len) = head.headers().get("content-length") {
|
if let Some(len) = head.headers().get("content-length") {
|
||||||
if meta.len() != len.to_str()?.parse::<u64>()? {
|
if meta.len() != len.to_str()?.parse::<u64>()? {
|
||||||
log!(0, "Warning: {} was updated, consider moving the outdated file", relative_path.to_string_lossy());
|
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");
|
||||||
if !ilias.opt.force {
|
if !ilias.opt.force {
|
||||||
return Ok(());
|
return Ok(());
|
||||||
@ -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