Skip to main content

Crate usenet_dl

Crate usenet_dl 

Source
Expand description

§usenet-dl

Highly configurable backend library for Usenet download applications.

§Design Philosophy

usenet-dl is designed to be:

  • Highly configurable - Almost every behavior can be customized
  • Sensible defaults - Works out of the box with zero configuration
  • Library-first - No CLI or UI, purely a Rust crate for embedding
  • Event-driven - Consumers subscribe to events, no polling required

§Quick Start

use usenet_dl::{UsenetDownloader, Config, ServerConfig};

#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
    let config = Config {
        servers: vec![
            ServerConfig {
                host: "news.example.com".to_string(),
                port: 563,
                tls: true,
                username: Some("user".to_string()),
                password: Some("pass".to_string()),
                connections: 10,
                priority: 0,
                pipeline_depth: 10,
            }
        ],
        ..Default::default()
    };

    let downloader = UsenetDownloader::new(config).await?;

    // Subscribe to events
    let mut events = downloader.subscribe();
    tokio::spawn(async move {
        while let Ok(event) = events.recv().await {
            println!("Event: {:?}", event);
        }
    });

    Ok(())
}

Re-exports§

pub use config::Config;
pub use config::DuplicateAction;
pub use config::ServerConfig;
pub use db::Database;
pub use downloader::UsenetDownloader;
pub use error::ApiError;
pub use error::DatabaseError;
pub use error::DownloadError;
pub use error::Error;
pub use error::ErrorDetail;
pub use error::PostProcessError;
pub use error::Result;
pub use error::ToHttpStatus;
pub use parity::CliParityHandler;
pub use parity::NoOpParityHandler;
pub use parity::ParityCapabilities;
pub use parity::ParityHandler;
pub use parity::RepairResult;
pub use parity::VerifyResult;
pub use scheduler::RuleId;
pub use scheduler::ScheduleAction;
pub use scheduler::ScheduleRule;
pub use scheduler::Scheduler;
pub use scheduler::Weekday;
pub use types::DownloadId;
pub use types::DownloadInfo;
pub use types::DownloadOptions;
pub use types::DuplicateInfo;
pub use types::Event;
pub use types::HistoryEntry;
pub use types::Priority;
pub use types::QueueStats;
pub use types::ServerCapabilities;
pub use types::ServerTestResult;
pub use types::Stage;
pub use types::Status;

Modules§

api
REST API module REST API server module
config
Configuration types Configuration types for usenet-dl
db
Database persistence layer Database layer for usenet-dl
deobfuscation
Filename deobfuscation Obfuscated filename detection and handling
downloader
Core downloader implementation (decomposed into focused submodules) Core downloader implementation split into focused submodules.
error
Error types Error types for usenet-dl
extraction
Archive extraction Archive extraction with password support
folder_watcher
Folder watching for automatic NZB import Folder watching for automatic NZB import
parity
PAR2 parity handling PAR2 parity file handling
post_processing
Post-processing pipeline Post-processing pipeline for completed downloads
retry
Retry logic with exponential backoff Retry logic with exponential backoff
rss_manager
RSS feed management RSS feed management for automatic NZB monitoring and downloading.
rss_scheduler
RSS feed scheduler RSS feed scheduling and periodic checking
scheduler
Time-based scheduling Time-based scheduler for applying speed limits and pause/resume based on schedules.
scheduler_task
Scheduler task execution Scheduler task execution for time-based automation
speed_limiter
Speed limiting with token bucket Speed limiting using token bucket algorithm
types
Core types and events Core types for usenet-dl
utils
Utility functions Utility functions for file operations and path manipulation

Functions§

run_with_shutdown
Helper function to run the downloader with graceful signal handling.