diff --git a/Shokofin/API/Info/CollectionInfo.cs b/Shokofin/API/Info/CollectionInfo.cs index e3d8e1e..8c2990c 100644 --- a/Shokofin/API/Info/CollectionInfo.cs +++ b/Shokofin/API/Info/CollectionInfo.cs @@ -35,14 +35,14 @@ public class CollectionInfo(ShokoGroup group, string? mainSeasonId, List /// Collection Name. /// - public string DefaultTitle { get; init; } = group.Name; + public string Title { get; init; } = group.Name; public IReadOnlyList Titles { get; init; } = []; /// <summary> /// Collection Description. /// </summary> - public string DefaultOverview { get; init; } = group.Description; + public string Overview { get; init; } = group.Description; public IReadOnlyList<TextOverview> Overviews { get; init; } = []; @@ -74,9 +74,9 @@ public class CollectionInfo(ShokoGroup group, string? mainSeasonId, List<ShowInf public CollectionInfo(ShokoGroup group, ShokoSeries series, string? mainSeasonId, List<ShowInfo> shows, List<CollectionInfo> subCollections) : this(group, mainSeasonId, shows, subCollections) { - DefaultTitle = series.Name; + Title = series.Name; Titles = series.AniDB.Titles; - DefaultOverview = series.Description == series.AniDB.Description + Overview = series.Description == series.AniDB.Description ? Text.SanitizeAnidbDescription(series.Description) : series.Description; Overviews = [ diff --git a/Shokofin/API/Info/EpisodeInfo.cs b/Shokofin/API/Info/EpisodeInfo.cs index 7c170b5..9e8cce7 100644 --- a/Shokofin/API/Info/EpisodeInfo.cs +++ b/Shokofin/API/Info/EpisodeInfo.cs @@ -46,11 +46,11 @@ public class EpisodeInfo : IExtendedItemInfo { public int EpisodeNumber { get; init; } - public string DefaultTitle { get; init; } + public string Title { get; init; } public IReadOnlyList<Title> Titles { get; init; } - public string? DefaultOverview { get; init; } + public string? Overview { get; init; } public IReadOnlyList<TextOverview> Overviews { get; init; } @@ -119,12 +119,12 @@ public EpisodeInfo( SeasonNumber = null; EpisodeNumber = episode.AniDB.EpisodeNumber; ExtraType = Ordering.GetExtraType(episode.AniDB); - DefaultTitle = episode.Name; + Title = episode.Name; Titles = [ ..episode.AniDB.Titles, ..(tmdbEntity?.Titles ?? []), ]; - DefaultOverview = episode.Description == episode.AniDB.Description + Overview = episode.Description == episode.AniDB.Description ? Text.SanitizeAnidbDescription(episode.Description) : episode.Description; Overviews = [ @@ -232,9 +232,9 @@ public EpisodeInfo(ShokoApiClient client, TmdbEpisode tmdbEpisode, TmdbShow tmdb IsStandalone = false; SeasonNumber = tmdbEpisode.SeasonNumber; EpisodeNumber = tmdbEpisode.EpisodeNumber; - DefaultTitle = tmdbEpisode.Title; + Title = tmdbEpisode.Title; Titles = tmdbEpisode.Titles; - DefaultOverview = tmdbEpisode.Overview; + Overview = tmdbEpisode.Overview; Overviews = tmdbEpisode.Overviews; OriginalLanguageCode = tmdbShow.OriginalLanguage; ExtraType = null; @@ -284,9 +284,9 @@ public EpisodeInfo(ShokoApiClient client, TmdbMovie tmdbMovie) { IsStandalone = true; SeasonNumber = null; EpisodeNumber = 1; - DefaultTitle = tmdbMovie.Title; + Title = tmdbMovie.Title; Titles = tmdbMovie.Titles; - DefaultOverview = tmdbMovie.Overview; + Overview = tmdbMovie.Overview; Overviews = tmdbMovie.Overviews; OriginalLanguageCode = tmdbMovie.OriginalLanguage; ExtraType = null; diff --git a/Shokofin/API/Info/IBaseItemInfo.cs b/Shokofin/API/Info/IBaseItemInfo.cs index c9a563e..cb83ece 100644 --- a/Shokofin/API/Info/IBaseItemInfo.cs +++ b/Shokofin/API/Info/IBaseItemInfo.cs @@ -3,16 +3,37 @@ namespace Shokofin.API.Info; +/// <summary> +/// Information about a base item. +/// </summary> public interface IBaseItemInfo { + /// <summary> + /// Unique identifier for the base item. + /// </summary> string Id { get; } - string DefaultTitle { get; } + /// <summary> + /// Preferred title according to title settings on the server for the base item type. + /// </summary> + string Title { get; } + /// <summary> + /// List of all available titles for the base item. + /// </summary> IReadOnlyList<Title> Titles { get; } - string? DefaultOverview { get; } + /// <summary> + /// Preferred overview according to description settings on the server. + /// </summary> + string? Overview { get; } + /// <summary> + /// List of all available overviews for the base item. + /// </summary> IReadOnlyList<TextOverview> Overviews { get; } + /// <summary> + /// Original language code for the base item if available. + /// </summary> string? OriginalLanguageCode { get; } } diff --git a/Shokofin/API/Info/SeasonInfo.cs b/Shokofin/API/Info/SeasonInfo.cs index 5437900..4a7c121 100644 --- a/Shokofin/API/Info/SeasonInfo.cs +++ b/Shokofin/API/Info/SeasonInfo.cs @@ -45,11 +45,11 @@ public class SeasonInfo : IExtendedItemInfo { public bool IsRestricted { get; init; } - public string DefaultTitle { get; init; } + public string Title { get; init; } public IReadOnlyList<Title> Titles { get; init; } - public string? DefaultOverview { get; init; } + public string? Overview { get; init; } public IReadOnlyList<TextOverview> Overviews { get; init; } @@ -300,12 +300,12 @@ IReadOnlyDictionary<string, SeriesConfiguration> seriesConfigurationMap Type = type; IsMultiEntry = type is SeriesType.Movie && series.Sizes.Total.Episodes > 1; IsRestricted = series.AniDB.Restricted; - DefaultTitle = series.Name; + Title = series.Name; Titles = [ ..series.AniDB.Titles, ..(tmdbEntity?.Titles ?? []), ]; - DefaultOverview = series.Description == series.AniDB.Description + Overview = series.Description == series.AniDB.Description ? Text.SanitizeAnidbDescription(series.Description) : series.Description; Overviews = [ @@ -369,9 +369,9 @@ public SeasonInfo(ShokoApiClient client, TmdbSeason tmdbSeason, TmdbShow tmdbSho Type = SeriesType.TV; IsMultiEntry = true; IsRestricted = tmdbShow.IsRestricted; - DefaultTitle = tmdbShow.Title; + Title = tmdbShow.Title; Titles = tmdbSeason.Titles; - DefaultOverview = tmdbSeason.Overview; + Overview = tmdbSeason.Overview; Overviews = tmdbSeason.Overviews; OriginalLanguageCode = tmdbShow.OriginalLanguage; CommunityRating = tmdbShow.UserRating; @@ -409,9 +409,9 @@ public SeasonInfo(ShokoApiClient client, TmdbMovie tmdbMovie, EpisodeInfo episod Type = SeriesType.Movie; IsMultiEntry = false; IsRestricted = tmdbMovie.IsRestricted; - DefaultTitle = tmdbMovie.Title; + Title = tmdbMovie.Title; Titles = tmdbMovie.Titles; - DefaultOverview = tmdbMovie.Overview; + Overview = tmdbMovie.Overview; Overviews = tmdbMovie.Overviews; OriginalLanguageCode = tmdbMovie.OriginalLanguage; CommunityRating = episodeInfo.CommunityRating; @@ -445,9 +445,9 @@ public SeasonInfo(ShokoApiClient client, TmdbMovieCollection tmdbMovieCollection Type = SeriesType.Movie; IsMultiEntry = true; IsRestricted = movies.Any(movie => movie.IsRestricted); - DefaultTitle = tmdbMovieCollection.Title; + Title = tmdbMovieCollection.Title; Titles = tmdbMovieCollection.Titles; - DefaultOverview = tmdbMovieCollection.Overview; + Overview = tmdbMovieCollection.Overview; Overviews = tmdbMovieCollection.Overviews; OriginalLanguageCode = movies[0].OriginalLanguage; CommunityRating = episodes[0].CommunityRating; diff --git a/Shokofin/API/Info/ShowInfo.cs b/Shokofin/API/Info/ShowInfo.cs index 3e67da6..19a010f 100644 --- a/Shokofin/API/Info/ShowInfo.cs +++ b/Shokofin/API/Info/ShowInfo.cs @@ -46,11 +46,11 @@ public class ShowInfo : IExtendedItemInfo { /// </summary> public string? CollectionId { get; init; } - public string DefaultTitle { get; init; } + public string Title { get; init; } public IReadOnlyList<Title> Titles { get; init; } - public string? DefaultOverview { get; init; } + public string? Overview { get; init; } public IReadOnlyList<TextOverview> Overviews { get; init; } @@ -175,9 +175,9 @@ public ShowInfo(ShokoApiClient client, SeasonInfo seasonInfo, string? collection CollectionId = collectionId ?? seasonInfo.ShokoGroupId; IsMovieCollection = seasonInfo.Type is SeriesType.Movie; IsStandalone = true; - DefaultTitle = seasonInfo.DefaultTitle; + Title = seasonInfo.Title; Titles = seasonInfo.Titles; - DefaultOverview = seasonInfo.DefaultOverview; + Overview = seasonInfo.Overview; Overviews = seasonInfo.Overviews; OriginalLanguageCode = seasonInfo.OriginalLanguageCode; Tags = seasonInfo.Tags; @@ -278,12 +278,12 @@ bool useGroupIdForCollection TmdbId = tmdbShow.Id.ToString(); TvdbId = tmdbShow.TvdbId?.ToString(); } - DefaultTitle = group.Name; + Title = group.Name; Titles = [ ..defaultSeason.Titles.Where(t => t.Source is "AniDB"), ..(tmdbEntity?.Titles ?? []), ]; - DefaultOverview = Text.SanitizeAnidbDescription(group.Description) == defaultSeason.Overviews.FirstOrDefault(t => t.Source is "AniDB")?.Value + Overview = Text.SanitizeAnidbDescription(group.Description) == defaultSeason.Overviews.FirstOrDefault(t => t.Source is "AniDB")?.Value ? Text.SanitizeAnidbDescription(group.Description) : group.Description; Overviews = [ @@ -365,9 +365,9 @@ public ShowInfo(ShokoApiClient client, TmdbShow tmdbShow, IReadOnlyList<SeasonIn TvdbId = tmdbShow.TvdbId?.ToString(); IsMovieCollection = false; IsStandalone = true; - DefaultTitle = tmdbShow.Title; + Title = tmdbShow.Title; Titles = tmdbShow.Titles; - DefaultOverview = tmdbShow.Overview; + Overview = tmdbShow.Overview; Overviews = tmdbShow.Overviews; OriginalLanguageCode = tmdbShow.OriginalLanguage; PremiereDate = tmdbShow.FirstAiredAt?.ToDateTime(TimeOnly.Parse("00:00:00", CultureInfo.InvariantCulture), DateTimeKind.Local); @@ -402,9 +402,9 @@ public ShowInfo(ShokoApiClient client, TmdbMovie tmdbMovie, SeasonInfo seasonInf CollectionId = ShokoGroupId; IsMovieCollection = true; IsStandalone = true; - DefaultTitle = tmdbMovie.Title; + Title = tmdbMovie.Title; Titles = tmdbMovie.Titles; - DefaultOverview = tmdbMovie.Overview; + Overview = tmdbMovie.Overview; Overviews = tmdbMovie.Overviews; OriginalLanguageCode = tmdbMovie.OriginalLanguage; PremiereDate = releasedAt; @@ -473,9 +473,9 @@ public ShowInfo(ShokoApiClient client, TmdbMovieCollection tmdbMovieCollection, CollectionId = ShokoGroupId; IsMovieCollection = seasonList.Count is 1; IsStandalone = false; - DefaultTitle = tmdbMovieCollection.Title; + Title = tmdbMovieCollection.Title; Titles = tmdbMovieCollection.Titles; - DefaultOverview = tmdbMovieCollection.Overview; + Overview = tmdbMovieCollection.Overview; Overviews = tmdbMovieCollection.Overviews; OriginalLanguageCode = defaultSeason.OriginalLanguageCode; Tags = seasonList.SelectMany(s => s.Tags).Distinct().ToArray(); diff --git a/Shokofin/API/ShokoAPIManager.cs b/Shokofin/API/ShokoAPIManager.cs index 848f4e4..7c7b3b8 100644 --- a/Shokofin/API/ShokoAPIManager.cs +++ b/Shokofin/API/ShokoAPIManager.cs @@ -957,7 +957,7 @@ public Task<IReadOnlyList<SeasonInfo>> GetSeasonInfosForShokoSeries(string serie private Task<SeasonInfo> CreateSeasonInfo(TmdbMovie tmdbMovie) => DataCache.GetOrCreateAsync( $"season:{IdPrefix.TmdbMovie}{tmdbMovie.Id}", - (seasonInfo) => Logger.LogTrace("Reusing info object for season {SeasonTitle}. (Source=TMDB,Movie={MovieId})", seasonInfo.DefaultTitle, tmdbMovie.Id), + (seasonInfo) => Logger.LogTrace("Reusing info object for season {SeasonTitle}. (Source=TMDB,Movie={MovieId})", seasonInfo.Title, tmdbMovie.Id), async () => { Logger.LogTrace("Creating info object for season {SeasonTitle}. (Source=TMDB,Movie={MovieId})", tmdbMovie.Title, tmdbMovie.Id); @@ -975,7 +975,7 @@ private Task<SeasonInfo> CreateSeasonInfo(TmdbMovie tmdbMovie) private Task<SeasonInfo> CreateSeasonInfo(TmdbMovieCollection tmdbMovieCollection) => DataCache.GetOrCreateAsync( $"season:{IdPrefix.TmdbMovieCollection}{tmdbMovieCollection.Id}", - (seasonInfo) => Logger.LogTrace("Reusing info object for season {SeasonTitle}. (Source=TMDB,MovieCollection={MovieId})", seasonInfo.DefaultTitle, tmdbMovieCollection.Id), + (seasonInfo) => Logger.LogTrace("Reusing info object for season {SeasonTitle}. (Source=TMDB,MovieCollection={MovieId})", seasonInfo.Title, tmdbMovieCollection.Id), async () => { Logger.LogTrace("Creating info object for season {SeasonTitle}. (Source=TMDB,MovieCollection={MovieId})", tmdbMovieCollection.Title, tmdbMovieCollection.Id); @@ -995,7 +995,7 @@ private Task<SeasonInfo> CreateSeasonInfo(TmdbMovieCollection tmdbMovieCollectio private Task<SeasonInfo> CreateSeasonInfo(TmdbSeason tmdbSeason, TmdbShow tmdbShow) => DataCache.GetOrCreateAsync( $"season:{IdPrefix.TmdbShow}{tmdbSeason.Id}", - (seasonInfo) => Logger.LogTrace("Reusing info object for season {SeasonTitle}. (Source=TMDB,Season={SeasonId},Show={ShowId})", seasonInfo.DefaultTitle, tmdbSeason.Id, tmdbSeason.ShowId), + (seasonInfo) => Logger.LogTrace("Reusing info object for season {SeasonTitle}. (Source=TMDB,Season={SeasonId},Show={ShowId})", seasonInfo.Title, tmdbSeason.Id, tmdbSeason.ShowId), async () => { Logger.LogTrace("Creating info object for season {SeasonTitle}. (Source=TMDB,Season={SeasonId},Show={ShowId})", tmdbSeason.Title, tmdbSeason.Id, tmdbSeason.ShowId); @@ -1080,7 +1080,7 @@ private async Task<SeasonInfo> CreateSeasonInfo(ShokoSeries series) { var (primaryId, extraIds) = await GetSeriesIdsForSeason(series).ConfigureAwait(false); return await DataCache.GetOrCreateAsync( $"season:{primaryId}", - (seasonInfo) => Logger.LogTrace("Reusing info object for season {SeasonTitle}. (Source=Shoko,Series={SeriesId},ExtraSeries={ExtraIds})", seasonInfo.DefaultTitle, primaryId, extraIds), + (seasonInfo) => Logger.LogTrace("Reusing info object for season {SeasonTitle}. (Source=Shoko,Series={SeriesId},ExtraSeries={ExtraIds})", seasonInfo.Title, primaryId, extraIds), async () => { // We updated the "primary" series id for the merge group, so fetch the new series details from the client cache. if (!string.Equals(series.Id, primaryId, StringComparison.Ordinal)) @@ -1624,7 +1624,7 @@ public async Task<IReadOnlyList<ShowInfo>> GetShowInfosForShokoSeries(string ser private Task<ShowInfo> CreateShowInfo(TmdbShow tmdbShow) => DataCache.GetOrCreateAsync( $"show:by-tmdb-show-id:{tmdbShow.Id}", - (showInfo) => Logger.LogTrace("Reusing info object for show {ShowName}. (Source=TMDB,Show={ShowId})", showInfo?.DefaultTitle, tmdbShow.Id), + (showInfo) => Logger.LogTrace("Reusing info object for show {ShowName}. (Source=TMDB,Show={ShowId})", showInfo?.Title, tmdbShow.Id), async () => { Logger.LogTrace("Creating info object for show {ShowName}. (Source=TMDB,Show={ShowId})", tmdbShow.Title, tmdbShow.Id); var seasonsInShow = await ApiClient.GetTmdbSeasonsInTmdbShow(tmdbShow.Id.ToString()).ConfigureAwait(false); @@ -1642,7 +1642,7 @@ private Task<ShowInfo> CreateShowInfo(TmdbShow tmdbShow) private Task<ShowInfo> CreateShowInfoForTmdbMovieCollection(TmdbMovieCollection tmdbMovieCollection, bool singleSeasonMode = false) => DataCache.GetOrCreateAsync( $"show:by-tmdb-movie-collection-id:{tmdbMovieCollection.Id}:{singleSeasonMode}", - (showInfo) => Logger.LogTrace("Reusing info object for show {ShowName}. (Source=TMDB,MovieCollection={MovieCollectionId},SingleSeasonMode={SingleSeasonMode})", showInfo?.DefaultTitle, tmdbMovieCollection.Id, singleSeasonMode), + (showInfo) => Logger.LogTrace("Reusing info object for show {ShowName}. (Source=TMDB,MovieCollection={MovieCollectionId},SingleSeasonMode={SingleSeasonMode})", showInfo?.Title, tmdbMovieCollection.Id, singleSeasonMode), async () => { Logger.LogTrace("Creating info object for show {ShowName}. (Source=TMDB,MovieCollection={MovieCollectionId},SingleSeasonMode={SingleSeasonMode})", tmdbMovieCollection.Title, tmdbMovieCollection.Id, singleSeasonMode); @@ -1662,7 +1662,7 @@ private Task<ShowInfo> CreateShowInfoForTmdbMovieCollection(TmdbMovieCollection private Task<ShowInfo> CreateShowInfoForTmdbMovie(TmdbMovie tmdbMovie) => DataCache.GetOrCreateAsync( $"show:by-tmdb-movie-id:{tmdbMovie.Id}", - (showInfo) => Logger.LogTrace("Reusing info object for show {ShowName}. (Source=TMDB,Movie={MovieId})", showInfo?.DefaultTitle, tmdbMovie.Id), + (showInfo) => Logger.LogTrace("Reusing info object for show {ShowName}. (Source=TMDB,Movie={MovieId})", showInfo?.Title, tmdbMovie.Id), async () => { Logger.LogTrace("Creating info object for show {ShowName}. (Source=TMDB,Movie={MovieId})", tmdbMovie.Title, tmdbMovie.Id); @@ -1678,7 +1678,7 @@ private Task<ShowInfo> CreateShowInfoForTmdbMovie(TmdbMovie tmdbMovie) private Task<ShowInfo?> CreateShowInfoForShokoGroup(ShokoGroup group, string groupId) => DataCache.GetOrCreateAsync( $"show:by-group-id:{groupId}", - (showInfo) => Logger.LogTrace("Reusing info object for show {GroupName}. (Source=Shoko,Group={GroupId})", showInfo?.DefaultTitle, groupId), + (showInfo) => Logger.LogTrace("Reusing info object for show {GroupName}. (Source=Shoko,Group={GroupId})", showInfo?.Title, groupId), async () => { Logger.LogTrace("Creating info object for show {GroupName}. (Source=Shoko,Group={GroupId})", group.Name, groupId); @@ -1705,10 +1705,10 @@ private Task<ShowInfo> CreateShowInfoForTmdbMovie(TmdbMovie tmdbMovie) var tmdbEntities = new List<ITmdbEntity>(); foreach (var seasonInfo in seasonList) { if (!string.IsNullOrEmpty(seasonInfo.TmdbSeasonId)) { - Logger.LogTrace("Fetching TMDB show for Shoko Series {SeriesName}. (Series={SeriesId},Show={ShowId})", seasonInfo.DefaultTitle, seasonInfo.Id, seasonInfo.TmdbSeasonId); + Logger.LogTrace("Fetching TMDB show for Shoko Series {SeriesName}. (Series={SeriesId},Show={ShowId})", seasonInfo.Title, seasonInfo.Id, seasonInfo.TmdbSeasonId); if (await ApiClient.GetTmdbShowForSeason(seasonInfo.TmdbSeasonId).ConfigureAwait(false) is not { } tmdbShow) { - Logger.LogTrace("Failed to fetch TMDB show for Shoko Series {SeriesName}. (Series={SeriesId},Show={ShowId})", seasonInfo.DefaultTitle, seasonInfo.Id, seasonInfo.TmdbSeasonId); + Logger.LogTrace("Failed to fetch TMDB show for Shoko Series {SeriesName}. (Series={SeriesId},Show={ShowId})", seasonInfo.Title, seasonInfo.Id, seasonInfo.TmdbSeasonId); continue; } @@ -1716,10 +1716,10 @@ private Task<ShowInfo> CreateShowInfoForTmdbMovie(TmdbMovie tmdbMovie) } if (!string.IsNullOrEmpty(seasonInfo.TmdbMovieCollectionId)) { - Logger.LogTrace("Fetching TMDB movie collection for Shoko Series {SeriesName}. (Series={SeriesId},Show={ShowId})", seasonInfo.DefaultTitle, seasonInfo.Id, seasonInfo.TmdbMovieCollectionId); + Logger.LogTrace("Fetching TMDB movie collection for Shoko Series {SeriesName}. (Series={SeriesId},Show={ShowId})", seasonInfo.Title, seasonInfo.Id, seasonInfo.TmdbMovieCollectionId); if (await ApiClient.GetTmdbMovieCollection(seasonInfo.TmdbMovieCollectionId).ConfigureAwait(false) is not { } tmdbMovieCollection) { - Logger.LogTrace("Failed to fetch TMDB movie collection for Shoko Series {SeriesName}. (Series={SeriesId},Show={ShowId})", seasonInfo.DefaultTitle, seasonInfo.Id, seasonInfo.TmdbMovieCollectionId); + Logger.LogTrace("Failed to fetch TMDB movie collection for Shoko Series {SeriesName}. (Series={SeriesId},Show={ShowId})", seasonInfo.Title, seasonInfo.Id, seasonInfo.TmdbMovieCollectionId); continue; } @@ -1746,9 +1746,9 @@ private Task<ShowInfo> CreateShowInfoForTmdbMovie(TmdbMovie tmdbMovie) private ShowInfo CreateShowInfoForShokoSeries(SeasonInfo seasonInfo, string? collectionId = null) => DataCache.GetOrCreate( $"show:by-series-id:{seasonInfo.Id}", - (showInfo) => Logger.LogTrace("Reusing info object for show {GroupName}. (Source=Shoko,Series={SeriesId})", showInfo.DefaultTitle, seasonInfo.Id), + (showInfo) => Logger.LogTrace("Reusing info object for show {GroupName}. (Source=Shoko,Series={SeriesId})", showInfo.Title, seasonInfo.Id), () => { - Logger.LogTrace("Creating info object for show {SeriesName}. (Source=Shoko,Series={SeriesId})", seasonInfo.DefaultTitle, seasonInfo.Id); + Logger.LogTrace("Creating info object for show {SeriesName}. (Source=Shoko,Series={SeriesId})", seasonInfo.Title, seasonInfo.Id); var showInfo = new ShowInfo(ApiClient, seasonInfo, collectionId); @@ -1792,7 +1792,7 @@ public bool TryGetShowIdForSeasonId(string seasonId, [NotNullWhen(true)] out str return null; if (DataCache.TryGetValue<CollectionInfo>($"collection:{collectionId}", out var collectionInfo)) { - Logger.LogTrace("Reusing info object for collection {GroupName}. (Group={GroupId})", collectionInfo.DefaultTitle, collectionId); + Logger.LogTrace("Reusing info object for collection {GroupName}. (Group={GroupId})", collectionInfo.Title, collectionId); return collectionInfo; } @@ -1805,7 +1805,7 @@ public bool TryGetShowIdForSeasonId(string seasonId, [NotNullWhen(true)] out str private Task<CollectionInfo> CreateCollectionInfo(ShokoGroup group, string groupId) => DataCache.GetOrCreateAsync( $"collection:{groupId}", - (collectionInfo) => Logger.LogTrace("Reusing info object for collection {GroupName}. (Group={GroupId})", collectionInfo.DefaultTitle, groupId), + (collectionInfo) => Logger.LogTrace("Reusing info object for collection {GroupName}. (Group={GroupId})", collectionInfo.Title, groupId), async () => { Logger.LogTrace("Creating info object for collection {GroupName}. (Group={GroupId})", group.Name, groupId); Logger.LogTrace("Fetching show info objects for collection {GroupName}. (Group={GroupId})", group.Name, groupId); diff --git a/Shokofin/Collections/CollectionManager.cs b/Shokofin/Collections/CollectionManager.cs index dae98c9..cf9ae7e 100644 --- a/Shokofin/Collections/CollectionManager.cs +++ b/Shokofin/Collections/CollectionManager.cs @@ -152,7 +152,7 @@ private async Task ReconstructMovieSeriesCollections(IProgress<double> progress, foreach (var missingId in toAdd) { var seasonInfo = seasonDict[missingId]; var collection = await _collection.CreateCollectionAsync(new() { - Name = $"{seasonInfo.DefaultTitle.ForceASCII()} [{ShokoCollectionSeriesId.Name}={missingId}]", + Name = $"{seasonInfo.Title.ForceASCII()} [{ShokoCollectionSeriesId.Name}={missingId}]", ProviderIds = new() { { ShokoCollectionSeriesId.Name, missingId } }, }).ConfigureAwait(false); @@ -402,7 +402,7 @@ private async Task ReconstructSharedCollections(IProgress<double> progress, Canc var missingId = toAdd[index]; var collectionInfo = finalGroups[missingId]; var collection = await _collection.CreateCollectionAsync(new() { - Name = $"{collectionInfo.DefaultTitle.ForceASCII()} [{ShokoCollectionGroupId.Name}={missingId}]", + Name = $"{collectionInfo.Title.ForceASCII()} [{ShokoCollectionGroupId.Name}={missingId}]", ProviderIds = new() { { ShokoCollectionGroupId.Name, missingId } }, }).ConfigureAwait(false); @@ -426,8 +426,8 @@ private async Task ReconstructSharedCollections(IProgress<double> progress, Canc collection.SetParent(parent); updated = true; } - if (!string.Equals(collection.Name, collectionInfo.DefaultTitle)) { - collection.Name = collectionInfo.DefaultTitle; + if (!string.Equals(collection.Name, collectionInfo.Title)) { + collection.Name = collectionInfo.Title; updated = true; } if (updated) { diff --git a/Shokofin/Providers/BoxSetProvider.cs b/Shokofin/Providers/BoxSetProvider.cs index 5666d4e..70e1b80 100644 --- a/Shokofin/Providers/BoxSetProvider.cs +++ b/Shokofin/Providers/BoxSetProvider.cs @@ -81,14 +81,14 @@ private async Task<MetadataResult<BoxSet>> GetShokoGroupMetadata(BoxSetInfo info } var (displayTitle, alternateTitle) = Text.GetShowTitles(collectionInfo, info.MetadataLanguage); - displayTitle ??= collectionInfo.DefaultTitle; + displayTitle ??= collectionInfo.Title; _logger.LogInformation("Found collection {CollectionName} (Collection={CollectionId})", displayTitle, collectionInfo.Id); result.Item = new BoxSet { Name = displayTitle, OriginalTitle = alternateTitle, - Overview = Text.SanitizeAnidbDescription(collectionInfo.DefaultOverview), + Overview = Text.SanitizeAnidbDescription(collectionInfo.Overview), }; result.Item.SetProviderId(ShokoCollectionGroupId.Name, collectionInfo.Id); result.HasMetadata = true; diff --git a/Shokofin/Providers/CustomBoxSetProvider.cs b/Shokofin/Providers/CustomBoxSetProvider.cs index 239f3c8..5f14083 100644 --- a/Shokofin/Providers/CustomBoxSetProvider.cs +++ b/Shokofin/Providers/CustomBoxSetProvider.cs @@ -103,7 +103,7 @@ private async Task<bool> EnsureGroupCollectionIsCorrect(Folder collectionRoot, B var updated = EnsureNoTmdbIdIsSet(collection); var parent = collectionInfo.IsTopLevel ? collectionRoot : await GetCollectionByCollectionId(collectionRoot, collectionInfo.ParentId).ConfigureAwait(false); var (displayTitle, alternateTitle) = Text.GetShowTitles(collectionInfo, collection.GetPreferredMetadataLanguage()); - displayTitle ??= collectionInfo.DefaultTitle; + displayTitle ??= collectionInfo.Title; if (collection.ParentId != parent.Id) { collection.SetParent(parent); updated = true; @@ -153,7 +153,7 @@ private async Task<BoxSet> GetCollectionByCollectionId(Folder collectionRoot, st } private BoxSet? GetCollectionByPath(Folder collectionRoot, CollectionInfo collectionInfo) { - var baseName = $"{collectionInfo.DefaultTitle.ForceASCII()} [{ShokoCollectionGroupId.Name}={collectionInfo.Id}]"; + var baseName = $"{collectionInfo.Title.ForceASCII()} [{ShokoCollectionGroupId.Name}={collectionInfo.Id}]"; var folderName = BaseItem.FileSystem.GetValidFilename(baseName) + " [boxset]"; var path = Path.Combine(collectionRoot.Path, folderName); return _libraryManager.FindByPath(path, true) as BoxSet; diff --git a/Shokofin/Providers/CustomEpisodeProvider.cs b/Shokofin/Providers/CustomEpisodeProvider.cs index 6c3a135..3cbcadc 100644 --- a/Shokofin/Providers/CustomEpisodeProvider.cs +++ b/Shokofin/Providers/CustomEpisodeProvider.cs @@ -115,7 +115,7 @@ public static bool AddVirtualEpisode(ILibraryManager libraryManager, ILogger log var episodeId = libraryManager.GetNewItemId(season.Series.Id + " Season " + seasonInfo.Id + " Episode " + episodeInfo.Id, typeof(Episode)); var episode = EpisodeProvider.CreateMetadata(showInfo, seasonInfo, episodeInfo, season, episodeId); - logger.LogInformation("Adding virtual Episode {EpisodeNumber} in Season {SeasonNumber} for Series {SeriesName}. (Episode={EpisodeId},Season={SeasonId},ExtraSeasons={ExtraIds},Group={GroupId})", episode.IndexNumber, season.IndexNumber, showInfo.DefaultTitle, episodeInfo.Id, seasonInfo.Id, seasonInfo.ExtraIds, showInfo.ShokoGroupId); + logger.LogInformation("Adding virtual Episode {EpisodeNumber} in Season {SeasonNumber} for Series {SeriesName}. (Episode={EpisodeId},Season={SeasonId},ExtraSeasons={ExtraIds},Group={GroupId})", episode.IndexNumber, season.IndexNumber, showInfo.Title, episodeInfo.Id, seasonInfo.Id, seasonInfo.ExtraIds, showInfo.ShokoGroupId); season.AddChild(episode); diff --git a/Shokofin/Providers/EpisodeProvider.cs b/Shokofin/Providers/EpisodeProvider.cs index c3291bc..f2e2e82 100644 --- a/Shokofin/Providers/EpisodeProvider.cs +++ b/Shokofin/Providers/EpisodeProvider.cs @@ -106,7 +106,7 @@ private static Episode CreateMetadata(Info.ShowInfo showInfo, Info.SeasonInfo se var displayTitles = new List<string?>(); var alternateTitles = new List<string?>(); foreach (var (eI, _, _) in file.EpisodeList) { - string defaultEpisodeTitle = eI.DefaultTitle; + string defaultEpisodeTitle = eI.Title; if ( // Movies (seasonInfo.Type == SeriesType.Movie && eI.Type is EpisodeType.Normal or EpisodeType.Special) || @@ -128,7 +128,7 @@ private static Episode CreateMetadata(Info.ShowInfo showInfo, Info.SeasonInfo se description = Text.GetDescription(file.EpisodeList.Select(tuple => tuple.Episode), metadataLanguage); } else { - string defaultEpisodeTitle = episodeInfo.DefaultTitle; + string defaultEpisodeTitle = episodeInfo.Title; if ( // Movies (seasonInfo.Type == SeriesType.Movie && episodeInfo.Type is EpisodeType.Normal or EpisodeType.Special) || diff --git a/Shokofin/Providers/SeasonProvider.cs b/Shokofin/Providers/SeasonProvider.cs index 7af0548..24d4b44 100644 --- a/Shokofin/Providers/SeasonProvider.cs +++ b/Shokofin/Providers/SeasonProvider.cs @@ -64,7 +64,7 @@ public async Task<MetadataResult<Season>> GetMetadata(SeasonInfo info, Cancellat return result; } - _logger.LogInformation("Found info for Season {SeasonNumber} in Series {SeriesName} (MainSeason={MainSeasonId},Group={GroupId})", seasonNumber, showInfo.DefaultTitle, seasonId, showInfo.ShokoGroupId); + _logger.LogInformation("Found info for Season {SeasonNumber} in Series {SeriesName} (MainSeason={MainSeasonId},Group={GroupId})", seasonNumber, showInfo.Title, seasonId, showInfo.ShokoGroupId); var offset = Math.Abs(seasonNumber - baseSeasonNumber); @@ -93,7 +93,7 @@ public static Season CreateMetadata(Info.SeasonInfo seasonInfo, int seasonNumber private static Season CreateMetadata(Info.SeasonInfo seasonInfo, int seasonNumber, int offset, string metadataLanguage, string metadataCountryCode, Series? series, Guid seasonId) { var (displayTitle, alternateTitle) = Text.GetSeasonTitles(seasonInfo, offset, metadataLanguage); - var sortTitle = $"S{seasonNumber} - {seasonInfo.DefaultTitle}"; + var sortTitle = $"S{seasonNumber} - {seasonInfo.Title}"; Season season; if (series != null) { season = new Season { diff --git a/Shokofin/Resolvers/ShokoIgnoreRule.cs b/Shokofin/Resolvers/ShokoIgnoreRule.cs index be84bb8..b49d072 100644 --- a/Shokofin/Resolvers/ShokoIgnoreRule.cs +++ b/Shokofin/Resolvers/ShokoIgnoreRule.cs @@ -140,7 +140,7 @@ private async Task<bool> ShouldFilterDirectory(string partialPath, string fullPa foreach (var entry in entries) { season = await ApiManager.GetSeasonInfoByPath(entry.FullName).ConfigureAwait(false); if (season is not null) { - Logger.LogDebug("Found shoko series {SeriesName} for sub-directory of path {Path} (Season={SeasonId},ExtraSeries={ExtraIds})", season.DefaultTitle, partialPath, season.Id, season.ExtraIds); + Logger.LogDebug("Found shoko series {SeriesName} for sub-directory of path {Path} (Season={SeasonId},ExtraSeries={ExtraIds})", season.Title, partialPath, season.Id, season.ExtraIds); break; } } @@ -175,9 +175,9 @@ private async Task<bool> ShouldFilterDirectory(string partialPath, string fullPa var show = await ApiManager.GetShowInfoBySeasonId(season.Id).ConfigureAwait(false)!; if (!string.IsNullOrEmpty(show?.ShokoGroupId)) - Logger.LogInformation("Found shoko group {GroupName} (Season={SeasonId},ExtraSeries={ExtraIds},Group={GroupId})", show.DefaultTitle, season.Id, season.ExtraIds, show.ShokoGroupId); + Logger.LogInformation("Found shoko group {GroupName} (Season={SeasonId},ExtraSeries={ExtraIds},Group={GroupId})", show.Title, season.Id, season.ExtraIds, show.ShokoGroupId); else - Logger.LogInformation("Found series {SeriesName} (Season={SeasonId},ExtraSeries={ExtraIds})", season.DefaultTitle, season.Id, season.ExtraIds); + Logger.LogInformation("Found series {SeriesName} (Season={SeasonId},ExtraSeries={ExtraIds})", season.Title, season.Id, season.ExtraIds); return false; } @@ -194,7 +194,7 @@ private async Task<bool> ShouldFilterFile(string partialPath, string fullPath, b return shouldIgnore; } - Logger.LogInformation("Found {EpisodeCount} shoko episode(s) for {SeriesName} (Season={SeasonId},ExtraSeries={ExtraIds},File={FileId})", file.EpisodeList.Count, season.DefaultTitle, season.Id, season.ExtraIds, file.Id); + Logger.LogInformation("Found {EpisodeCount} shoko episode(s) for {SeriesName} (Season={SeasonId},ExtraSeries={ExtraIds},File={FileId})", file.EpisodeList.Count, season.Title, season.Id, season.ExtraIds, file.Id); // We're going to post process this file later, but we don't want to include it in our library for now. if (file.EpisodeList.Any(eI => season.IsExtraEpisode(eI.Episode))) { diff --git a/Shokofin/Resolvers/VirtualFileSystemService.cs b/Shokofin/Resolvers/VirtualFileSystemService.cs index 2156d9d..c9d08bc 100644 --- a/Shokofin/Resolvers/VirtualFileSystemService.cs +++ b/Shokofin/Resolvers/VirtualFileSystemService.cs @@ -761,7 +761,7 @@ await Task.WhenAll(allFiles.Select(async (tuple) => { if (show is null) return ([], null); - var showName = (show.Titles.FirstOrDefault(t => t.Source is "AniDB" && t.IsDefault)?.Value ?? show.DefaultTitle)?.ReplaceInvalidPathCharacters() ?? $"Shoko Series {show.Id}"; + var showName = (show.Titles.FirstOrDefault(t => t.Source is "AniDB" && t.IsDefault)?.Value ?? show.Title)?.ReplaceInvalidPathCharacters() ?? $"Shoko Series {show.Id}"; var episodeNumber = Ordering.GetEpisodeNumber(show, season, episode); var episodeName = (episode.Titles.FirstOrDefault(t => t.Source is "AniDB" && t.LanguageCode == "en")?.Value ?? $"{(episode.Type is EpisodeType.Normal ? "Episode " : $"{episode.Type} ")}{episodeNumber}").ReplaceInvalidPathCharacters(); diff --git a/Shokofin/Utils/Ordering.cs b/Shokofin/Utils/Ordering.cs index 6a1eb31..430ce2c 100644 --- a/Shokofin/Utils/Ordering.cs +++ b/Shokofin/Utils/Ordering.cs @@ -147,7 +147,7 @@ public static int GetEpisodeNumber(ShowInfo showInfo, SeasonInfo seasonInfo, Epi // If we still cannot find the episode for whatever reason, then bail. I don't fudging know why, but I know it's not the plugin's fault. if (index == -1) - throw new IndexOutOfRangeException($"Unable to find index to use for \"{episodeInfo.DefaultTitle}\". (Group=\"{showInfo.ShokoGroupId}\",Series=\"{seasonInfo.Id}\",ExtraSeries={(seasonInfo.ExtraIds.Count > 0 ? $"[\"{seasonInfo.ExtraIds.Join("\",\"")}\"]" : "[]")},Episode={episodeInfo.Id})"); + throw new IndexOutOfRangeException($"Unable to find index to use for \"{episodeInfo.Title}\". (Group=\"{showInfo.ShokoGroupId}\",Series=\"{seasonInfo.Id}\",ExtraSeries={(seasonInfo.ExtraIds.Count > 0 ? $"[\"{seasonInfo.ExtraIds.Join("\",\"")}\"]" : "[]")},Episode={episodeInfo.Id})"); return index + 1; } diff --git a/Shokofin/Utils/Text.cs b/Shokofin/Utils/Text.cs index d879a1f..a0cb7df 100644 --- a/Shokofin/Utils/Text.cs +++ b/Shokofin/Utils/Text.cs @@ -159,7 +159,7 @@ public static string GetDescription(IBaseItemInfo baseInfo, string? metadataLang foreach (var provider in GetOrderedDescriptionProviders()) { var overview = provider switch { DescriptionProvider.Shoko => - baseInfo.DefaultOverview, + baseInfo.Overview, DescriptionProvider.AniDB => baseInfo.Overviews.Where(o => o.Source is "AniDB" && string.Equals(o.LanguageCode, metadataLanguage, StringComparison.InvariantCultureIgnoreCase)).FirstOrDefault()?.Value, DescriptionProvider.TMDB => @@ -329,7 +329,7 @@ private static TitleProvider[] GetOrderedTitleProvidersByType(TitleProviderType foreach (var provider in GetOrderedTitleProvidersByType(type)) { var title = provider switch { TitleProvider.Shoko_Default => - episodeInfo.DefaultTitle, + episodeInfo.Title, TitleProvider.AniDB_Default => episodeInfo.Titles.FirstOrDefault(title => title.Source is "AniDB" && title.LanguageCode is "en")?.Value, TitleProvider.AniDB_LibraryLanguage => @@ -354,7 +354,7 @@ private static TitleProvider[] GetOrderedTitleProvidersByType(TitleProviderType foreach (var provider in GetOrderedTitleProvidersByType(type)) { var title = provider switch { TitleProvider.Shoko_Default => - baseInfo.DefaultTitle, + baseInfo.Title, TitleProvider.AniDB_Default => baseInfo.Titles.Where(t => t.Source is "AniDB").FirstOrDefault(title => title.IsDefault)?.Value, TitleProvider.AniDB_LibraryLanguage =>