Class: M3Uzi::File

Inherits:
Item
  • Object
show all
Defined in:
lib/m3uzi/file.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from Item

#valid?

Constructor Details

#initializeFile

Unsupported tags: PROGRAM-DATE-TIME, DISCONTINUITY, I-FRAMES-ONLY Autogenerated tags: EXTINF, BYTERANGE, KEY, VERSION, TARGETDURATION, ENDLIST



9
10
11
# File 'lib/m3uzi/file.rb', line 9

def initialize
  @encryption_key_url = :unset
end

Instance Attribute Details

#byterangeObject

Returns the value of attribute byterange.



4
5
6
# File 'lib/m3uzi/file.rb', line 4

def byterange
  @byterange
end

#byterange_offsetObject

Returns the value of attribute byterange_offset.



4
5
6
# File 'lib/m3uzi/file.rb', line 4

def byterange_offset
  @byterange_offset
end

#descriptionObject

Returns the value of attribute description.



4
5
6
# File 'lib/m3uzi/file.rb', line 4

def description
  @description
end

#durationObject

Returns the value of attribute duration.



4
5
6
# File 'lib/m3uzi/file.rb', line 4

def duration
  @duration
end

#encryption_ivObject

Returns the value of attribute encryption_iv.



4
5
6
# File 'lib/m3uzi/file.rb', line 4

def encryption_iv
  @encryption_iv
end

#encryption_key_urlObject

Returns the value of attribute encryption_key_url.



4
5
6
# File 'lib/m3uzi/file.rb', line 4

def encryption_key_url
  @encryption_key_url
end

#pathObject

Returns the value of attribute path.



4
5
6
# File 'lib/m3uzi/file.rb', line 4

def path
  @path
end

Instance Method Details

#attribute_stringObject



13
14
15
16
17
18
19
# File 'lib/m3uzi/file.rb', line 13

def attribute_string
  if duration.kind_of?(Float)
    "#{sprintf('%0.4f',duration)}," + description.to_s.gsub(/[\r\n]/,' ').strip
  else
    "#{duration.to_i.round}," + description.to_s.gsub(/[\r\n]/,' ').strip
  end
end

#formatObject



21
22
23
24
# File 'lib/m3uzi/file.rb', line 21

def format
  # Need to add key info if appropriate?
  "#EXTINF:#{attribute_string}\n#{path}"
end