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:
parent
df05687ad9
commit
7d2ab89180
1 changed files with 3 additions and 8 deletions
11
src/main.rs
11
src/main.rs
|
|
@ -77,7 +77,7 @@ enum Source {
|
|||
// 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.
|
||||
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
|
||||
// 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.
|
||||
if hash_exists {
|
||||
println!("File already archived.");
|
||||
let _ = fs::remove_file(
|
||||
store_path
|
||||
.join("temp")
|
||||
.join(×tamp)
|
||||
.join(format!("{timestamp}{file_extension}")),
|
||||
);
|
||||
process::exit(0);
|
||||
let _ = fs::remove_file(store_path.join("temp").join(×tamp));
|
||||
} else {
|
||||
move_temp_to_raw(
|
||||
&store_path
|
||||
|
|
@ -288,6 +282,7 @@ fn main() -> Result<()> {
|
|||
&hash,
|
||||
&store_path,
|
||||
)?;
|
||||
let _ = fs::remove_file(store_path.join("temp").join(×tamp));
|
||||
|
||||
println!("File archived successfully.");
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue