pawanpaudel93 / m3u-parser

A parser for m3u files. It parses the contents of the m3u file to a list of streams information which can be saved as a JSON/CSV/M3U file.
MIT License
29 stars 16 forks source link

Remove duplicate by (name or name pattern, url) #24

Open mull-codes opened 8 months ago

mull-codes commented 8 months ago

Please write a method to remove duplicate stream by:

It would be very nice if there could a default call while initialising the object and at object initialisation url and name duplications could be removed

pawanpaudel93 commented 7 months ago

Hey @mull-codes thanks for the issue. I will update as soon as i finish with this issue.

pawanpaudel93 commented 7 months ago

Hey @mull-codes, Please install the latest version 0.4.0. Then you can do the following:

from m3u_parser import M3uParser

parser = M3uParser()
parser.parse_m3u(url)

# Remove all duplicates
parser.remove_duplicates()

# Remove duplicate with name and url
parser.remove_duplicates("Channel 1", "http://example.com/stream1")

# Remove duplicate with name pattern and url
parser.remove_duplicates("Chan.*", "http://example.com/stream1")

# Get the list of streams
print(len(parser.get_list()))