Skip to content

Commit

Permalink
Prevent errors on missing images on TVDB
Browse files Browse the repository at this point in the history
  • Loading branch information
DariusIII committed Sep 13, 2018
1 parent a694bb3 commit e72b830
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 3 deletions.
15 changes: 12 additions & 3 deletions Blacklight/processing/tv/TVDB.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
*/
class TVDB extends TV
{
private const TVDB_URL = 'https://api.thetvdb.com';
private const TVDB_IMAGES_URL = 'https://www.thetvdb.com/banners/';
private const TVDB_API_KEY = '31740C28BAC74DEF';
private const MATCH_PROBABILITY = 75;
Expand Down Expand Up @@ -391,8 +390,18 @@ protected function getEpisodeInfo($tvDbId, $season, $episode, $airDate = '', $vi
*/
protected function formatShowInfo($show): array
{
$poster = $this->client->series()->getImagesWithQuery($show->id, ['keyType' => 'poster']);
$fanart = $this->client->series()->getImagesWithQuery($show->id, ['keyType' => 'fanart']);
try {
$poster = $this->client->series()->getImagesWithQuery($show->id, ['keyType' => 'poster']);
} catch (ResourceNotFoundException $e) {
ColorCLI::doEcho(ColorCLI::notice('Poster image not found on TVDB'), true);
}

try {
$fanart = $this->client->series()->getImagesWithQuery($show->id, ['keyType' => 'fanart']);
} catch (ResourceNotFoundException $e) {
ColorCLI::doEcho(ColorCLI::notice('Fanart image not found on TVDB'), true);
}

$imdbid = $this->client->series()->getById($show->id);
preg_match('/tt(?P<imdbid>\d{6,7})$/i', $imdbid->imdbId, $imdb);

Expand Down
1 change: 1 addition & 0 deletions Changelog
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
2018-09-13 DariusIII
* Chg: Prevent errors on missing images on TVDB
* Chg: Update scripts to use now() helper
* Chg: Use now() helper and related functions for time calculations in ProcessReleases class
* Chg: Update laravel/framework to version 5.7
Expand Down

0 comments on commit e72b830

Please sign in to comment.