コード例 #1
0
        public GlobalJsonResult <Project> GetWorkingProject()
        {
            var projectId = store.GetWorkingProjectId();
            var result    = dispatcher.Dispatch(ProjectActions.GetProject(projectId));

            return(GlobalJsonResult <Project> .Success(System.Net.HttpStatusCode.OK, result));
        }
コード例 #2
0
        public GlobalJsonResult <EmptyResult> Load(int videoId, [FromBody] LoadVideoPlaybackRequest request)
        {
            var video = videoComponentService.GetById(videoId);

            videoPlayer.Load(video);

            return(GlobalJsonResult <EmptyResult> .Success(HttpStatusCode.OK));
        }
コード例 #3
0
        public GlobalJsonResult <Build> UpdateBuild([FromBody] UpdateBuildRequest request)
        {
            var build = request.Map();

            dataAccessDispatcher.Dispatch(BuildActions.UpdateBuild(build));

            return(GlobalJsonResult <Build> .Success(System.Net.HttpStatusCode.OK, build));
        }
コード例 #4
0
        public GlobalJsonResult <EmptyResult> Clear(int videoId)
        {
            var video = videoService.GetById(videoId);

            video.ClearFrames();

            return(GlobalJsonResult <EmptyResult> .Success(HttpStatusCode.OK));
        }
コード例 #5
0
        public GlobalJsonResult <EmptyResult> New([FromBody] VideoMetadataCreateRequest request)
        {
            var video = videoComponentService.Initialize(request.Id, request);

            videoComponentService.Save(video);

            return(GlobalJsonResult <EmptyResult> .Success(HttpStatusCode.Created));
        }
コード例 #6
0
        public GlobalJsonResult <bool> NewSession([FromBody] NewSessionRequest request)
        {
            var client = request.Map();

            clientStore.Set(client);

            return(GlobalJsonResult <bool> .Success(System.Net.HttpStatusCode.OK, true));
        }
コード例 #7
0
        public GlobalJsonResult <InstallationStatusResult> GetInstallationStatus()
        {
            var installationStatus = installation.GetStatus();

            var result = new InstallationStatusResult();

            result.PopulateFrom(installationStatus);

            return(GlobalJsonResult <InstallationStatusResult> .Success(System.Net.HttpStatusCode.OK, result));
        }
コード例 #8
0
        public GlobalJsonResult <EmptyResult> Append(int videoId, [FromBody] AppendFramesRequest request)
        {
            var video  = videoService.GetById(videoId);
            var frames = request.AppendFrameRequests
                         .Select(req => frameService.Initialize(1, req));

            video.AddFrames(frames);

            return(GlobalJsonResult <EmptyResult> .Success(HttpStatusCode.Created));
        }
コード例 #9
0
        public GlobalJsonResult <RollbackResult> RollbackComponentsForVersion([FromBody] RollbackRequest request)
        {
            installation.RollbackInstallationVersion(request.FailedInstallationComponentId, Version.Parse(request.FailedInstallationVersion));
            var version = installation.GetCurrentVersion();

            var result = new RollbackResult();

            result.PopulateFrom(version);

            return(GlobalJsonResult <RollbackResult> .Success(System.Net.HttpStatusCode.NoContent, result));
        }
コード例 #10
0
        public GlobalJsonResult <EmptyResult> Put([FromBody] VideoMetadataPutRequest request)
        {
            var video = videoComponentService.GetById(request.Id);

            PutRequest.DoThisIfValueIsNotDefault(request.FileName, v => video.SetFileName(v));
            PutRequest.DoThisIfValueIsNotDefault(request.FrameRate, v => video.SetFrameRate(v));

            videoComponentService.Save(video);

            return(GlobalJsonResult <EmptyResult> .Success(HttpStatusCode.OK));
        }
コード例 #11
0
        public GlobalJsonResult <InstallationResult> InstallNextComponent([FromBody] ComponentInstallationRequest request)
        {
            var installationResult = installation.InstallNextComponent(request.InstallationComponentId, Version.Parse(request.Version));

            var result = new InstallationResult();

            result.PopulateFrom(installationResult);

            return(result.IsSuccess
                ? GlobalJsonResult <InstallationResult> .Success(System.Net.HttpStatusCode.Created, result)
                : GlobalJsonResult <InstallationResult> .Success(System.Net.HttpStatusCode.OK, result));
        }
コード例 #12
0
        public GlobalJsonResult <InstallationResult> StartInstallation([FromBody] StartInstallationRequest request)
        {
            var installationResult = installation.StartInstallation();

            var result = new InstallationResult();

            result.PopulateFrom(installationResult);

            return(result.IsSuccess
                ? GlobalJsonResult <InstallationResult> .Success(System.Net.HttpStatusCode.Created, result)
                : GlobalJsonResult <InstallationResult> .Success(System.Net.HttpStatusCode.OK, result));
        }
コード例 #13
0
        public GlobalJsonResult <IEnumerable <VideoMetadataResult> > GetAll()
        {
            var results = videoComponentService
                          .GetAll()
                          .Select(v =>
            {
                var result = new VideoMetadataResult();
                result.Populate(v);
                return(result);
            });

            return(GlobalJsonResult <IEnumerable <VideoMetadataResult> > .Success(HttpStatusCode.OK, results));
        }
コード例 #14
0
        public GlobalJsonResult <VideoMetadataResponse> GetProjectVideoMetadata(int projectId)
        {
            var video = dispatcher.Dispatch(VideoActions.GetVideoForProject(projectId));

            Guard.This(video).AgainstDefaultValue(string.Format("No video exists for project with id {0}", projectId));
            Guard.This(video.FilePath).WithRule(path => File.Exists(path), string.Format("Video {0} does not exist", video.FilePath));

            videoFileReader.Open(video.FilePath);
            var result = new VideoMetadataResponse();

            result.Populate(videoFileReader);

            return(GlobalJsonResult <VideoMetadataResponse> .Success(System.Net.HttpStatusCode.OK, result));
        }
コード例 #15
0
        public GlobalJsonResult <ProjectVideo> AddMostRecentVideoUploadToProject(int projectId, int videoReferenceId)
        {
            var result = dispatcher.Dispatch(VideoActions.SetVideoForProject(projectId, videoReferenceId));

            // When a video changes, create new version of project devices
            var projectDevices = dispatcher.Dispatch(ProjectDeviceActions.GetProjectDevices(projectId));

            foreach (var projectDevice in projectDevices)
            {
                var latestProjectDeviceVersion = dispatcher.Dispatch(ProjectDeviceActions.GetLatestProjectDeviceVersion(projectDevice.Id));
                dispatcher.Dispatch(ProjectDeviceActions.SetLatestProjectDeviceVersion(latestProjectDeviceVersion));
            }

            return(GlobalJsonResult <ProjectVideo> .Success(System.Net.HttpStatusCode.Created, result));
        }
コード例 #16
0
        public GlobalJsonResult <Dictionary <string, string> > GetProjectDeviceStatuses(int projectId)
        {
            var projectDevices = dataAccessDispatcher.Dispatch(DeviceActions.GetProjectDevices(projectId));

            var statuses = new Dictionary <string, string>();

            foreach (var projectDevice in projectDevices)
            {
                var name = string.IsNullOrEmpty(projectDevice.Name)
                    ? projectDevice.IpAddress
                    : projectDevice.Name;

                var status = deviceStatusService.IsOnline(projectDevice)
                    ? ProjectDevicePlaybackStatus.Ready
                    : ProjectDevicePlaybackStatus.NotOnline;

                statuses.Add(name, status.ToString());
            }

            return(GlobalJsonResult <Dictionary <string, string> > .Success(System.Net.HttpStatusCode.OK, statuses));
        }
コード例 #17
0
        public GlobalJsonResult <Project> Get(int id)
        {
            var project = dispatcher.Dispatch(ProjectActions.GetProject(id));

            return(GlobalJsonResult <Project> .Success(System.Net.HttpStatusCode.OK, project));
        }
コード例 #18
0
        public GlobalJsonResult <VideoReference> GetProjectVideo(int projectId)
        {
            var result = dispatcher.Dispatch(VideoActions.GetVideoForProject(projectId));

            return(GlobalJsonResult <VideoReference> .Success(System.Net.HttpStatusCode.OK, result));
        }
コード例 #19
0
        public GlobalJsonResult <VideoReference> FinishVideoUpload()
        {
            var result = videoUploader.ConsumeAndFinishUpload();

            return(GlobalJsonResult <VideoReference> .Success(System.Net.HttpStatusCode.OK, result));
        }
コード例 #20
0
        public GlobalJsonResult <EmptyResult> PreUploadVideo(string fileName)
        {
            videoUploader.PreUpload(fileName);

            return(GlobalJsonResult <EmptyResult> .Success(System.Net.HttpStatusCode.OK));
        }
コード例 #21
0
        public GlobalJsonResult <IEnumerable <VideoReference> > GetVideoReferences()
        {
            var result = dispatcher.Dispatch(VideoActions.GetVideoReferences());

            return(GlobalJsonResult <IEnumerable <VideoReference> > .Success(System.Net.HttpStatusCode.OK, result));
        }
コード例 #22
0
        public GlobalJsonResult <EmptyResult> DeleteBuild([FromBody] DeleteBuildRequest request)
        {
            dataAccessDispatcher.Dispatch(BuildActions.DeleteBuild(request.Id));

            return(GlobalJsonResult <EmptyResult> .Success(System.Net.HttpStatusCode.NoContent));
        }
コード例 #23
0
        public GlobalJsonResult <EmptyResult> SetWorkingProject(int projectId)
        {
            store.SetCurrentProject(projectId);

            return(GlobalJsonResult <EmptyResult> .Success(System.Net.HttpStatusCode.Created));
        }
コード例 #24
0
        public GlobalJsonResult <EmptyResult> ClearWorkingProject()
        {
            store.ClearCurrentProject();

            return(GlobalJsonResult <EmptyResult> .Success(System.Net.HttpStatusCode.OK));
        }
コード例 #25
0
        public GlobalJsonResult <bool> HasWorkingProject()
        {
            var result = store.HasWorkingProject();

            return(GlobalJsonResult <bool> .Success(System.Net.HttpStatusCode.OK, result));
        }
コード例 #26
0
        public GlobalJsonResult <EmptyResult> Delete(int id)
        {
            dispatcher.Dispatch(ProjectActions.DeleteProject(id));

            return(GlobalJsonResult <EmptyResult> .Success(System.Net.HttpStatusCode.NoContent));
        }
コード例 #27
0
        public GlobalJsonResult <Project> Update([FromBody] Project project)
        {
            dispatcher.Dispatch(ProjectActions.UpdateProject(project));

            return(GlobalJsonResult <Project> .Success(System.Net.HttpStatusCode.OK, project));
        }
コード例 #28
0
        public GlobalJsonResult <IEnumerable <Project> > GetAll()
        {
            var projects = dispatcher.Dispatch(ProjectActions.GetAllProjects());

            return(GlobalJsonResult <IEnumerable <Project> > .Success(System.Net.HttpStatusCode.OK, projects));
        }
コード例 #29
0
 public GlobalJsonResult <DateTime> Get()
 {
     return(GlobalJsonResult <DateTime> .Success(System.Net.HttpStatusCode.OK, DateTime.Now));
 }
コード例 #30
0
        public GlobalJsonResult <Project> CopyProject(Project project)
        {
            var newProject = dispatcher.Dispatch(ProjectActions.CopyProject(project));

            return(GlobalJsonResult <Project> .Success(System.Net.HttpStatusCode.Created, newProject));
        }