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

Remove temp file using timestamp path

Delete the temp entry at store_path/temp/<timestamp> in both
the hash-exists and success paths. Stop constructing the full filename
with extension and remove the early process::exit to de-duplicate
cleanup.
This commit is contained in:
TheGeneralist 2026-03-31 10:56:20 +02:00
parent df05687ad9
commit 7d2ab89180
Signed by: thegeneralist01
SSH key fingerprint: SHA256:pp9qddbCNmVNoSjevdvQvM5z0DHN7LTa8qBMbcMq/R4

View file

@ -77,7 +77,7 @@ enum Source {
// INFO: yt-dlp supports a lot of sites; so, when archiving (for example) a website, the user // INFO: yt-dlp supports a lot of sites; so, when archiving (for example) a website, the user
// -> should be asked whether they want to archive the whole website or just the video(s) on it. // -> should be asked whether they want to archive the whole website or just the video(s) on it.
fn determine_source(path: &str) -> Source { fn determine_source(path: &str) -> Source {
// INFO: Extractors' URLs can be found here: // INFO: Extractor URLs can be found here:
// -> https://github.com/yt-dlp/yt-dlp/tree/dfc0a84c192a7357dd1768cc345d590253a14fe5/yt_dlp/extractor // -> https://github.com/yt-dlp/yt-dlp/tree/dfc0a84c192a7357dd1768cc345d590253a14fe5/yt_dlp/extractor
// TEST: X posts can have multiple videos. // TEST: X posts can have multiple videos.
@ -272,13 +272,7 @@ fn main() -> Result<()> {
// Dir or whatever. it's midnight and my brain ain't wording/braining. // Dir or whatever. it's midnight and my brain ain't wording/braining.
if hash_exists { if hash_exists {
println!("File already archived."); println!("File already archived.");
let _ = fs::remove_file( let _ = fs::remove_file(store_path.join("temp").join(&timestamp));
store_path
.join("temp")
.join(&timestamp)
.join(format!("{timestamp}{file_extension}")),
);
process::exit(0);
} else { } else {
move_temp_to_raw( move_temp_to_raw(
&store_path &store_path
@ -288,6 +282,7 @@ fn main() -> Result<()> {
&hash, &hash,
&store_path, &store_path,
)?; )?;
let _ = fs::remove_file(store_path.join("temp").join(&timestamp));
println!("File archived successfully."); println!("File archived successfully.");
} }