Skip to content

Commit

Permalink
Update documentation for lrc files
Browse files Browse the repository at this point in the history
  • Loading branch information
dagronf committed Nov 1, 2024
1 parent 7aff2a3 commit b535287
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 4 deletions.
12 changes: 12 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,18 @@ let content2 = try coder.encode(subtitles: subtitles)

Format is documented [here](https://github.com/Podcastindex-org/podcast-namespace/blob/main/transcripts/transcripts.md#json)

### Lyrics file format

Format is documented [here](https://en.wikipedia.org/wiki/LRC_(file_format))

The format defines the sub-second timing as 'hundredths of a second', however some online sample files use milliseconds
instead. This encoder supports both for decoding, and the encoder supports both formats when writing.

```
[00:12.41]Is it that sweet? I guess so
[00:12.419]Is it that sweet? I guess so
```

### CSV coding/encoding

There appears to be no formal CSV specification for subtitles, so this coder tries to make a generic "enough" encoder/decoder to make it easier for an app to export into a spreadsheet or google docs.
Expand Down
5 changes: 1 addition & 4 deletions Tests/SwiftSubtitlesTests/LRCTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -107,10 +107,7 @@ final class LRCTests: XCTestCase {
[01:19.485]
"""

let subs = try Subtitles.Coder.LRC()
.decode(str)

Swift.print(subs)
let subs = try Subtitles.Coder.LRC().decode(str)

XCTAssertEqual(34, subs.cues.count)
XCTAssertEqual(Subtitles.Time(hour: 0, minute: 1, second: 13, millisecond: 699), subs.cues[31].startTime)
Expand Down

0 comments on commit b535287

Please sign in to comment.