extern crate tvdb; /// Custom error #[derive(Debug)] enum MyError { ErrorFromTvdb { reason: String }, NotFound, } impl From for MyError { fn from(err: tvdb::TvdbError) -> MyError { MyError::ErrorFromTvdb { reason: format!("{}", err), } } } /* fn lookup_tvdb(series: &str, season: u32, episode: u32) -> Result { // Create API with your API key let api = tvdb::Tvdb::new("0629B785CE550C8D"); api.login().unwrap(); // Perform search (returns a vector of SeriesSearchResult's) let lang = "en"; // Search for English show let sr = api.search(series)?; if sr.data.len() > 0 { // Look up episode based on reference to first result (the API automatically creates an // tvdb::EpisodeId from the `SeriesSearchResult` which the `search` method returns) let ep = try!(api.episode(123));// FIXME &sr.data[0], season, episode)); // Return episode name return Ok(ep.episode_name); } else { // No search results, return error return Err(MyError::NotFound); } } */ fn main() { // FIXME /* match lookup_tvdb("Scrubs", 1, 22) { Ok(name) => println!("Success: {}", name), Err(e) => println!("Error: {:?}", e), } */ }