You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
38 lines
1.1 KiB
38 lines
1.1 KiB
using System.Collections.Generic;
|
|
using NzbDrone.Api.REST;
|
|
using NzbDrone.Core.MediaFiles;
|
|
|
|
namespace NzbDrone.Api.Episodes
|
|
{
|
|
public class RenameEpisodeModule : NzbDroneRestModule<RenameEpisodeResource>
|
|
{
|
|
private readonly IRenameEpisodeFileService _renameEpisodeFileService;
|
|
|
|
public RenameEpisodeModule(IRenameEpisodeFileService renameEpisodeFileService)
|
|
: base("rename")
|
|
{
|
|
_renameEpisodeFileService = renameEpisodeFileService;
|
|
|
|
GetResourceAll = GetEpisodes;
|
|
}
|
|
|
|
private List<RenameEpisodeResource> GetEpisodes()
|
|
{
|
|
if (!Request.Query.SeriesId.HasValue)
|
|
{
|
|
throw new BadRequestException("seriesId is missing");
|
|
}
|
|
|
|
var seriesId = (int)Request.Query.SeriesId;
|
|
|
|
if (Request.Query.SeasonNumber.HasValue)
|
|
{
|
|
var seasonNumber = (int)Request.Query.SeasonNumber;
|
|
return _renameEpisodeFileService.GetRenamePreviews(seriesId, seasonNumber).ToResource();
|
|
}
|
|
|
|
return _renameEpisodeFileService.GetRenamePreviews(seriesId).ToResource();
|
|
}
|
|
}
|
|
}
|