Skip to content

Commit

Permalink
v10.2.X-0.4 (#19)
Browse files Browse the repository at this point in the history
* Update the videos/playlists pull pipelines to automatically refresh the search index to prevent a race condition (#14)

Co-authored-by: Cody Rodgers <[email protected]>

* v10.1.X-3.6 (#18)

* V10.2.0.3 (#16)

* Fixed broken DXF configuration content for labels/folders

* Add more error handling to the folder and labels property value readers

* Fix bug preventing new labels from being synced

* Remove automatic re-indexing from the videos/playlists pipeline

---------

Co-authored-by: Cody Rodgers <[email protected]>

* Add missing embed media buttons

* Reorganize DEF files

* Update the DEF GET pipelines to have better error handling and removed broken SetFolderSettings code

* Update the DEF resolve pipelines to have better error handling

* Updated the UPDATE DEF pipelines to have better logging and error handling

* Update playlist/video pipelines to accuratly reflect video name changes made outside of Sitecore

* Fix bug preventing deleted Brightcove items from being deleted in Sitecore

* Fix broken standard values for experience items

* Update the Brightcove services to trim account ids/secrets

* Update logging levels on video/player pipelines

* Update all pipelines to handle name changes

* Update sitecore package creation script to include patching instructions

* Update the pull pipelines to support creating items in languages other an "en"

* Update all template fields to be shared

* Update the push pipelines to support creating items in languages other than "en"

* Update the folder/labels value readers to have better error handling

* Add support for embedding medai links again. It was removed as part of the upgrade but returned on client request

* Update the resolve asset item pipeline step to rename resolved items if the name has been changed since creation

* Fix the brightcove settings config so it loads both html editor scripts correctly

* Update sitecore package creation script

---------

Co-authored-by: Cody Rodgers <[email protected]>

---------

Co-authored-by: Cody Rodgers <[email protected]>
  • Loading branch information
codrod and rdacrodgers authored May 16, 2023
1 parent d724bbc commit d009516
Show file tree
Hide file tree
Showing 91 changed files with 1,950 additions and 926 deletions.
4 changes: 2 additions & 2 deletions Brightcove.Core/Services/BrightcoveAuthenticationService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@ public BrightcoveAuthenticationService(string clientId, string clientSecret)
throw new ArgumentException("argument must not be null or empty", nameof(clientSecret));
}

this.clientId = clientId;
this.clientSecret = clientSecret;
this.clientId = clientId.Trim();
this.clientSecret = clientSecret.Trim();
}

AccessToken GetAccessToken()
Expand Down
4 changes: 1 addition & 3 deletions Brightcove.Core/Services/BrightcoveService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ public BrightcoveService(string accountId, string clientId, string clientSecret)
throw new ArgumentException("argument must not be null or empty", nameof(accountId));
}

this.accountId = accountId;
this.accountId = accountId.Trim();

authenticationService = new BrightcoveAuthenticationService(clientId, clientSecret);
}
Expand Down Expand Up @@ -513,8 +513,6 @@ public PlayerList GetPlayers()
HttpResponseMessage response = SendRequest(request);

PlayerList players = JsonConvert.DeserializeObject<PlayerList>(response.Content.ReadAsString());
foreach (var p in players.Items)
p.LastSyncTime = DateTime.UtcNow;

