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) => {
|
Err(err) => {
|
||||||
eprintln!(r#"[error] failed to request episode "{}" with error: "{}". skipping"#, title, err);
|
eprintln!(r#"[error] failed to request episode "{}" with error: "{}". skipping"#, title, err);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
spec.write_to(&spec_file)?;
|
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
let mut feed_change = false;
|
||||||
// Setting episodes which have been removed to no longer be current
|
// Setting episodes which have been removed to no longer be current
|
||||||
for (_, episodes) in &mut spec.feed {
|
for (_, episodes) in &mut spec.feed {
|
||||||
for episode in episodes {
|
for episode in episodes {
|
||||||
if !current_episodes.contains(episode.id.as_ref()) {
|
if !current_episodes.contains(episode.id.as_ref()) {
|
||||||
episode.current = false;
|
episode.current = false;
|
||||||
|
feed_change = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
spec.write_to(&spec_file)?;
|
if feed_change {
|
||||||
|
spec.write_to(&spec_file)?;
|
||||||
|
}
|
||||||
|
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user