public static ArtistResource ToResource(this NzbDrone.Core.Music.Artist model) { if (model == null) { return(null); } return(new ArtistResource { Id = model.Id, ArtistMetadataId = model.ArtistMetadataId, ArtistName = model.Name, //AlternateTitles SortName = model.SortName, Status = model.Metadata.Value.Status, Overview = model.Metadata.Value.Overview, ArtistType = model.Metadata.Value.Type, Disambiguation = model.Metadata.Value.Disambiguation, Images = model.Metadata.Value.Images.JsonClone(), Path = model.Path, QualityProfileId = model.QualityProfileId, MetadataProfileId = model.MetadataProfileId, Links = model.Metadata.Value.Links, Monitored = model.Monitored, CleanName = model.CleanName, ForeignArtistId = model.Metadata.Value.ForeignArtistId, // Root folder path is now calculated from the artist path // RootFolderPath = model.RootFolderPath, Genres = model.Metadata.Value.Genres, Tags = model.Tags, Added = model.Added, AddOptions = model.AddOptions, Ratings = model.Metadata.Value.Ratings, Statistics = new ArtistStatisticsResource() }); }
private List <ManualImportResource> GetMediaFiles() { var folder = (string)Request.Query.folder; var downloadId = (string)Request.Query.downloadId; NzbDrone.Core.Music.Artist artist = null; var artistIdQuery = Request.GetNullableIntegerQueryParameter("artistId", null); if (artistIdQuery.HasValue && artistIdQuery.Value > 0) { artist = _artistService.GetArtist(Convert.ToInt32(artistIdQuery.Value)); } var filter = Request.GetBooleanQueryParameter("filterExistingFiles", true) ? FilterFilesType.Matched : FilterFilesType.None; var replaceExistingFiles = Request.GetBooleanQueryParameter("replaceExistingFiles", true); return(_manualImportService.GetMediaFiles(folder, downloadId, artist, filter, replaceExistingFiles).ToResource().Select(AddQualityWeight).ToList()); }
public static NzbDrone.Core.Music.Artist ToModel(this ArtistResource resource, NzbDrone.Core.Music.Artist artist) { var updatedArtist = resource.ToModel(); artist.ApplyChanges(updatedArtist); return(artist); }