예제 #1
0
        private JsonResponse <NamingExampleResource> GetExamples(NamingConfigResource config)
        {
            if (config.Id == 0)
            {
                config = GetNamingConfig();
            }

            var nameSpec       = config.ToModel();
            var sampleResource = new NamingExampleResource();

            var singleTrackSampleResult    = _filenameSampleService.GetStandardTrackSample(nameSpec);
            var multiDiscTrackSampleResult = _filenameSampleService.GetMultiDiscTrackSample(nameSpec);

            sampleResource.SingleTrackExample = _filenameValidationService.ValidateTrackFilename(singleTrackSampleResult) != null
                    ? null
                    : singleTrackSampleResult.FileName;

            sampleResource.MultiDiscTrackExample = _filenameValidationService.ValidateTrackFilename(multiDiscTrackSampleResult) != null
                    ? null
                    : multiDiscTrackSampleResult.FileName;

            sampleResource.ArtistFolderExample = nameSpec.ArtistFolderFormat.IsNullOrWhiteSpace()
                ? null
                : _filenameSampleService.GetArtistFolderSample(nameSpec);

            sampleResource.AlbumFolderExample = nameSpec.AlbumFolderFormat.IsNullOrWhiteSpace()
                ? null
                : _filenameSampleService.GetAlbumFolderSample(nameSpec);

            return(sampleResource.AsResponse());
        }