Coder Social home page Coder Social logo

ipytv's People

Contributors

beer4ever83 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

ipytv's Issues

Export / save playlist

Hi, Is it possible to build / sort / export a playlist back to a m3u file after processing the data with this package?

Don't use fixed versions in requirements.txt

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.

Evaluate alternatives to travis-ci.com

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.

Urlencode tvg-logo attributes

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.

Remove warning when installing deepdiff 5.5.0

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'

Rework sanitization functions in m3u_tools

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.

Use type hints

Let's use type hints to allow static analysis and to enable IDE autocompletion.

Consider adding ChatGPT description of this project to README.md

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

Sanitize attribute name

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.

Sanitize attributes containing a comma

#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.

Some Questions

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&amp%3Bapikey=1ngjw23osgcis1i1vbj96lmfqs&amp%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

Playlist loading methods do not belong in the M3UPlaylist class

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).

Pass-through for #EXTVLCOPT tags?

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.

Improve playlist interface

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.

Split requirements.txt

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.

First playlist line left unprocessed

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

Refactor channel, m3u_tools and doctor modules

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).

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.