aboutsummaryrefslogtreecommitdiff
path: root/MediaBrowser.Api/TvShowsService.cs
diff options
context:
space:
mode:
authorLuke Pulverenti <luke.pulverenti@gmail.com>2015-01-27 23:30:44 -0500
committerLuke Pulverenti <luke.pulverenti@gmail.com>2015-01-27 23:30:44 -0500
commitbed6bed5c699e1b44b0b133cebd450bba829ca41 (patch)
treea9064cf8f758ce7092f0b94d44b18de76730550a /MediaBrowser.Api/TvShowsService.cs
parent6f59f6cd927ed0ebd0da74e0262fa108ca57cfdb (diff)
support getting all episodes per series
Diffstat (limited to 'MediaBrowser.Api/TvShowsService.cs')
-rw-r--r--MediaBrowser.Api/TvShowsService.cs21
1 files changed, 16 insertions, 5 deletions
diff --git a/MediaBrowser.Api/TvShowsService.cs b/MediaBrowser.Api/TvShowsService.cs
index ccb844912..f72a0a441 100644
--- a/MediaBrowser.Api/TvShowsService.cs
+++ b/MediaBrowser.Api/TvShowsService.cs
@@ -413,7 +413,18 @@ namespace MediaBrowser.Api
IEnumerable<Episode> episodes;
- if (string.IsNullOrEmpty(request.SeasonId))
+ if (!string.IsNullOrWhiteSpace(request.SeasonId))
+ {
+ var season = _libraryManager.GetItemById(new Guid(request.SeasonId)) as Season;
+
+ if (season == null)
+ {
+ throw new ResourceNotFoundException("No season exists with Id " + request.SeasonId);
+ }
+
+ episodes = season.GetEpisodes(user);
+ }
+ else if (request.Season.HasValue)
{
var series = _libraryManager.GetItemById(request.Id) as Series;
@@ -426,14 +437,14 @@ namespace MediaBrowser.Api
}
else
{
- var season = _libraryManager.GetItemById(new Guid(request.SeasonId)) as Season;
+ var series = _libraryManager.GetItemById(request.Id) as Series;
- if (season == null)
+ if (series == null)
{
- throw new ResourceNotFoundException("No season exists with Id " + request.SeasonId);
+ throw new ResourceNotFoundException("No series exists with Id " + request.Id);
}
- episodes = season.GetEpisodes(user);
+ episodes = series.GetEpisodes(user);
}
// Filter after the fact in case the ui doesn't want them