inline get_link function
This commit is contained in:
parent
0b6903404a
commit
05f7258978
1 changed files with 2 additions and 6 deletions
|
@ -2,7 +2,7 @@
|
|||
|
||||
use std::fs::File;
|
||||
|
||||
use atom_syndication::{Entry, Link};
|
||||
use atom_syndication::Link;
|
||||
|
||||
mod errors;
|
||||
mod feed;
|
||||
|
@ -16,7 +16,7 @@ pub fn run(subscriptions: &str, history: &str, site: &str) -> Result<()> {
|
|||
println!("Channel: {}", channel_name);
|
||||
let feed_url = feed::get_feed_url(site, &channel_name)?;
|
||||
for entry in feed::get_feed(feed_url)?.entries() {
|
||||
if let Some(link) = get_link(entry) {
|
||||
if let Some(link) = entry.links().get(0).cloned() {
|
||||
if !is_already_downloaded(&link, history)? {
|
||||
println!("Downloading {}: {}", &channel_name, entry.title().as_str());
|
||||
download_audio(&link)?;
|
||||
|
@ -28,10 +28,6 @@ pub fn run(subscriptions: &str, history: &str, site: &str) -> Result<()> {
|
|||
Ok(())
|
||||
}
|
||||
|
||||
fn get_link(item: &Entry) -> Option<Link> {
|
||||
item.links().get(0).cloned()
|
||||
}
|
||||
|
||||
// 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};
|
||||
|
|
Loading…
Add table
Reference in a new issue