예제 #1
0
파일: Workflow.cs 프로젝트: lulzzz/SkyMedia
        private static void TrackJob(string directoryId, string authToken, IJob job, MediaJobTask[] jobTasks)
        {
            User authUser = new User(authToken);

            string storageAccountName = job.InputMediaAssets[0].StorageAccountName;
            string storageAccountKey  = Storage.GetAccountKey(authToken, storageAccountName);

            MediaPublish contentPublish = new MediaPublish()
            {
                PartitionKey       = authUser.MediaAccount.Id,
                RowKey             = job.Id,
                MediaAccount       = authUser.MediaAccount,
                StorageAccountName = storageAccountName,
                StorageAccountKey  = storageAccountKey,
                UserId             = authUser.Id,
                MobileNumber       = authUser.MobileNumber
            };

            TableClient tableClient = new TableClient();
            string      tableName   = Constant.Storage.Table.ContentPublish;

            tableClient.InsertEntity(tableName, contentPublish);

            ContentProtection[] contentProtections = MediaClient.GetContentProtections(directoryId, job, jobTasks);
            foreach (ContentProtection contentProtection in contentProtections)
            {
                tableName = Constant.Storage.Table.ContentProtection;
                contentProtection.PartitionKey = contentPublish.RowKey;
                tableClient.InsertEntity(tableName, contentProtection);
            }
        }