trying to make tests work with new metadata

This commit is contained in:
Igor Katson 2024-08-14 10:25:05 +01:00
parent 55649e181a
commit c196c11860
No known key found for this signature in database
GPG key ID: B4EC22B66D61A3F5
6 changed files with 45 additions and 29 deletions

View file

@ -20,6 +20,14 @@ impl Magnet {
self.id32
}
pub fn from_id20(id20: Id20, trackers: Vec<String>) -> Self {
Self {
id20: Some(id20),
id32: None,
trackers,
}
}
/// Parse a magnet link.
pub fn parse(url: &str) -> anyhow::Result<Magnet> {
let url = url::Url::parse(url).context("magnet link must be a valid URL")?;