New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Can't dump playlist with custom tags #347
Comments
From the README:
To preserve a tag in the output, you may also need to subclass the |
I've basically written my custom dumps function to include custom tags in the output: https://github.com/ulville/freeiptv/blob/master/testlinks.py#L24C1-L24C1 I could have created subclasses but it's just a quick and dirty solution if you need one. PS: custom tag names are hardcoded |
@ulville did it work fine? |
@mauricioabreu it works fine for my use case. And would be helpful for others who need something similar too. You can add it as an example 👍🏼 |
@ulville thank you! Can you please explain in more details about your idea?
|
@mauricioabreu Nevermind, I haven't looked at the code for a while so I forgot how thing worked.
I also looked at the ways we could implement it inside the Line 660 in 1ac31c1
we can do something like: if self.uri:
if self.duration is not None:
output.append("#EXTINF:%s" % number_to_string(self.duration))
if self.include_custom_values:
for key in custom_value_keys:
custom_tags = self.custom_parser_values[key]
for tag in custom_tags:
output.append(" %s=\"%s\"" % (tag, seg_props[tag]))
if self.title:
output.append(","self.title)
output.append("\n")
...
... But I don't think it's any "general purpose" of a solution. It's very opinionated and very case spesific. Especially the location I append the custom tags. Maybe writing your own custom And as I said I haven't looked at the code for a while so excuse me if I made any mistakes here and there. |
@ulville Thank you! There are all good ideas I'm going to add your code in the docs to better document how to use custom tags |
I've just noticed it is already in the docs 😆 |
@mauricioabreu where exactly? I couldn't find it. There is an example for parsing custom tags (that I took advantage of when writing my code) but I couldn't find anything mentioning dumping with them. Am I looking at the wrong place? |
@ulville Here https://github.com/globocom/m3u8?tab=readme-ov-file#custom-tags My mistake. I was reading your code thinking it was m3u8 docs 😕 |
The playlist can be parsed with custom tags correctly. But when dumping the playlist, the parsed custom tags info will be lost.
The text was updated successfully, but these errors were encountered: