mirror of
https://github.com/talwat/lowfi
synced 2025-01-14 20:31:27 +00:00
fix: silly spelling mistake
This commit is contained in:
parent
a1471db89a
commit
e599ada5ce
@ -20,9 +20,9 @@ struct Args {
|
|||||||
enum Commands {
|
enum Commands {
|
||||||
/// Scrapes the lofi girl website file server for files.
|
/// Scrapes the lofi girl website file server for files.
|
||||||
Scrape {
|
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")]
|
#[clap(long, short, default_value = "mp3")]
|
||||||
extention: String,
|
extension: String,
|
||||||
|
|
||||||
/// Whether to include the full HTTP URL or just the distinguishing part.
|
/// Whether to include the full HTTP URL or just the distinguishing part.
|
||||||
#[clap(long, short)]
|
#[clap(long, short)]
|
||||||
@ -37,9 +37,9 @@ async fn main() -> eyre::Result<()> {
|
|||||||
if let Some(command) = cli.command {
|
if let Some(command) = cli.command {
|
||||||
match command {
|
match command {
|
||||||
Commands::Scrape {
|
Commands::Scrape {
|
||||||
extention,
|
extension,
|
||||||
include_full,
|
include_full,
|
||||||
} => scrape::scrape(extention, include_full).await,
|
} => scrape::scrape(extension, include_full).await,
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
play::play().await
|
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.
|
/// 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.
|
/// 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>> {
|
async fn scan(extension: &str, include_full: bool) -> eyre::Result<Vec<String>> {
|
||||||
let extention = &format!(".{}", extention);
|
let extension = &format!(".{}", extension);
|
||||||
|
|
||||||
let items = parse("").await?;
|
let items = parse("").await?;
|
||||||
|
|
||||||
@ -53,7 +53,7 @@ async fn scan(extention: &str, include_full: bool) -> eyre::Result<Vec<String>>
|
|||||||
items
|
items
|
||||||
.into_iter()
|
.into_iter()
|
||||||
.filter_map(|x| {
|
.filter_map(|x| {
|
||||||
if x.ends_with(extention) {
|
if x.ends_with(extension) {
|
||||||
if include_full {
|
if include_full {
|
||||||
Some(format!("{BASE_URL}{path}{x}"))
|
Some(format!("{BASE_URL}{path}{x}"))
|
||||||
} else {
|
} else {
|
||||||
@ -76,8 +76,8 @@ async fn scan(extention: &str, include_full: bool) -> eyre::Result<Vec<String>>
|
|||||||
eyre::Result::Ok(files)
|
eyre::Result::Ok(files)
|
||||||
}
|
}
|
||||||
|
|
||||||
pub async fn scrape(extention: String, include_full: bool) -> eyre::Result<()> {
|
pub async fn scrape(extension: String, include_full: bool) -> eyre::Result<()> {
|
||||||
let files = scan(&extention, include_full).await?;
|
let files = scan(&extension, include_full).await?;
|
||||||
for file in files {
|
for file in files {
|
||||||
println!("{}", file);
|
println!("{}", file);
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user