aboutsummaryrefslogtreecommitdiff
path: root/MediaBrowser.Server.Implementations/Library/Resolvers
diff options
context:
space:
mode:
authorLuke Pulverenti <luke.pulverenti@gmail.com>2013-05-20 23:16:43 -0400
committerLuke Pulverenti <luke.pulverenti@gmail.com>2013-05-20 23:16:43 -0400
commitf3a7307ebb9a1a484a82563c4cfab6bf461c7631 (patch)
tree9cfc2177081b9713215e4453b45e4213dc67c200 /MediaBrowser.Server.Implementations/Library/Resolvers
parent96e8f053b56a385dc0f8c8e2c81fd0ac23794692 (diff)
reduce requests against tvdb by getting entire series metadata at once
Diffstat (limited to 'MediaBrowser.Server.Implementations/Library/Resolvers')
-rw-r--r--MediaBrowser.Server.Implementations/Library/Resolvers/TV/EpisodeResolver.cs33
1 files changed, 23 insertions, 10 deletions
diff --git a/MediaBrowser.Server.Implementations/Library/Resolvers/TV/EpisodeResolver.cs b/MediaBrowser.Server.Implementations/Library/Resolvers/TV/EpisodeResolver.cs
index 84f7a8522..d6fe5d456 100644
--- a/MediaBrowser.Server.Implementations/Library/Resolvers/TV/EpisodeResolver.cs
+++ b/MediaBrowser.Server.Implementations/Library/Resolvers/TV/EpisodeResolver.cs
@@ -18,41 +18,54 @@ namespace MediaBrowser.Server.Implementations.Library.Resolvers.TV
/// <returns>Episode.</returns>
protected override Episode Resolve(ItemResolveArgs args)
{
- var isInSeason = args.Parent is Season;
+ var season = args.Parent as Season;
// If the parent is a Season or Series, then this is an Episode if the VideoResolver returns something
- if (isInSeason || args.Parent is Series)
+ if (season != null || args.Parent is Series)
{
+ Episode episode = null;
+
if (args.IsDirectory)
{
if (args.ContainsFileSystemEntryByName("video_ts"))
{
- return new Episode
+ episode = new Episode
{
- IndexNumber = TVUtils.GetEpisodeNumberFromFile(args.Path, isInSeason),
Path = args.Path,
VideoType = VideoType.Dvd
};
}
if (args.ContainsFileSystemEntryByName("bdmv"))
{
- return new Episode
+ episode = new Episode
{
- IndexNumber = TVUtils.GetEpisodeNumberFromFile(args.Path, isInSeason),
Path = args.Path,
VideoType = VideoType.BluRay
};
}
}
- var episide = base.Resolve(args);
+ if (episode == null)
+ {
+ episode = base.Resolve(args);
+ }
- if (episide != null)
+ if (episode != null)
{
- episide.IndexNumber = TVUtils.GetEpisodeNumberFromFile(args.Path, isInSeason);
+ episode.IndexNumber = TVUtils.GetEpisodeNumberFromFile(args.Path, season != null);
+
+ if (season != null)
+ {
+ episode.ParentIndexNumber = season.IndexNumber;
+ }
+
+ if (episode.ParentIndexNumber == null)
+ {
+ episode.ParentIndexNumber = TVUtils.GetSeasonNumberFromEpisodeFile(args.Path);
+ }
}
- return episide;
+ return episode;
}
return null;