Class: RestFtpDaemon::Transform::Mp4split
- Inherits:
-
Base
- Object
- Base
- RestFtpDaemon::Transform::Mp4split
- Defined in:
- lib/plugins/rest-ftp-daemon/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
12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 |
# File 'lib/plugins/rest-ftp-daemon/transform/mp4split.rb', line 12 def prepare super # Init @command = @config[:command] # Ensure MP4SPLIT lib is available raise RestFtpDaemon::Transform::ErrorMissingBinary, "mp4split binary not found: #{@config[:command]}" unless File.exist? (@command) raise RestFtpDaemon::Transform::ErrorMissingBinary, "mp4split binary not executable: #{@config[:command]}" unless File.executable? (@command) # Ensure MP4SPLIT licence is available @licence = @config[:licence] raise RestFtpDaemon::Transform::ErrorMissingBinary, "mp4split licence not found: #{@config[:licence]}" unless @config[:licence] # Target loc should have a name raise RestFtpDaemon::TargetNameRequired, "mp4split requires target to provided a filename" unless target_loc.name end |
#process ⇒ Object
30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 |
# File 'lib/plugins/rest-ftp-daemon/transform/mp4split.rb', line 30 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
7 8 9 |
# File 'lib/plugins/rest-ftp-daemon/transform/mp4split.rb', line 7 def task_icon "film" end |