Skip to content

Commit

Permalink
cosmetic changes
Browse files Browse the repository at this point in the history
  • Loading branch information
pohhsu committed Jun 23, 2023
1 parent 08e42c1 commit 7c0de6b
Show file tree
Hide file tree
Showing 13 changed files with 25 additions and 25 deletions.
6 changes: 3 additions & 3 deletions AssetOptionsBinder.cs
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ This is specific to the cloud you are migrating to.
() => "${AssetId}/",
description: @"Path template to determine the final path in the storage where files are uploaded.
Can use ${AssetName} ${AssetId} ${ContainerName} or ${LocatorId}.
e.g., videos/${AssetName} will upload to a container named 'videos' with path begining with the asset name.")
e.g., videos/${AssetName} will upload to a container named 'videos' with path beginning with the asset name.")
{
Arity = ArgumentArity.ZeroOrOne
};
Expand Down Expand Up @@ -54,9 +54,9 @@ Can use ${AssetName} ${AssetId} ${ContainerName} or ${LocatorId}.
description: @"Skip assets that have been migrated already.");

private readonly Option<bool> _copyNonStreamable = new(
aliases: new[] { "--copy-nonstremable" },
aliases: new[] { "--copy-nonstreamable" },
() => true,
description: @"Copy non-stremable assets (Assets without .ism file) as is.");
description: @"Copy non-streamable assets (Assets without .ism file) as is.");

private readonly Option<bool> _overwrite = new(
aliases: new[] { "-y", "--overwrite" },
Expand Down
12 changes: 6 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ A command line tool to migrate your data from Azure Media Services.
This tool helps you to migrate your media data from Azure Media Services (AMS).
It can be packaged to be streamed directly from Azure storage without any service.

The tool supports both [ffmpeg](https://ffmpeg.org/) and [shaka-packager](https://github.com/shaka-project/shaka-packager) to conver the videos to directly streamable format.
The tool supports both [ffmpeg](https://ffmpeg.org/) and [shaka-packager](https://github.com/shaka-project/shaka-packager) to convert the videos to directly streamable format.
The content is converted to CMAF format with both a DASH and HLS manifest to support a wide range of devices.
The default is shaka packager because it can use pipes to reduce the temporary storage required but can changed via the command line.

Expand All @@ -38,7 +38,7 @@ The default is shaka packager because it can use pipes to reduce the temporary s
* Marks migrated assets and provides summary.

## Open Issues
* Live assets with discontinuiities are not supported.
* Live assets with discontinuities are not supported.
* Captions in TTML are not migrated.
* Direct migration from an Azure Storage account without using the AMS API.

Expand All @@ -51,20 +51,20 @@ The identity used to migrate must have 'Contributor' role on the Azure Media Ser
The tool supports various types of migration depending on the asset format and the command line options.
* It can simply upload the files to the new storage account.
* For assets created by live events, it can convert to MP4 files and then upload.
* For direct streaming, it can convers the assets to CMAF files with a DASH and HLS manifest.
* For direct streaming, it can convert the assets to CMAF files with a DASH and HLS manifest.

# Temporary storage needed.
The tool uses temporary storage space for format conversion and uses pipes where possible to minimize storage usage.
Smooth Streaming assets or assets from live events dont need to be downloaded locally.
Smooth Streaming assets or assets from live events don't need to be downloaded locally.

## Linux
* The only storage needed is for manifests when using shaka packager.
* When using ffmpeg, if the asset files are MP4, it downloads the files locally before converting so storage is proportional to asset size.

## Windows
* Shaka packager writes the packaged files to local disk first before uploading due to a windows specific bug.
* Using ffmpeg needs doulbe the local disk space when packaging MP4 files.
* Smooth Streaming assets or assets from live events dont need to be downloaded locally.
* Using ffmpeg needs double the local disk space when packaging MP4 files.
* Smooth Streaming assets or assets from live events don't need to be downloaded locally.

## Migrate to an Azure Storage Account.

Expand Down
4 changes: 2 additions & 2 deletions ams/AccountMigrator.cs
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@ public override async Task MigrateAsync(CancellationToken cancellationToken)
{
_logger.LogInformation("Begin migration for media account: {name}", _globalOptions.AccountName);
var account = await _resourceProvider.GetMediaAccountAsync(cancellationToken);
//TODO: Migrate everyting like assets, keys, transforms etc.
_logger.LogInformation("Finshed migration for account {name}", _globalOptions.AccountName);
//TODO: Migrate everything like assets, keys, transforms etc.
_logger.LogInformation("Finished migration for account {name}", _globalOptions.AccountName);
}
}
}
2 changes: 1 addition & 1 deletion ams/AssetMigrator.cs
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ private void WriteSummary(AssetStats stats)
.AddColumn("Count")
.AddRow("Total", $"{stats.Total}")
.AddRow("[green]Already Migrated[/]", $"[green]{stats.Migrated}[/]")
.AddRow("[gray]Skiped[/]", $"[gray]{stats.Skipped}[/]")
.AddRow("[gray]Skipped[/]", $"[gray]{stats.Skipped}[/]")
.AddRow("[green]Successful[/]", $"[green]{stats.Successful}[/]")
.AddRow("[red]Failed[/]", $"[red]{stats.Failed}[/]")
.AddRow("[orange3]Deleted[/]", $"[orange3]{stats.Deleted}[/]");
Expand Down
6 changes: 3 additions & 3 deletions ams/KeysMigrator.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ internal class KeysMigrator : BaseMigrator
{
private readonly ILogger _logger;
private readonly KeyOptions _keyOptions;
private readonly ISecretUploader _secretUplaoder;
private readonly ISecretUploader _secretUploader;
private readonly TemplateMapper _templateMapper;

public KeysMigrator(
Expand All @@ -27,7 +27,7 @@ public KeysMigrator(
_logger = logger;
_keyOptions = keyOptions;
_templateMapper = templateMapper;
_secretUplaoder = cloudProvider.GetSecretProvider(keyOptions);
_secretUploader = cloudProvider.GetSecretProvider(keyOptions);
}

public override async Task MigrateAsync(CancellationToken cancellationToken)
Expand Down Expand Up @@ -64,7 +64,7 @@ private async Task MigrateLocatorAsync(StreamingLocatorResource locator, Cancell
{
_logger.LogInformation("Migrating content key {id}", key.Id);
var secretName = _templateMapper.ExpandKeyTemplate(key, _keyOptions.KeyTemplate);
await _secretUplaoder.UploadAsync(secretName, key.Value, cancellationToken);
await _secretUploader.UploadAsync(secretName, key.Value, cancellationToken);
}
}
catch (Exception ex)
Expand Down
4 changes: 2 additions & 2 deletions ams/StorageMigrator.cs
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ private static BarChartItem[] GetItems(AssetStats value)
{
new BarChartItem("Assets", value.Total),
new BarChartItem("AlreadyMigrated", value.Migrated, Color.Green),
new BarChartItem("Skiped", value.Skipped, Color.Grey),
new BarChartItem("Skipped", value.Skipped, Color.Grey),
new BarChartItem("Successful", value.Successful, Color.Green),
new BarChartItem("Failed", value.Failed, Color.Red),
new BarChartItem("Deleted", value.Deleted, Color.Orange3)
Expand Down Expand Up @@ -186,7 +186,7 @@ private void WriteSummary(double total, AssetStats stats)
.AddRow("Total", $"{total}")
.AddRow("Assets", $"{stats.Total}")
.AddRow("[green]Already Migrated[/]", $"[green]{stats.Migrated}[/]")
.AddRow("[gray]Skiped[/]", $"[gray]{stats.Skipped}[/]")
.AddRow("[gray]Skipped[/]", $"[gray]{stats.Skipped}[/]")
.AddRow("[green]Successful[/]", $"[green]{stats.Successful}[/]")
.AddRow("[red]Failed[/]", $"[red]{stats.Failed}[/]")
.AddRow("[orange3]Deleted[/]", $"[orange3]{stats.Deleted}[/]");
Expand Down
2 changes: 1 addition & 1 deletion ams/TemplateMapper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ public string ExpandTemplate(string template, Func<string, string?> valueExtract
expandedValue = expandedValue.Replace(match.Value, value);
}
}
_logger.LogTrace("Template {template} expaned to {value}", template, expandedValue);
_logger.LogTrace("Template {template} expanded to {value}", template, expandedValue);
return expandedValue;
}

Expand Down
2 changes: 1 addition & 1 deletion azure/KeyVaultUploader.cs
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ public KeyVaultUploader(

public async Task UploadAsync(string secretName, string secretValue, CancellationToken cancellationToken)
{
_logger.LogInformation("Saving secret {name} to key valut {vault}", secretName, _keyOptions.KeyVaultUri);
_logger.LogInformation("Saving secret {name} to key vault {vault}", secretName, _keyOptions.KeyVaultUri);
await _secretClient.SetSecretAsync(secretName, secretValue, cancellationToken);
}
}
Expand Down
2 changes: 1 addition & 1 deletion contracts/Manifest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ public Track(StreamType type)

public StreamType Type { get; }

// Check if the track is storead as one file per fragment.
// Check if the track is stored as one file per fragment.
public bool IsMultiFile => string.IsNullOrEmpty(Path.GetExtension(Source));
}

Expand Down
4 changes: 2 additions & 2 deletions pipes/BlobSink.cs
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,10 @@ internal class UploadSink : IPipeSink
private readonly string _filename;
private readonly ILogger _logger;

public UploadSink(IFileUploader uploader, string contianer, string filename, ILogger logger)
public UploadSink(IFileUploader uploader, string container, string filename, ILogger logger)
{
_uploader = uploader;
_container = contianer;
_container = container;
_filename = filename;
_logger = logger;
}
Expand Down
2 changes: 1 addition & 1 deletion transform/PackageTransform.cs
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ protected override async Task<string> TransformAsync(
var outputDirectory = Path.Combine(workingDirectory, "output");
Directory.CreateDirectory(outputDirectory);

// TODO: Dont assume implementation.
// TODO: Don't assume implementation.
var packager = _packagerFactory.GetPackager(details, cancellationToken);
try
{
Expand Down
2 changes: 1 addition & 1 deletion transform/StorageExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ static class StorageExtensions
if (manifests.Length > 1)
{
logger.LogWarning(
"Multiple manifsets (.ism) present in container {name}. Only processing the first one {manifest}",
"Multiple manifests (.ism) present in container {name}. Only processing the first one {manifest}",
container.Name,
manifests[0].Name);
}
Expand Down
2 changes: 1 addition & 1 deletion transform/TransformFactory.cs
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ public TransformFactory(
}


// There should be atleast one transform.
// There should be at least one transform.
Debug.Assert(_storageTransforms.Count > 0, "No transform selected based on the options provided");
_assetTransforms.AddRange(_storageTransforms.Select(
t => new AssetTransform(options, templateMapper, t, loggerFactory.CreateLogger<AssetTransform>()))
Expand Down

0 comments on commit 7c0de6b

Please sign in to comment.