Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cleanup code and make it more performant #173

Merged
merged 1 commit into from
Sep 11, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 8 additions & 20 deletions ams/AzureResourceProvider.cs
Original file line number Diff line number Diff line change
Expand Up @@ -40,28 +40,16 @@ public async Task SetStorageResourceGroupsAsync(MediaServicesAccountResource acc
if (mediaServiceResource.GetRawResponse().Status == 200)
{
storageAccounts = mediaServiceResource.Value.Data.StorageAccounts;
if (storageAccounts != null && storageAccounts.Any())

foreach (var storageAccount in storageAccounts)
{
foreach (var storageAccount in storageAccounts)
{
string? storageAccountId = storageAccount.Id;
///subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.storage/storageaccounts/{accountName}
if (!string.IsNullOrEmpty(storageAccountId))
{
string[] parts;
parts = storageAccountId.Split('/');
string resourceGroupName = parts[4];
string storageAccName = parts[8];
string subscriptionId = parts[2];
var resourceGroupId = ResourceGroupResource.CreateResourceIdentifier(
subscriptionId,
resourceGroupName);
var resourceGroup = _armClient.GetResourceGroupResource(resourceGroupId);
_storageResourceGroups.Add(storageAccName, resourceGroup);
}
}
var storageAccountId = storageAccount.Id;
var resourceGroupId = ResourceGroupResource.CreateResourceIdentifier(
storageAccountId.SubscriptionId!,
storageAccountId.ResourceGroupName!);
var resourceGroup = _armClient.GetResourceGroupResource(resourceGroupId);
_storageResourceGroups.Add(storageAccountId.Name, resourceGroup);
}

}
}

Expand Down
6 changes: 1 addition & 5 deletions transform/ShakaPackager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -62,11 +62,7 @@ public ShakaPackager(MigratorOptions options, AssetDetails assetDetails, TransMu
videoStream = stream;
numVideoStreams++;
}
}

foreach (var stream in clientManifest.Streams)
{
if (stream.Type == StreamType.Audio)
else if (stream.Type == StreamType.Audio)
{
audioStream = stream;
numAudioStreams++;
Expand Down
Loading