diff --git a/src/discord.rs b/src/discord.rs index 02f47e0..7bd6592 100644 --- a/src/discord.rs +++ b/src/discord.rs @@ -57,7 +57,10 @@ impl Discord { .unwrap() ); media = "movies"; - link_imdb = format!("https://www.imdb.com/title/{}", movie.ids.imdb); + link_imdb = format!( + "https://www.imdb.com/title/{}", + movie.ids.imdb.as_ref().unwrap() + ); link_trakt = format!( "https://trakt.tv/{}/{}", media, @@ -70,7 +73,10 @@ impl Discord { details = show.title.to_string(); state = format!("S{}E{} - {}", episode.season, episode.number, episode.title); media = "shows"; - link_imdb = format!("https://www.imdb.com/title/{}", show.ids.imdb); + link_imdb = format!( + "https://www.imdb.com/title/{}", + show.ids.imdb.as_ref().unwrap() + ); link_trakt = format!( "https://trakt.tv/{}/{}", media, diff --git a/src/trakt.rs b/src/trakt.rs index 9db2232..1b1b7ab 100644 --- a/src/trakt.rs +++ b/src/trakt.rs @@ -29,7 +29,7 @@ pub struct TraktIds { pub trakt: u32, pub slug: Option, pub tvdb: Option, - pub imdb: String, + pub imdb: Option, pub tmdb: Option, pub tvrage: Option, } @@ -86,9 +86,14 @@ impl Trakt { .into_string() .unwrap(); + println!("{}", response); + match serde_json::from_str(&response) { Ok(response) => Some(response), - Err(_) => None, + Err(err) => { + println!("{}", err); + None + } } }