mirror of
https://github.com/talwat/lowfi
synced 2025-01-13 20:01:27 +00:00
fix: silly spelling mistake
This commit is contained in:
parent
a1471db89a
commit
e599ada5ce
@ -20,9 +20,9 @@ struct Args {
|
||||
enum Commands {
|
||||
/// Scrapes the lofi girl website file server for files.
|
||||
Scrape {
|
||||
/// The file extention to search for, defaults to mp3.
|
||||
/// The file extension to search for, defaults to mp3.
|
||||
#[clap(long, short, default_value = "mp3")]
|
||||
extention: String,
|
||||
extension: String,
|
||||
|
||||
/// Whether to include the full HTTP URL or just the distinguishing part.
|
||||
#[clap(long, short)]
|
||||
@ -37,9 +37,9 @@ async fn main() -> eyre::Result<()> {
|
||||
if let Some(command) = cli.command {
|
||||
match command {
|
||||
Commands::Scrape {
|
||||
extention,
|
||||
extension,
|
||||
include_full,
|
||||
} => scrape::scrape(extention, include_full).await,
|
||||
} => scrape::scrape(extension, include_full).await,
|
||||
}
|
||||
} else {
|
||||
play::play().await
|
||||
|
@ -26,8 +26,8 @@ async fn parse(path: &str) -> eyre::Result<Vec<String>> {
|
||||
///
|
||||
/// It's a bit hacky, and basically works by checking all of the years, then months, and then all of the files.
|
||||
/// This is done as a way to avoid recursion, since async rust really hates recursive functions.
|
||||
async fn scan(extention: &str, include_full: bool) -> eyre::Result<Vec<String>> {
|
||||
let extention = &format!(".{}", extention);
|
||||
async fn scan(extension: &str, include_full: bool) -> eyre::Result<Vec<String>> {
|
||||
let extension = &format!(".{}", extension);
|
||||
|
||||
let items = parse("").await?;
|
||||
|
||||
@ -53,7 +53,7 @@ async fn scan(extention: &str, include_full: bool) -> eyre::Result<Vec<String>>
|
||||
items
|
||||
.into_iter()
|
||||
.filter_map(|x| {
|
||||
if x.ends_with(extention) {
|
||||
if x.ends_with(extension) {
|
||||
if include_full {
|
||||
Some(format!("{BASE_URL}{path}{x}"))
|
||||
} else {
|
||||
@ -76,8 +76,8 @@ async fn scan(extention: &str, include_full: bool) -> eyre::Result<Vec<String>>
|
||||
eyre::Result::Ok(files)
|
||||
}
|
||||
|
||||
pub async fn scrape(extention: String, include_full: bool) -> eyre::Result<()> {
|
||||
let files = scan(&extention, include_full).await?;
|
||||
pub async fn scrape(extension: String, include_full: bool) -> eyre::Result<()> {
|
||||
let files = scan(&extension, include_full).await?;
|
||||
for file in files {
|
||||
println!("{}", file);
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user