Beispiel #1
0
        public void UpdateUmbracoMedia(IMedia mediaItem, IMediaService mediaService, IIntelligentMediaSettings settings)
        {
            if (settings.Settings <GlobalSettings>().OverwriteName)
            {
                mediaItem.Name = Name;
            }

            new TagsProperty(mediaItem).SetValueIfExists(string.Join(",", Tags.OrderByDescending(t => t.Confidence).Select(t => t.Tag).Distinct()));
            new DescriptionProperty(mediaItem).SetValueIfExists(Descriptions.OrderByDescending(d => d.Confidence).First().Tag);
            new CategoriesProperty(mediaItem).SetValueIfExists(string.Join(",", Categories.OrderByDescending(t => t.Confidence).Select(t => t.Tag.Replace("_", " ").TrimEnd())));
            new NumberOfFacesProperty(mediaItem).SetValueIfExists(NumberOfFaces);
            new PrimaryColourProperty(mediaItem).SetValueIfExists(PrimaryColour);
            new BackgroundColourProperty(mediaItem).SetValueIfExists(BackgroundColour);
            new PopulatedProperty(mediaItem).SetValueIfExists(true);
            mediaService.Save(mediaItem);
        }