-
Notifications
You must be signed in to change notification settings - Fork 330
Custom Tag Support #138
Custom Tag Support #138
Conversation
Summary of changes in latest commits:
|
@@ -48,6 +48,17 @@ func (p *MasterPlaylist) DecodeFrom(reader io.Reader, strict bool) error { | |||
return p.decode(buf, strict) | |||
} | |||
|
|||
func (p *MasterPlaylist) WithCustomDecoders(customDecoders []CustomDecoder) Playlist { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please add comments to the public methods, which will help us to generate document correctly. @mjneil
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, but please add comments to the public methods, which will help us to generate document correctly.
Thanks for the review, I've updated with comments on exports. |
@leikao have you had a chance to take another look at this? |
@leikao I updated my PR to do the custom tag parsing first before other tags to support the ability to custom parse already existing tags without conflicts |
structure.go
Outdated
type CustomDecoder interface { | ||
TagName() string | ||
Decode(line string) (CustomTag, error) | ||
Segment() bool |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What does this do?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Okay I see, it signals whether the tag applies to the playlist or per segment.
I think the method could have a better name which is less ambiguous.
Maybe something like PerSegment, SegmentTag, IsPlaylistTag
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That is correct. I will add comments to each method in the interface as it will be useful for anyone needing to implement it.
I agree it is a bit ambiguous, I will update to SegmentTag
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@tmm1 I've updated my PR per this discussion, let me know if that makes things more clear, thanks! :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Much better, thanks. Appreciate all the comments in the public interface methods.
This would be a great addition to the m3u8 library. The diff looks very clean and well tested. 👍 from me. @leikao What do you think? |
@leikao any update on this? |
Thank you for contributing. |
Thanks @leikao I appreciate your time working with me on this. Would you be able to also release a new version tag with these changes please? |
A new version |
Hello, thanks for an awesome m3u8 project. We came across the need to read and write custom tags to m3u8 so I've implemented it through an interface in my fork, but would love to get this upstream so we don't have to use a fork. I've implemented this in a way that should allow for the parsing of any format as the user will have to implement the interface. This way we do not have to pollute the source code with parsing/writing for non-standard tags that only a few users have need for or that cant be made open source. I've also included example template files for how to implement your own custom tag readers and writers.
I noticed there is an issue as well that this will help resolve #82