mirror of
https://github.com/YGGverse/aquatic-crawler.git
synced 2026-03-31 17:15:35 +00:00
take regex config value
This commit is contained in:
parent
bd49ae8c6f
commit
c34f435153
2 changed files with 3 additions and 3 deletions
|
|
@ -33,7 +33,7 @@ async fn main() -> Result<()> {
|
|||
let peers = peers::Peers::init(&config.initial_peer)?;
|
||||
let preload = config
|
||||
.preload
|
||||
.map(|ref p| Preload::init(p, config.preload_regex.as_deref(), config.clear).unwrap());
|
||||
.map(|ref p| Preload::init(p, config.preload_regex, config.clear).unwrap());
|
||||
let trackers = Trackers::init(&config.tracker)?;
|
||||
let torrent = config.export_torrents.map(|p| Torrent::init(&p).unwrap());
|
||||
let session = librqbit::Session::new_with_opts(
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@ pub struct Preload {
|
|||
}
|
||||
|
||||
impl Preload {
|
||||
pub fn init(directory: &str, regex: Option<&str>, clear: bool) -> Result<Self> {
|
||||
pub fn init(directory: &str, regex: Option<String>, clear: bool) -> Result<Self> {
|
||||
let path = PathBuf::from_str(directory)?;
|
||||
if let Ok(t) = fs::metadata(&path) {
|
||||
if t.is_file() {
|
||||
|
|
@ -28,7 +28,7 @@ impl Preload {
|
|||
fs::create_dir_all(&path)?;
|
||||
Ok(Self {
|
||||
path,
|
||||
regex: regex.map(|r| Regex::new(r).unwrap()),
|
||||
regex: regex.map(|r| Regex::new(&r).unwrap()),
|
||||
})
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue