Closed dineiar closed 2 years ago
@dineiar My motive was to create a uniform structure for all the m3u files. What if some contain one information and some other don't inside a m3u file? Do you have any suggestions ??
I think it is better to only generate the keys that were present at the original M3U file. JSON allows for this flexibility, it does not enforces a schema for all items on a list. When processing a JSON structure, it is expected that some keys may be missing if they do not have a value.
@dineiar do you think its better now ??
@pawanpaudel93, yes, it is!
I continued your work and added this same treatment for the other keys, such as tvg-
ones, category
, and so on. Check my PR #11.
When using
to_file
orget_json
functions, m3u_parser generates all the keys, even the ones that were not present in the parsed M3U. For example, consider the following sample M3U input file (sample.m3u
):Using the following code:
The output file (
out.json
) looks like:It doesn't make sense to output fields like "language" and "country", since they were not provided in the source M3U file.