Class: SubtitleIt::Subtitle
- Inherits:
-
Object
- Object
- SubtitleIt::Subtitle
- Includes:
- Comparable, Formats
- Defined in:
- lib/subtitle_it/subtitle.rb
Instance Attribute Summary collapse
-
#download_count ⇒ Object
readonly
Returns the value of attribute download_count.
-
#download_url ⇒ Object
readonly
Returns the value of attribute download_url.
-
#filename ⇒ Object
readonly
Returns the value of attribute filename.
-
#format ⇒ Object
readonly
Returns the value of attribute format.
-
#fps ⇒ Object
writeonly
Sets the attribute fps.
-
#id ⇒ Object
readonly
Returns the value of attribute id.
-
#info ⇒ Object
readonly
Returns the value of attribute info.
-
#language ⇒ Object
readonly
Returns the value of attribute language.
-
#lines ⇒ Object
Returns the value of attribute lines.
-
#original_filename ⇒ Object
readonly
Returns the value of attribute original_filename.
-
#osdb_id ⇒ Object
readonly
Returns the value of attribute osdb_id.
-
#rating ⇒ Object
readonly
Returns the value of attribute rating.
-
#raw ⇒ Object
readonly
Returns the value of attribute raw.
-
#release_name ⇒ Object
readonly
Returns the value of attribute release_name.
-
#style ⇒ Object
Returns the value of attribute style.
-
#user ⇒ Object
readonly
Returns the value of attribute user.
Instance Method Summary collapse
- #<=>(other) ⇒ Object
- #data=(data) ⇒ Object
-
#initialize(args = {}) ⇒ Subtitle
constructor
A new instance of Subtitle.
Methods included from Formats
#endl, #parse_ass, #parse_mpl, #parse_rsb, #parse_srt, #parse_sub, #parse_time, #parse_xml, #parse_yml, #ratio, #to_ass, #to_mpl, #to_rsb, #to_srt, #to_sub, #to_xml, #to_yml, #xml_lines
Methods included from PlatformEndLine
Constructor Details
#initialize(args = {}) ⇒ Subtitle
Returns a new instance of Subtitle.
22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 |
# File 'lib/subtitle_it/subtitle.rb', line 22 def initialize(args = {}) # Looks like opensubtitle is the only provider around.. # If a second one comes need big refactor... if @info = args[:info] # @osdb_info = info @osdb_id = @info['IDSubtitleFile'].to_s @original_filename = @info['SubFileName'].to_s @format = @info['SubFormat'].to_s @user = @info['UserNickName'].to_s @language = @info['LanguageName'].to_s @release_name = @info['MovieReleaseName'].to_s @download_count = @info['SubDownloadsCnt'].to_i @rating = @info['SubRating'].to_f @uploaded_at = @info['SubAddDate'].to_s # TODO: convert to time object? @download_url = @info['SubDownloadLink'].to_s end @fps = args[:fps] || 23.976 return unless dump = args[:dump] parse_dump(args[:dump], args[:format]) end |
Instance Attribute Details
#download_count ⇒ Object (readonly)
Returns the value of attribute download_count.
18 19 20 |
# File 'lib/subtitle_it/subtitle.rb', line 18 def download_count @download_count end |
#download_url ⇒ Object (readonly)
Returns the value of attribute download_url.
18 19 20 |
# File 'lib/subtitle_it/subtitle.rb', line 18 def download_url @download_url end |
#filename ⇒ Object (readonly)
Returns the value of attribute filename.
18 19 20 |
# File 'lib/subtitle_it/subtitle.rb', line 18 def filename @filename end |
#format ⇒ Object (readonly)
Returns the value of attribute format.
18 19 20 |
# File 'lib/subtitle_it/subtitle.rb', line 18 def format @format end |
#fps=(value) ⇒ Object (writeonly)
Sets the attribute fps
20 21 22 |
# File 'lib/subtitle_it/subtitle.rb', line 20 def fps=(value) @fps = value end |
#id ⇒ Object (readonly)
Returns the value of attribute id.
18 19 20 |
# File 'lib/subtitle_it/subtitle.rb', line 18 def id @id end |
#info ⇒ Object (readonly)
Returns the value of attribute info.
18 19 20 |
# File 'lib/subtitle_it/subtitle.rb', line 18 def info @info end |
#language ⇒ Object (readonly)
Returns the value of attribute language.
18 19 20 |
# File 'lib/subtitle_it/subtitle.rb', line 18 def language @language end |
#lines ⇒ Object
Returns the value of attribute lines.
18 19 20 |
# File 'lib/subtitle_it/subtitle.rb', line 18 def lines @lines end |
#original_filename ⇒ Object (readonly)
Returns the value of attribute original_filename.
18 19 20 |
# File 'lib/subtitle_it/subtitle.rb', line 18 def original_filename @original_filename end |
#osdb_id ⇒ Object (readonly)
Returns the value of attribute osdb_id.
18 19 20 |
# File 'lib/subtitle_it/subtitle.rb', line 18 def osdb_id @osdb_id end |
#rating ⇒ Object (readonly)
Returns the value of attribute rating.
18 19 20 |
# File 'lib/subtitle_it/subtitle.rb', line 18 def @rating end |
#raw ⇒ Object (readonly)
Returns the value of attribute raw.
18 19 20 |
# File 'lib/subtitle_it/subtitle.rb', line 18 def raw @raw end |
#release_name ⇒ Object (readonly)
Returns the value of attribute release_name.
18 19 20 |
# File 'lib/subtitle_it/subtitle.rb', line 18 def release_name @release_name end |
#style ⇒ Object
Returns the value of attribute style.
18 19 20 |
# File 'lib/subtitle_it/subtitle.rb', line 18 def style @style end |
#user ⇒ Object (readonly)
Returns the value of attribute user.
18 19 20 |
# File 'lib/subtitle_it/subtitle.rb', line 18 def user @user end |
Instance Method Details
#<=>(other) ⇒ Object
47 48 49 |
# File 'lib/subtitle_it/subtitle.rb', line 47 def <=>(other) <=> other. end |
#data=(data) ⇒ Object
43 44 45 |
# File 'lib/subtitle_it/subtitle.rb', line 43 def data=(data) @raw = data end |