1
Fork 0
mirror of https://github.com/thegeneralist01/archivr synced 2026-05-30 08:36:47 +02:00

Clean up some clanker-written code

Signed-off-by: TheGeneralist <180094941+thegeneralist01@users.noreply.github.com>
This commit is contained in:
TheGeneralist 2026-04-02 18:54:58 +02:00
parent 26d94a8289
commit 741e33c3af
Signed by: thegeneralist01
SSH key fingerprint: SHA256:pp9qddbCNmVNoSjevdvQvM5z0DHN7LTa8qBMbcMq/R4
2 changed files with 6 additions and 10 deletions

View file

@ -356,7 +356,6 @@ fn main() -> Result<()> {
};
let source = determine_source(path);
let resolved_path = resolve_source_path(path, &source);
match source {
Source::Other => {
@ -394,6 +393,7 @@ fn main() -> Result<()> {
}
// Other sources
let path = resolve_source_path(path, &source);
let hash = match source {
Source::YouTubeVideo
| Source::X
@ -402,11 +402,7 @@ fn main() -> Result<()> {
| Source::TikTok
| Source::Reddit
| Source::Snapchat => {
match downloader::ytdlp::download(
resolved_path.clone(),
&store_path,
&timestamp,
) {
match downloader::ytdlp::download(path.clone(), &store_path, &timestamp) {
Ok(h) => h,
Err(e) => {
eprintln!("Failed to download from YouTube: {e}");
@ -415,7 +411,7 @@ fn main() -> Result<()> {
}
}
Source::Local => {
match downloader::local::save(resolved_path.clone(), &store_path, &timestamp) {
match downloader::local::save(path.clone(), &store_path, &timestamp) {
Ok(h) => h,
Err(e) => {
eprintln!("Failed to archive local file: {e}");
@ -435,7 +431,7 @@ fn main() -> Result<()> {
| Source::Reddit
| Source::Snapchat => ".mp4",
Source::Local => {
let p = Path::new(resolved_path.trim_start_matches("file://"));
let p = Path::new(path.trim_start_matches("file://"));
&p.extension()
.map_or(String::new(), |ext| format!(".{}", ext.to_string_lossy()))
}