예제 #1
0
        private static dynamic GetResult(FileContainer fileContainer, bool error = false)
        {
            switch (fileContainer.TypeContainer)
            {
            case TypeContainer.Video:
                return(new
                {
                    finished = fileContainer.Finished(),
                    debugInfo = error ? DebugInfo(fileContainer) : null,
                    sourceAudioCpuEncoding = AudioCpuEncodeResultJson(fileContainer.SourceFileItem, error),
                    sourceVideoGpuEncoding = VideoGpuEncodeResultJson(fileContainer.SourceFileItem, error),
                    ipfsAddSourceVideo = IpfsResultJson(fileContainer.SourceFileItem, error),
                    sprite = fileContainer.SpriteVideoFileItem == null ? null :
                             new
                    {
                        spriteCreation = SpriteResultJson(fileContainer.SpriteVideoFileItem, error),
                        ipfsAddSprite = IpfsResultJson(fileContainer.SpriteVideoFileItem, error)
                    },
                    encodedVideos = !fileContainer.EncodedFileItems.Any() ? null :
                                    fileContainer.EncodedFileItems.Select(e =>
                                                                          new
                    {
                        encode = AudioVideoCpuEncodeResultJson(e, error),
                        ipfsAddEncodeVideo = IpfsResultJson(e, error)
                    })
                                    .ToArray()
                });

            case TypeContainer.Image:
                return(new
                {
                    ipfsAddSource = IpfsResultJson(fileContainer.SnapFileItem, error),
                    ipfsAddOverlay = IpfsResultJson(fileContainer.OverlayFileItem, error)
                });

            case TypeContainer.Subtitle:
                return(new
                {
                    ipfsAddSource = IpfsResultJson(fileContainer.SubtitleFileItem, error)
                });
            }

            LogManager.AddGeneralMessage(LogLevel.Critical, "Type container non géré " + fileContainer.TypeContainer, "Error");
            throw new InvalidOperationException("type container non géré");
        }
예제 #2
0
        private JsonResult GetResult(FileContainer fileContainer)
        {
            switch (fileContainer.TypeContainer)
            {
            case TypeContainer.Video:
                return(Json(new
                {
                    finished = fileContainer.Finished(),
                    sourceAudioCpuEncoding = AudioCpuEncodeResultJson(fileContainer.SourceFileItem),
                    sourceVideoGpuEncoding = VideoGpuEncodeResultJson(fileContainer.SourceFileItem),
                    ipfsAddSourceVideo = IpfsResultJson(fileContainer.SourceFileItem),
                    sprite = fileContainer.SpriteVideoFileItem == null ? null : (new
                    {
                        spriteCreation = SpriteResultJson(fileContainer.SpriteVideoFileItem),
                        ipfsAddSprite = IpfsResultJson(fileContainer.SpriteVideoFileItem)
                    }),
                    encodedVideos = fileContainer.EncodedFileItems
                                    .Select(e =>
                                            new
                    {
                        encode = AudioVideoCpuEncodeResultJson(e),
                        ipfsAddEncodeVideo = IpfsResultJson(e)
                    })
                                    .ToArray()
                }));

            case TypeContainer.Overlay:
                return(Json(new
                {
                    ipfsAddSource = IpfsResultJson(fileContainer.SourceFileItem),
                    ipfsAddOverlay = IpfsResultJson(fileContainer.OverlayFileItem)
                }));
            }

            Debug.WriteLine("Type container non géré " + fileContainer.TypeContainer);
            throw new InvalidOperationException("type container non géré");
        }