mirror of
https://github.com/YGGverse/aquatic-crawler.git
synced 2026-04-02 01:55:28 +00:00
implement temporary data cleanup on commit preload content
This commit is contained in:
parent
6f4d2894b3
commit
3e053fa806
3 changed files with 58 additions and 27 deletions
13
src/main.rs
13
src/main.rs
|
|
@ -116,12 +116,9 @@ async fn main() -> Result<()> {
|
|||
only_files: Some(Vec::with_capacity(
|
||||
config.preload_max_filecount.unwrap_or_default(),
|
||||
)),
|
||||
// the destination folder to preload files match `only_files_regex`
|
||||
// the destination folder to preload files match `preload_regex`
|
||||
// * e.g. images for audio albums
|
||||
output_folder: preload
|
||||
.output_folder(&i)?
|
||||
.to_str()
|
||||
.map(|s| s.to_string()),
|
||||
output_folder: preload.tmp(&i)?.to_str().map(|s| s.to_string()),
|
||||
..Default::default()
|
||||
}),
|
||||
),
|
||||
|
|
@ -170,9 +167,9 @@ async fn main() -> Result<()> {
|
|||
session.unpause(&mt).await?;
|
||||
// await for `preload_regex` files download to continue
|
||||
mt.wait_until_completed().await?;
|
||||
// cleanup irrelevant files (see rqbit#408)
|
||||
preload.cleanup(&i, Some(keep_files))?;
|
||||
preload.persist_torrent_bytes(&i, &bytes)?;
|
||||
// persist torrent bytes and preloaded content,
|
||||
// cleanup tmp (see rqbit#408)
|
||||
preload.commit(&i, &bytes, Some(keep_files))?;
|
||||
// remove torrent from session as indexed
|
||||
session
|
||||
.delete(librqbit::api::TorrentIdOrHash::Id(id), false)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue