예제 #1
0
 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);
 }
예제 #2
0
        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();
        }
예제 #3
0
        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);
        }
예제 #4
0
        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;
        }
예제 #5
0
        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;
        }
예제 #6
0
 private void RemoveAssets(RemoveContentContext context, CloudVideoPart part) {
     _assetManager.DeleteAssetsFor(part);
     _jobManager.CloseJobsFor(part);
 }
예제 #7
0
 private void CancelAndUnpublishAssets(PublishContentContext context, CloudVideoPart part) {
     part.PublishOnUpload = false;
     _assetManager.UnpublishAssetsFor(part);
 }
예제 #8
0
 private void SetupFields(ActivatedContentContext context, CloudVideoPart part) {
     part._assetManager = _assetManager;
     part._jobManager = _jobManager;
 } 
예제 #9
0
 private IQueryable<JobRecord> GetJobRecordsFor(CloudVideoPart part) {
     return
         from jobRecord in _jobRepository.Table
         where jobRecord.CloudVideoPartId == part.Id
         select jobRecord;
 }
예제 #10
0
        public void CloseJobsFor(CloudVideoPart part) {
            var openJobs = GetJobRecordsFor(part).Select(Activate).Where(x => x.IsOpen);

            foreach (var job in openJobs) {
                job.Status = JobStatus.Archived;
            }
        }