beer4ever83 / ipytv Goto Github PK
View Code? Open in Web Editor NEWA python library to handle IPTV playlists in m3u_plus format
License: MIT License
A python library to handle IPTV playlists in m3u_plus format
License: MIT License
Hi, Is it possible to build / sort / export a playlist back to a m3u file after processing the data with this package?
The packages in requirements.txt specify requirements that are fixed (e.g. requests==2.25.1
).
This is to rigid: requirements should be relaxed to allow for a range of versions.
Allow users to take advantage of code completion and hints when using IDEs
Since the move from travis-ci.org to travis-ci.com, open source projects are only given a total of 10,000 free credits.
Once the credits expire, the build jobs will not run anymore, unless one purchases one of their paid plans (the cheapest of which costs 69$/month).
This issue is about looking for and evaluating alternatives to Travis-CI that are either Free or sensibly cheaper.
Implement packaging as source distribution (sdist) and upload it to the pypi repository.
The library should be installable as:
pip3 install ipytv
Badly encoded tvg-logo attributes (especially the ones containing commas) are likely to mess up the parsing logic of some applications (e.g. VLC).
URL-encoding the tvg-logo fields would fix this.
Add Docker Hub authentication to CircleCI configuration as explained here:
https://circleci.com/docs/2.0/private-images/
The requirements.txt file specifies this dependency: deepdiff[murmur]==5.5.0
Apparently the murmur
extra has been removed from new versions of deepdiff, so when installing it, this warning is printed:
WARNING: deepdiff 5.5.0 does not provide the extra 'murmur'
Currently the sanitize_attributes
function in m3u_tools.IPTVChannelDoctor
performs 2 sanitization operations at once (i.e. remove commas from attributes values and convert the attributes to lowercase).
There is one more sanitization, urlencode_logo
, which is not performed as part of sanitize_attributes
.
This is not homogeneous and shall be improved.
I like the idea of a function that performs all sanitizations at once, but users should also be given the freedom to choose which sanitizations they want to apply.
So said, this is a possible restructuring of this class:
urlencode_logo --> public function that url-encodes the tvg-logo attributes
attributes_to_lowercase --> public function that converts all attribute names to lowercase (e.g. tvg-ID to tvg-id)
convert_commas --> public function that converts all commas found in attributes values (except in tvg-logo) to underscores
sanitize_attributes --> public function that runs all sanitization functions on a channel's attributes
Please note: the functions in m3u_tools.M3UPlaylistDoctor
shall reflect the structure above.
Let's use type hints to allow static analysis and to enable IDE autocompletion.
This is ChatGPT response to the What do you know about m3u-ipytv?
prompt:
M3U is a file format used for multimedia playlists. It is commonly used for creating IPTV playlists to access live TV channels and on-demand content over the internet. IPYTV is a Python library that allows users to create, modify, and manage M3U playlists programmatically.
With M3U-IPYTV, users can generate M3U playlists from various sources and customize them according to their preferences. The library provides methods for adding or removing channels from a playlist, updating the channel information, and organizing the channels in different categories. It also allows users to filter channels by country or genre, and sort them alphabetically or by popularity.
M3U-IPYTV is open-source software and is available on GitHub. It requires some programming knowledge to use effectively, but it can be a powerful tool for creating personalized IPTV playlists.
Perhaps it could be used as overview in README.md
The pl.search() method has inline documentation, but it isn't even mentioned in the README file.
Well-known attributes (i.e. the ones listed in the IPTVAttr enum class) are not always present in their lowercase form.
For example:
tvg-ID (should be tvg-id)
Implement a function in m3u_tools.M3UDoctor to sanitize such attribute names.
Let's add a pyproject.toml
file as per this guide.
During the execution of scripts/packaging.sh
the following error is displayed:
rm: cannot remove 'dist/*': No such file or directory
This is only a cosmetic issue, but nonetheless it should be fixed.
#EXTINF attributes that contain commas are likely to mess up the parsing logic of some applications (e.g. VLC).
Sanitizing these fields (e.g. by replacing the comma with another character) would fix this.
in that case they don`t have a quotes
Just found this program and have some questions.
I primarily use tvheadend, with an iptv provider.
In tvheadend, the original m3u8 seems to be fine, no issues with display of the playlist.
Your m3udoctor.py, makes some minor changes, as below.
Referencing the original m3u8, how would these manifest as errors or issues?
`original
#EXTINF:-1 tvh-chnum="948" tvg-id="hallmarkchannel.us" tvg-name="HALLMARK CHANNEL" tvg-logo="https://tv-fanatic-res.cloudinary.com/iu/s--gBrQRyxY--/t_full/cs_srgb, 162 f_auto,fl_strip_profile.lossy,q_auto:420/v1434689610/hallmark-channel-logo.jpg" group-title="US-ENTERTAINMENT",HALLMARK CHANNEL
163 http://my.provider.zzz.as:port/me/password/1XXXX5623
m3udoctor.py
#EXTINF:-1 tvh-chnum="948" tvg-id="hallmarkchannel.us" tvg-name="HALLMARK CHANNEL" tvg-logo="https://tv-fanatic-res.cloudinary.com/iu/s--gBrQRyxY--/t_full/cs_srgb% 162 2Cf_auto%2Cfl_strip_profile.lossy%2Cq_auto:420/v1434689610/hallmark-channel-logo.jpg" group-title="US-ENTERTAINMENT",HALLMARK CHANNEL
163 http://my.provider.zzz.as:port/me/password/1XXXX4356
original
#EXTINF:-1 tvg-id="" tvg-name="Music Choice 00: 70s Audio Channel" tvg-logo="http://primestreamstv.com/logos/MC%20POP%20.png" group-title="MUSIC",Music Choice 00: 2 70s Audio Channel
3 http://my.provider.zzz.as:port/me/password/2XXXght
m3udoctor.py
#EXTINF:-1 tvg-id="" tvg-name="Music Choice 00: 70s Audio Channel" tvg-logo="http://primestreamstv.com/logos/MC%20POP%20.png" group-title="MUSIC",Music Choice 00: 2 70s Audio Channel
3 http://my.provider.zzz.as:port/me/password/2cxzsad
original
#EXTINF:-1 tvg-id="" tvg-name="PC: Golf PC: Open " tvg-logo="https://upload.wikimedia.org/wikipedia/commons/thumb/d/d3/NBCUniversal_Peacock_Logo.svg/2560px-NBCUniversal_Peacock_Logo.svg.png" group-title="US-PEACOCK",PC: Golf PC: Open
http://my.provider.zzz.as:port/me/password/2thuygfd
m3udoctor.py
#EXTINF:-1 tvg-id="" tvg-name="PC: Golf PC: Open " tvg-logo="https://upload.wikimedia.org/wikipedia/commons/thumb/d/d3/NBCUniversal_Peacock_Logo.svg/2560px-NBCUniversal_Peacock_Logo.svg.png" group-title="US-PEACOCK",PC: Golf PC: Open
http://my.provider.zzz.as:port/me/password/2opulip
original
#EXTINF:-1 tvg-id="ESPNPlay100.jm" tvg-name="(JM) ESPN PLAY 100:" tvg-logo="https://artwork.api.espn.com/artwork/collections/airings/b2ca1b6e-a870-4177-b782-0a12650c0b53/default?width=640&apikey=1ngjw23osgcis1i1vbj96lmfqs&timestamp" group-title="ESPN PLAY",(JM) ESPN PLAY 100:
m3udoctor.py
#EXTINF:-1 tvg-id="ESPNPlay100.jm" tvg-name="(JM) ESPN PLAY 100:" tvg-logo="https://artwork.api.espn.com/artwork/collections/airings/b2ca1b6e-a870-4177-b782-0a12650c0b53/default?width=640&%3Bapikey=1ngjw23osgcis1i1vbj96lmfqs&%3Btimestamp" group-title="ESPN PLAY",(JM) ESPN PLAY 100:
`
I generally have more issues with the epg data, the tv_grab_file has problems digesting the xml file, I have to socat to xmltv.sock, that seems to work. The xml never validates, to many errors.
Are you aware of some script, or program similar to m3udoctor.py, that checks and repairs xmltv ?
Thanks
The load[asuf]
methods are currently part of the M3UPlaylist
class.
Considering that they are all static methods (so they don't really depend on the internals of the M3UPlaylist
class), it would make more sense to move them out of the class.
The ideal location should be in the playlist
module, as top-level functions (which would be pretty natural as they're all static methods anyway).
There has been an increasing number of m3u playlists including the VideoLAN-specific #EXTVLCOPT
tag.
This library considers this tag as unsupported, so it's ignored upon load.
I wonder whether it should be simply copied as-is in the destination channel.
Please note: this would complicate the chunking logic quite a bit, but maybe it's time to improve that part.
Currently the M3UPlaylist
class only lets the user interact with the channel list via the list
property.
While this grants a great deal of flexibility to the user, it is also error prone (and exposes the internals of the library to the outer world).
Having said so, it would be appropriate if the class would also offer ad-hoc methods to interact with the channel list, besides the possibility to mess with the internal list.
Currently the main README.md is used (in setup.py) as documentation for the pypi repository.
It would be better to keep the main readme in one place (i.e. GitHub) and create an ad-hoc readme for pypi (with a link to the main one).
Currently requirements.txt contains the dependencies of both the library and the test.
It should be split in requirements.txt and requirements_test.txt with the former containing only the dependencies that are necessary for the library to function, and the latter the extra dependencies that are only needed for test.
A recent change in the handling of the cryptography dependency in Alpine linux has triggered some changes in Dockerfile.
Apparently, as result of these changes, now the Building wheel for cryptography (PEP 517)
step takes a lot of time to complete.
This issue is about investigating and possibly fixing the aforementioned problem.
Steps to reproduce the issue:
logging.basicConfig(level=logging.DEBUG)
playlist.loadf(filename)
)populating playlist with rows from %s to %s"
are logged on screen.Now package creates empty channels from empty lines. I think they must be skipped
If first line of playlist (second line of file) not started with #EXTINF
it will be skipped on processing
Compare parsing result of
#EXTM3U
#EXTINF:-1 tvg-id="" tvg-name="Music Channel" tvg-language="Romanian" tvg-logo="https://i.imgur.com/PRgvj4c.png" tvg-country="RO" tvg-url="" group-title="Music",1 Music Channel
#EXT-INETRA-STREAM-INF: id=233 aspect-ratio=16:9 has-timeshift=true
https://edge126.rcs-rds.ro/utvedge/musicchannelhq.stream/playlist.m3u8
and
#EXTM3U
#EXT-INETRA-STREAM-INF: id=233 aspect-ratio=16:9 has-timeshift=true
#EXTINF:-1 tvg-id="" tvg-name="Music Channel" tvg-language="Romanian" tvg-logo="https://i.imgur.com/PRgvj4c.png" tvg-country="RO" tvg-url="" group-title="Music",1 Music Channel
https://edge126.rcs-rds.ro/utvedge/musicchannelhq.stream/playlist.m3u8
check channel.extras
content
Most of the static methods in IPTVChannel should be moved to the m3u_tools module, at the same time, all the *Doctor* classes in m3u_tools should be moved to a module of their own (perhaps named doctor
).
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.