Class: DFXP
Overview
Library to handle DFXP Files
Extends the TTML Class as except for namespace differences there isn't much to call between ttml and dfxp
Constant Summary collapse
- SUPPORTED_TRANSFORMATIONS =
[TYPE_SCC, TYPE_SRT, TYPE_VTT, TYPE_TTML]
Constants included from CommonUtils
CommonUtils::CREDITS, CommonUtils::SCC_DEFAULT_FRAME_RATE
Constants included from AllFather
AllFather::TYPE_DFXP, AllFather::TYPE_SCC, AllFather::TYPE_SRT, AllFather::TYPE_TTML, AllFather::TYPE_VTT, AllFather::VALID_FILES
Instance Method Summary collapse
- #callsign ⇒ Object
-
#initialize(cc_file, opts = nil) ⇒ DFXP
constructor
A new instance of DFXP.
- #is_valid? ⇒ Boolean
- #supported_transformations ⇒ Object
Methods inherited from TTML
#infer_languages, #set_translator, #transform_to, #translate
Methods included from CommonUtils
#create_file, #extension_from_type, #new_cue, #scc_encode, #time_details, #write_cue
Methods included from AllFather
#infer_languages, #set_translator, #transform_to, #translate
Constructor Details
#initialize(cc_file, opts = nil) ⇒ DFXP
Returns a new instance of DFXP.
15 16 17 18 19 |
# File 'lib/dfxp.rb', line 15 def initialize(cc_file, opts=nil) @cc_file = cc_file @force_detect = opts ? (opts[:force_detect] || false) : false raise "Invalid DFXP file provided" unless is_valid? end |
Instance Method Details
#callsign ⇒ Object
31 32 33 |
# File 'lib/dfxp.rb', line 31 def callsign TYPE_DFXP end |
#is_valid? ⇒ Boolean
21 22 23 24 25 26 27 28 29 |
# File 'lib/dfxp.rb', line 21 def is_valid? # Do any VTT specific validations here if @cc_file =~ /^.*\.(dfxp)$/ return true end # TODO: Check if it's required to do a File read to see if this # a well-formed XML. Another is to see if lang is available in each div return false end |
#supported_transformations ⇒ Object
35 36 37 |
# File 'lib/dfxp.rb', line 35 def supported_transformations return SUPPORTED_TRANSFORMATIONS end |