I hate daytimes with a passion.
This commit is contained in:
parent
dad74dc706
commit
68d185b7ef
@ -27,7 +27,6 @@ pub fn parse_podcast(chan: &Channel, source_id: i32) -> Result<models::NewPodcas
|
|||||||
Ok(foo)
|
Ok(foo)
|
||||||
}
|
}
|
||||||
|
|
||||||
// This is also an initial prototype mess.
|
|
||||||
pub fn parse_episode<'a>(item: &'a Item, parent_id: i32) -> Result<models::NewEpisode<'a>> {
|
pub fn parse_episode<'a>(item: &'a Item, parent_id: i32) -> Result<models::NewEpisode<'a>> {
|
||||||
|
|
||||||
let title = item.title();
|
let title = item.title();
|
||||||
@ -47,11 +46,23 @@ pub fn parse_episode<'a>(item: &'a Item, parent_id: i32) -> Result<models::NewEp
|
|||||||
let local_uri = None;
|
let local_uri = None;
|
||||||
|
|
||||||
let pub_date = item.pub_date();
|
let pub_date = item.pub_date();
|
||||||
let date = DateTime::parse_from_rfc2822(&pub_date.unwrap())?;
|
|
||||||
// info!("{}", date);
|
|
||||||
|
|
||||||
let epoch = date.timestamp() as i32;
|
let epoch = match pub_date{
|
||||||
// info!("{}", epoch);
|
Some(foo) => {
|
||||||
|
// info!("{}", foo);
|
||||||
|
let date = DateTime::parse_from_rfc2822(foo);
|
||||||
|
match date {
|
||||||
|
Ok(bar) => bar.timestamp() as i32,
|
||||||
|
Err(baz) => {
|
||||||
|
error!("Error while trying to parse \"{}\" as date.", foo);
|
||||||
|
error!("{}", baz);
|
||||||
|
debug!("Falling back to default 0");
|
||||||
|
0
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
_ => 0
|
||||||
|
};
|
||||||
|
|
||||||
let length = item.enclosure().map(|x| x.length().parse().unwrap_or_default());
|
let length = item.enclosure().map(|x| x.length().parse().unwrap_or_default());
|
||||||
|
|
||||||
|
|||||||
@ -12,7 +12,7 @@ pub fn foo() {
|
|||||||
let inpt = vec![
|
let inpt = vec![
|
||||||
"https://request-for-explanation.github.io/podcast/rss.xml",
|
"https://request-for-explanation.github.io/podcast/rss.xml",
|
||||||
"https://feeds.feedburner.com/InterceptedWithJeremyScahill",
|
"https://feeds.feedburner.com/InterceptedWithJeremyScahill",
|
||||||
"http://feeds.propublica.org/propublica/main",
|
"http://feeds.propublica.org/propublica/podcast",
|
||||||
"http://feeds.feedburner.com/linuxunplugged",
|
"http://feeds.feedburner.com/linuxunplugged",
|
||||||
];
|
];
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user