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