Skip to content

Commit

Permalink
Add example for nested playlist parsing
Browse files Browse the repository at this point in the history
  • Loading branch information
BjoernPetersen committed Oct 20, 2020
1 parent fef9f61 commit 5818cb0
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -68,8 +68,9 @@ val m3uReader: InputStreamReader = m3uStream.reader()
val streamEntries: List<M3uEntry> = M3uParser.parse(m3uReader)

// Passing in the content of an M3U file as a String also works
val someWeirdApi = TODO("Not real")
val m3uContent: String = someWeirdApi.getPlaylist("Best of Willy Astor")
val someApi = TODO("Not a real API object")
// Returns a playlist in the M3U format
val m3uContent: String = someApi.getPlaylist("Best of Willy Astor")
val entries: List<M3uEntry> = M3uParser.parse(m3uContent)
```

Expand All @@ -91,6 +92,14 @@ val nestedM3uLocation: MediaPath = TODO("...")
M3uParser.parse(nestedM3uLocation.path)
```

You can use the `M3uParser.resolveNestedPlaylists()` method to recursively parse all nested playlist file references:

```kotlin
val entries: List<M3uEntry> = M3uParser.parse(Paths.get("playlist.m3u"))
// Doesn't contain any .m3u file references anymore
val resolvedEntries: List<M3uEntry> = M3uParser.resolveNestedPlaylists(entries)
```

## License

This project is released under the MIT License. That includes every file in this repository,
Expand Down

0 comments on commit 5818cb0

Please sign in to comment.