2013-11-16 05:03:42 +00:00
|
|
|
using FluentValidation.Results;
|
|
|
|
|
|
|
|
namespace NzbDrone.Core.Organizer
|
|
|
|
{
|
|
|
|
public interface IFilenameValidationService
|
|
|
|
{
|
2017-06-19 02:16:39 +00:00
|
|
|
ValidationFailure ValidateTrackFilename(SampleResult sampleResult);
|
2013-11-16 05:03:42 +00:00
|
|
|
}
|
|
|
|
|
2014-07-28 21:14:34 +00:00
|
|
|
public class FileNameValidationService : IFilenameValidationService
|
2013-11-16 05:03:42 +00:00
|
|
|
{
|
|
|
|
private const string ERROR_MESSAGE = "Produces invalid file names";
|
|
|
|
|
2017-06-19 02:16:39 +00:00
|
|
|
public ValidationFailure ValidateTrackFilename(SampleResult sampleResult)
|
|
|
|
{
|
|
|
|
var validationFailure = new ValidationFailure("StandardTrackFormat", ERROR_MESSAGE);
|
|
|
|
|
2022-11-22 01:51:00 +00:00
|
|
|
// TODO Add Validation for TrackFilename
|
|
|
|
// var parsedEpisodeInfo = Parser.Parser.ParseTitle(sampleResult.FileName);
|
2017-06-19 02:16:39 +00:00
|
|
|
|
2022-11-22 01:51:00 +00:00
|
|
|
// if (parsedEpisodeInfo == null)
|
|
|
|
// {
|
2017-06-19 02:16:39 +00:00
|
|
|
// return validationFailure;
|
2022-11-22 01:51:00 +00:00
|
|
|
// }
|
2017-06-19 02:16:39 +00:00
|
|
|
|
2022-11-22 01:51:00 +00:00
|
|
|
// if (!ValidateSeasonAndEpisodeNumbers(sampleResult.Episodes, parsedEpisodeInfo))
|
|
|
|
// {
|
2017-06-19 02:16:39 +00:00
|
|
|
// return validationFailure;
|
2022-11-22 01:51:00 +00:00
|
|
|
// }
|
2017-06-19 02:16:39 +00:00
|
|
|
return null;
|
|
|
|
}
|
2013-11-16 05:03:42 +00:00
|
|
|
}
|
|
|
|
}
|