Skip to content
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

Removing part of the title when it contains comma #12

Closed
dineiar opened this issue Jul 21, 2021 · 2 comments
Closed

Removing part of the title when it contains comma #12

dineiar opened this issue Jul 21, 2021 · 2 comments

Comments

@dineiar
Copy link
Contributor

dineiar commented Jul 21, 2021

When the name of the entry in the M3U contains a comma, M3uParser only gets the last part of the name. Sample M3U:

#EXTM3U
#EXTINF:-1 tvg-name="John Doe, The gunslinger" group-title="Doe Family", Doe, John
https://johndoe.net/

Using parse_m3u and to_file('json') outputs:

[
    {
        "name": "John",
        "url": "https://johndoe.net/",
        "category": "Doe Family",
        "tvg": {
            "name": "John Doe, The gunslinger"
        },
        "status": "GOOD"
    }
]

The "name" field should be Doe, John, but it is only John.

Also, to_file('m3u') outputs:

#EXTM3U
#EXTINF:-1 tvg-name="John Doe, The gunslinger" group-title="Doe Family", John
https://johndoe.net/

The issue is the parsing of the title, which I'm still not entirely sure how to fix.

@pawanpaudel93
Copy link
Owner

@dineiar I have tried fixing it. Can you try and give feedback and also parse_m3u method will take trim=True/False so by default trim is False but if you pass trim=True while generating json the empty values will be removed. I have kept this so that we can get desired output. And saving to m3u only saves info present on the original m3u file only.

@dineiar
Copy link
Contributor Author

dineiar commented Jul 22, 2021

@pawanpaudel93, it looks great. I made some tests and it seems to be working great. I made some comments on your commit to some points that I think could be improved.

I've also renamed the trim parameter that you created to enforce_schema in PR #13. Merge it if you agree with me.
Also, I believe that the default value for this parameter should be False (ignoring non-existing fields by default), because that is what I would expect a library to do (keep the processed file as close as possible to the original), but I kept it True according to your implementation of the trim parameter.

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

No branches or pull requests

2 participants