#EXTINF:-1 tvg-id="AmarinTV.th",Amarin TV To enable IPyTV's logging, add a logging configuration to your application: import logging from ipytv import playlist logging. sanitize ( pl ) with open ( 'my-fixed-playlist.m3u', 'w', encoding = 'utf-8' ) as out_file : content = fixed_pl. loadl ( fixed_content ) fixed_pl = M3UPlaylistDoctor. It can be used as follows: from ipytv.doctor import M3UDoctor, M3UPlaylistDoctor from ipytv import playlist with open ( 'my-broken-playlist.m3u', encoding = 'utf-8' ) as in_file : content = in_file. In charge of applying all different fixes. It applies the fixes in IPTVChannelDoctor to all channels in theĪll the classes above offer one public, static method named sanitize() that is.It contains methods to fix errors in a channel (i.e.Make it impossible to load an m3u file as a playlist). It contains methods to fix errors in m3u files (i.e.The module contains three classes, each with its own scope: Module aims to detect and fix some of these errors. Internet-sourced IPTV playlists, often contain a number of format errors. The IPTVAttr enum class contains attribute names that are commonly found in items (): print ( f '", extras = ) print ( channel. get_attributes () for k, v in attributes. Get_attributes() method: from ipytv import playlist url = "" pl = playlist. These attributes, in the form of a dictionary, can be accessed via the they apply to the playlist itself or to everyįor example the x-tvg-url part below: #EXTM3U x-tvg-url="" Key-value pairs that are specified in the #EXTM3U row are treated as What these properties are and how they can be accessed is described in the next There are two main properties in a playlist, and they are: This class models the concept of a playlist (which is, basically, a list ofĬhannels) and offers methods to interact with the playlist itself and with its length ()) M3UPlaylist classĮvery load function above returns an object of the M3UPlaylist class. Use the playlist.loadl(rows) function: from ipytv import playlist rows = pl = playlist. Use the playlist.loads(string) function: from ipytv import playlist string = """#EXTM3U #EXTINF:-1 tvg-id="Rai 1" tvg-name="Rai 1" group-title="RAI",Rai 1 """ pl = playlist. Use the playlist.loadu(url) function: from ipytv import playlist url = "" pl = playlist. Use the playlist.loadf(file) function: from ipytv import playlist file = "~/Documents/my_playlist.m3u" pl = playlist. Everything related to the loading and handling of M3U playlists.Constants and functions related to M3U files.All the exceptions thrown by the library.A collection of functions to fix common errors found in M3U files.Everything related to the handling of channels in a playlist.The library comprises several modules, each with a specific area of competence: To install it within a virtual environment, run: python -m venv. To install the library system-wide, run: pip install m3u-ipytv PLEASE NOTE: the library makes use of the multiprocessing.Pool class that This library requires Python 3 (and the related pip installer). In the example below, the #EXTVLCOPT row is not parsed, but copied as-is: #EXTINF:-1 tvg-id="" tvg-name="hello" tvg-country="IT" tvg-url="" group-title="Greetings",Hello! they are parsedĪnd their value is made available as properties of an IPTVChannel object).Īll tags that are found between an #EXTINF row and its related url row areĪdded as extras to a channel, but without performing any parsing (i.e. Only #EXTM3U, #EXTINF and plain url rows are supported (i.e. It does not fully support regular M3U8 playlists (only basicĬhannel attributes are parsed). This library has been created from scratch to parse and handle the M3U Plusįormat only. The backward compatibility with the original M3U8 standard (as explained in The syntax of the #EXTM3U and #EXTINF tags has been modified to includeĮxtra attributes (e.g., logo, group, language). Which it supports only 2 tags ( #EXTM3U and #EXTINF). While IPTV Playlist refers to playlists in M3U Plus format. Interchangeably, but in this repository M3U Plus refers to the data format, The terms IPTV playlist and M3U Plus playlist are generally used The M3U Plus format is a de facto standard for distributing IPTV playlists on A python3 library to parse IPTV playlists in the M3U Plus format.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |