Skip to content

Commit

Permalink
UPDATED README
Browse files Browse the repository at this point in the history
  • Loading branch information
pawanpaudel93 committed Jul 21, 2021
1 parent eadadf6 commit be151e9
Showing 1 changed file with 12 additions and 6 deletions.
18 changes: 12 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,20 +40,22 @@ parser = M3uParser(timeout=5, useragent=useragent)
>Functions
```python
def parse_m3u(self, path: str, check_live: bool = True):
def parse_m3u(self, path: str, check_live: bool = True, trim: bool = False):
"""Parses the content of local file/URL.
It downloads the file from the given url or use the local file path to get the content and parses line by line
to a structured format of streams information.
:param path: Path can be a url or local filepath
:type path: str
:param trim: To remove the non existing information from a stream
:type trim: bool
:param check_live: To check if the stream links are working or not
:type check_live: bool
:rtype: None
"""

def filter_by(self, key: str, filters: Union[str, list], retrieve: bool = True, nested_key: bool = False):
def filter_by(self, key: str, filters: Union[str, list], key_splitter: str = "-", retrieve: bool = True, nested_key: bool = False):
"""Filter streams infomation.
It retrieves/removes stream information from streams information list using filter/s on key.
Expand All @@ -62,6 +64,8 @@ def filter_by(self, key: str, filters: Union[str, list], retrieve: bool = True,
:type key: str
:param filters: List of filter/s to perform the retrieve or remove operation.
:type filters: str or list
:param key_splitter: A splitter to split the nested keys. Default: "-"
:type key_splitter: str
:param retrieve: True to retrieve and False for removing based on key.
:type retrieve: bool
:param nested_key: True/False for if the key is nested or not.
Expand Down Expand Up @@ -115,13 +119,15 @@ def retrieve_by_category(self, filter_word: Union[str, list]):
:rtype: None
"""

def sort_by(self, key: str, asc: bool = True, nested_key: bool = False):
def sort_by(self, key: str, key_splitter: str = "-", asc: bool = True, nested_key: bool = False):
"""Sort streams information.
It sorts streams information list sorting by key in asc/desc order.
:param key: It can be single or nested key.
:type key: str
:param key_splitter: A splitter to split the nested keys. Default: "-"
:type key_splitter: str
:param asc: Sort by asc or desc order
:type asc: bool
:param nested_key: True/False for if the key is nested or not.
Expand Down Expand Up @@ -159,13 +165,13 @@ def get_random_stream(self, random_shuffle: bool = True):
"""

def to_file(self, filename: str, format: str = "json"):
"""Save to file (CSV or JSON)
"""Save to file (CSV, JSON, or M3U)
It saves streams information as a CSV or JSON file with a given filename and format parameters.
It saves streams information as a CSV, JSON, or M3U file with a given filename and format parameters.
:param filename: Name of the file to save streams_info as.
:type filename: str
:param format: csv/json to save the streams_info.
:param format: csv/json/m3u to save the streams_info.
:type format: str
:rtype: None
"""
Expand Down

0 comments on commit be151e9

Please sign in to comment.