NewPodcast: Prefer the rss.description attribute.
Since we can handle rendering html stuff by converting it to pango we no longer need the text-only itunes summary attribure.
This commit is contained in:
parent
935d61324f
commit
af1cb43bd6
@ -1,7 +1,7 @@
|
||||
use diesel;
|
||||
use diesel::prelude::*;
|
||||
|
||||
use ammonia;
|
||||
// use ammonia;
|
||||
use rss;
|
||||
|
||||
use errors::DataError;
|
||||
@ -11,7 +11,8 @@ use schema::podcast;
|
||||
|
||||
use database::connection;
|
||||
use dbqueries;
|
||||
use utils::{replace_extra_spaces, url_cleaner};
|
||||
// use utils::{replace_extra_spaces, url_cleaner};
|
||||
use utils::url_cleaner;
|
||||
|
||||
#[derive(Insertable, AsChangeset)]
|
||||
#[table_name = "podcast"]
|
||||
@ -90,14 +91,15 @@ impl NewPodcast {
|
||||
pub(crate) fn new(chan: &rss::Channel, source_id: i32) -> NewPodcast {
|
||||
let title = chan.title().trim();
|
||||
|
||||
let description = chan.description().trim();
|
||||
// Prefer itunes summary over rss.description since many feeds put html into
|
||||
// rss.description.
|
||||
let summary = chan.itunes_ext().map(|s| s.summary()).and_then(|s| s);
|
||||
let description = if let Some(sum) = summary {
|
||||
replace_extra_spaces(&ammonia::clean(sum))
|
||||
} else {
|
||||
replace_extra_spaces(&ammonia::clean(chan.description()))
|
||||
};
|
||||
// let summary = chan.itunes_ext().map(|s| s.summary()).and_then(|s| s);
|
||||
// let description = if let Some(sum) = summary {
|
||||
// replace_extra_spaces(&ammonia::clean(sum))
|
||||
// } else {
|
||||
// replace_extra_spaces(&ammonia::clean(chan.description()))
|
||||
// };
|
||||
|
||||
let link = url_cleaner(chan.link());
|
||||
let itunes_img = chan.itunes_ext()
|
||||
|
||||
@ -112,12 +112,10 @@ Tobias Bernard
|
||||
<property name="halign">start</property>
|
||||
<property name="valign">end</property>
|
||||
<property name="label">foo</property>
|
||||
<property name="use_markup">True</property>
|
||||
<property name="wrap">True</property>
|
||||
<property name="wrap_mode">word-char</property>
|
||||
<property name="max_width_chars">90</property>
|
||||
<attributes>
|
||||
<attribute name="weight" value="medium"/>
|
||||
</attributes>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
|
||||
@ -123,7 +123,7 @@ impl ShowWidget {
|
||||
// markup.
|
||||
// let desc = dissolve::strip_html_tags(text).join(" ");
|
||||
// self.description.set_text(&replace_extra_spaces(&desc));
|
||||
self.description.set_text(&html_to_pango_markup(text));
|
||||
self.description.set_markup(&html_to_pango_markup(text));
|
||||
}
|
||||
|
||||
/// Set scrolled window vertical adjustment.
|
||||
|
||||
Loading…
Reference in New Issue
Block a user