qbt-clean 0.3.0

Automated rules-based cleaning of qBittorrent torrents.
#[serde_with::serde_as]
#[derive(Debug,serde::Deserialize)]
#[serde(default)]
pub struct Config {
	#[serde_as(as="serde_with::FromInto<crate::SerdeBytes>")] pub target_free: u64,
	#[serde_as(as="serde_with::FromInto<crate::SerdeDuration>")] pub last_activity_min: std::time::Duration,
	#[serde_as(as="serde_with::FromInto<crate::SerdeDuration>")] pub seed_time_min: std::time::Duration,
	#[serde_as(as="serde_with::FromInto<crate::SerdeRegexSet>")] pub names_pinned: regex::RegexSet,
	#[serde_as(as="serde_with::FromInto<crate::SerdeRegexSet>")] pub trackers_pinned: regex::RegexSet,
	pub age_d_max_weight: f64,
	pub categories_allowed: std::collections::HashSet<String>,
	pub copies_weight: f64,
	pub dry_run: bool,
	pub last_activity_d_weight: f64,
	pub qbt_url: url::Url,
	pub seeder_count_min: u64,
	pub seeder_count_weight: f64,
	pub size_weight: f64,
	pub state_allowed: std::collections::HashSet<String>,
}

impl Default for Config {
	fn default() -> Self {
		Config {
			age_d_max_weight: 0.0,
			categories_allowed: Default::default(),
			copies_weight: 0.0,
			dry_run: true,
			last_activity_d_weight: 0.0,
			last_activity_min: std::time::Duration::from_secs(7 * 24 * 3600),
			names_pinned: Default::default(),
			qbt_url: "http://localhost:8080".parse().unwrap(),
			seed_time_min: std::time::Duration::from_secs(14 * 24 * 3600),
			seeder_count_min: 3,
			seeder_count_weight: 0.0,
			size_weight: 0.0,
			state_allowed: ["stalledUP", "stopped"].into_iter().map(|s| s.into()).collect(),
			target_free: 10_000_000_000,
			trackers_pinned: Default::default(),
		}
	}
}