diff --git a/Sources/WWDCHelper/main.swift b/Sources/WWDCHelper/main.swift index 1b0a709..e33b774 100644 --- a/Sources/WWDCHelper/main.swift +++ b/Sources/WWDCHelper/main.swift @@ -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 diff --git a/Sources/WWDCWebVTTToSRTHelperKit/WebVTTParsable.swift b/Sources/WWDCWebVTTToSRTHelperKit/WebVTTParsable.swift index 7e87a29..dbd94e6 100644 --- a/Sources/WWDCWebVTTToSRTHelperKit/WebVTTParsable.swift +++ b/Sources/WWDCWebVTTToSRTHelperKit/WebVTTParsable.swift @@ -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]) { diff --git a/Tests/WWDCWebVTTToSRTHelperKitTests/WWDCWebVTTToSRTHelperKitSpecs.swift b/Tests/WWDCWebVTTToSRTHelperKitTests/WWDCWebVTTToSRTHelperKitSpecs.swift index 1a648b8..fea096d 100644 --- a/Tests/WWDCWebVTTToSRTHelperKitTests/WWDCWebVTTToSRTHelperKitSpecs.swift +++ b/Tests/WWDCWebVTTToSRTHelperKitTests/WWDCWebVTTToSRTHelperKitSpecs.swift @@ -70,6 +70,7 @@ public func testWWDCWebVTTToSRTHelperKit() { let expectResult = ["1", "01:42:58.766 --> 01:43:00.516 A:middle", ">> And with that, I hope you have a <<", + "", "2", "01:43:00.516 --> 01:43:01.546 A:middle", "great conference, and I'll see", @@ -83,6 +84,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", @@ -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", @@ -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", @@ -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 }