NewPodcast: refactor an if else statement and document it.
This commit is contained in:
parent
7a74534285
commit
c910e0af40
@ -91,14 +91,13 @@ impl NewPodcast {
|
||||
|
||||
let description = ammonia::clean(chan.description().trim());
|
||||
let link = url_cleaner(chan.link());
|
||||
|
||||
// Try to get the itunes img first
|
||||
let itunes_img = chan.itunes_ext()
|
||||
.and_then(|s| s.image())
|
||||
.map(|s| s.to_owned());
|
||||
let image_uri = if itunes_img.is_some() {
|
||||
itunes_img
|
||||
} else {
|
||||
chan.image().map(|s| s.url().to_owned())
|
||||
};
|
||||
// If itunes is None, try to get the channel.image from the rss spec
|
||||
let image_uri = itunes_img.or_else(|| chan.image().map(|s| s.url().to_owned()));
|
||||
|
||||
NewPodcastBuilder::default()
|
||||
.title(title)
|
||||
|
||||
Loading…
Reference in New Issue
Block a user