aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBond-009 <bond.009@outlook.com>2023-11-08 11:18:12 +0100
committerGitHub <noreply@github.com>2023-11-08 11:18:12 +0100
commit5e48278e2a119ffb48ab99aaccbd2008229542cf (patch)
tree3e8863f86116f89d8caacd776cf05a6217d75f2d
parent2853a5c047ad96dab2924a149b8e187a82cf5ea0 (diff)
parent1d19fe50b4889406f8cf5517392668f09b3e1f18 (diff)
Merge pull request #10078 from scampower3/master
Combine Title and Overview for multi-episodes files for the TMDB provider
-rw-r--r--CONTRIBUTORS.md1
-rw-r--r--MediaBrowser.Providers/Plugins/Tmdb/TV/TmdbEpisodeProvider.cs60
2 files changed, 58 insertions, 3 deletions
diff --git a/CONTRIBUTORS.md b/CONTRIBUTORS.md
index dc5f99c0c..74f1a8965 100644
--- a/CONTRIBUTORS.md
+++ b/CONTRIBUTORS.md
@@ -170,6 +170,7 @@
- [TheTyrius](https://github.com/TheTyrius)
- [tallbl0nde](https://github.com/tallbl0nde)
- [sleepycatcoding](https://github.com/sleepycatcoding)
+ - [scampower3](https://github.com/scampower3)
# Emby Contributors
diff --git a/MediaBrowser.Providers/Plugins/Tmdb/TV/TmdbEpisodeProvider.cs b/MediaBrowser.Providers/Plugins/Tmdb/TV/TmdbEpisodeProvider.cs
index f18575aa9..489f5e2a1 100644
--- a/MediaBrowser.Providers/Plugins/Tmdb/TV/TmdbEpisodeProvider.cs
+++ b/MediaBrowser.Providers/Plugins/Tmdb/TV/TmdbEpisodeProvider.cs
@@ -3,6 +3,7 @@ using System.Collections.Generic;
using System.Globalization;
using System.Linq;
using System.Net.Http;
+using System.Text;
using System.Threading;
using System.Threading.Tasks;
using Jellyfin.Data.Enums;
@@ -13,6 +14,7 @@ using MediaBrowser.Controller.Entities.TV;
using MediaBrowser.Controller.Providers;
using MediaBrowser.Model.Entities;
using MediaBrowser.Model.Providers;
+using TMDbLib.Objects.TvShows;
namespace MediaBrowser.Providers.Plugins.Tmdb.TV
{
@@ -102,9 +104,61 @@ namespace MediaBrowser.Providers.Plugins.Tmdb.TV
return metadataResult;
}
- var episodeResult = await _tmdbClientManager
- .GetEpisodeAsync(seriesTmdbId, seasonNumber.Value, episodeNumber.Value, info.SeriesDisplayOrder, info.MetadataLanguage, TmdbUtils.GetImageLanguagesParam(info.MetadataLanguage), cancellationToken)
- .ConfigureAwait(false);
+ TvEpisode? episodeResult = null;
+ if (info.IndexNumberEnd.HasValue)
+ {
+ var startindex = episodeNumber;
+ var endindex = info.IndexNumberEnd;
+ List<TvEpisode>? result = null;
+ for (int? episode = startindex; episode <= endindex; episode++)
+ {
+ var episodeInfo = await _tmdbClientManager.GetEpisodeAsync(seriesTmdbId, seasonNumber.Value, episode.Value, info.SeriesDisplayOrder, info.MetadataLanguage, TmdbUtils.GetImageLanguagesParam(info.MetadataLanguage), cancellationToken).ConfigureAwait(false);
+ if (episodeInfo is not null)
+ {
+ (result ??= new List<TvEpisode>()).Add(episodeInfo);
+ }
+ }
+
+ if (result is not null)
+ {
+ // Forces a deep copy of the first TvEpisode, so we don't modify the original because it's cached
+ episodeResult = new TvEpisode()
+ {
+ Name = result[0].Name,
+ Overview = result[0].Overview,
+ AirDate = result[0].AirDate,
+ VoteAverage = result[0].VoteAverage,
+ ExternalIds = result[0].ExternalIds,
+ Videos = result[0].Videos,
+ Credits = result[0].Credits
+ };
+
+ if (result.Count > 1)
+ {
+ var name = new StringBuilder(episodeResult.Name);
+ var overview = new StringBuilder(episodeResult.Overview);
+
+ for (int i = 1; i < result.Count; i++)
+ {
+ name.Append(" / ").Append(result[i].Name);
+ overview.Append(" / ").Append(result[i].Overview);
+ }
+
+ episodeResult.Name = name.ToString();
+ episodeResult.Overview = overview.ToString();
+ }
+ }
+ else
+ {
+ return metadataResult;
+ }
+ }
+ else
+ {
+ episodeResult = await _tmdbClientManager
+ .GetEpisodeAsync(seriesTmdbId, seasonNumber.Value, episodeNumber.Value, info.SeriesDisplayOrder, info.MetadataLanguage, TmdbUtils.GetImageLanguagesParam(info.MetadataLanguage), cancellationToken)
+ .ConfigureAwait(false);
+ }
if (episodeResult is null)
{