Read and write M3U files with (relative) ease.
Read an M3U file:
M3Uzi.read("/path/to/file.m3u8")
Write an M3U file:
m3u.write("/path/to/file.m3u8")
Get a list of filenames:
m3u.filenames
Get all file reference objects:
m3u.files
Add a file to the M3U index:
m3u.add_file do |file|
file.path = "/path/to/file.ts"
file.duration = 10
file.description = "no desc"
end
Get all tag reference objects:
m3u.tags
Get an individual tag value (TARGETDURATION MEDIA-SEQUENCE ALLOW-CACHE STREAM-INF ENDLIST VERSION):
m3u[:targetduration]
m3u[:media_sequence]
Set an individual tag value:
m3u[:targetduration] = 100
Add a tag to the M3U index (custom tags even):
m3u.add_tag do |tag|
tag.name = "VERSION"
tag.value = "1"
end
Add a comment:
m3u << "Comment"
m3u.add_comment("Comment")
- Target duration will be calculated and included if omitted
- Tags KEY, PROGRAM-DATE-TIME, and DISCONTINUITY are not supported
- Stream info is not working yet
- Tests need to be written
- Needs to be turned into a gem
(c) 2010 Brandon Arbini / Zencoder, Inc.