This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
CloudStorageAccount storageAccount = new CloudStorageAccount( | |
new StorageCredentials(accountName, accountKey), true); | |
CloudTableClient tableClient = storageAccount.CreateCloudTableClient(); | |
CloudTable bookTable = tableClient.GetTableReference("book"); | |
var query = from book in bookTable.CreateQuery<BookEntity>() | |
where book.PartitionKey == "hardback" | |
select book; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private String GetStreamingUrl(IJob job) | |
{ | |
IAsset assetToStream = job.OutputMediaAssets[0]; | |
var theManifest = | |
from f in assetToStream.AssetFiles | |
where f.Name.EndsWith(".ism") | |
select f; | |
IAssetFile manifestFile = theManifest.First(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private List<String> GetDownloadAssetSasList(IJob job) | |
{ | |
IAsset assetToDownload = job.OutputMediaAssets[0]; | |
IAccessPolicy sharedAccessPolicy = context.AccessPolicies.Create( | |
"DownloadFor7DaysPolicy", | |
TimeSpan.FromDays(7), | |
AccessPermissions.Read | |
); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
String inputAssetId = ASSET_ID; | |
IJob job = context.Jobs.Create("Encoding job"); | |
// Note that there are two Windows Azure Media Encoder processors | |
IMediaProcessor processor = context.MediaProcessors | |
.Where(p => p.Name == "Windows Azure Media Encoder") | |
.ToList() | |
.OrderBy(p => new Version(p.Version)) | |
.LastOrDefault(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
String pathToFile = PATH_TO_MEDIA_FILE; | |
String fileName = Path.GetFileName(pathToFile); | |
String assetName = "SOME ASSET NAME"; | |
CloudMediaContext context = new CloudMediaContext( | |
ACCOUNT_NAME, ACCOUNT_KEY); | |
IAsset asset = context.Assets.Create( | |
assetName, AssetCreationOptions.None); | |
IAssetFile assetFile = asset.AssetFiles.Create(fileName); | |
assetFile.Upload(pathToFile); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
CloudMediaContext context = | |
new CloudMediaContext(ACCOUNT_NAME, ACCOUNT_KEY); | |
DateTime tenDaysAgo = DateTime.UtcNow.AddDays(-10); | |
var jobQuery = | |
from job in context.Jobs | |
where job.Created >= tenDaysAgo | |
select job; | |
List<IJob> jobs = jobQuery.ToList(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public void LeaseBlob(String containerName, String blobName) | |
{ | |
String requestMethod = "PUT"; | |
String urlPath = String.Format("{0}/{1}?comp=lease", containerName, blobName); | |
String modifiedUrlPath = String.Format("{0}/{1}\ncomp:lease", containerName, blobName); | |
const Int32 contentLength = 0; | |
String storageServiceVersion = "2012-02-12"; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public void GetEntity(String tableName, String partitionKey, String rowKey) | |
{ | |
String requestMethod = "GET"; | |
String urlPath = String.Format("{0}(PartitionKey='{1}',RowKey='{2}')", tableName, partitionKey, rowKey); | |
String storageServiceVersion = "2012-02-12"; | |
String dateInRfc1123Format = DateTime.UtcNow.ToString("R", CultureInfo.InvariantCulture); | |
String canonicalizedResource = String.Format("/{0}/{1}", AzureStorageConstants.Account, urlPath); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public void InsertEntity(String tableName, String artist, String title) | |
{ | |
String requestMethod = "POST"; | |
String urlPath = tableName; | |
String storageServiceVersion = "2012-02-12"; | |
String dateInRfc1123Format = DateTime.UtcNow.ToString("R", CultureInfo.InvariantCulture); | |
String contentMD5 = String.Empty; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public void GetMessage(String queueName) | |
{ | |
string requestMethod = "GET"; | |
String urlPath = String.Format("{0}/messages", queueName); | |
String storageServiceVersion = "2012-02-12"; | |
String dateInRfc1123Format = DateTime.UtcNow.ToString("R", CultureInfo.InvariantCulture); | |
String canonicalizedHeaders = String.Format( | |
"x-ms-date:{0}\nx-ms-version:{1}", |