Renamed parse_feeds.rs to feedparser.rs
This commit is contained in:
parent
870e37e5b1
commit
6b4b772462
@ -30,9 +30,9 @@ pub fn foo() {
|
|||||||
fn insert_source(connection: &SqliteConnection, url: &str) -> Result<()> {
|
fn insert_source(connection: &SqliteConnection, url: &str) -> Result<()> {
|
||||||
let foo = NewSource::new_with_uri(url);
|
let foo = NewSource::new_with_uri(url);
|
||||||
|
|
||||||
diesel::insert(&foo).into(schema::source::table).execute(
|
diesel::insert_or_replace(&foo)
|
||||||
connection,
|
.into(schema::source::table)
|
||||||
)?;
|
.execute(connection)?;
|
||||||
|
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
@ -40,16 +40,17 @@ fn insert_source(connection: &SqliteConnection, url: &str) -> Result<()> {
|
|||||||
|
|
||||||
pub fn index_loop(db: SqliteConnection) -> Result<()> {
|
pub fn index_loop(db: SqliteConnection) -> Result<()> {
|
||||||
// let db = ::establish_connection();
|
// let db = ::establish_connection();
|
||||||
use parse_feeds;
|
use feedparser;
|
||||||
|
|
||||||
let f = dbqueries::get_sources(&db);
|
let f = dbqueries::get_sources(&db);
|
||||||
|
|
||||||
for feed in f.unwrap().iter_mut() {
|
for feed in f.unwrap().iter_mut() {
|
||||||
info!("{:?}", feed.id());
|
// info!("{:?}", feed.id());
|
||||||
|
|
||||||
// This method will defently get split and nuked
|
// This method will defently get split and nuked
|
||||||
// but for now its poc
|
// but for now its poc
|
||||||
let chan = feed.get_podcast_chan(&db)?;
|
let chan = feed.get_podcast_chan(&db)?;
|
||||||
let pd = parse_feeds::parse_podcast(&chan, feed.id())?;
|
let pd = feedparser::parse_podcast(&chan, feed.id())?;
|
||||||
|
|
||||||
// TODO: Separate the insert/update logic
|
// TODO: Separate the insert/update logic
|
||||||
diesel::insert_or_replace(&pd)
|
diesel::insert_or_replace(&pd)
|
||||||
@ -59,7 +60,7 @@ pub fn index_loop(db: SqliteConnection) -> Result<()> {
|
|||||||
// Holy shit this works!
|
// Holy shit this works!
|
||||||
let episodes: Vec<_> = chan.items()
|
let episodes: Vec<_> = chan.items()
|
||||||
.iter()
|
.iter()
|
||||||
.map(|x| parse_feeds::parse_episode(x, feed.id()).unwrap())
|
.map(|x| feedparser::parse_episode(x, feed.id()).unwrap())
|
||||||
.collect();
|
.collect();
|
||||||
|
|
||||||
// lazy invoking the compiler to check for the Vec type :3
|
// lazy invoking the compiler to check for the Vec type :3
|
||||||
@ -70,7 +71,7 @@ pub fn index_loop(db: SqliteConnection) -> Result<()> {
|
|||||||
.execute(&db)?;
|
.execute(&db)?;
|
||||||
|
|
||||||
info!("{:#?}", pd);
|
info!("{:#?}", pd);
|
||||||
info!("{:#?}", episodes);
|
// info!("{:#?}", episodes);
|
||||||
// info!("{:?}", chan);
|
// info!("{:?}", chan);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -26,7 +26,7 @@ extern crate rss;
|
|||||||
pub mod cli;
|
pub mod cli;
|
||||||
pub mod schema;
|
pub mod schema;
|
||||||
pub mod models;
|
pub mod models;
|
||||||
pub mod parse_feeds;
|
pub mod feedparser;
|
||||||
pub mod index_feed;
|
pub mod index_feed;
|
||||||
pub mod dbqueries;
|
pub mod dbqueries;
|
||||||
|
|
||||||
|
|||||||
@ -87,7 +87,7 @@ impl<'a> Source {
|
|||||||
self.update(con, etag, lst_mod)?;
|
self.update(con, etag, lst_mod)?;
|
||||||
|
|
||||||
let chan = Channel::from_str(&buf)?;
|
let chan = Channel::from_str(&buf)?;
|
||||||
// let foo = ::parse_feeds::parse_podcast(&chan, self.id())?;
|
// let foo = ::feedparser::parse_podcast(&chan, self.id())?;
|
||||||
|
|
||||||
Ok(chan)
|
Ok(chan)
|
||||||
}
|
}
|
||||||
@ -160,7 +160,7 @@ impl<'a> NewPodcast {
|
|||||||
|
|
||||||
pub fn from_url(uri: &'a str, parent: &Source) -> Result<NewPodcast> {
|
pub fn from_url(uri: &'a str, parent: &Source) -> Result<NewPodcast> {
|
||||||
let chan = Channel::from_url(uri)?;
|
let chan = Channel::from_url(uri)?;
|
||||||
let foo = ::parse_feeds::parse_podcast(&chan, parent.id())?;
|
let foo = ::feedparser::parse_podcast(&chan, parent.id())?;
|
||||||
Ok(foo)
|
Ok(foo)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Loading…
Reference in New Issue
Block a user