hammond-data::parser : Do not clean image urls cause feeds put redirects for uri for some reason.

This commit is contained in:
Jordan Petridis 2017-12-22 14:51:57 +02:00
parent 8513ba3644
commit b820ee4db7
No known key found for this signature in database
GPG Key ID: CEABAD9F5683B9A6
2 changed files with 2 additions and 10 deletions

View File

@ -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()))
{

View File

@ -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<NewEpisode> {
.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() {