Commit c25cc6e2 authored by Mike Cronce's avatar Mike Cronce
Browse files

src/lib.rs: + Client::moviesearch()

parent 86befda7
Pipeline #332 failed with stages
in 6 minutes and 11 seconds
......@@ -78,5 +78,17 @@ impl Client {
let items = self.get_items("tvsearch", qparams).await?;
Ok(items.into_iter().map(|v| Torrent::try_from(v)).collect::<Vec<_>>())
}
pub async fn moviesearch(&self, q: Option<&str>, imdbid: Option<u64>) -> Result<Vec<Result<Torrent, Error>>, Error> {
let mut qparams = BTreeMap::<String, String>::new();
if let Some(v) = q {
qparams.insert("q".to_string(), v.to_string());
}
if let Some(v) = imdbid {
qparams.insert("imdbid".to_string(), v.to_string());
}
let items = self.get_items("movies", qparams).await?;
Ok(items.into_iter().map(|v| Torrent::try_from(v)).collect::<Vec<_>>())
}
}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment