Class: Ace::Demo::Organisms::DemoRecorder
- Inherits:
-
Object
- Object
- Ace::Demo::Organisms::DemoRecorder
- Defined in:
- lib/ace/demo/organisms/demo_recorder.rb
Constant Summary collapse
- SUPPORTED_FORMATS =
%w[gif webm].freeze
Instance Method Summary collapse
-
#initialize(resolver: Molecules::TapeResolver.new, executor: Molecules::VhsExecutor.new, asciinema_executor: Molecules::AsciinemaExecutor.new, agg_executor: Molecules::AggExecutor.new, cast_verifier: Molecules::CastVerifier.new, yaml_parser: Atoms::DemoYamlParser, yaml_compiler: Atoms::VhsTapeCompiler, asciinema_tape_compiler: Atoms::AsciinemaTapeCompiler, media_retimer: Molecules::MediaRetimer.new, sandbox_builder: Molecules::DemoSandboxBuilder.new, teardown_executor: Molecules::DemoTeardownExecutor.new, output_dir: Demo.config["output_dir"], vhs_bin: Demo.config["vhs_bin"], asciinema_bin: Demo.config["asciinema_bin"], agg_bin: Demo.config["agg_bin"], agg_font_family: Demo.config["agg_font_family"], default_backend: Demo.config.dig("record", "backend")) ⇒ DemoRecorder
constructor
A new instance of DemoRecorder.
- #record(tape_ref:, output: nil, format: nil, playback_speed: nil, retime_output: nil, yaml_spec: nil, backend: nil) ⇒ Object
Constructor Details
#initialize(resolver: Molecules::TapeResolver.new, executor: Molecules::VhsExecutor.new, asciinema_executor: Molecules::AsciinemaExecutor.new, agg_executor: Molecules::AggExecutor.new, cast_verifier: Molecules::CastVerifier.new, yaml_parser: Atoms::DemoYamlParser, yaml_compiler: Atoms::VhsTapeCompiler, asciinema_tape_compiler: Atoms::AsciinemaTapeCompiler, media_retimer: Molecules::MediaRetimer.new, sandbox_builder: Molecules::DemoSandboxBuilder.new, teardown_executor: Molecules::DemoTeardownExecutor.new, output_dir: Demo.config["output_dir"], vhs_bin: Demo.config["vhs_bin"], asciinema_bin: Demo.config["asciinema_bin"], agg_bin: Demo.config["agg_bin"], agg_font_family: Demo.config["agg_font_family"], default_backend: Demo.config.dig("record", "backend")) ⇒ DemoRecorder
Returns a new instance of DemoRecorder.
12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 |
# File 'lib/ace/demo/organisms/demo_recorder.rb', line 12 def initialize( resolver: Molecules::TapeResolver.new, executor: Molecules::VhsExecutor.new, asciinema_executor: Molecules::AsciinemaExecutor.new, agg_executor: Molecules::AggExecutor.new, cast_verifier: Molecules::CastVerifier.new, yaml_parser: Atoms::DemoYamlParser, yaml_compiler: Atoms::VhsTapeCompiler, asciinema_tape_compiler: Atoms::AsciinemaTapeCompiler, media_retimer: Molecules::MediaRetimer.new, sandbox_builder: Molecules::DemoSandboxBuilder.new, teardown_executor: Molecules::DemoTeardownExecutor.new, output_dir: Demo.config["output_dir"], vhs_bin: Demo.config["vhs_bin"], asciinema_bin: Demo.config["asciinema_bin"], agg_bin: Demo.config["agg_bin"], agg_font_family: Demo.config["agg_font_family"], default_backend: Demo.config.dig("record", "backend") ) @resolver = resolver @executor = executor @asciinema_executor = asciinema_executor @agg_executor = agg_executor @cast_verifier = cast_verifier @yaml_parser = yaml_parser @yaml_compiler = yaml_compiler @asciinema_tape_compiler = asciinema_tape_compiler @media_retimer = media_retimer @sandbox_builder = sandbox_builder @teardown_executor = teardown_executor @output_dir = output_dir || ".ace-local/demo" @vhs_bin = vhs_bin || "vhs" @asciinema_bin = asciinema_bin || "asciinema" @agg_bin = agg_bin || "agg" @agg_font_family = agg_font_family @default_backend = default_backend || "asciinema" end |
Instance Method Details
#record(tape_ref:, output: nil, format: nil, playback_speed: nil, retime_output: nil, yaml_spec: nil, backend: nil) ⇒ Object
50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 |
# File 'lib/ace/demo/organisms/demo_recorder.rb', line 50 def record(tape_ref:, output: nil, format: nil, playback_speed: nil, retime_output: nil, yaml_spec: nil, backend: nil) normalized_format = Atoms::RecordOptionValidator.normalize_format( format, supported_formats: SUPPORTED_FORMATS ) normalized_backend = Atoms::RecordOptionValidator.normalize_backend(backend) tape_path = @resolver.resolve(tape_ref) return record_yaml_tape( tape_path: tape_path, output: output, format: normalized_format, playback_speed: playback_speed, retime_output: retime_output, yaml_spec: yaml_spec, backend: normalized_backend ) if yaml_tape?(tape_path) Atoms::RecordOptionValidator.validate_raw_tape_backend!(backend: normalized_backend) record_tape_file(tape_path: tape_path, output: output, format: normalized_format || "gif") end |