Skip to content
This repository was archived by the owner on Dec 8, 2024. It is now read-only.

Conversation

mjneil
Copy link

@mjneil mjneil commented May 22, 2019

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

@coveralls
Copy link

coveralls commented May 22, 2019

Coverage Status

Coverage increased (+1.2%) to 75.365% when pulling b6f2ecc on mjneil:custom into 920643e on grafov:master.

@mjneil
Copy link
Author

mjneil commented May 23, 2019

Summary of changes in latest commits:

  • Added tests to writer_test.go to increase coverage
  • Separate the CustomTag interface into CustomTag and CustomDecoder. I thought that this made the code a little easier to understand and helped with writing the tests. I welcome any feedback on how these interfaces are implemented so we have an implementation everyone is happy with.

@@ -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 {
Copy link
Collaborator

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

Copy link
Collaborator

@leikao leikao left a 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.

@mjneil
Copy link
Author

mjneil commented May 31, 2019

Thanks for the review, I've updated with comments on exports.

@mjneil
Copy link
Author

mjneil commented Jun 13, 2019

@leikao have you had a chance to take another look at this?

@mjneil
Copy link
Author

mjneil commented Jun 26, 2019

@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
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What does this do?

Copy link

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

Copy link
Author

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

Copy link
Author

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! :)

Copy link

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.

@tmm1
Copy link

tmm1 commented Jul 16, 2019

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?

@mjneil
Copy link
Author

mjneil commented Aug 6, 2019

@leikao any update on this?

@leikao leikao merged commit 036100c into grafov:master Aug 9, 2019
@leikao
Copy link
Collaborator

leikao commented Aug 9, 2019

Thank you for contributing.

@mjneil
Copy link
Author

mjneil commented Aug 9, 2019

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?

@leikao
Copy link
Collaborator

leikao commented Aug 9, 2019

A new version v0.11.1 was made @mjneil

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Question: Custom TAGs
4 participants