only write spec if changed
This commit is contained in:
parent
61db0cdf9f
commit
42c00a5794
@ -291,28 +291,33 @@ pub (crate) fn update_podcast_from_feed(
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
// Update the file as we go, but only if a change has occured
|
||||
spec.write_to(&spec_file)?;
|
||||
},
|
||||
Err(err) => {
|
||||
eprintln!(r#"[error] failed to request episode "{}" with error: "{}". skipping"#, title, err);
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
spec.write_to(&spec_file)?;
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
let mut feed_change = false;
|
||||
// Setting episodes which have been removed to no longer be current
|
||||
for (_, episodes) in &mut spec.feed {
|
||||
for episode in episodes {
|
||||
if !current_episodes.contains(episode.id.as_ref()) {
|
||||
episode.current = false;
|
||||
feed_change = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if feed_change {
|
||||
spec.write_to(&spec_file)?;
|
||||
}
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user