Skip to content

Commit

Permalink
fix: always use default tmdb title for tmdb entities
Browse files Browse the repository at this point in the history
and set a better fallback name
  • Loading branch information
revam committed Dec 25, 2024
1 parent d05924a commit a0bfea8
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions Shokofin/Resolvers/VirtualFileSystemService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -748,6 +748,7 @@ await Task.WhenAll(allFiles.Select(async (tuple) => {
return ([], null);

var isMovieSeason = season.Type is SeriesType.Movie;
var isMovieLibrary = collectionType is CollectionType.movies || (collectionType is null && isMovieSeason);
var config = Plugin.Instance.Configuration;
var shouldAbort = collectionType switch {
CollectionType.tvshows => isMovieSeason && config.SeparateMovies,
Expand All @@ -761,7 +762,9 @@ 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.Title)?.ReplaceInvalidPathCharacters() ?? $"Shoko Series {show.Id}";
var showName = (show.Titles.FirstOrDefault(t => t.Source is "AniDB" && t.IsDefault)?.Value ?? show.Titles.FirstOrDefault(t => t.Source is "TMDB" && t.IsDefault)?.Value)?.ReplaceInvalidPathCharacters();
if (string.IsNullOrWhiteSpace(showName))
showName = isMovieLibrary ? "Movie" : "Series";
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();

Expand Down Expand Up @@ -796,7 +799,7 @@ await Task.WhenAll(allFiles.Select(async (tuple) => {
};
var fileIdList = fileId;
var filePartSuffix = "";
if (collectionType is CollectionType.movies || (collectionType is null && isMovieSeason)) {
if (isMovieLibrary) {
if (extrasFolders != null) {
foreach (var extrasFolder in extrasFolders)
foreach (var episodeInfo in season.EpisodeList.Where(e => e.IsAvailable))
Expand Down

0 comments on commit a0bfea8

Please sign in to comment.