move podcasts to within nested podcasts folder (significant breaking change)
This commit is contained in:
@@ -7,8 +7,10 @@ use std::collections::{HashMap, BTreeMap, HashSet};
|
||||
use anyhow::Context;
|
||||
use sanitise_file_name::sanitise;
|
||||
|
||||
use crate::folders;
|
||||
use crate::rss;
|
||||
|
||||
|
||||
#[derive(Debug, Default, serde::Serialize, serde::Deserialize)]
|
||||
pub(crate) struct Specification<'a> {
|
||||
files: HashMap<Cow<'a, str>, Cow<'a, path::Path>>,
|
||||
@@ -98,10 +100,10 @@ pub(crate) fn update_podcast(
|
||||
) -> anyhow::Result<()> {
|
||||
|
||||
// Create output directory
|
||||
let output = root.join(sanitise(&alias));
|
||||
let output = folders::podcast_folder(root, alias);
|
||||
if !output.exists() {
|
||||
fs::create_dir(&output)
|
||||
.with_context(|| format!("failed to create output directory for podcast {}", alias))?;
|
||||
fs::create_dir_all(&output)
|
||||
.context(format!("failed to create output directory for podcast {}", alias))?;
|
||||
}
|
||||
|
||||
println!(r#"[info] scanning feed for "{}""#, alias);
|
||||
@@ -115,7 +117,7 @@ pub(crate) fn update_podcast(
|
||||
.with_header("User-Agent", "podcast-downloader")
|
||||
.with_header("Accept", "*/*")
|
||||
.send()
|
||||
.with_context(|| format!(r#"error when requesting feed url "{}" for {}"#, feed_url, alias))?;
|
||||
.context(format!(r#"error when requesting feed url "{}" for {}"#, feed_url, alias))?;
|
||||
|
||||
if response.status_code != 200 {
|
||||
eprintln!(r#"[error] feed "{}" for alias {} responded with non-200 ({}) status code"#, feed_url, alias, response.status_code);
|
||||
|
Reference in New Issue
Block a user