From b820ee4db70b8b8002c9781b9f622fd378dc4fd4 Mon Sep 17 00:00:00 2001 From: Jordan Petridis Date: Fri, 22 Dec 2017 14:51:57 +0200 Subject: [PATCH] hammond-data::parser : Do not clean image urls cause feeds put redirects for uri for some reason. --- hammond-data/src/models/insertables.rs | 4 ---- hammond-data/src/parser.rs | 8 ++------ 2 files changed, 2 insertions(+), 10 deletions(-) diff --git a/hammond-data/src/models/insertables.rs b/hammond-data/src/models/insertables.rs index c847a2e..983e11b 100644 --- a/hammond-data/src/models/insertables.rs +++ b/hammond-data/src/models/insertables.rs @@ -112,10 +112,6 @@ impl NewPodcast { let con = db.get()?; match pd { Ok(foo) => { - if foo.source_id() != self.source_id { - error!("NSPD sid: {}, SPD sid: {}", self.source_id, foo.source_id()); - }; - if (foo.link() != self.link) || (foo.title() != self.title) || (foo.image_uri() != self.image_uri.as_ref().map(|x| x.as_str())) { diff --git a/hammond-data/src/parser.rs b/hammond-data/src/parser.rs index 566b06f..b6b244d 100644 --- a/hammond-data/src/parser.rs +++ b/hammond-data/src/parser.rs @@ -17,9 +17,9 @@ pub(crate) fn new_podcast(chan: &Channel, source_id: i32) -> NewPodcast { let link = url_cleaner(chan.link()); let x = chan.itunes_ext().map(|s| s.image()); let image_uri = if let Some(img) = x { - img.map(|s| url_cleaner(s)) + img.map(|s| s.to_owned()) } else { - chan.image().map(|foo| url_cleaner(foo.url())) + chan.image().map(|foo| foo.url().to_owned()) }; NewPodcastBuilder::default() @@ -43,10 +43,6 @@ pub(crate) fn new_episode(item: &Item, parent_id: i32) -> Result { .map(|s| replace_extra_spaces(&ammonia::clean(s))); let guid = item.guid().map(|s| s.value().trim().to_owned()); - // Its kinda weird this being an Option type. - // Rss 2.0 specified that it's optional. - // Though the db scema has a requirment of episode uri being Unique && Not Null. - // TODO: Restructure let x = item.enclosure().map(|s| url_cleaner(s.url())); // FIXME: refactor let uri = if x.is_some() {