extract subscriptions
This commit is contained in:
parent
a60999785b
commit
13600e0927
2 changed files with 12 additions and 12 deletions
14
src/lib.rs
14
src/lib.rs
|
@ -1,18 +1,17 @@
|
||||||
// https://www.phind.com/agent?cache=clke9xk39001cmj085upzho1t
|
// https://www.phind.com/agent?cache=clke9xk39001cmj085upzho1t
|
||||||
|
|
||||||
use std::fs::File;
|
|
||||||
|
|
||||||
use atom_syndication::Link;
|
use atom_syndication::Link;
|
||||||
|
|
||||||
mod errors;
|
mod errors;
|
||||||
mod feed;
|
mod feed;
|
||||||
mod history;
|
mod history;
|
||||||
pub mod prelude;
|
pub mod prelude;
|
||||||
|
mod subscriptions;
|
||||||
|
|
||||||
use prelude::*;
|
use prelude::*;
|
||||||
|
|
||||||
pub fn run(subscriptions: &str, history: &str, site: &str) -> Result<()> {
|
pub fn run(subscriptions: &str, history: &str, site: &str) -> Result<()> {
|
||||||
for channel_name in lines_from(subscriptions)? {
|
for channel_name in subscriptions::lines_from(subscriptions)? {
|
||||||
let channel_name = channel_name?;
|
let channel_name = channel_name?;
|
||||||
println!("Channel: {}", channel_name);
|
println!("Channel: {}", channel_name);
|
||||||
let feed_url = feed::get_feed_url(site, &channel_name)?;
|
let feed_url = feed::get_feed_url(site, &channel_name)?;
|
||||||
|
@ -29,15 +28,6 @@ pub fn run(subscriptions: &str, history: &str, site: &str) -> Result<()> {
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
// read list of rss feed URLs from file 'feeds.txt'
|
|
||||||
fn lines_from(file_name: &str) -> Result<std::io::Lines<std::io::BufReader<std::fs::File>>> {
|
|
||||||
use std::io::{BufRead, BufReader};
|
|
||||||
|
|
||||||
let file = File::open(file_name)?;
|
|
||||||
let reader = BufReader::new(file);
|
|
||||||
Ok(reader.lines())
|
|
||||||
}
|
|
||||||
|
|
||||||
fn download_audio(link: &Link) -> Result<()> {
|
fn download_audio(link: &Link) -> Result<()> {
|
||||||
use std::process::Command;
|
use std::process::Command;
|
||||||
|
|
||||||
|
|
10
src/subscriptions.rs
Normal file
10
src/subscriptions.rs
Normal file
|
@ -0,0 +1,10 @@
|
||||||
|
use crate::prelude::*;
|
||||||
|
|
||||||
|
use std::fs::File;
|
||||||
|
use std::io::{BufRead, BufReader, Lines};
|
||||||
|
|
||||||
|
pub fn lines_from(file_name: &str) -> Result<Lines<BufReader<File>>> {
|
||||||
|
let file = File::open(file_name)?;
|
||||||
|
let reader = BufReader::new(file);
|
||||||
|
Ok(reader.lines())
|
||||||
|
}
|
Loading…
Add table
Reference in a new issue