mirror of
https://github.com/lidarr/lidarr.git
synced 2025-08-20 13:33:34 -07:00
added support for getting series by slug
This commit is contained in:
parent
806ed921f4
commit
8373e1ce10
3 changed files with 30 additions and 0 deletions
|
@ -2,9 +2,11 @@
|
|||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using FluentValidation;
|
||||
using Nancy;
|
||||
using NzbDrone.Core.SeriesStats;
|
||||
using NzbDrone.Core.Tv;
|
||||
using NzbDrone.Api.Validation;
|
||||
using NzbDrone.Api.Extensions;
|
||||
|
||||
namespace NzbDrone.Api.Series
|
||||
{
|
||||
|
@ -25,15 +27,30 @@ namespace NzbDrone.Api.Series
|
|||
UpdateResource = UpdateSeries;
|
||||
DeleteResource = DeleteSeries;
|
||||
|
||||
Get["/{slug}"] = o => GetSeries((string)o.slug.ToString());
|
||||
|
||||
SharedValidator.RuleFor(s => s.RootFolderId).ValidId();
|
||||
SharedValidator.RuleFor(s => s.QualityProfileId).ValidId();
|
||||
|
||||
|
||||
|
||||
|
||||
PostValidator.RuleFor(s => s.Title).NotEmpty();
|
||||
|
||||
}
|
||||
|
||||
private Response GetSeries(string slug)
|
||||
{
|
||||
var series = _seriesService.FindBySlug(slug);
|
||||
|
||||
if (series == null)
|
||||
{
|
||||
return new NotFoundResponse();
|
||||
}
|
||||
|
||||
return series.AsResponse();
|
||||
}
|
||||
|
||||
private List<SeriesResource> AllSeries()
|
||||
{
|
||||
var seriesStats = _seriesStatisticsService.SeriesStatistics();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue