Skip to content

Commit

Permalink
Merge pull request #6 from kingcos/dev
Browse files Browse the repository at this point in the history
Compatible with some video players
  • Loading branch information
kingcos committed Sep 16, 2017
2 parents bdba186 + 0874731 commit 4d02836
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 3 deletions.
2 changes: 1 addition & 1 deletion Sources/WWDCHelper/main.swift
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import CommandLineKit
import Rainbow
import WWDCHelperKit

let appVersion = "v0.2.0"
let appVersion = "v0.3.0"
let cli = CommandLineKit.CommandLine()

cli.formatOutput = { s, type in
Expand Down
4 changes: 3 additions & 1 deletion Sources/WWDCWebVTTToSRTHelperKit/WebVTTParsable.swift
Original file line number Diff line number Diff line change
Expand Up @@ -58,11 +58,13 @@ extension RegexWebVTTParsable {
while i < contentArr.count {
if contentArr[i].contains("-->") {
contentArr.insert("\(n)", at: i)
contentArr.insert("", at: i)
n += 1
i += 1
i += 2
}
i += 1
}
contentArr.removeFirst()
}

func dealWithLines(_ contentArr: inout [String]) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ public func testWWDCWebVTTToSRTHelperKit() {
let expectResult = ["1",
"01:42:58.766 --> 01:43:00.516 A:middle",
"&gt;&gt; And with that, I hope you have a &lt;&lt;",
"",
"2",
"01:43:00.516 --> 01:43:01.546 A:middle",
"<c.magenta>great conference, and I'll see</c>",
Expand All @@ -83,6 +84,7 @@ public func testWWDCWebVTTToSRTHelperKit() {
let expectResult = ["1",
"01:42:58,766 --> 01:43:00,516",
"&gt;&gt; And with that, I hope you have a &lt;&lt;",
"",
"2",
"01:43:00,516 --> 01:43:01,546",
"great conference, and I'll see",
Expand All @@ -96,6 +98,7 @@ public func testWWDCWebVTTToSRTHelperKit() {
let expectResult = ["1",
"01:42:58,766 --> 01:43:00,516",
">> And with that, I hope you have a <<",
"",
"2",
"01:43:00,516 --> 01:43:01,546",
"great conference, and I'll see",
Expand All @@ -109,6 +112,7 @@ public func testWWDCWebVTTToSRTHelperKit() {
let expectResult = ["1",
"01:42:58,766 --> 01:43:00,516",
">> And with that, I hope you have a <<",
"",
"2",
"01:43:00,516 --> 01:43:01,546",
"great conference, and I'll see",
Expand All @@ -127,7 +131,7 @@ public func testWWDCWebVTTToSRTHelperKit() {

guard let string = parser.parseToSRT(strArr) else { return }
let result = string.components(separatedBy: "\n").count
let expectResult = 247
let expectResult = 328

try expect(expectResult) == result
}
Expand Down

0 comments on commit 4d02836

Please sign in to comment.