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:
parent
26d94a8289
commit
741e33c3af
2 changed files with 6 additions and 10 deletions
12
src/main.rs
12
src/main.rs
|
|
@ -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,
|
||||
×tamp,
|
||||
) {
|
||||
match downloader::ytdlp::download(path.clone(), &store_path, ×tamp) {
|
||||
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, ×tamp) {
|
||||
match downloader::local::save(path.clone(), &store_path, ×tamp) {
|
||||
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()))
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue