Thats a hack, a terrible one, but without it the user
would have to manually click refresh if the user that was added happen to redirect somewhere else. The problem is in the hammond-data/src/models/source.rs fn request_constructor. It has to do with futures and lifetimes and I am not sure how to tackle it yet.
This commit is contained in:
@@ -208,6 +208,17 @@ pub fn get_source_from_uri(uri_: &str) -> Result<Source> {
|
||||
.map_err(From::from)
|
||||
}
|
||||
|
||||
pub fn get_source_from_id(id_: i32) -> Result<Source> {
|
||||
use schema::source::dsl::*;
|
||||
let db = connection();
|
||||
let con = db.get()?;
|
||||
|
||||
source
|
||||
.filter(id.eq(id_))
|
||||
.get_result::<Source>(&con)
|
||||
.map_err(From::from)
|
||||
}
|
||||
|
||||
pub fn get_podcast_from_source_id(sid: i32) -> Result<Podcast> {
|
||||
use schema::podcast::dsl::*;
|
||||
let db = connection();
|
||||
|
||||
@@ -85,6 +85,23 @@ pub fn run(sources: Vec<Source>, ignore_etags: bool) -> Result<()> {
|
||||
pipeline(sources, ignore_etags, &mut core, &pool, client)
|
||||
}
|
||||
|
||||
/// Docs
|
||||
pub fn index_single_source(s: Source, ignore_etags: bool) -> Result<()> {
|
||||
let pool = CpuPool::new_num_cpus();
|
||||
let mut core = Core::new()?;
|
||||
let handle = core.handle();
|
||||
|
||||
let client = Client::configure()
|
||||
.connector(HttpsConnector::new(num_cpus::get(), &handle)?)
|
||||
.build(&handle);
|
||||
|
||||
let work = s.into_feed(&client, pool.clone(), ignore_etags)
|
||||
.and_then(clone!(pool => move |feed| pool.clone().spawn(feed.index())))
|
||||
.map(|_| ());
|
||||
|
||||
core.run(work)
|
||||
}
|
||||
|
||||
fn determine_ep_state(ep: NewEpisodeMinimal, item: &rss::Item) -> Result<IndexState<NewEpisode>> {
|
||||
// Check if feed exists
|
||||
let exists = dbqueries::episode_exists(ep.title(), ep.podcast_id())?;
|
||||
|
||||
Reference in New Issue
Block a user