Formatting
This commit is contained in:
24
src/main.rs
24
src/main.rs
@@ -156,9 +156,7 @@ fn make_backend_config(
|
||||
output: &Option<PathBuf>,
|
||||
cookies: &Option<PathBuf>,
|
||||
) -> anyhow::Result<BackendConfig> {
|
||||
let fmt: AudioFormat = format
|
||||
.parse()
|
||||
.map_err(|e: String| anyhow::anyhow!(e))?;
|
||||
let fmt: AudioFormat = format.parse().map_err(|e: String| anyhow::anyhow!(e))?;
|
||||
Ok(BackendConfig {
|
||||
output_dir: output.clone().unwrap_or_else(default_output_dir),
|
||||
format: fmt,
|
||||
@@ -199,13 +197,12 @@ async fn main() -> anyhow::Result<()> {
|
||||
let config = make_backend_config(&format, &output, &cookies)?;
|
||||
|
||||
// Determine if it's a URL or a search query
|
||||
let target = if query_or_url.starts_with("http://")
|
||||
|| query_or_url.starts_with("https://")
|
||||
{
|
||||
DownloadTarget::Url(query_or_url)
|
||||
} else {
|
||||
DownloadTarget::Query(query_or_url)
|
||||
};
|
||||
let target =
|
||||
if query_or_url.starts_with("http://") || query_or_url.starts_with("https://") {
|
||||
DownloadTarget::Url(query_or_url)
|
||||
} else {
|
||||
DownloadTarget::Query(query_or_url)
|
||||
};
|
||||
|
||||
download_single(&backend, target, &config, dry_run).await?;
|
||||
}
|
||||
@@ -235,7 +232,8 @@ async fn main() -> anyhow::Result<()> {
|
||||
println!("\nQueue processing complete: {stats}");
|
||||
}
|
||||
QueueAction::Add { query } => {
|
||||
let item = queries::downloads::enqueue(db.conn(), &query, None, "ytdlp").await?;
|
||||
let item =
|
||||
queries::downloads::enqueue(db.conn(), &query, None, "ytdlp").await?;
|
||||
println!("Added to queue: id={}, query=\"{}\"", item.id, item.query);
|
||||
}
|
||||
QueueAction::List { status } => {
|
||||
@@ -254,8 +252,8 @@ async fn main() -> anyhow::Result<()> {
|
||||
println!("Queue is empty.");
|
||||
} else {
|
||||
println!(
|
||||
"{:<5} {:<12} {:<6} {:<40} {}",
|
||||
"ID", "STATUS", "RETRY", "QUERY", "ERROR"
|
||||
"{:<5} {:<12} {:<6} {:<40} ERROR",
|
||||
"ID", "STATUS", "RETRY", "QUERY"
|
||||
);
|
||||
for item in &items {
|
||||
println!(
|
||||
|
||||
Reference in New Issue
Block a user