diff options
Diffstat (limited to 'MediaBrowser.Server.Implementations/Library')
| -rw-r--r-- | MediaBrowser.Server.Implementations/Library/LibraryManager.cs | 8 | ||||
| -rw-r--r-- | MediaBrowser.Server.Implementations/Library/Resolvers/TV/EpisodeResolver.cs | 37 |
2 files changed, 31 insertions, 14 deletions
diff --git a/MediaBrowser.Server.Implementations/Library/LibraryManager.cs b/MediaBrowser.Server.Implementations/Library/LibraryManager.cs index 9d66455e7..7458e7541 100644 --- a/MediaBrowser.Server.Implementations/Library/LibraryManager.cs +++ b/MediaBrowser.Server.Implementations/Library/LibraryManager.cs @@ -368,10 +368,10 @@ namespace MediaBrowser.Server.Implementations.Library { return; } - //if (!(item is Folder)) - //{ - // return; - //} + if (!(item is Folder)) + { + return; + } LibraryItemsCache.AddOrUpdate(id, item, delegate { return item; }); } diff --git a/MediaBrowser.Server.Implementations/Library/Resolvers/TV/EpisodeResolver.cs b/MediaBrowser.Server.Implementations/Library/Resolvers/TV/EpisodeResolver.cs index 14e5e446b..6d0f4ffe2 100644 --- a/MediaBrowser.Server.Implementations/Library/Resolvers/TV/EpisodeResolver.cs +++ b/MediaBrowser.Server.Implementations/Library/Resolvers/TV/EpisodeResolver.cs @@ -30,21 +30,38 @@ namespace MediaBrowser.Server.Implementations.Library.Resolvers.TV return null; } - var season = parent as Season; - - // Just in case the user decided to nest episodes. - // Not officially supported but in some cases we can handle it. - if (season == null) - { - season = parent.GetParents().OfType<Season>().FirstOrDefault(); - } - // If the parent is a Season or Series, then this is an Episode if the VideoResolver returns something // Also handle flat tv folders - if (season != null || args.HasParent<Series>() || string.Equals(args.GetCollectionType(), CollectionType.TvShows, StringComparison.OrdinalIgnoreCase)) + if (string.Equals(args.GetCollectionType(), CollectionType.TvShows, StringComparison.OrdinalIgnoreCase)) { var episode = ResolveVideo<Episode>(args, false); + if (episode != null) + { + var season = parent as Season; + // Just in case the user decided to nest episodes. + // Not officially supported but in some cases we can handle it. + if (season == null) + { + season = parent.GetParents().OfType<Season>().FirstOrDefault(); + } + + var series = parent as Series; + if (series == null) + { + series = parent.GetParents().OfType<Series>().FirstOrDefault(); + } + + if (series != null) + { + episode.SeriesId = series.Id; + } + if (season != null) + { + episode.SeasonId = season.Id; + } + } + return episode; } |
