Class: RubyLens::ClipGenerator
- Inherits:
-
Object
- Object
- RubyLens::ClipGenerator
- Defined in:
- lib/rubylens/clip_generator.rb
Overview
Generates a shareable MP4 of a project's showcase. The showcase HTML is written first (it is the render input and stays useful on its own), then headless Chrome and ffmpeg turn it into one seamless 1080p camera loop. The toolchain is checked before any indexing so a missing browser or ffmpeg fails in under a second with install guidance.
Constant Summary collapse
- DEFAULT_CLIP_NAME =
"rubylens-clip.mp4"- MARKER_SCAN_HEAD_BYTES =
faststart parks the metadata (and so the marker) right behind ftyp, so every clip RubyLens writes matches within this head window.
512 * 1024
Instance Method Summary collapse
- #call ⇒ Object
-
#initialize(path: Dir.pwd, output: nil, lockfile: nil, details: false, progress: nil, renderer: nil) ⇒ ClipGenerator
constructor
A new instance of ClipGenerator.
Constructor Details
#initialize(path: Dir.pwd, output: nil, lockfile: nil, details: false, progress: nil, renderer: nil) ⇒ ClipGenerator
Returns a new instance of ClipGenerator.
26 27 28 29 30 31 32 33 |
# File 'lib/rubylens/clip_generator.rb', line 26 def initialize(path: Dir.pwd, output: nil, lockfile: nil, details: false, progress: nil, renderer: nil) @path = path @output = output @lockfile = lockfile @details = details @progress = progress @renderer = renderer end |
Instance Method Details
#call ⇒ Object
35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 |
# File 'lib/rubylens/clip_generator.rb', line 35 def call renderer = @renderer || build_renderer root = File.realpath(@path) output, showcase_output = resolve_outputs(root) showcase_result = ShowcaseGenerator.new( path: @path, output: showcase_output, lockfile: @lockfile, details: @details, ).call render_atomically(renderer, showcase_result.output_path, output) ClipResult.new( output_path: output, showcase_path: showcase_result.output_path, counts: showcase_result.counts, warnings: showcase_result.warnings, ) rescue Errno::ENOENT, Errno::EACCES, Errno::ELOOP => error raise Error, error. end |