return players;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -420,44 +420,43 @@
<Reference Include="System.Xml.ReaderWriter" />
</ItemGroup>
<ItemGroup>
<Compile Include="Converters\PipelineStepWithEndpointFromConverter.cs" />
<Compile Include="Converters\PipelineStep\PipelineStepWithEndpointFromConverter.cs" />
<Compile Include="Converters\NullableEnumValueReaderConverter.cs" />
<Compile Include="Converters\ReadAssetItemsPipelineStepConverter.cs" />
<Compile Include="Converters\UpdatePipelineStepConverter.cs" />
<Compile Include="Converters\LabelsPropertyValueAccessorConverter.cs" />
<Compile Include="Converters\FolderPropertyValueAccessorConverter.cs" />
<Compile Include="Converters\PipelineStep\ReadAssetItemsPipelineStepConverter.cs" />
<Compile Include="Converters\PipelineStep\UpdatePipelineStepConverter.cs" />
<Compile Include="Converters\ValueAccessor\LabelsPropertyValueAccessorConverter.cs" />
<Compile Include="Converters\ValueAccessor\FolderPropertyValueAccessorConverter.cs" />
<Compile Include="Converters\WebApiEndpointConverter.cs" />
<Compile Include="Converters\ResolveAssetItemPipelineStepConverter.cs" />
<Compile Include="Converters\CsvStringPropertyValueAccessorConverter.cs" />
<Compile Include="Converters\VideoIdsPropertyValueAccessorConverter.cs" />
<Compile Include="Converters\StringDictionaryPropertyValueAccessorConverter.cs" />
<Compile Include="Converters\ChainedPropertyValueAccessorConverter.cs" />
<Compile Include="Converters\ResolveOrUpdateAssetModelPipelineStepConverter.cs" />
<Compile Include="Converters\PipelineStep\ResolveAssetItemPipelineStepConverter.cs" />
<Compile Include="Converters\ValueAccessor\CsvStringPropertyValueAccessorConverter.cs" />
<Compile Include="Converters\ValueAccessor\VideoIdsPropertyValueAccessorConverter.cs" />
<Compile Include="Converters\ValueAccessor\StringDictionaryPropertyValueAccessorConverter.cs" />
<Compile Include="Converters\ValueAccessor\ChainedPropertyValueAccessorConverter.cs" />
<Compile Include="Converters\PipelineStep\ResolveOrUpdateAssetModelPipelineStepConverter.cs" />
<Compile Include="Extensions\ItemModelExtensions.cs" />
<Compile Include="Helpers\ItemUpdater.cs" />
<Compile Include="Helpers\Mapper.cs" />
<Compile Include="Helpers\ResolveHelper.cs" />
<Compile Include="Processors\BasePipelineStepProcessor.cs" />
<Compile Include="Processors\BasePipelineStepWithEndpointFromProcessor.cs" />
<Compile Include="Processors\BasePipelineStepWithWebApiEndpointProcessor.cs" />
<Compile Include="Processors\GetExperiencesPipelineStepProcessor.cs" />
<Compile Include="Processors\GetFoldersPipelineStepProcessor.cs" />
<Compile Include="Processors\GetPlayersPipelineStepProcessor.cs" />
<Compile Include="Processors\GetLabelsPipelineStepProcessor.cs" />
<Compile Include="Processors\Get\GetExperiencesPipelineStepProcessor.cs" />
<Compile Include="Processors\Get\GetFoldersPipelineStepProcessor.cs" />
<Compile Include="Processors\Get\GetPlayersPipelineStepProcessor.cs" />
<Compile Include="Processors\Get\GetLabelsPipelineStepProcessor.cs" />
<Compile Include="Processors\ReadAssetItemsPipelineStepProcessor.cs" />
<Compile Include="Processors\ResolveAssetItemPipelineStepProcessor.cs" />
<Compile Include="Processors\GetPlayListsPipelineStepProcessor.cs" />
<Compile Include="Processors\GetVideosPipelineStepProcessor.cs" />
<Compile Include="Processors\ResolveFolderModelPipelineStepProcessor.cs" />
<Compile Include="Processors\ResolveLabelModelPipelineStepProcessor.cs" />
<Compile Include="Processors\ResolvePlayerModelPipelineStepProcessor.cs" />
<Compile Include="Processors\ResolvePlayListModelPipelineStepProcessor.cs" />
<Compile Include="Processors\UpdateLabelModelPipelineStepProcessor.cs" />
<Compile Include="Processors\UpdateFolderModelPipelineStepProcessor.cs" />
<Compile Include="Processors\UpdatePlaylistModelPipelineStepProcessor.cs" />
<Compile Include="Processors\UpdatePlayerModelPipelineStepProcessor.cs" />
<Compile Include="Processors\UpdateVideoItemProcessor.cs" />
<Compile Include="Processors\UpdateVideoModelPipelineStepProcessor.cs" />
<Compile Include="Processors\ResolveVideoModelPipelineStepProcessor.cs" />
<Compile Include="Processors\Resolve\ResolveAssetItemPipelineStepProcessor.cs" />
<Compile Include="Processors\Get\GetPlayListsPipelineStepProcessor.cs" />
<Compile Include="Processors\Get\GetVideosPipelineStepProcessor.cs" />
<Compile Include="Processors\Resolve\ResolveFolderModelPipelineStepProcessor.cs" />
<Compile Include="Processors\Resolve\ResolveLabelModelPipelineStepProcessor.cs" />
<Compile Include="Processors\Resolve\ResolvePlayerModelPipelineStepProcessor.cs" />
<Compile Include="Processors\Resolve\ResolvePlayListModelPipelineStepProcessor.cs" />
<Compile Include="Processors\Update\UpdateLabelModelPipelineStepProcessor.cs" />
<Compile Include="Processors\Update\UpdateFolderModelPipelineStepProcessor.cs" />
<Compile Include="Processors\Update\UpdatePlaylistModelPipelineStepProcessor.cs" />
<Compile Include="Processors\Update\UpdatePlayerModelPipelineStepProcessor.cs" />
<Compile Include="Processors\Update\UpdateVideoItemProcessor.cs" />
<Compile Include="Processors\Update\UpdateVideoModelPipelineStepProcessor.cs" />
<Compile Include="Processors\Resolve\ResolveVideoModelPipelineStepProcessor.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="SearchResults\AssetSearchResult.cs" />
<Compile Include="Settings\EndpointsSettings.cs" />
Expand Down
24 changes: 24 additions & 0 deletions Brightcove.DataExchangeFramework/Extensions/ItemModelExtensions.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
using Sitecore.Services.Core.Model;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Brightcove.DataExchangeFramework.Extensions
{
public static class ItemModelExtensions
{
public static string GetLanguage(this ItemModel model)
{
object language = null;

if(!model.TryGetValue(ItemModel.ItemLanguage, out language))
{
language = "en";
}

return (string)language;
}
}
}
12 changes: 0 additions & 12 deletions Brightcove.DataExchangeFramework/Helpers/ResolveHelper.cs

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -43,15 +43,13 @@ protected override void ProcessPipelineStep(PipelineStep pipelineStep = null, Pi
}
catch(Exception ex)
{
LogFatal("An unexpected error occured running the pipeline step", ex);
pipelineContext.CriticalError = true;
LogFatal("An unexpected error occured running the internal pipeline step", ex);
pipelineContext.CriticalError = false;
}
}

