mirror of
https://github.com/YGGverse/btracker.git
synced 2026-03-31 17:15:31 +00:00
use redb index, update db revision
This commit is contained in:
parent
752ef69732
commit
7afc7d8f90
2 changed files with 4 additions and 13 deletions
|
|
@ -23,5 +23,6 @@ urlencoding = "2.1"
|
||||||
yggtracker-redb = "0.1"
|
yggtracker-redb = "0.1"
|
||||||
|
|
||||||
[patch.crates-io]
|
[patch.crates-io]
|
||||||
yggtracker-redb = { git = "https://github.com/YGGverse/yggtracker-redb.git", rev="008402696d81c4b7d4cc7786c9cf3263ae8632b6" }
|
# yggtracker-redb = { path = "../yggtracker-redb" }
|
||||||
|
yggtracker-redb = { git = "https://github.com/YGGverse/yggtracker-redb.git", rev="e6cdd9c41df4a90c45bf3be2e605a2efb83585b7" }
|
||||||
librqbit = { git = "https://github.com/ikatson/rqbit.git", rev="b580a9610ae7c6eaacd305a3905f7e2d3202ca69" }
|
librqbit = { git = "https://github.com/ikatson/rqbit.git", rev="b580a9610ae7c6eaacd305a3905f7e2d3202ca69" }
|
||||||
14
src/main.rs
14
src/main.rs
|
|
@ -72,8 +72,6 @@ async fn main() -> Result<()> {
|
||||||
|
|
||||||
// begin
|
// begin
|
||||||
println!("Crawler started on {time_init}");
|
println!("Crawler started on {time_init}");
|
||||||
let mut processed = HashSet::with_capacity(config.index_capacity);
|
|
||||||
|
|
||||||
loop {
|
loop {
|
||||||
let time_queue = Local::now();
|
let time_queue = Local::now();
|
||||||
if config.debug {
|
if config.debug {
|
||||||
|
|
@ -100,7 +98,7 @@ async fn main() -> Result<()> {
|
||||||
// convert to string once
|
// convert to string once
|
||||||
let i = i.to_string();
|
let i = i.to_string();
|
||||||
// already indexed?
|
// already indexed?
|
||||||
if processed.contains(&i) {
|
if database.torrent(&i)?.is_some() {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if config.debug {
|
if config.debug {
|
||||||
|
|
@ -163,12 +161,6 @@ async fn main() -> Result<()> {
|
||||||
}
|
}
|
||||||
if info.relative_filename.extension().is_none_or(|e|
|
if info.relative_filename.extension().is_none_or(|e|
|
||||||
!matches!(e.as_bytes(), b"png" | b"jpeg" | b"jpg" | b"gif" | b"webp")) {
|
!matches!(e.as_bytes(), b"png" | b"jpeg" | b"jpg" | b"gif" | b"webp")) {
|
||||||
if config.debug {
|
|
||||||
println!(
|
|
||||||
"\t\t\tskip non-image file `{}` for `{i}`.",
|
|
||||||
info.relative_filename.to_string_lossy()
|
|
||||||
)
|
|
||||||
}
|
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if preload.max_filesize.is_some_and(|limit| info.len > limit) {
|
if preload.max_filesize.is_some_and(|limit| info.len > limit) {
|
||||||
|
|
@ -259,8 +251,6 @@ async fn main() -> Result<()> {
|
||||||
if config.debug {
|
if config.debug {
|
||||||
println!("\t\t\tadd `{i}` to index.")
|
println!("\t\t\tadd `{i}` to index.")
|
||||||
}
|
}
|
||||||
// skip processed torrent on the next iteration
|
|
||||||
assert!(processed.insert(i))
|
|
||||||
}
|
}
|
||||||
Ok(_) => panic!(),
|
Ok(_) => panic!(),
|
||||||
Err(e) => eprintln!("Failed to resolve `{i}`: `{e}`."),
|
Err(e) => eprintln!("Failed to resolve `{i}`: `{e}`."),
|
||||||
|
|
@ -276,7 +266,7 @@ async fn main() -> Result<()> {
|
||||||
if config.debug {
|
if config.debug {
|
||||||
println!(
|
println!(
|
||||||
"Queue completed on {time_queue}\n\ttotal: {}\n\ttime: {} s\n\tuptime: {} s\n\tawait {} seconds to continue...",
|
"Queue completed on {time_queue}\n\ttotal: {}\n\ttime: {} s\n\tuptime: {} s\n\tawait {} seconds to continue...",
|
||||||
processed.len(),
|
database.torrents_total()?,
|
||||||
Local::now()
|
Local::now()
|
||||||
.signed_duration_since(time_queue)
|
.signed_duration_since(time_queue)
|
||||||
.as_seconds_f32(),
|
.as_seconds_f32(),
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue