Class: Titlekit::Specification
- Inherits:
-
Object
- Object
- Titlekit::Specification
- Defined in:
- lib/titlekit/specification.rb
Instance Attribute Summary collapse
-
#subtitles ⇒ Object
Only for internal usage by the job control center.
Instance Method Summary collapse
-
#encoding(*args) ⇒ Object
If you omit the argument, it returns the already specified encoding.
-
#file(*args) ⇒ Object
If you omit the argument, it returns the already specified path.
-
#fps(*args) ⇒ Object
If you omit the argument, it returns the already specified fps.
-
#initialize ⇒ Specification
constructor
A new instance of Specification.
-
#reference(name, *args, hours: nil, minutes: nil, seconds: nil, milliseconds: nil, srt_timecode: nil, ssa_timecode: nil, ass_timecode: nil) ⇒ Object
Places a named reference (in the form of a string or a symbol) on a timecode specified by either
hours,minutes,secondsormilliseconds. -
#references ⇒ Object
Returns all named references you have specified.
-
#track(*args) ⇒ Object
If you omit the argument, it returns the already specified track.
Constructor Details
#initialize ⇒ Specification
Returns a new instance of Specification.
7 8 9 10 11 12 13 14 15 16 |
# File 'lib/titlekit/specification.rb', line 7 def initialize @encoding = nil @file = nil @fps = nil @references = {} @subtitles = [] @track = nil return self end |
Instance Attribute Details
#subtitles ⇒ Object
Only for internal usage by the job control center
5 6 7 |
# File 'lib/titlekit/specification.rb', line 5 def subtitles @subtitles end |
Instance Method Details
#encoding(*args) ⇒ Object
Returns If you omit the argument, it returns the already specified encoding.
20 21 22 23 24 25 26 27 |
# File 'lib/titlekit/specification.rb', line 20 def encoding(*args) if args.empty? return @encoding else @encoding = args[0] return self end end |
#file(*args) ⇒ Object
Returns If you omit the argument, it returns the already specified path.
31 32 33 34 35 36 37 38 |
# File 'lib/titlekit/specification.rb', line 31 def file(*args) if args.empty? return @file else @file = args[0] return self end end |
#fps(*args) ⇒ Object
Returns If you omit the argument, it returns the already specified fps.
53 54 55 56 57 58 59 60 |
# File 'lib/titlekit/specification.rb', line 53 def fps(*args) if args.empty? return @fps else @fps = args[0] return self end end |
#reference(name, *args, hours: nil, minutes: nil, seconds: nil, milliseconds: nil, srt_timecode: nil, ssa_timecode: nil, ass_timecode: nil) ⇒ Object
Places a named reference (in the form of a string or a symbol) on a timecode specified by either hours, minutes, seconds or milliseconds.
Its typical use-case is to reference a specific subtitle you can recognize in both the movie and your subtitle file, where usually for the subtitle file (represented by Have) you will reference the subtitle index and for the movie (represented by Want) you will reference the timecode that is displayed when the line occurs in the movie.
101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 |
# File 'lib/titlekit/specification.rb', line 101 def reference(name, *args, hours: nil, minutes: nil, seconds: nil, milliseconds: nil, srt_timecode: nil, ssa_timecode: nil, ass_timecode: nil) @references[name] = case when hours { timecode: hours * 3600 } when minutes { timecode: minutes * 60 } when seconds { timecode: seconds } when milliseconds { timecode: milliseconds / 1000 } when srt_timecode { timecode: Titlekit::SRT.parse_timecode(srt_timecode) } when ssa_timecode { timecode: Titlekit::SSA.parse_timecode(ssa_timecode) } when ass_timecode { timecode: Titlekit::ASS.parse_timecode(ass_timecode) } end return self end |
#references ⇒ Object
Returns all named references you have specified
63 64 65 |
# File 'lib/titlekit/specification.rb', line 63 def references return @references end |
#track(*args) ⇒ Object
Returns If you omit the argument, it returns the already specified track.
42 43 44 45 46 47 48 49 |
# File 'lib/titlekit/specification.rb', line 42 def track(*args) if args.empty? return @track else @track = args[0] return self end end |