Skip to content

Commit

Permalink
fix: rollback imdb option
Browse files Browse the repository at this point in the history
  • Loading branch information
afonsojramos committed Feb 7, 2022
1 parent e83e9b9 commit df6acea
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 4 deletions.
10 changes: 8 additions & 2 deletions src/discord.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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,
Expand Down
9 changes: 7 additions & 2 deletions src/trakt.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ pub struct TraktIds {
pub trakt: u32,
pub slug: Option<String>,
pub tvdb: Option<u32>,
pub imdb: String,
pub imdb: Option<String>,
pub tmdb: Option<u32>,
pub tvrage: Option<String>,
}
Expand Down Expand Up @@ -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
}
}
}

Expand Down

0 comments on commit df6acea

Please sign in to comment.