diff options
| author | Luke Pulverenti <luke.pulverenti@gmail.com> | 2013-05-19 13:05:33 -0400 |
|---|---|---|
| committer | Luke Pulverenti <luke.pulverenti@gmail.com> | 2013-05-19 13:05:33 -0400 |
| commit | f9c00a6145ae6492ae68509887bcae382255c12b (patch) | |
| tree | 5a31f481c9053fae76daf196da2a895f281031ad /MediaBrowser.Server.Implementations/Library/Resolvers | |
| parent | b2163c77dcfb14881c63dbaba1e33fa49b8835a2 (diff) | |
parse episode index number at resolve time
Diffstat (limited to 'MediaBrowser.Server.Implementations/Library/Resolvers')
| -rw-r--r-- | MediaBrowser.Server.Implementations/Library/Resolvers/TV/EpisodeResolver.cs | 31 |
1 files changed, 21 insertions, 10 deletions
diff --git a/MediaBrowser.Server.Implementations/Library/Resolvers/TV/EpisodeResolver.cs b/MediaBrowser.Server.Implementations/Library/Resolvers/TV/EpisodeResolver.cs index 717370590..84f7a8522 100644 --- a/MediaBrowser.Server.Implementations/Library/Resolvers/TV/EpisodeResolver.cs +++ b/MediaBrowser.Server.Implementations/Library/Resolvers/TV/EpisodeResolver.cs @@ -18,30 +18,41 @@ namespace MediaBrowser.Server.Implementations.Library.Resolvers.TV /// <returns>Episode.</returns> protected override Episode Resolve(ItemResolveArgs args) { + var isInSeason = args.Parent is Season; + // If the parent is a Season or Series, then this is an Episode if the VideoResolver returns something - if (args.Parent is Season || args.Parent is Series) + if (isInSeason || args.Parent is Series) { if (args.IsDirectory) { if (args.ContainsFileSystemEntryByName("video_ts")) { return new Episode - { - Path = args.Path, - VideoType = VideoType.Dvd - }; + { + IndexNumber = TVUtils.GetEpisodeNumberFromFile(args.Path, isInSeason), + Path = args.Path, + VideoType = VideoType.Dvd + }; } if (args.ContainsFileSystemEntryByName("bdmv")) { return new Episode - { - Path = args.Path, - VideoType = VideoType.BluRay - }; + { + IndexNumber = TVUtils.GetEpisodeNumberFromFile(args.Path, isInSeason), + Path = args.Path, + VideoType = VideoType.BluRay + }; } } - return base.Resolve(args); + var episide = base.Resolve(args); + + if (episide != null) + { + episide.IndexNumber = TVUtils.GetEpisodeNumberFromFile(args.Path, isInSeason); + } + + return episide; } return null; |