protected virtual void ProcessPipelineStepInternal(PipelineStep pipelineStep = null, PipelineContext pipelineContext = null, ILogger logger = null)
{
LogFatal($"No processor has been defined for the pipeline step");
pipelineContext.CriticalError = true;
return;
}

Expand Down Expand Up @@ -119,7 +117,7 @@ private string GetErrorMessage(string message)

private string GetExceptionMessage(Exception ex)
{
return $"{ex.GetType()}: {ex.Message}\n{ex.StackTrace}";
return ex.ToString();
}
}
}

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -22,100 +22,59 @@

namespace Brightcove.DataExchangeFramework.Processors
{
public class BasePipelineStepWithWebApiEndpointProcessor : BasePipelineStepWithEndpointFromProcessor
public class BasePipelineStepWithWebApiEndpointProcessor : BasePipelineStepProcessor
{
protected WebApiSettings WebApiSettings { get; set; }
protected Endpoint EndpointFrom { get; set; }

protected override void ProcessPipelineStep(PipelineStep pipelineStep = null, PipelineContext pipelineContext = null, ILogger logger = null)
{
base.ProcessPipelineStep(pipelineStep, pipelineContext, logger);

if (pipelineContext.CriticalError)
if (pipelineStep == null)
{
return;
throw new ArgumentNullException(nameof(pipelineStep));
}

WebApiSettings = EndpointFrom.GetPlugin<WebApiSettings>();

if (WebApiSettings == null)
if (pipelineContext == null)
{
logger.Error(
"No web api settings specified on the endpoint. " +
"(pipeline step: {0})",
pipelineStep.Name);

pipelineContext.CriticalError = true;
return;
throw new ArgumentNullException(nameof(pipelineContext));
}

if (string.IsNullOrWhiteSpace(WebApiSettings.AccountId))
if (logger == null)
{
logger.Error(
"No account ID is specified on the endpoint. " +
"(pipeline step: {0})",
pipelineStep.Name);
throw new ArgumentNullException(nameof(logger));
}

EndpointSettings endpointSettings = pipelineStep.GetEndpointSettings();

pipelineContext.CriticalError = true;
if (endpointSettings == null)
{
LogFatal("Pipeline step processing will abort because the pipeline step is missing endpoint settings.");
return;
}

if (string.IsNullOrWhiteSpace(WebApiSettings.ClientId))
{
logger.Error(
"No client ID is specified on the endpoint. " +
"(pipeline step: {0})",
pipelineStep.Name);
EndpointFrom = endpointSettings.EndpointFrom;

pipelineContext.CriticalError = true;
if (EndpointFrom == null)
{
LogFatal("Pipeline step processing will abort because the pipeline step is missing an endpoint to read from.");
return;
}

if (string.IsNullOrWhiteSpace(WebApiSettings.ClientSecret))
{
logger.Error(
"No client secret is specified on the endpoint. " +
"(pipeline step: {0})",
pipelineStep.Name);
WebApiSettings = GetPluginOrFail<WebApiSettings>(EndpointFrom);

pipelineContext.CriticalError = true;
if(!WebApiSettings.Validate())
{
LogFatal("Pipeline step processing will abort because the Brightcove web API settings are invalid: "+WebApiSettings.ValidationMessage);
return;
}
}

public void SetFolderSettings(string accountName, string folderName)
{
Sitecore.Data.Database masterDB = Sitecore.Configuration.Factory.GetDatabase("master");
Sitecore.Data.Items.Item node = masterDB.GetItem($"/sitecore/media library/BrightCove/{accountName}/{folderName}");
if (node == null)
try
{
Sitecore.Data.Items.Item parentNode = masterDB.GetItem($"/sitecore/media library/BrightCove/{accountName}");
Sitecore.Data.Items.Item folder = masterDB.GetItem("/sitecore/templates/Common/Folder");
parentNode.Add(folderName, new TemplateItem(folder));

node = masterDB.GetItem("/sitecore/media library/BrightCove/BrightCove Account/"+ folderName);
using (new Sitecore.Data.Items.EditContext(node, SecurityCheck.Disable))
{
IsBucketItemCheckBox(node).Checked = true;
}
ProcessPipelineStepInternal(pipelineStep, pipelineContext, logger);
}
else
catch (Exception ex)
{
using (new Sitecore.Data.Items.EditContext(node, SecurityCheck.Disable))
{
if (!IsBucketItemCheck(node))
IsBucketItemCheckBox(node).Checked = true;
}
LogFatal("An unexpected error occured running the internal pipeline step", ex);
pipelineContext.CriticalError = false;
}
}

public bool IsBucketItemCheck(Item item)
{
return (((item != null) && (item.Fields[Sitecore.Buckets.Util.Constants.IsBucket] != null)) && item.Fields[Sitecore.Buckets.Util.Constants.IsBucket].Value.Equals("1"));
}

public CheckboxField IsBucketItemCheckBox(Item item)
{
return item.Fields[Sitecore.Buckets.Util.Constants.IsBucket];
}
}
}
Loading

0 comments on commit d009516

Please sign in to comment.