You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Such as the files that iTunes outputs when exporting playlists.
It's understandable (and clearly necessary) to have a library that handles HLS m3u8 files, it would just also be nice to import these other standard files.
The text was updated successfully, but these errors were encountered:
Joshfindit
changed the title
Support "regular" m3u8 files?
Request/bug: Support iTunes' m3u8 files
Jun 3, 2021
For some reason that I could not reasonably agree with, iTunes exports m3u8 files with \r as line terminators.
Ruby then sees only one line, and m3u8 sees 0 tracks.
Thankfully there is a way to have the read function use \r as the separator:
Could be file.read.each_line(sep="\r").with_index do |line, index|, but sep does not seem to take multiple optional line endings and each_line does not seem to be able to intelligently choose the line separator itself.
Cary Swoveland posted this function to find the line terminator, and that found terminator could be used as the sep value:
def separator(fname)
f = File.open(fname)
enum = f.each_char
c = enum.next
loop do
case c[/\r|\n/]
when "\n" then break
when "\r"
c << "\n" if enum.peek=="\n"
break
end
c = enum.next
end
c[0][/\r|\n/] ? c : "\n"
end
Or, the function could be changed so that the entire file is read in to memory and then .split since .splitdoes take multiple optional line endings:
input.read.split(/\r?\n|\r\n?/).each_with_index do |line, index|
If any of those solutions is reasonable, just reply "Yes" with which one you want, and I'll put in a PR for it.
Such as the files that iTunes outputs when exporting playlists.
It's understandable (and clearly necessary) to have a library that handles HLS m3u8 files, it would just also be nice to import these other standard files.
The text was updated successfully, but these errors were encountered: