Class: RestFtpDaemon::Transform::TransformMp4split
- Inherits:
-
TaskTransform
- Object
- TaskTransform
- RestFtpDaemon::Transform::TransformMp4split
- Defined in:
- lib/plugins/rest-ftp-daemon/transform/transform_mp4split.rb
Instance Method Summary collapse
-
#prepare ⇒ Object
Task operations.
- #process ⇒ Object
-
#task_icon ⇒ Object
Task attributes.
Instance Method Details
#prepare ⇒ Object
Task operations
15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 |
# File 'lib/plugins/rest-ftp-daemon/transform/transform_mp4split.rb', line 15 def prepare # Init @command = @config[:command] # Ensure MP4SPLIT lib is available raise Task::TransformMissingBinary, "mp4split binary not found: #{@config[:command]}" unless File.exist? (@command) raise Task::TransformMissingBinary, "mp4split binary not executable: #{@config[:command]}" unless File.executable? (@command) # Ensure MP4SPLIT licence is available @licence = @config[:licence] raise Task::TransformMissingBinary, "mp4split licence not found: #{@config[:licence]}" unless @config[:licence] # Target loc should have a name raise Task::TargetNameRequired, "mp4split requires target to provided a filename" unless target_loc.name end |
#process ⇒ Object
31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 |
# File 'lib/plugins/rest-ftp-daemon/transform/transform_mp4split.rb', line 31 def process # Generate temp target from current location #output = target_loc.clone output = tempfile_for("transform") # Ensure target directory exists t_dir = output.dir_abs log_info "mkdir_p [#{t_dir}]" FileUtils.mkdir_p t_dir # Run command # Build a tempfile with a custom name licence_file = Tempfile.new('mp4split-licence-') licence_file.write(@licence) licence_file.close mp4split input, output, licence_file.path end |
#task_icon ⇒ Object
Task attributes
10 11 12 |
# File 'lib/plugins/rest-ftp-daemon/transform/transform_mp4split.rb', line 10 def task_icon "film" end |