public override bool NeedUpdate(object entity, Item accountItem, MediaServiceSearchResult searchResult) { object cachedObjectData = HttpRuntime.Cache.Get("BrightcoveForceSync"); if (cachedObjectData != null) { return(true); } Video video = (Video)entity; VideoSearchResult videoSearchResult = (VideoSearchResult)searchResult; string thumbnailSrc = null; if (video.Images.Thumbnail != null && video.Images.Thumbnail.Sources != null) { foreach (var imageSrc in video.Images.Thumbnail.Sources) { if (Settings.EnableSecureImages && imageSrc.Src.StartsWith("https://")) { thumbnailSrc = imageSrc.Src; } else if (!Settings.EnableSecureImages && imageSrc.Src.StartsWith("http://")) { thumbnailSrc = imageSrc.Src; } } } else { thumbnailSrc = video.Images.Thumbnail?.Src?.Replace("http://", "https://"); } string posterSrc = null; if (video.Images.Poster != null && video.Images.Poster.Sources != null) { foreach (var imageSrc in video.Images.Poster.Sources) { if (Settings.EnableSecureImages && imageSrc.Src.StartsWith("https://")) { posterSrc = imageSrc.Src; } else if (!Settings.EnableSecureImages && imageSrc.Src.StartsWith("http://")) { posterSrc = imageSrc.Src; } } } else { posterSrc = video.Images.Poster?.Src?.Replace("http://", "https://"); } if (Sitecore.Integration.Common.Utils.StringUtil.EqualsIgnoreNullEmpty(video.LastModifiedDate.ToString(), videoSearchResult.LastModifiedDate) && (Sitecore.Integration.Common.Utils.StringUtil.EqualsIgnoreNullEmpty(thumbnailSrc, videoSearchResult.ThumbnailUrl))) { return(!Sitecore.Integration.Common.Utils.StringUtil.EqualsIgnoreNullEmpty(posterSrc, videoSearchResult.VideoStillURL)); } return(true); }
public override bool NeedUpdate(object entity, Item accountItem, MediaServiceSearchResult searchResult) { object cachedObjectData = HttpRuntime.Cache.Get("BrightcoveForceSync"); if (cachedObjectData != null) { return(true); } Video video = (Video)entity; VideoSearchResult videoSearchResult = (VideoSearchResult)searchResult; var thumbnailSrc = video.Images.Thumbnail != null?video.Images.Thumbnail.Src?.Replace("http://", "https://") : null; var posterSrc = video.Images.Poster != null?video.Images.Poster.Src?.Replace("http://", "https://") : null; if (Sitecore.Integration.Common.Utils.StringUtil.EqualsIgnoreNullEmpty(video.LastModifiedDate.ToString(), videoSearchResult.LastModifiedDate) && (Sitecore.Integration.Common.Utils.StringUtil.EqualsIgnoreNullEmpty(thumbnailSrc, videoSearchResult.ThumbnailUrl))) { return(!Sitecore.Integration.Common.Utils.StringUtil.EqualsIgnoreNullEmpty(posterSrc, videoSearchResult.VideoStillURL)); } return(true); }