qbt-clean 0.3.0

Automated rules-based cleaning of qBittorrent torrents.
#[derive(Debug,Default)]
pub struct Group {
	pub pinned: bool,
	pub torrents: Vec<crate::Torrent>,
}

impl Group {
	pub fn last_activity(&self, now: std::time::SystemTime) -> std::time::Duration {
		self.torrents.iter()
			.map(|t| t.last_activity.duration_since(now).unwrap_or_default())
			.min()
			.unwrap()
	}

	pub fn min_age(&self, now: std::time::SystemTime) -> std::time::Duration {
		self.torrents.iter()
			.map(|t| t.added_on.duration_since(now).unwrap_or_default())
			.min()
			.unwrap()
	}

	pub fn seeders(&self) -> u64 {
		self.torrents.iter()
			.map(|t| t.seeders)
			.sum()
	}

	pub fn size(&self) -> u64 {
		self.torrents.iter()
			.map(|t| t.selected_size)
			.max()
			.unwrap()
	}
}