private void DeferOrPublishAssets(PublishContentContext context, CloudVideoPart part) { if (part.MezzanineAsset != null && part.MezzanineAsset.UploadState.Status != AssetUploadStatus.Uploaded) { part.PublishOnUpload = true; _notifier.Warning(T("The cloud video item was saved, but will not be published until the primary video asset has finished uploading to Windows Azure Media Services.")); context.Cancel = true; } else _assetManager.PublishAssetsFor(part); }
public IEnumerable<Job> GetJobsFor(CloudVideoPart part) { Logger.Debug("GetJobsFor() invoked for cloud video item with ID {0}.", part.Id); var jobsQuery = from jobRecord in GetJobRecordsFor(part) select Activate(jobRecord); // OK to call Activate() inline here because GetJobRecordsFor() contains an inner projection. return jobsQuery.ToArray(); }
public void DeleteJobsFor(CloudVideoPart part) { Logger.Debug("DeleteJobsFor() invoked for cloud video item with ID {0}.", part.Id); var records = GetJobRecordsFor(part); foreach (var record in records) { _jobRepository.Delete(record); Logger.Information("Job with record ID {0} was deleted.", record.Id); } Logger.Information("Jobs were deleted for cloud video item with ID {0}.", part.Id); }
public Job CreateJobFor(CloudVideoPart part, Action<Job> initialize = null) { Logger.Debug("CreateJobFor() invoked for cloud video item with ID {0}.", part.Id); var newJob = Activate(new JobRecord { CloudVideoPartId = part.Id }); if (initialize != null) initialize(newJob); _jobRepository.Create(newJob.Record); Logger.Information("New job was created with record ID {0} for cloud video item with ID {1}.", newJob.Record.Id, part.Id); return newJob; }
private IShape CreatePlayershape(CloudVideoPart part, HtmlNode node) { var playerWidth = GetInt32(node, "data-player-width"); var playerHeight = GetInt32(node, "data-player-height"); var applyMediaQueries = GetBoolean(node, "data-player-apply-media-queries"); var autoPlay = GetBoolean(node, "data-player-auto-play"); var playerShape = _shapeFactory.Create("CloudVideoPlayer", Arguments.From(new { CloudVideoPart = part, AssetId = default(int?), IgnoreIncludeInPlayer = false, AllowPrivateUrls = false, PlayerWidth = playerWidth, PlayerHeight = playerHeight, ApplyMediaQueries = applyMediaQueries, AutoPlay = autoPlay })); return playerShape; }
private void RemoveAssets(RemoveContentContext context, CloudVideoPart part) { _assetManager.DeleteAssetsFor(part); _jobManager.CloseJobsFor(part); }
private void CancelAndUnpublishAssets(PublishContentContext context, CloudVideoPart part) { part.PublishOnUpload = false; _assetManager.UnpublishAssetsFor(part); }
private void SetupFields(ActivatedContentContext context, CloudVideoPart part) { part._assetManager = _assetManager; part._jobManager = _jobManager; }
private IQueryable<JobRecord> GetJobRecordsFor(CloudVideoPart part) { return from jobRecord in _jobRepository.Table where jobRecord.CloudVideoPartId == part.Id select jobRecord; }
public void CloseJobsFor(CloudVideoPart part) { var openJobs = GetJobRecordsFor(part).Select(Activate).Where(x => x.IsOpen); foreach (var job in openJobs) { job.Status = JobStatus.Archived; } }