Skip to content

Commit

Permalink
fix: use tmdb first as metadata provider and fallback to tvdb (#1138)
Browse files Browse the repository at this point in the history
* fix: use tmdb first as metadata provider and fallback to tvdb

This PR changes the order of the metadata provider to TMDB first and then fallback to TheTVDB if no
TMDB metadata is available. Previously, TheTVDB was used first and there was no fallback if the
latter failed.

fix #1137

* feat: add logs

* fix: add logs

* fix: add show name
  • Loading branch information
gauthier-th authored Dec 8, 2024
1 parent 5776715 commit 84fd884
Showing 1 changed file with 28 additions and 9 deletions.
37 changes: 28 additions & 9 deletions server/lib/scanners/jellyfin/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -210,14 +210,27 @@ class JellyfinScanner {
return;
}

if (metadata.ProviderIds.Tvdb) {
tvShow = await this.tmdb.getShowByTvdbId({
tvdbId: Number(metadata.ProviderIds.Tvdb),
});
} else if (metadata.ProviderIds.Tmdb) {
tvShow = await this.tmdb.getTvShow({
tvId: Number(metadata.ProviderIds.Tmdb),
});
if (metadata.ProviderIds.Tmdb) {
try {
tvShow = await this.tmdb.getTvShow({
tvId: Number(metadata.ProviderIds.Tmdb),
});
} catch {
this.log('Unable to find TMDb ID for this title.', 'debug', {
jellyfinitem,
});
}
}
if (!tvShow && metadata.ProviderIds.Tvdb) {
try {
tvShow = await this.tmdb.getShowByTvdbId({
tvdbId: Number(metadata.ProviderIds.Tvdb),
});
} catch {
this.log('Unable to find TVDb ID for this title.', 'debug', {
jellyfinitem,
});
}
}

if (tvShow) {
Expand Down Expand Up @@ -491,7 +504,13 @@ class JellyfinScanner {
}
});
} else {
this.log(`failed show: ${metadata.Name}`);
this.log(
`No information found for the show: ${metadata.Name}`,
'debug',
{
jellyfinitem,
}
);
}
} catch (e) {
this.log(
Expand Down

0 comments on commit 84fd884

Please sign in to comment.