Skip to content

Commit

Permalink
Merge pull request #1 from amagimedia/ak-fix-whitespace
Browse files Browse the repository at this point in the history
fix(srt): consider whitespace texts as text
  • Loading branch information
vinayagar-amagi authored Sep 14, 2022
2 parents 05cf405 + 1cf0985 commit 1367bc4
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion lib/captions/formats/srt.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,10 @@ def parse
count += 1
line = @file.gets
break if line.nil? ## End of file
line.strip!
line.chomp!
case state
when :new_cue
line.strip!
next if line.empty? ## just another blank line, remain in new_cue state
begin
cue = Cue.new(Integer(line))
Expand All @@ -21,6 +22,7 @@ def parse
end
state = :time
when :time
line.strip!
raise InvalidSubtitle, "Invalid Time Format at line #{count}" unless is_time?(line)
start_time, end_time = get_time(line)
cue.set_time(start_time, end_time)
Expand All @@ -32,6 +34,7 @@ def parse
cue = nil
state = :new_cue
else
line.strip!
cue.add_text(line)
end
end
Expand Down

0 comments on commit 1367bc4

Please sign in to comment.