diff --git a/IND.m3u b/IND.m3u
new file mode 100644
index 0000000..0a0e970
--- /dev/null
+++ b/IND.m3u
@@ -0,0 +1,271 @@
+#EXTM3U
+
+#EXTINF:-1 group-title="General",9x Jhakaas
+https://amg01281-9xmediapvtltd-9xjhakaas-samsungin-ci2cs.amagi.tv/playlist/amg01281-9xmediapvtltd-9xjhakaas-samsungin/playlist.m3u8
+
+#EXTINF:-1 group-title="General",9X Tashan
+https://amg01281-9xmediapvtltd-9xtashan-samsungin-xz1sd.amagi.tv/playlist/amg01281-9xmediapvtltd-9xtashan-samsungin/playlist.m3u8
+
+#EXTINF:-1 group-title="General",9X Jalwa (1080p)
+https://d35j504z0x2vu2.cloudfront.net/v1/master/0bc8e8376bd8417a1b6761138aa41c26c7309312/9x-jalwa/master.m3u8
+
+#EXTINF:-1 group-title="General",9X Tashan
+https://9xjio.wiseplayout.com/9X_Tashan/master.m3u8
+
+#EXTINF:-1 group-title="General",9X Jhakaas
+https://9xjio.wiseplayout.com/9X_Jhakaas/master.m3u8
+
+#EXTINF:-1 group-title="General",9XM
+https://9xjio.wiseplayout.com/9XM/master.m3u8
+
+#EXTINF:-1 group-title="General",ABP News (1080p)
+https://d2l4ar6y3mrs4k.cloudfront.net/live-streaming/abpnews-livetv/master.m3u8
+
+#EXTINF:-1 group-title="General",Aaj Tak
+https://feeds.intoday.in/aajtak/api/aajtakhd/master.m3u8
+
+#EXTINF:-1 group-title="General",Aaj Tak (1080p)
+https://livehub-voidnet.onrender.com/cluster/streamcore/in/AAJTAK_REDIS.m3u8
+
+#EXTINF:-1 group-title="General",B4U Bhojpuri (1080p)
+https://cdnb4u.wiseplayout.com/B4U_Bhojpuri/master.m3u8
+
+#EXTINF:-1 group-title="General",B4U Movies
+https://mumt02.tangotv.in/B4UMOVIES/index.m3u8
+
+#EXTINF:-1 group-title="General",B4U Movies India (1080p)
+https://cdnb4u.wiseplayout.com/B4U_Movies/master.m3u8
+
+#EXTINF:-1 group-title="General",B4U Music (1080p)
+https://cdnb4u.wiseplayout.com/B4U_Music/master.m3u8
+
+#EXTINF:-1 group-title="General",Bhojpuri Cinema (720p)
+https://live-bhojpuri.akamaized.net/liveabr/playlist.m3u8
+
+#EXTINF:-1 group-title="General",Colors (1080p)
+http://66.102.120.18:8000/play/a00a/index.m3u8
+
+#EXTINF:-1 group-title="General",Colors Cineplex (1080p)
+http://66.102.120.18:8000/play/a06z/index.m3u8
+
+#EXTINF:-1 group-title="General",Colors Infinity (1080p)
+http://66.102.120.18:8000/play/a014/index.m3u8
+
+#EXTINF:-1 group-title="General",DD Bangla
+https://d3eyhgoylams0m.cloudfront.net/v1/manifest/93ce20f0f52760bf38be911ff4c91ed02aa2fd92/ed7bd2c7-8d10-4051-b397-2f6b90f99acb/2e9e32a4-c4f7-49c3-96d6-c4e3660c7e3f/2.m3u8
+
+#EXTINF:-1 group-title="General",DD India (1080p)
+https://d3qs3d2rkhfqrt.cloudfront.net/out/v1/ceda14583477426aa162a65392d8ea07/index.m3u8
+
+#EXTINF:-1 group-title="General",CNBC Awaaz (1080p)
+https://n18syndication.akamaized.net/bpk-tv/CNBC_Awaaz_NW18_MOB/output01/master.m3u8
+
+#EXTINF:-1 group-title="General",DD Bharati (720p)
+https://cdn-1.pishow.tv/live/10/master.m3u8
+
+#EXTINF:-1 group-title="General",CNBC Bajar (1080p)
+https://n18syndication.akamaized.net/bpk-tv/CNBC_Bazaar_NW18_MOB/output01/master.m3u8
+
+#EXTINF:-1 group-title="General",CNBC TV18 (1080p)
+https://d35j504z0x2vu2.cloudfront.net/v1/master/0bc8e8376bd8417a1b6761138aa41c26c7309312/cnbc-tv18/master.m3u8
+
+#EXTINF:-1 group-title="General",DD National HD (1080p)
+https://d3qs3d2rkhfqrt.cloudfront.net/out/v1/40492a64c1db4a1385ba1a397d357d3a/index.m3u8
+
+#EXTINF:-1 group-title="General",DD News (1080p)
+https://d3qs3d2rkhfqrt.cloudfront.net/out/v1/0811cd8c37ca4c409d5385a6cd2fa18b/index.m3u8
+
+#EXTINF:-1 group-title="General",Desi Channel (720p)
+https://livestream.unlimitedcdn.com/agm-dc/desi-channel/index.m3u8
+
+#EXTINF:-1 group-title="General",DD Madhya Pradesh (720p)
+https://cdn-1.pishow.tv/live/31/master.m3u8
+
+#EXTINF:-1 group-title="General",Disney Channel (576p) [Not 24/7]
+http://66.102.120.18:8000/play/a070/index.m3u8
+
+#EXTINF:-1 group-title="General",Disney Channel HD (1080p)
+http://66.102.120.18:8000/play/a013/index.m3u8
+
+#EXTINF:-1 group-title="General",Disney International HD
+http://66.102.120.18:8000/play/a078/index.m3u8
+
+#EXTINF:-1 group-title="General",DD Sports (720p)
+https://cdn-6.pishow.tv/live/13/master.m3u8
+
+#EXTINF:-1 group-title="General",DD Uttar Pradesh (720p)
+https://cdn-1.pishow.tv/live/36/master.m3u8
+
+#EXTINF:-1 group-title="General",Enterr 10 Bangla (720p) [Not 24/7]
+https://live-bangla.akamaized.net/liveabr/playlist.m3u8
+
+#EXTINF:-1 group-title="General",Dhoom Music (720p)
+https://cdn-1.pishow.tv/live/1456/master.m3u8
+
+#EXTINF:-1 group-title="General",Epic TV (1080p)
+https://epiconvh.akamaized.net/live/epic/master.m3u8
+
+#EXTINF:-1 group-title="General",ETV Cinema HD (1080p)
+https://d1q7j6ha51ro6f.cloudfront.net/v1/master/9d43eacaed199f8d5883927e7aef514a8a08e108/ETV_CINEMA_H264-3_cloud_in/index.m3u8
+
+#EXTINF:-1 group-title="General",ETV Life (480p)
+https://d2cj1h11htct8o.cloudfront.net/v1/master/9d43eacaed199f8d5883927e7aef514a8a08e108/ETV_LIFE_H264_cloud_in/index.m3u8
+
+#EXTINF:-1 group-title="General",India News (1080p)
+https://newsxott.in/hls/indianewsnational.m3u8
+
+#EXTINF:-1 group-title="General",India News Uttar Pradesh (1080p)
+https://newsxott.in/hls/indianewsupuk.m3u8
+
+#EXTINF:-1 group-title="General",India TV (720p)
+https://pl-indiatvnews.akamaized.net/out/v1/db79179b608641ceaa5a4d0dd0dca8da/index.m3u8
+
+#EXTINF:-1 group-title="General",India TV Speed News (1080p)
+https://poclive-indiatvnews.akamaized.net/hlslive/Admin/px0219297/live/janya/master.m3u8
+
+#EXTINF:-1 group-title="General",Kolkata TV (1080p)
+https://d35j504z0x2vu2.cloudfront.net/v1/master/0bc8e8376bd8417a1b6761138aa41c26c7309312/kolkata-tv/index.m3u8
+
+#EXTINF:-1 group-title="General",India Today (720p) [Not 24/7]
+https://indiatodaylive.akamaized.net/hls/live/2014320/indiatoday/indiatodaylive/playlist.m3u8
+
+#EXTINF:-1 group-title="General",India Today
+https://livehub-voidnet.onrender.com/cluster/streamcore/in/INDIATODAY_StreamOrchestrator.m3u8
+
+#EXTINF:-1 group-title="General",Khushboo Bangla (720p)
+https://cdn-4.pishow.tv/live/1473/master.m3u8
+
+#EXTINF:-1 group-title="General",Movies Now (1080p)
+http://163.61.227.29:8000/play/a01y/index.m3u8
+
+#EXTINF:-1 group-title="General",National Geographic HD (1080p)
+http://66.102.120.18:8000/play/a01f/index.m3u8
+
+#EXTINF:-1 group-title="General",National Geographic Wild HD (1080p)
+http://66.102.120.18:8000/play/a01d/index.m3u8
+
+#EXTINF:-1 group-title="General",NDTV Good Times (1080p)
+https://amg01448-samsungin-ndtvgoodtimes-samsungin-ad-gp.amagi.tv/playlist/amg01448-samsungin-ndtvgoodtimes-samsungin/playlist.m3u8
+
+#EXTINF:-1 group-title="General",Music India (720p) [Not 24/7]
+https://cdn-2.pishow.tv/live/226/master.m3u8
+
+#EXTINF:-1 group-title="General",News X (1080p)
+https://newsxott.in/hls/newsx.m3u8
+
+#EXTINF:-1 group-title="General",News18 Bangla (1080p)
+https://n18syndication.akamaized.net/bpk-tv/News18_Bangla_NW18_MOB/output01/master.m3u8
+
+#EXTINF:-1 group-title="General",News Nation (1080p)
+https://d3qs3d2rkhfqrt.cloudfront.net/out/v1/6cd2f649739a45ca9de1daf81cc7d0f2/index.m3u8
+
+#EXTINF:-1 group-title="General",News18 India (1080p)
+https://n18syndication.akamaized.net/bpk-tv/News18_India_NW18_MOB/output01/master.m3u8
+
+#EXTINF:-1 group-title="General",Republic TV (1080p)
+https://samsung-republictv.amagi.tv/ts-ap-s1-n1/playlist/samsungin-republictv-samsungindia/playlist.m3u8
+
+#EXTINF:-1 group-title="General",Sanskar USA (1080p)
+https://d2netiedy8cz3x.cloudfront.net/out/v1/9bf6fa4ac8d6432cb98da13b121ba3c2/index.m3u8
+
+#EXTINF:-1 group-title="General",Rupasi Bangla (720p)
+https://cdn-4.pishow.tv/live/1039/master.m3u8
+
+#EXTINF:-1 group-title="General",Satsang Web TV (1080p)
+https://d1ji7e9jbzm5g8.cloudfront.net/out/v1/769f22f64d80442889306b9c4abea63c/index.m3u8
+
+#EXTINF:-1 group-title="General",Sangeet Bangla (720p)
+https://cdn-4.pishow.tv/live/1143/master.m3u8
+
+#EXTINF:-1 group-title="General",Shemaroo Josh (720p)
+https://airtelapp.shemaroo.com/shemarooChumbakTV/smil:shemarooChumbakTVadp.smil/playlist.m3u8
+
+#EXTINF:-1 group-title="General",Star Family (576p) [Not 24/7]
+http://c0.cdn.trinity-tv.net/stream/zfmjgma9zn46fa797ez9fgkw7msh9mj4tppspg23gey6mmx5fqiy7ky3jqx4uhgsfsrd8r76si8ykb2anw9442g4qkq5fzpdvwdqf5te24ixu9zrx3aesm9fzt59q5y2s8qwgbqhvf6d3z5bjy3qb2t4.m3u8
+
+#EXTINF:-1 group-title="General",Sony Entertainment Television (1080p)
+http://66.102.120.18:8000/play/a005/index.m3u8
+
+#EXTINF:-1 group-title="General",Sony BBC Earth (1080p)
+http://66.102.120.18:8000/play/a01r/index.m3u8
+
+#EXTINF:-1 group-title="General",Sony Sports Ten 1 (1080p)
+http://66.102.120.18:8000/play/a00e/index.m3u8
+
+#EXTINF:-1 group-title="General",Sony Max 2 (576p)
+http://66.102.120.18:8000/play/a00h/index.m3u8
+
+#EXTINF:-1 group-title="General",Sony Pix (1080p)
+http://66.102.120.18:8000/play/a01z/index.m3u8
+
+#EXTINF:-1 group-title="General",Sony Sports Ten 5 (1080p)
+http://66.102.120.18:8000/play/a010/index.m3u8
+
+#EXTINF:-1 group-title="General",Shemaroo TV (720p)
+https://cdn-3.pishow.tv/live/230/master.m3u8
+
+#EXTINF:-1 group-title="General",Sony Sports Ten 2 (1080p)
+http://66.102.120.18:8000/play/a01y/index.m3u8
+
+#EXTINF:-1 group-title="General",Star Gold 2 HD (1080p)
+http://66.102.120.18:8000/play/a077/index.m3u8
+
+#EXTINF:-1 group-title="General",Star Gold HD (1080p)
+http://66.102.120.18:8000/play/a00f/index.m3u8
+
+#EXTINF:-1 group-title="General",Star Sports 2 HD (1080p)
+http://163.61.227.29:8000/play/a069/index.m3u8
+
+#EXTINF:-1 group-title="General",Star Movies Select HD (1080p)
+http://66.102.120.18:8000/play/a020/index.m3u8
+
+#EXTINF:-1 group-title="General",Star Sports 1 HD (1080p)
+http://66.102.120.18:8000/play/a009/index.m3u8
+
+#EXTINF:-1 group-title="General",Star Movies HD (1080p)
+http://66.102.120.18:8000/play/a021/index.m3u8
+
+#EXTINF:-1 group-title="General",Star Sports 2 Hindi (1080p)
+http://66.102.120.18:8000/play/a00v/index.m3u8
+
+#EXTINF:-1 group-title="General",Star Sports 1 Hindi HD (1080p)
+http://66.102.120.18:8000/play/a072/index.m3u8
+
+#EXTINF:-1 group-title="General",StarPlus HD (1080p)
+http://66.102.120.18:8000/play/a008/index.m3u8
+
+#EXTINF:-1 group-title="General",Travelxp (720p)
+https://27c980761ff9437d929e64647afe183a.mediatailor.us-east-1.amazonaws.com/v1/master/44f73ba4d03e9607dcd9bebdcb8494d86964f1d8/RakutenTV-eu_TravelXP/playlist.m3u8
+
+#EXTINF:-1 group-title="General",TV9 Bangla (720p)
+https://dyjmyiv3bp2ez.cloudfront.net/pub-iotv9banaen8yq/liveabr/playlist.m3u8
+
+#EXTINF:-1 group-title="General",WION (Adaptive) (1080p)
+https://raw.githubusercontent.com/Alstruit/adaptive-streams/alstruit-10_23_in/streams/in/WION.in.m3u8
+
+#EXTINF:-1 group-title="General",ZB Cartoon (1080p)
+https://server.zillarbarta.com/zbcatun/video.m3u8
+
+#EXTINF:-1 group-title="General",Zee News (1080p)
+https://dknttpxmr0dwf.cloudfront.net/index_57.m3u8
+
+#EXTINF:-1 group-title="General",Zee Cinema (1080p)
+http://66.102.120.18:8000/play/a06w/index.m3u8
+
+#EXTINF:-1 group-title="General",Zee Cafe (1080p)
+http://66.102.120.18:8000/play/a076/index.m3u8
+
+#EXTINF:-1 group-title="General",Zoom Global (720p)
+https://d35j504z0x2vu2.cloudfront.net/v1/master/0bc8e8376bd8417a1b6761138aa41c26c7309312/zoom-tv/master.m3u8
+
+#EXTINF:-1 group-title="General",Zee TV (1080p)
+http://66.102.120.18:8000/play/a00y/index.m3u8
+
+#EXTINF:-1 group-title="General",Zee Horror Nights (1080p)
+https://amg00862-amg00862c7-amgplt0173.playout.now3.amagi.tv/playlist/amg00862-amg00862c7-amgplt0173/playlist.m3u8
+
+#EXTINF:-1 group-title="General",Zee Comedy Nation (1080p)
+https://amg00862-amg00862c5-amgplt0173.playout.now3.amagi.tv/playlist/amg00862-amg00862c5-amgplt0173/playlist.m3u8
+
+#EXTINF:-1 group-title="General",Zee Dil Se (1080p)
+https://amg00862-amg00862c6-amgplt0173.playout.now3.amagi.tv/playlist/amg00862-amg00862c6-amgplt0173/playlist.m3u8
diff --git a/LICENSE b/LICENSE
index 94a9ed0..c0f5ea0 100644
--- a/LICENSE
+++ b/LICENSE
@@ -1,674 +1,21 @@
- GNU GENERAL PUBLIC LICENSE
- Version 3, 29 June 2007
-
- Copyright (C) 2007 Free Software Foundation, Inc.
- Everyone is permitted to copy and distribute verbatim copies
- of this license document, but changing it is not allowed.
-
- Preamble
-
- The GNU General Public License is a free, copyleft license for
-software and other kinds of works.
-
- The licenses for most software and other practical works are designed
-to take away your freedom to share and change the works. By contrast,
-the GNU General Public License is intended to guarantee your freedom to
-share and change all versions of a program--to make sure it remains free
-software for all its users. We, the Free Software Foundation, use the
-GNU General Public License for most of our software; it applies also to
-any other work released this way by its authors. You can apply it to
-your programs, too.
-
- When we speak of free software, we are referring to freedom, not
-price. Our General Public Licenses are designed to make sure that you
-have the freedom to distribute copies of free software (and charge for
-them if you wish), that you receive source code or can get it if you
-want it, that you can change the software or use pieces of it in new
-free programs, and that you know you can do these things.
-
- To protect your rights, we need to prevent others from denying you
-these rights or asking you to surrender the rights. Therefore, you have
-certain responsibilities if you distribute copies of the software, or if
-you modify it: responsibilities to respect the freedom of others.
-
- For example, if you distribute copies of such a program, whether
-gratis or for a fee, you must pass on to the recipients the same
-freedoms that you received. You must make sure that they, too, receive
-or can get the source code. And you must show them these terms so they
-know their rights.
-
- Developers that use the GNU GPL protect your rights with two steps:
-(1) assert copyright on the software, and (2) offer you this License
-giving you legal permission to copy, distribute and/or modify it.
-
- For the developers' and authors' protection, the GPL clearly explains
-that there is no warranty for this free software. For both users' and
-authors' sake, the GPL requires that modified versions be marked as
-changed, so that their problems will not be attributed erroneously to
-authors of previous versions.
-
- Some devices are designed to deny users access to install or run
-modified versions of the software inside them, although the manufacturer
-can do so. This is fundamentally incompatible with the aim of
-protecting users' freedom to change the software. The systematic
-pattern of such abuse occurs in the area of products for individuals to
-use, which is precisely where it is most unacceptable. Therefore, we
-have designed this version of the GPL to prohibit the practice for those
-products. If such problems arise substantially in other domains, we
-stand ready to extend this provision to those domains in future versions
-of the GPL, as needed to protect the freedom of users.
-
- Finally, every program is threatened constantly by software patents.
-States should not allow patents to restrict development and use of
-software on general-purpose computers, but in those that do, we wish to
-avoid the special danger that patents applied to a free program could
-make it effectively proprietary. To prevent this, the GPL assures that
-patents cannot be used to render the program non-free.
-
- The precise terms and conditions for copying, distribution and
-modification follow.
-
- TERMS AND CONDITIONS
-
- 0. Definitions.
-
- "This License" refers to version 3 of the GNU General Public License.
-
- "Copyright" also means copyright-like laws that apply to other kinds of
-works, such as semiconductor masks.
-
- "The Program" refers to any copyrightable work licensed under this
-License. Each licensee is addressed as "you". "Licensees" and
-"recipients" may be individuals or organizations.
-
- To "modify" a work means to copy from or adapt all or part of the work
-in a fashion requiring copyright permission, other than the making of an
-exact copy. The resulting work is called a "modified version" of the
-earlier work or a work "based on" the earlier work.
-
- A "covered work" means either the unmodified Program or a work based
-on the Program.
-
- To "propagate" a work means to do anything with it that, without
-permission, would make you directly or secondarily liable for
-infringement under applicable copyright law, except executing it on a
-computer or modifying a private copy. Propagation includes copying,
-distribution (with or without modification), making available to the
-public, and in some countries other activities as well.
-
- To "convey" a work means any kind of propagation that enables other
-parties to make or receive copies. Mere interaction with a user through
-a computer network, with no transfer of a copy, is not conveying.
-
- An interactive user interface displays "Appropriate Legal Notices"
-to the extent that it includes a convenient and prominently visible
-feature that (1) displays an appropriate copyright notice, and (2)
-tells the user that there is no warranty for the work (except to the
-extent that warranties are provided), that licensees may convey the
-work under this License, and how to view a copy of this License. If
-the interface presents a list of user commands or options, such as a
-menu, a prominent item in the list meets this criterion.
-
- 1. Source Code.
-
- The "source code" for a work means the preferred form of the work
-for making modifications to it. "Object code" means any non-source
-form of a work.
-
- A "Standard Interface" means an interface that either is an official
-standard defined by a recognized standards body, or, in the case of
-interfaces specified for a particular programming language, one that
-is widely used among developers working in that language.
-
- The "System Libraries" of an executable work include anything, other
-than the work as a whole, that (a) is included in the normal form of
-packaging a Major Component, but which is not part of that Major
-Component, and (b) serves only to enable use of the work with that
-Major Component, or to implement a Standard Interface for which an
-implementation is available to the public in source code form. A
-"Major Component", in this context, means a major essential component
-(kernel, window system, and so on) of the specific operating system
-(if any) on which the executable work runs, or a compiler used to
-produce the work, or an object code interpreter used to run it.
-
- The "Corresponding Source" for a work in object code form means all
-the source code needed to generate, install, and (for an executable
-work) run the object code and to modify the work, including scripts to
-control those activities. However, it does not include the work's
-System Libraries, or general-purpose tools or generally available free
-programs which are used unmodified in performing those activities but
-which are not part of the work. For example, Corresponding Source
-includes interface definition files associated with source files for
-the work, and the source code for shared libraries and dynamically
-linked subprograms that the work is specifically designed to require,
-such as by intimate data communication or control flow between those
-subprograms and other parts of the work.
-
- The Corresponding Source need not include anything that users
-can regenerate automatically from other parts of the Corresponding
-Source.
-
- The Corresponding Source for a work in source code form is that
-same work.
-
- 2. Basic Permissions.
-
- All rights granted under this License are granted for the term of
-copyright on the Program, and are irrevocable provided the stated
-conditions are met. This License explicitly affirms your unlimited
-permission to run the unmodified Program. The output from running a
-covered work is covered by this License only if the output, given its
-content, constitutes a covered work. This License acknowledges your
-rights of fair use or other equivalent, as provided by copyright law.
-
- You may make, run and propagate covered works that you do not
-convey, without conditions so long as your license otherwise remains
-in force. You may convey covered works to others for the sole purpose
-of having them make modifications exclusively for you, or provide you
-with facilities for running those works, provided that you comply with
-the terms of this License in conveying all material for which you do
-not control copyright. Those thus making or running the covered works
-for you must do so exclusively on your behalf, under your direction
-and control, on terms that prohibit them from making any copies of
-your copyrighted material outside their relationship with you.
-
- Conveying under any other circumstances is permitted solely under
-the conditions stated below. Sublicensing is not allowed; section 10
-makes it unnecessary.
-
- 3. Protecting Users' Legal Rights From Anti-Circumvention Law.
-
- No covered work shall be deemed part of an effective technological
-measure under any applicable law fulfilling obligations under article
-11 of the WIPO copyright treaty adopted on 20 December 1996, or
-similar laws prohibiting or restricting circumvention of such
-measures.
-
- When you convey a covered work, you waive any legal power to forbid
-circumvention of technological measures to the extent such circumvention
-is effected by exercising rights under this License with respect to
-the covered work, and you disclaim any intention to limit operation or
-modification of the work as a means of enforcing, against the work's
-users, your or third parties' legal rights to forbid circumvention of
-technological measures.
-
- 4. Conveying Verbatim Copies.
-
- You may convey verbatim copies of the Program's source code as you
-receive it, in any medium, provided that you conspicuously and
-appropriately publish on each copy an appropriate copyright notice;
-keep intact all notices stating that this License and any
-non-permissive terms added in accord with section 7 apply to the code;
-keep intact all notices of the absence of any warranty; and give all
-recipients a copy of this License along with the Program.
-
- You may charge any price or no price for each copy that you convey,
-and you may offer support or warranty protection for a fee.
-
- 5. Conveying Modified Source Versions.
-
- You may convey a work based on the Program, or the modifications to
-produce it from the Program, in the form of source code under the
-terms of section 4, provided that you also meet all of these conditions:
-
- a) The work must carry prominent notices stating that you modified
- it, and giving a relevant date.
-
- b) The work must carry prominent notices stating that it is
- released under this License and any conditions added under section
- 7. This requirement modifies the requirement in section 4 to
- "keep intact all notices".
-
- c) You must license the entire work, as a whole, under this
- License to anyone who comes into possession of a copy. This
- License will therefore apply, along with any applicable section 7
- additional terms, to the whole of the work, and all its parts,
- regardless of how they are packaged. This License gives no
- permission to license the work in any other way, but it does not
- invalidate such permission if you have separately received it.
-
- d) If the work has interactive user interfaces, each must display
- Appropriate Legal Notices; however, if the Program has interactive
- interfaces that do not display Appropriate Legal Notices, your
- work need not make them do so.
-
- A compilation of a covered work with other separate and independent
-works, which are not by their nature extensions of the covered work,
-and which are not combined with it such as to form a larger program,
-in or on a volume of a storage or distribution medium, is called an
-"aggregate" if the compilation and its resulting copyright are not
-used to limit the access or legal rights of the compilation's users
-beyond what the individual works permit. Inclusion of a covered work
-in an aggregate does not cause this License to apply to the other
-parts of the aggregate.
-
- 6. Conveying Non-Source Forms.
-
- You may convey a covered work in object code form under the terms
-of sections 4 and 5, provided that you also convey the
-machine-readable Corresponding Source under the terms of this License,
-in one of these ways:
-
- a) Convey the object code in, or embodied in, a physical product
- (including a physical distribution medium), accompanied by the
- Corresponding Source fixed on a durable physical medium
- customarily used for software interchange.
-
- b) Convey the object code in, or embodied in, a physical product
- (including a physical distribution medium), accompanied by a
- written offer, valid for at least three years and valid for as
- long as you offer spare parts or customer support for that product
- model, to give anyone who possesses the object code either (1) a
- copy of the Corresponding Source for all the software in the
- product that is covered by this License, on a durable physical
- medium customarily used for software interchange, for a price no
- more than your reasonable cost of physically performing this
- conveying of source, or (2) access to copy the
- Corresponding Source from a network server at no charge.
-
- c) Convey individual copies of the object code with a copy of the
- written offer to provide the Corresponding Source. This
- alternative is allowed only occasionally and noncommercially, and
- only if you received the object code with such an offer, in accord
- with subsection 6b.
-
- d) Convey the object code by offering access from a designated
- place (gratis or for a charge), and offer equivalent access to the
- Corresponding Source in the same way through the same place at no
- further charge. You need not require recipients to copy the
- Corresponding Source along with the object code. If the place to
- copy the object code is a network server, the Corresponding Source
- may be on a different server (operated by you or a third party)
- that supports equivalent copying facilities, provided you maintain
- clear directions next to the object code saying where to find the
- Corresponding Source. Regardless of what server hosts the
- Corresponding Source, you remain obligated to ensure that it is
- available for as long as needed to satisfy these requirements.
-
- e) Convey the object code using peer-to-peer transmission, provided
- you inform other peers where the object code and Corresponding
- Source of the work are being offered to the general public at no
- charge under subsection 6d.
-
- A separable portion of the object code, whose source code is excluded
-from the Corresponding Source as a System Library, need not be
-included in conveying the object code work.
-
- A "User Product" is either (1) a "consumer product", which means any
-tangible personal property which is normally used for personal, family,
-or household purposes, or (2) anything designed or sold for incorporation
-into a dwelling. In determining whether a product is a consumer product,
-doubtful cases shall be resolved in favor of coverage. For a particular
-product received by a particular user, "normally used" refers to a
-typical or common use of that class of product, regardless of the status
-of the particular user or of the way in which the particular user
-actually uses, or expects or is expected to use, the product. A product
-is a consumer product regardless of whether the product has substantial
-commercial, industrial or non-consumer uses, unless such uses represent
-the only significant mode of use of the product.
-
- "Installation Information" for a User Product means any methods,
-procedures, authorization keys, or other information required to install
-and execute modified versions of a covered work in that User Product from
-a modified version of its Corresponding Source. The information must
-suffice to ensure that the continued functioning of the modified object
-code is in no case prevented or interfered with solely because
-modification has been made.
-
- If you convey an object code work under this section in, or with, or
-specifically for use in, a User Product, and the conveying occurs as
-part of a transaction in which the right of possession and use of the
-User Product is transferred to the recipient in perpetuity or for a
-fixed term (regardless of how the transaction is characterized), the
-Corresponding Source conveyed under this section must be accompanied
-by the Installation Information. But this requirement does not apply
-if neither you nor any third party retains the ability to install
-modified object code on the User Product (for example, the work has
-been installed in ROM).
-
- The requirement to provide Installation Information does not include a
-requirement to continue to provide support service, warranty, or updates
-for a work that has been modified or installed by the recipient, or for
-the User Product in which it has been modified or installed. Access to a
-network may be denied when the modification itself materially and
-adversely affects the operation of the network or violates the rules and
-protocols for communication across the network.
-
- Corresponding Source conveyed, and Installation Information provided,
-in accord with this section must be in a format that is publicly
-documented (and with an implementation available to the public in
-source code form), and must require no special password or key for
-unpacking, reading or copying.
-
- 7. Additional Terms.
-
- "Additional permissions" are terms that supplement the terms of this
-License by making exceptions from one or more of its conditions.
-Additional permissions that are applicable to the entire Program shall
-be treated as though they were included in this License, to the extent
-that they are valid under applicable law. If additional permissions
-apply only to part of the Program, that part may be used separately
-under those permissions, but the entire Program remains governed by
-this License without regard to the additional permissions.
-
- When you convey a copy of a covered work, you may at your option
-remove any additional permissions from that copy, or from any part of
-it. (Additional permissions may be written to require their own
-removal in certain cases when you modify the work.) You may place
-additional permissions on material, added by you to a covered work,
-for which you have or can give appropriate copyright permission.
-
- Notwithstanding any other provision of this License, for material you
-add to a covered work, you may (if authorized by the copyright holders of
-that material) supplement the terms of this License with terms:
-
- a) Disclaiming warranty or limiting liability differently from the
- terms of sections 15 and 16 of this License; or
-
- b) Requiring preservation of specified reasonable legal notices or
- author attributions in that material or in the Appropriate Legal
- Notices displayed by works containing it; or
-
- c) Prohibiting misrepresentation of the origin of that material, or
- requiring that modified versions of such material be marked in
- reasonable ways as different from the original version; or
-
- d) Limiting the use for publicity purposes of names of licensors or
- authors of the material; or
-
- e) Declining to grant rights under trademark law for use of some
- trade names, trademarks, or service marks; or
-
- f) Requiring indemnification of licensors and authors of that
- material by anyone who conveys the material (or modified versions of
- it) with contractual assumptions of liability to the recipient, for
- any liability that these contractual assumptions directly impose on
- those licensors and authors.
-
- All other non-permissive additional terms are considered "further
-restrictions" within the meaning of section 10. If the Program as you
-received it, or any part of it, contains a notice stating that it is
-governed by this License along with a term that is a further
-restriction, you may remove that term. If a license document contains
-a further restriction but permits relicensing or conveying under this
-License, you may add to a covered work material governed by the terms
-of that license document, provided that the further restriction does
-not survive such relicensing or conveying.
-
- If you add terms to a covered work in accord with this section, you
-must place, in the relevant source files, a statement of the
-additional terms that apply to those files, or a notice indicating
-where to find the applicable terms.
-
- Additional terms, permissive or non-permissive, may be stated in the
-form of a separately written license, or stated as exceptions;
-the above requirements apply either way.
-
- 8. Termination.
-
- You may not propagate or modify a covered work except as expressly
-provided under this License. Any attempt otherwise to propagate or
-modify it is void, and will automatically terminate your rights under
-this License (including any patent licenses granted under the third
-paragraph of section 11).
-
- However, if you cease all violation of this License, then your
-license from a particular copyright holder is reinstated (a)
-provisionally, unless and until the copyright holder explicitly and
-finally terminates your license, and (b) permanently, if the copyright
-holder fails to notify you of the violation by some reasonable means
-prior to 60 days after the cessation.
-
- Moreover, your license from a particular copyright holder is
-reinstated permanently if the copyright holder notifies you of the
-violation by some reasonable means, this is the first time you have
-received notice of violation of this License (for any work) from that
-copyright holder, and you cure the violation prior to 30 days after
-your receipt of the notice.
-
- Termination of your rights under this section does not terminate the
-licenses of parties who have received copies or rights from you under
-this License. If your rights have been terminated and not permanently
-reinstated, you do not qualify to receive new licenses for the same
-material under section 10.
-
- 9. Acceptance Not Required for Having Copies.
-
- You are not required to accept this License in order to receive or
-run a copy of the Program. Ancillary propagation of a covered work
-occurring solely as a consequence of using peer-to-peer transmission
-to receive a copy likewise does not require acceptance. However,
-nothing other than this License grants you permission to propagate or
-modify any covered work. These actions infringe copyright if you do
-not accept this License. Therefore, by modifying or propagating a
-covered work, you indicate your acceptance of this License to do so.
-
- 10. Automatic Licensing of Downstream Recipients.
-
- Each time you convey a covered work, the recipient automatically
-receives a license from the original licensors, to run, modify and
-propagate that work, subject to this License. You are not responsible
-for enforcing compliance by third parties with this License.
-
- An "entity transaction" is a transaction transferring control of an
-organization, or substantially all assets of one, or subdividing an
-organization, or merging organizations. If propagation of a covered
-work results from an entity transaction, each party to that
-transaction who receives a copy of the work also receives whatever
-licenses to the work the party's predecessor in interest had or could
-give under the previous paragraph, plus a right to possession of the
-Corresponding Source of the work from the predecessor in interest, if
-the predecessor has it or can get it with reasonable efforts.
-
- You may not impose any further restrictions on the exercise of the
-rights granted or affirmed under this License. For example, you may
-not impose a license fee, royalty, or other charge for exercise of
-rights granted under this License, and you may not initiate litigation
-(including a cross-claim or counterclaim in a lawsuit) alleging that
-any patent claim is infringed by making, using, selling, offering for
-sale, or importing the Program or any portion of it.
-
- 11. Patents.
-
- A "contributor" is a copyright holder who authorizes use under this
-License of the Program or a work on which the Program is based. The
-work thus licensed is called the contributor's "contributor version".
-
- A contributor's "essential patent claims" are all patent claims
-owned or controlled by the contributor, whether already acquired or
-hereafter acquired, that would be infringed by some manner, permitted
-by this License, of making, using, or selling its contributor version,
-but do not include claims that would be infringed only as a
-consequence of further modification of the contributor version. For
-purposes of this definition, "control" includes the right to grant
-patent sublicenses in a manner consistent with the requirements of
-this License.
-
- Each contributor grants you a non-exclusive, worldwide, royalty-free
-patent license under the contributor's essential patent claims, to
-make, use, sell, offer for sale, import and otherwise run, modify and
-propagate the contents of its contributor version.
-
- In the following three paragraphs, a "patent license" is any express
-agreement or commitment, however denominated, not to enforce a patent
-(such as an express permission to practice a patent or covenant not to
-sue for patent infringement). To "grant" such a patent license to a
-party means to make such an agreement or commitment not to enforce a
-patent against the party.
-
- If you convey a covered work, knowingly relying on a patent license,
-and the Corresponding Source of the work is not available for anyone
-to copy, free of charge and under the terms of this License, through a
-publicly available network server or other readily accessible means,
-then you must either (1) cause the Corresponding Source to be so
-available, or (2) arrange to deprive yourself of the benefit of the
-patent license for this particular work, or (3) arrange, in a manner
-consistent with the requirements of this License, to extend the patent
-license to downstream recipients. "Knowingly relying" means you have
-actual knowledge that, but for the patent license, your conveying the
-covered work in a country, or your recipient's use of the covered work
-in a country, would infringe one or more identifiable patents in that
-country that you have reason to believe are valid.
-
- If, pursuant to or in connection with a single transaction or
-arrangement, you convey, or propagate by procuring conveyance of, a
-covered work, and grant a patent license to some of the parties
-receiving the covered work authorizing them to use, propagate, modify
-or convey a specific copy of the covered work, then the patent license
-you grant is automatically extended to all recipients of the covered
-work and works based on it.
-
- A patent license is "discriminatory" if it does not include within
-the scope of its coverage, prohibits the exercise of, or is
-conditioned on the non-exercise of one or more of the rights that are
-specifically granted under this License. You may not convey a covered
-work if you are a party to an arrangement with a third party that is
-in the business of distributing software, under which you make payment
-to the third party based on the extent of your activity of conveying
-the work, and under which the third party grants, to any of the
-parties who would receive the covered work from you, a discriminatory
-patent license (a) in connection with copies of the covered work
-conveyed by you (or copies made from those copies), or (b) primarily
-for and in connection with specific products or compilations that
-contain the covered work, unless you entered into that arrangement,
-or that patent license was granted, prior to 28 March 2007.
-
- Nothing in this License shall be construed as excluding or limiting
-any implied license or other defenses to infringement that may
-otherwise be available to you under applicable patent law.
-
- 12. No Surrender of Others' Freedom.
-
- If conditions are imposed on you (whether by court order, agreement or
-otherwise) that contradict the conditions of this License, they do not
-excuse you from the conditions of this License. If you cannot convey a
-covered work so as to satisfy simultaneously your obligations under this
-License and any other pertinent obligations, then as a consequence you may
-not convey it at all. For example, if you agree to terms that obligate you
-to collect a royalty for further conveying from those to whom you convey
-the Program, the only way you could satisfy both those terms and this
-License would be to refrain entirely from conveying the Program.
-
- 13. Use with the GNU Affero General Public License.
-
- Notwithstanding any other provision of this License, you have
-permission to link or combine any covered work with a work licensed
-under version 3 of the GNU Affero General Public License into a single
-combined work, and to convey the resulting work. The terms of this
-License will continue to apply to the part which is the covered work,
-but the special requirements of the GNU Affero General Public License,
-section 13, concerning interaction through a network will apply to the
-combination as such.
-
- 14. Revised Versions of this License.
-
- The Free Software Foundation may publish revised and/or new versions of
-the GNU General Public License from time to time. Such new versions will
-be similar in spirit to the present version, but may differ in detail to
-address new problems or concerns.
-
- Each version is given a distinguishing version number. If the
-Program specifies that a certain numbered version of the GNU General
-Public License "or any later version" applies to it, you have the
-option of following the terms and conditions either of that numbered
-version or of any later version published by the Free Software
-Foundation. If the Program does not specify a version number of the
-GNU General Public License, you may choose any version ever published
-by the Free Software Foundation.
-
- If the Program specifies that a proxy can decide which future
-versions of the GNU General Public License can be used, that proxy's
-public statement of acceptance of a version permanently authorizes you
-to choose that version for the Program.
-
- Later license versions may give you additional or different
-permissions. However, no additional obligations are imposed on any
-author or copyright holder as a result of your choosing to follow a
-later version.
-
- 15. Disclaimer of Warranty.
-
- THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
-APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
-HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
-OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
-THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
-IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
-ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
-
- 16. Limitation of Liability.
-
- IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
-WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
-THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
-GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
-USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
-DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
-PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
-EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
-SUCH DAMAGES.
-
- 17. Interpretation of Sections 15 and 16.
-
- If the disclaimer of warranty and limitation of liability provided
-above cannot be given local legal effect according to their terms,
-reviewing courts shall apply local law that most closely approximates
-an absolute waiver of all civil liability in connection with the
-Program, unless a warranty or assumption of liability accompanies a
-copy of the Program in return for a fee.
-
- END OF TERMS AND CONDITIONS
-
- How to Apply These Terms to Your New Programs
-
- If you develop a new program, and you want it to be of the greatest
-possible use to the public, the best way to achieve this is to make it
-free software which everyone can redistribute and change under these terms.
-
- To do so, attach the following notices to the program. It is safest
-to attach them to the start of each source file to most effectively
-state the exclusion of warranty; and each file should have at least
-the "copyright" line and a pointer to where the full notice is found.
-
-
- Copyright (C)
-
- This program is free software: you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation, either version 3 of the License, or
- (at your option) any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program. If not, see .
-
-Also add information on how to contact you by electronic and paper mail.
-
- If the program does terminal interaction, make it output a short
-notice like this when it starts in an interactive mode:
-
- Copyright (C)
- This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
- This is free software, and you are welcome to redistribute it
- under certain conditions; type `show c' for details.
-
-The hypothetical commands `show w' and `show c' should show the appropriate
-parts of the General Public License. Of course, your program's commands
-might be different; for a GUI interface, you would use an "about box".
-
- You should also get your employer (if you work as a programmer) or school,
-if any, to sign a "copyright disclaimer" for the program, if necessary.
-For more information on this, and how to apply and follow the GNU GPL, see
-.
-
- The GNU General Public License does not permit incorporating your program
-into proprietary programs. If your program is a subroutine library, you
-may consider it more useful to permit linking proprietary applications with
-the library. If this is what you want to do, use the GNU Lesser General
-Public License instead of this License. But first, please read
-.
+MIT License
+
+Copyright (c) 2025 peterpt
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in all
+copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+SOFTWARE.
diff --git a/MY_list.m3u b/MY_list.m3u
new file mode 100644
index 0000000..5964fa4
--- /dev/null
+++ b/MY_list.m3u
@@ -0,0 +1,41 @@
+#EXTM3U
+
+#EXTINF:-1 group-title="CBS",CBS News 24/7 (720p)
+https://cbsn-us.cbsnstream.cbsnews.com/out/v1/55a8648e8f134e82a470f83d562deeca/master.m3u8
+
+#EXTINF:-1 group-title="CBS",CBS News Bay Area (720p)
+https://cbsn-sf.cbsnstream.cbsnews.com/out/v1/dac63c1abb3f4a2dac9f508f44bb072a/master.m3u8
+
+#EXTINF:-1 group-title="CBS",CBS News Los Angeles (720p)
+https://cbsn-la.cbsnstream.cbsnews.com/out/v1/57b6c4534a164accb6b1872b501e0028/master.m3u8
+
+#EXTINF:-1 group-title="KIDS",PBS Kids Pacific (1080p)
+https://livestream.pbskids.org/out/v1/11f2e6b73eaa4887b3746cb863960e79/pst.m3u8
+
+#EXTINF:-1 group-title="KIDS",Baby Shark TV (720p)
+https://newidco-babysharktv-1-eu.rakuten.wurl.tv/playlist.m3u8
+
+#EXTINF:-1 group-title="FI",YleX Studio Live (720p)
+https://ylestudiolive.akamaized.net/hls/live/2007826/ylestudiolive-YleX/master.m3u8
+
+#EXTINF:-1 group-title="FI",Onni TV (720p)
+https://onnitv.digitacdn.net/live/ott/onnitv/playlist.m3u8
+
+#EXTINF:-1 group-title="FI",Himlen TV7 (720p)
+https://vod.tv7.fi/tv7-se/smil:tv7-se.smil/playlist.m3u8
+
+#EXTINF:-1 group-title="FI",Taevas TV7 (720p)
+https://vod.tv7.fi/tv7-ee/smil:tv7-ee.smil/playlist.m3u8
+
+#EXTINF:-1 group-title="FI",MTV Uutiset (720p)
+https://live.streaming.a2d.tv/asset/20025962.isml/.m3u8
+
+#EXTINF:-1 group-title="FI",Taivas TV7 (720p)
+https://vod.tv7.fi/tv7-fi/smil:tv7-fi.smil/playlist.m3u8
+
+#EXTINF:-1 group-title="FI",YLE TV 1 (1080p) [Not 24/7]
+https://yletvworld.akamaized.net/hls/live/622540/yletv1w/index.m3u8
+
+#EXTINF:-1 group-title="FI",YLE TV 2 (1080p) [Not 24/7]
+https://yletvworld.akamaized.net/hls/live/622541/yletv2w/index.m3u8
+
diff --git a/Rakuten.m3u b/Rakuten.m3u
new file mode 100644
index 0000000..865d783
--- /dev/null
+++ b/Rakuten.m3u
@@ -0,0 +1,182 @@
+#EXTM3U
+
+#EXTINF:-1 group-title="General",Cosmic Frontiers (1080p)
+https://amg00376-magellan-amg00376c14-rakuten-uk-1694.playouts.now.amagi.tv/playlist/amg00376-magellantv-spacesciencenowcauk-rakutenuk/playlist.m3u8
+
+#EXTINF:-1 group-title="General",Curiosity Now (1080p)
+https://amg00170-curiositystream-amg00170c3-rakuten-us-2289.playouts.now.amagi.tv/playlist/amg00170-curiositystreamllcfast-curiositynowrow-rakutenus/playlist.m3u8
+
+#EXTINF:-1 group-title="General",GB News (1080p)
+https://rakutenaa-lightning-gbnews-rakuten-ccoa9.amagi.tv/playlist/rakutenAA-lightning-gbnews-rakuten/playlist.m3u8
+
+#EXTINF:-1 group-title="General",Dog The Bounty Hunter [Geo-blocked] (1080p)
+https://amg00276-amg00276c11-rakuten-uk-3446.playouts.now.amagi.tv/playlist/amg00276-aetelevisionnetworksfast-dogthebountyhunterall-rakutenuk/playlist.m3u8
+
+#EXTINF:-1 group-title="General",History Hunters (1080p)
+https://amg00841-amg00841c7-rakuten-uk-2820.playouts.now.amagi.tv/playlist/amg00841-aeemeafast-historyhuntersrakuten-rakutenuk/playlist.m3u8
+
+#EXTINF:-1 group-title="General",Adventure Earth (720p)
+https://autentic-adventure-earth-1-eu.rakuten.wurl.tv/playlist.m3u8
+
+#EXTINF:-1 group-title="General",Ax Men (720p)
+https://36dc2f37.wurl.com/master/f36d25e7e52f1ba8d7e56eb859c636563214f541/UmFrdXRlblRWLWdiX0F4TWVuX0hMUw/playlist.m3u8
+
+#EXTINF:-1 group-title="General",Duck Dynasty (1080p)
+https://amg00276-amg00276c2-rakuten-uk-3449.playouts.now.amagi.tv/playlist.m3u8
+
+#EXTINF:-1 group-title="General",Hardcore Pawn (1080p)
+https://amg00627-amg00627c8-rakuten-uk-4801.playouts.now.amagi.tv/playlist.m3u8
+
+#EXTINF:-1 group-title="General",Homes Under Hammer (720p)
+https://all3media-homes-under-the-hammer-1-gb.rakuten.wurl.tv/playlist.m3u8
+
+#EXTINF:-1 group-title="General",Love Pets (1080p)
+https://rakutenaa-blueskyent-lovepetsemea-rakuten-ikc4q.amagi.tv/playlist/rakutenAA-blueskyent-lovepetsemea-rakuten/playlist.m3u8
+
+#EXTINF:-1 group-title="General",MyZen Wellbeing TV (1080p)
+https://rakutenaa-myzen-en-rakuten-5sex7.amagi.tv/playlist/rakutenAA-myzen-en-rakuten/playlist.m3u8
+
+#EXTINF:-1 group-title="General",Highway Thru Hell (1080p)
+https://amg00627-amg00627c15-rakuten-uk-4803.playouts.now.amagi.tv/playlist.m3u8
+
+#EXTINF:-1 group-title="General",Graham Norton (1080p)
+https://amg00654-itv-amg00654c35-rakuten-gb-7598.playouts.now.amagi.tv/playlist.m3u8
+
+#EXTINF:-1 group-title="General",Mr. Bean Anime (1080p)
+https://amg00627-amg00627c28-rakuten-uk-3984.playouts.now.amagi.tv/playlist/amg00627-banijayfast-mrbeanukcc-rakutenuk/playlist.m3u8
+
+#EXTINF:-1 group-title="General",Hell's Kitchen (1080p)
+https://itv-hellskitchen-rakuten.amagi.tv/playlist.m3u8
+
+#EXTINF:-1 group-title="General",Mythbusters (1080p)
+https://amg00627-amg00627c14-rakuten-uk-4802.playouts.now.amagi.tv/index.m3u8
+
+#EXTINF:-1 group-title="General",NTD TV English (1080p)
+https://amg17596-ntdtv-amg17596c1-rakuten-gb-6741.playouts.now.amagi.tv/playlist/amg17596-newtangdynastytelevision-ntdtv-rakutengb/playlist.m3u8
+
+#EXTINF:-1 group-title="General",Inside Crime (1080p)
+https://aenetworks-insidecrime-rakuten.amagi.tv/playlist.m3u8
+
+#EXTINF:-1 group-title="General",Hotel Inspector (1080p)
+https://amg00654-itv-amg00654c4-rakuten-uk-5263.playouts.now.amagi.tv/playlist.m3u8
+
+#EXTINF:-1 group-title="General",Popflix (720p)
+https://signatureentertainment-popflix-1-gb.rakuten.wurl.tv/playlist.m3u8
+
+#EXTINF:-1 group-title="General",INFAST (1080p)
+https://lifestyle-rakuten.amagi.tv/playlist.m3u8
+
+#EXTINF:-1 group-title="General",DesiPlay TV (1080p)
+https://amg00857-amg00857c1-rakuten-us-4656.playouts.now.amagi.tv/playlist.m3u8
+
+#EXTINF:-1 group-title="General",Nitro Circus (1080p)
+https://amg13231-actve-amg13231c1-rakuten-us-5604.playouts.now.amagi.tv/playlist.m3u8
+
+#EXTINF:-1 group-title="General",Mystery TV (1080p)
+https://aenetworks-mysterytv-rakuten.amagi.tv/playlist.m3u8
+
+#EXTINF:-1 group-title="General",I Survived (720p)
+https://8e979536.wurl.com/master/f36d25e7e52f1ba8d7e56eb859c636563214f541/UmFrdXRlblRWLWdiX0lTdXJ2aXZlZF9ITFM/playlist.m3u8
+
+#EXTINF:-1 group-title="General",Haunt TV (1080p)
+https://bamcahaunttvrakuten.amagi.tv/playlist.m3u8
+
+#EXTINF:-1 group-title="General",Ninja Warrior (1080p)
+https://amg00654-itv-amg00654c27-rakuten-uk-5295.playouts.now.amagi.tv/playlist.m3u8
+
+#EXTINF:-1 group-title="General",Now 80s (720p)
+https://lightning-now80s-rakuten.amagi.tv/playlist.m3u8
+
+#EXTINF:-1 group-title="General",Tastemade (1080p)
+https://rakutenaa-tm-intl-aus-rakuten-eu-n1gtg.amagi.tv/playlist/rakutenAA-tm-intl-aus-rakuten-eu/playlist.m3u8
+
+#EXTINF:-1 group-title="General",MyTime Movie Network (1080p)
+https://appletree-mytimeuk-rakuten.amagi.tv/playlist.m3u8
+
+#EXTINF:-1 group-title="General",Real Crime Beta (1080p)
+https://lds-realcrimebeta-rakuten.amagi.tv/playlist.m3u8
+
+#EXTINF:-1 group-title="General",Rakuten TV Action Movies UK (1080p)
+https://54045f0c40fd442c8b06df076aaf1e85.mediatailor.eu-west-1.amazonaws.com/v1/master/0547f18649bd788bec7b67b746e47670f558b6b2/production-LiveChannel-6065/master.m3u8
+
+#EXTINF:-1 group-title="General",Real Wild (1080p)
+https://lds-realwild-rakuten.amagi.tv/playlist.m3u8
+
+#EXTINF:-1 group-title="General",Stormcast Westerns (720p)
+https://stormcast-cinema-llc-westernmaniafast-1-eu.rakuten.wurl.tv/playlist.m3u8
+
+#EXTINF:-1 group-title="General",Strongman (720p)
+https://rightsboosterltd-scl-1-eu.rakuten.wurl.tv/playlist.m3u8
+
+#EXTINF:-1 group-title="General",Pop (1080p)
+https://narrative-popkids-rakuten.amagi.tv/playlist.m3u8
+
+#EXTINF:-1 group-title="General",Red Bull TV (1080p)
+https://e7c8f7d5.wurl.com/master/f36d25e7e52f1ba8d7e56eb859c636563214f541/UmFrdXRlblRWLWdiX1JlZEJ1bGxUVi0xX0hMUw/playlist.m3u8
+
+#EXTINF:-1 group-title="General",Tennis Channel (720p)
+https://tennischannelintl-rakuten.amagi.tv/playlist.m3u8
+
+#EXTINF:-1 group-title="General",Rakuten TV Family Movies UK (1080p)
+https://e3207568b726401995c25670faaf32e4.mediatailor.eu-west-1.amazonaws.com/v1/master/0547f18649bd788bec7b67b746e47670f558b6b2/production-LiveChannel-6203/master.m3u8
+
+#EXTINF:-1 group-title="General",Rakuten Top Movies UK (1080p)
+https://0145451975a64b35866170fd2e8fa486.mediatailor.eu-west-1.amazonaws.com/v1/master/0547f18649bd788bec7b67b746e47670f558b6b2/production-LiveChannel-5987/master.m3u8
+
+#EXTINF:-1 group-title="General",True Lives (1080p)
+https://amg00654-itv-amg00654c7-rakuten-uk-1282.playouts.now.amagi.tv/playlist/amg00654-itvstudiosfast-truelives-rakutenuk/playlist.m3u8
+
+#EXTINF:-1 group-title="General",Travel XP (720p)
+https://travelxp-travelxp-1-eu.rakuten.wurl.tv/playlist.m3u8
+
+#EXTINF:-1 group-title="General",Rakuten TV Comedy Movies UK (1080p)
+https://9be783d652cd4b099cf63e1dc134c4a3.mediatailor.eu-west-1.amazonaws.com/v1/master/0547f18649bd788bec7b67b746e47670f558b6b2/production-LiveChannel-6181/master.m3u8
+
+#EXTINF:-1 group-title="General",Rakuten TV Drama Movies UK (1080p)
+https://fee09fd665814f51b939b6d106cf5f66.mediatailor.eu-west-1.amazonaws.com/v1/master/0547f18649bd788bec7b67b746e47670f558b6b2/production-LiveChannel-6093/master.m3u8
+
+#EXTINF:-1 group-title="General",Tiny House Nation (720p)
+https://7e5c93fc.wurl.com/master/f36d25e7e52f1ba8d7e56eb859c636563214f541/UmFrdXRlblRWLWdiX1RpbnlIb3VzZU5hdGlvbl9ITFM/playlist.m3u8
+
+#EXTINF:-1 group-title="General",Rakuten TV Reality UK (1080p)
+https://68f6dfd1f2bd415b9c42f1d383004b69.mediatailor.eu-west-1.amazonaws.com/v1/master/0547f18649bd788bec7b67b746e47670f558b6b2/production-LiveChannel-6233/master.m3u8
+
+#EXTINF:-1 group-title="General",The Chat Show Channel (1080p)
+https://amg00426-lds-amg00426c11-rakuten-uk-3888.playouts.now.amagi.tv/playlist.m3u8
+
+#EXTINF:-1 group-title="General",Timeline (1080p)
+https://lds-timeline-rakuten.amagi.tv/playlist.m3u8
+
+#EXTINF:-1 group-title="General",Rakuten TV Thrillers UK (1080p)
+https://thriller-rakuten-tv-uk.fast.rakuten.tv/v1/master/0547f18649bd788bec7b67b746e47670f558b6b2/production-LiveChannel-6482/master.m3u8
+
+#EXTINF:-1 group-title="General",Rakuten TV Romance Movies UK (1080p)
+https://2c88ed8c4df9479aa0c7138dc42115e2.mediatailor.eu-west-1.amazonaws.com/v1/master/0547f18649bd788bec7b67b746e47670f558b6b2/production-LiveChannel-6194/master.m3u8
+
+#EXTINF:-1 group-title="General",The Design Network (1080p)
+https://amg00441-amg00441c1-rakuten-us-6050.playouts.now.amagi.tv/playlist.m3u8
+
+#EXTINF:-1 group-title="General",Rakuten TV Sci-Fi UK (1080p)
+https://sci-fi-rakuten-tv-uk.fast.rakuten.tv/v1/master/0547f18649bd788bec7b67b746e47670f558b6b2/production-LiveChannel-6241/master.m3u8
+
+#EXTINF:-1 group-title="General",Tiny Pop (1080p)
+https://amg01753-narrativeuk-amg01753c1-rakuten-uk-2339.playouts.now.amagi.tv/playlist.m3u8
+
+#EXTINF:-1 group-title="General",Eggheads (1080p)
+https://amg00654-itv-amg00654c28-rakuten-uk-5302.playouts.now.amagi.tv/playlist.m3u8
+
+#EXTINF:-1 group-title="General",Waterbear (1080p)
+https://waterbear-waterbear-rakuten.amagi.tv/playlist.m3u8
+
+#EXTINF:-1 group-title="General",World War TV (1080p)
+https://aenetworks-worldwartv-rakuten.amagi.tv/playlist.m3u8
+
+#EXTINF:-1 group-title="General",Tennis+ (1080p)
+https://amg01935-amg01935c1-amgplt0165.playout.now3.amagi.tv/playlist.m3u8
+
+#EXTINF:-1 group-title="General",Vevo Pop (1080p)
+https://amg00056-amg00056c6-rakuten-uk-3235.playouts.now.amagi.tv/playlist.m3u8
+
+#EXTINF:-1 group-title="General",Tastemade (1080p)
+https://tastemade-tdint-rakuten.amagi.tv/playlist.m3u8
+
diff --git a/US.m3u b/US.m3u
new file mode 100644
index 0000000..efaa488
--- /dev/null
+++ b/US.m3u
@@ -0,0 +1,153 @@
+#EXTM3U
+#EXTINF:-1 group-title="General",ABN TV India (540p)
+https://mediaserver.abnvideos.com/streams/abntvindia.m3u8
+
+#EXTINF:-1 group-title="General",ABC
+http://41.205.93.154/ABC/index.m3u8
+
+#EXTINF:-1 group-title="General",AMC
+http://cors.tundracast.com:2000/https://streamer1.nexgen.bz/AMC/index.m3u8
+
+#EXTINF:-1 group-title="General",BBC America
+https://bcovlive-a.akamaihd.net/7f5ec16d102f4b5d92e8e27bc95ff424/us-east-1/6240731308001/playlist.m3u8
+
+#EXTINF:-1 group-title="General",Beach TV Key West & Florida Keys (720p)
+https://5ed325193d4e1.streamlock.net:444/LiveTV/KTVHD/playlist.m3u8
+
+#EXTINF:-1 group-title="General",Better Life TV (720p)
+https://tgn.bozztv.com/betterlife/betterlife/betterlife/index.m3u8
+
+#EXTINF:-1 group-title="General",ABC News (720p)
+https://content.uplynk.com/channel/3324f2467c414329b3b0cc5cd987b6be.m3u8
+
+#EXTINF:-1 group-title="General",Biz TV (1080p)
+https://thegateway.app/BizAndYou/BizTV/playlist.m3u8
+
+#EXTINF:-1 group-title="General",Blues TV
+https://2-fss-2.streamhoster.com/pl_138/205510-3094608-1/playlist.m3u8
+
+#EXTINF:-1 group-title="General",Bloomberg Originals (1080p)
+https://www.bloomberg.com/media-manifest/streams/originals-global.m3u8
+
+#EXTINF:-1 group-title="General",Bloomberg TV + (2160p)
+https://66e4bbba.wurl.com/master/f36d25e7e52f1ba8d7e56eb859c636563214f541/TEctZ2JfQmxvb21iZXJnVFZQbHVzX0hMUw/playlist.m3u8
+
+#EXTINF:-1 group-title="General",Caribbean World Channel
+https://live-us-cdn-1.tvstartupengine.com/live/playlist-prod-da1ba36f-39ba-4347-acce-c3a31de907f3/index.m3u8
+
+#EXTINF:-1 group-title="General",California Music Channel (720p) [Not 24/7]
+https://cmc-ono.amagi.tv/hls/amagi_hls_data_cmcAAAAAA-cmc-ono/CDN/playlist.m3u8
+
+#EXTINF:-1 group-title="General",CBN News Channel (1080p)
+https://fastly.live.brightcove.com/6380396819112/us-east-1/734546207001/eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJob3N0IjoiczFpM3ZpLmVncmVzcy50N2M3emwiLCJhY2NvdW50X2lkIjoiNzM0NTQ2MjA3MDAxIiwiZWhuIjoiZmFzdGx5LmxpdmUuYnJpZ2h0Y292ZS5jb20iLCJpc3MiOiJibGl2ZS1wbGF5YmFjay1zb3VyY2UtYXBpIiwic3ViIjoicGF0aG1hcHRva2VuIiwiYXVkIjpbIjczNDU0NjIwNzAwMSJdLCJqdGkiOiI2MzgwMzk2ODE5MTEyIn0.GDYp4IWtzwPkupEWeeOavnioVknO-Ev3UGlHvM1rE6I/playlist-hls.m3u8
+
+#EXTINF:-1 group-title="General",Channel 10 (720p)
+https://cdn3.wowza.com/5/cFh0V0QwUVc4SDl2/santa-paula/G0930_002/playlist.m3u8
+
+#EXTINF:-1 group-title="General",Bloomberg TV Europe
+https://viamotionhsi.netplus.ch/live/eds/bloomberg/browser-HLS8/bloomberg.m3u8
+
+#EXTINF:-1 group-title="General",CMC-USA (California Music Channel) (720p)
+https://hwlive.streamingmediahosting.com/14215-live/0_obd393sh/playlist.m3u8
+
+#EXTINF:-1 group-title="General",CNBC (720p)
+https://stream.livenewsplay.com:9443/hls/cnbc/cnbcsd.m3u8
+
+#EXTINF:-1 group-title="General",Cloudflare TV (720p)
+https://cloudflare.tv/hls/live.m3u8
+
+#EXTINF:-1 group-title="General",Comedy Central (720p)
+https://fl1.moveonjoy.com/Comedy_Central/index.m3u8
+
+#EXTINF:-1 group-title="General",Disney Channel (720p)
+https://fl31.moveonjoy.com/DISNEY/index.m3u8
+
+#EXTINF:-1 group-title="General",Bloomberg TV+ (1080p)
+https://bloomberg.com/media-manifest/streams/phoenix-us.m3u8
+
+#EXTINF:-1 group-title="General",America's Voice (720p)
+https://content.uplynk.com/channel/26bd482ffe364a1282bc3df28bd3c21f.m3u8
+
+#EXTINF:-1 group-title="General",Entertainment Tonight (720p)
+https://cbsta49f-cbsta49f-ms.global.ssl.fastly.net/amagi7b98-AmagiMixible/master/amagi7b98-AmagiMixible.m3u8
+
+#EXTINF:-1 group-title="General",Fox News Channel (720p)
+https://stream.livenewsplay.com:9443/hls/foxnews/foxsd.m3u8
+
+#EXTINF:-1 group-title="General",Great American Family (720p)
+https://fl1.moveonjoy.com/Great_American_Country/index.m3u8
+
+#EXTINF:-1 group-title="Radios",Freeform (720p)
+https://tvpass.org/live/FreeformEast/hd
+
+#EXTINF:-1 group-title="General",KQED-DT2
+https://kqeddt2.lls.pbs.org/kqeddt2-hls.m3u8
+
+#EXTINF:-1 group-title="General",Dateline 24/7
+https://dz59iptwz5rxs.cloudfront.net/live/master.m3u8
+
+#EXTINF:-1 group-title="Radios",Lego Channel (1080p)
+https://jmp2.uk/stvp-GBBC4300005AL
+
+#EXTINF:-1 group-title="General",NBC
+https://cors-proxy.cooks.fyi/https://streamer2.nexgen.bz/NBC/index.m3u8
+
+#EXTINF:-1 group-title="General",LiveNOW from FOX (720p)
+https://fox-foxnewsnow-vizio.amagi.tv/playlist.m3u8
+
+#EXTINF:-1 group-title="General",NBC West (San Diego) (1080p) [Not 24/7]
+https://nbculocallive.akamaized.net/hls/live/2037098/sandiego/stream1/master.m3u8
+
+#EXTINF:-1 group-title="General",Nickelodeon
+http://23.237.104.106:8080/USA_NICKELODEON/index.m3u8
+
+#EXTINF:-1 group-title="General",PBS Kids
+https://livestream.pbskids.org/out/v1/14507d931bbe48a69287e4850e53443c/est.m3u8
+
+#EXTINF:-1 group-title="General",QVC
+https://qvc-amd-live.akamaized.net/hls/live/2034113/lsqvc1us/master.m3u8
+
+#EXTINF:-1 group-title="General",QVC 2
+https://qvc-amd-live.akamaized.net/hls/live/2034113/lsqvc2us/master.m3u8
+
+#EXTINF:-1 group-title="General",QVC West
+https://qvc-amd-live.akamaized.net/hls/live/2034113/lsqvc1uswest/master.m3u8
+
+#EXTINF:-1 group-title="General",QVC 3 (1080p)
+https://qvc-amd-live.akamaized.net/hls/live/2034113/lsqvc3us/master.m3u8
+
+#EXTINF:-1 group-title="General",Pluto TV MTV Classic
+https://jmp2.uk/plu-66a11a21a79dea0008aa90ca.m3u8
+
+#EXTINF:-1 group-title="General",Shemaroo Bollywood (1080p)
+https://cdn-uw2-prod.tsv2.amagi.tv/linear/amg00864-shemarooenterta-shemabollywood-ono/playlist.m3u8
+
+#EXTINF:-1 group-title="General",Tennis Channel (1080p)
+https://cdn-uw2-prod.tsv2.amagi.tv/linear/amg01444-tennischannelth-tennischnlintl-lggb/playlist.m3u8
+
+#EXTINF:-1 group-title="General",The Cycling Channel
+https://cyclingtv.playout.vju.tv/cyclingtv/main.m3u8
+
+#EXTINF:-1 group-title="General",The Archive (1080p)
+https://cineverse.g-mana.live/media/09899328-5b22-4d3e-ba1e-111856798c99/playlist_3.m3u8
+
+#EXTINF:-1 group-title="General",TLN Media San Francisco
+https://fuel-streaming-prod01.fuelmedia.io/v1/sem/b29d27bb-88af-42d1-937a-5bdf76b71c17.m3u8
+
+#EXTINF:-1 group-title="General",Real America's Voice (720p)
+https://d2jiqiw4g5lj5k.cloudfront.net/v1/master/3722c60a815c199d9c0ef36c5b73da68a62b09d1/AmericasVoiceChannel-prod/AVSamsung/AVSamsung.m3u8
+
+#EXTINF:-1 group-title="General",TVS Bowling Network (720p)
+https://rpn.bozztv.com/gusa/gusa-tvsbowling/index.m3u8
+
+#EXTINF:-1 group-title="General",WildEarth (1080p)
+https://cdn-ue1-prod.tsv2.amagi.tv/linear/amg01290-wildearth-oando/playlist.m3u8
+
+#EXTINF:-1 group-title="Radios",Vevo Pop (1080p)
+https://jmp2.uk/stvp-GBBC19000017V
+
+#EXTINF:-1 group-title="General",World Channel (1080p)
+https://world.lls.pbs.org/index.m3u8
+
+#EXTINF:-1 group-title="General",Yahoo! Finance (1080p)
+https://d1ewctnvcwvvvu.cloudfront.net/playlist.m3u8
\ No newline at end of file
diff --git a/changelog.md b/changelog.md
index d9a4edb..3a41112 100644
--- a/changelog.md
+++ b/changelog.md
@@ -1,7 +1,9 @@
-## IPTV-Checker (Changelog)
-
+## IPTV-Check (Changelog)
+* v3.0 - Fully python3 integrated app , all funcionalities from previous version in CLI and GUI mode , added website finder m3u to find m3u links inside websites , This version does not install itself automatically on /usr/local/sbin anymore
+* v2.1b- Ffmpeg full implementation on capturing video streams to be checked ahead , also added "EXTVLCOPT" to the filters before parsing the links to ffmpeg to test them out
+* v2.0 - OCR Detection on working streaming channels to detect if that channel is really online or is just a bad login
* v1.0 - Few changes in m3u files
* v1.0 - Implemented automatic detection of xml iptv files
* v1.0 - Bug fix & implementation , changed how iptv-check filters the m3u file lists and from now will autoremove repeated urls on lists to scan
* v1.0 - Bug fix , waiting for data was change from 2s to 4s because servers may take sometime to start sending data
-* v1.0 - First Release
\ No newline at end of file
+* v1.0 - First Release
diff --git a/dependencies.txt b/dependencies.txt
new file mode 100644
index 0000000..beefda2
--- /dev/null
+++ b/dependencies.txt
@@ -0,0 +1,6 @@
+ffmpeg
+yt-dlp
+python3-tk
+tesseract-ocr
+libtesseract-dev
+tesseract-ocr-eng
diff --git a/iptv-check b/iptv-check
deleted file mode 100755
index 6542f5f..0000000
--- a/iptv-check
+++ /dev/null
@@ -1,358 +0,0 @@
-#!/bin/bash
-#variables
-path=$(pwd)
-sname=$0
-wfile="$path/oklist.m3u"
-
-#setup colors
-cyan='\e[0;36m'
-green='\033[92m'
-red='\e[1;31m'
-yellow='\e[0;33m'
-orange='\e[38;5;166m'
-
-# Check if temp directory exists
-if [[ ! -d $path/temp ]]
-then
-mkdir "$path/temp" >/dev/null 2>&1
-fi
-
-# Clean any files from previous run in temp folder
-rm -rf "$path/temp/*" >/dev/null 2>&1
-
-# Warning is a simple message that will display every 40 checks on streams to explain user how to quit
-warn() {
-if [[ $i -gt $wrn ]]
-then
-wrn=$((wrn+40))
-else
-if [[ $i == "$wrn" ]]
-then
-echo ""
-echo -e "$red""Press CTRL+C To Stop or Abort IPTV list check"
-echo ""
-fi
-fi
-}
-
-#Ctrl+C Interrupt to stop the script
-trap ctrl_c INT
-function ctrl_c() {
-if [[ -f "$path/temp/pid.tmp" ]]
-then
-pid=$(sed -n 1p < "$path/temp/pid.tmp")
-rpid=$(ps -p "$pid" -o pid= | awk '{print$1}')
-if [[ "$rpid" == "$pid" ]]
-then
-kill $pid >/dev/null 2>&1
-exit 1
-else
-exit 1
-fi
-else
-exit 1
-fi
-
-}
-
-logo() {
-echo -e "$green" "IPTV-Check Tool 1.0"
-echo -e "$yellow" "-------------------------------------"
-echo -e "$blue" "http://github.com/peterpt"
-echo -e "$yellow" "-------------------------------------"
-echo ""
-
-# checkig for wget if it is installed
-which wget > /dev/null 2>&1
- if [ "$?" -eq "1" ]; then
- echo -e "$red" "Wget Missing"
-echo ""
-echo -e "$yellow" "Try : apt-get install wget"
-exit 1
-fi
-}
-
-# The difference between writefile and writefile2 is that (writefile2) is to process the output from m3u files based in xml codes
-# while function (writefile) is to process in output file the conventional m3u files without xml codes in it
-function writefile2() {
-if [[ -f "$wfile" ]]
-then
-gturlline=$(grep -n "\<$chkf\>"<$path/temp/2 | tr ":" "\n" | sed -n 1p)
-stdata=$(sed -n "$gturlline p"< $path/temp/2 | awk '{$1=""; print $0}')
-echo "#EXTINF:-1 ,$stdata" >> "$wfile"
-echo "$chkf" >> "$wfile"
-echo "" >> "$wfile"
-else
-echo "#EXTM3U" > "$wfile"
-echo "" >> "$wfile"
-gturlline=$(grep -n "\<$chkf\>"<$path/temp/2 | tr ":" "\n" | sed -n 1p)
-stdata=$(sed -n "$gturlline p"< $path/temp/2 | awk '{$1=""; print $0}')
-echo "#EXTINF:-1 ,$stdata" >> "$wfile"
-echo "$chkf" >> "$wfile"
-echo "" >> "$wfile"
-fi
-}
-
-
-function writefile() {
-# checks if tool already created previously an m3u file
-if [[ -f "$wfile" ]]
-then
-#searchs for that specific url in original file and get line number
-gturlline=$(grep -n "$chkf"<$path/temp/1 | tr ":" "\n" | sed -n 1p)
-# This variavble will get the line number before the previous url (this is to get channel name)
-defline=$((gturlline-1))
-stdata=$(sed -n "$defline p"< $path/temp/1)
-echo "$stdata" >> "$wfile"
-echo "$chkf" >> "$wfile"
-echo "" >> "$wfile"
-else
-echo "#EXTM3U" > "$wfile"
-echo "" >> "$wfile"
-gturlline=$(grep -n "$chkf"<$path/temp/1 | tr ":" "\n" | sed -n 1p)
-defline=$((gturlline-1))
-stdata=$(sed -n "$defline p"< $path/temp/1)
-echo "$stdata" >> "$wfile"
-echo "$chkf" >> "$wfile"
-echo "" >> "$wfile"
-fi
-}
-
-# Function for m3u files with xml content
-function xmlproc() {
-
-# Find http links only and delete all the other xml codes in the file , this works with many tests i did , but it may need more filtering for m3u files with more xml funtions in it
-grep -F "http" <$path/temp/1 | sed 's///g' | sed 's/^.*http/http/' | sed 's/&.*|//' | sed -e 's/\(.ts\).*\(=\)/\1\2/' | sed 's/=/ /g' | sed "s~~ ~g" > $path/temp/2
-srvnmb=$(wc -l "$path/temp/2" | awk '{print$1}')
-rm -rf "$path/temp/stream" >/dev/null 2>&1
-rm -rf "$path/temp/pid.tmp" >/dev/null 2>&1
-echo ""
-echo -e "$red""Press CTRL+C To Stop or Abort IPTV list check"
-echo ""
-for i in $(seq "$srvnmb")
-do
-chkf=$(sed -n "${i}p" < "$path/temp/2" | awk {'print$1}')
-chkurl=$(echo "$chkf" | head -c 4)
-case "$chkurl" in
-http|rtmp|HTTP)
-wget -q "$chkf" -O "$path/temp/stream" & echo $! > "$path/temp/pid.tmp"
-pid=$(sed -n 1p < "$path/temp/pid.tmp")
-sleep 4
-rpid=$(ps -p "$pid" -o pid= | awk '{print$1}')
-if [[ "$rpid" == "$pid" ]]
-then
-kill $pid
-fi
-if [[ ! -f "$path/temp/stream" ]]
-then
-echo -e "$yellow" "Error reading captured file"
-else
-stsz=$(wc -c "$path/temp/stream" | awk '{print$1}')
-if [[ "$stsz" -le "100" ]]
-then
-echo -e "$green" "Link:$yellow $i$green of :$yellow$srvnmb$green is$red OFF"
-else
-echo -e "$green" "Link:$yellow $i$green of :$yellow$srvnmb$green is$green ON"
-writefile2
-fi
-fi
-;;
-*)
-;;
-esac
-rm -rf "$path/temp/stream" >/dev/null 2>&1
-rm -rf "$path/temp/pid.tmp" >/dev/null 2>&1
-warn
-done
-if [[ "$exts" == "0" ]]
-then
-if [[ -f "$wfile" ]]
-then
-echo ""
-echo -e "$green" "Job Finished"
-echo ""
-echo -e "$yellow" "You can find your new iptv list in :"
-echo -e "$orange" "$wfile"
-exit 1
-fi
-else
-echo ""
-echo -e "$green" "Job Finished"
-echo ""
-echo -e "$yellow" "Your iptv list was update in :"
-echo -e "$orange" "$wfile"
-exit 1
-fi
-}
-
-# Function that will download for specific time the test stream
-function teststream() {
-wrn="0"
-# Checks if tool already created a previous m3u file
-if [[ -f "$wfile" ]]
-then
-exts="1"
-else
-exts="0"
-fi
-
-# checks if m3u file have xml content
-ckf=$(grep "" <$path/temp/1)
-if [[ ! -z "$ckf" ]]
-then
-xmlproc
-fi
-#checks for the http links in m3u file
-glnk=$(grep -F "http" < "$path/temp/1" | sed '/EXTINF/d' | sed '/EXTM3U/d' | awk '!a[$0]++' | sed '/^$/d')
-
-#Write all the http links only to a new file so they can be checked ahead
-echo "$glnk" | tr " " "\n" > "$path/temp/2"
-# Counts how many links must be checked
-srvnmb=$(wc -l "$path/temp/2" | awk '{print$1}')
-# removes any previous temp pid files and stream captures from previous run
-rm -rf "$path/temp/stream" >/dev/null 2>&1
-rm -rf "$path/temp/pid.tmp" >/dev/null 2>&1
-echo ""
-echo -e "$red""Press CTRL+C To Stop or Abort IPTV list check"
-echo ""
-
-# Starts the stream checks
-for i in $(seq "$srvnmb")
-do
-chkf=$(sed -n "${i}p" < "$path/temp/2")
-# To avoid errors in previous filter , it checks if the link starts with http , rtmp or HTTP
-chkurl=$(echo "$chkf" | head -c 4)
-case "$chkurl" in
-http|rtmp|HTTP)
-# start the stream download with wget , creates a file with the pid from wget
-wget -q "$chkf" -O "$path/temp/stream" & echo $! > "$path/temp/pid.tmp"
-
-# reads current wget pid
-pid=$(sed -n 1p < "$path/temp/pid.tmp")
-
-# 4 seconds is the time that wget will download the stream befores gets killed
-sleep 4
-# checks if wget pid is still active
-rpid=$(ps -p "$pid" -o pid= | awk '{print$1}')
-
-if [[ "$rpid" == "$pid" ]]
-then
-# kills wget pid
-kill $pid
-fi
-
-# checks if downlaoded stream file it is in temp directory
-if [[ ! -f "$path/temp/stream" ]]
-then
-echo -e "$yellow" "Error reading captured file"
-else
-# checks the size of the stream file
-stsz=$(wc -c "$path/temp/stream" | awk '{print$1}')
-# In case stream file is less than 100 bytes then it is not valid
-if [[ "$stsz" -le "100" ]]
-then
-echo -e "$green" "Link:$yellow $i$green of :$yellow$srvnmb$green is$red OFF"
-else
-echo -e "$green" "Link:$yellow $i$green of :$yellow$srvnmb$green is$green ON"
-#file have more than 100 bytes , then it is a valid stream , goto write file fuction
-writefile
-fi
-fi
-;;
-*)
-;;
-esac
-rm -rf "$path/temp/stream" >/dev/null 2>&1
-rm -rf "$path/temp/pid.tmp" >/dev/null 2>&1
-warn
-done
-if [[ "$exts" == "0" ]]
-then
-if [[ -f "$wfile" ]]
-then
-echo ""
-echo -e "$green" "Job Finished"
-echo ""
-echo -e "$yellow" "You can find your new iptv list in :"
-echo -e "$orange" "$wfile"
-exit 1
-fi
-else
-echo ""
-echo -e "$green" "Job Finished"
-echo ""
-echo -e "$yellow" "Your iptv list was update in :"
-echo -e "$orange" "$wfile"
-exit 1
-fi
-}
-
-# Case user m3u file is remote (http) then run this function
-function remotef() {
-# wil download the remote m3u file to temp folder and will check its size
-wget "{$file}" -O "$path/temp/1" >/dev/null 2>&1
-flsz=$(wc -c "$path/temp/1" | awk '{print$1}')
-if [[ "$flsz" -le "10" ]]
-then
-echo -e "$yellow" "The remote link is down or the file size of it"
-echo -e "$yellow" " is too small to be an m3u iptv list file"
-echo ""
-exit 0
-fi
-teststream
-}
-
-# Local m3u file is loaded here
-function localf(){
-if [[ ! -f "$file" ]]
-then
-echo -e "$yellow" "The file you specified does not exist"
-echo -e "$yellow" "in :$green $file "
-echo ""
-echo -e "$yellow" "Make sure you wrote the right path of it"
-exit 1
-fi
-cp "$file" "$path/temp/1" >/dev/null 2>&1
-flsz=$(wc -c "$path/temp/1" | awk '{print$1}')
-if [[ "$flsz" -le "10" ]]
-then
-echo -e "$yellow" "The file you specified is too small to be an m3u iptv file"
-exit 0
-fi
-teststream
-}
-if [[ -z $1 ]]
-then
-echo -e "$green" "IPTV-Check Tool 1.0"
-echo -e "$yellow" "-------------------------------------"
-echo -e "$blue" "http://github.com/peterpt"
-echo -e "$yellow" "-------------------------------------"
-echo ""
-echo -e "$orange" "Example for remote list to check :"
-echo -e "$green" "$0 http://someurl/somelist.m3u"
-echo ""
-echo -e "$orange" "Example for local list to check :"
-echo -e "$green" "$0 /root/mylist.m3u"
-echo ""
-echo -e "$yellow" "-------------------------------------"
-echo ""
-exit 1
-fi
-# If a null file name is not found then executes the script again deflecting wget errors to dev/null
-if [[ ! -f $path/null ]]
-then
-echo "0" > $path/null
-exec $sname $1 2>/dev/null
-exit 1
-fi
-# here it means that script already was loaded and restarted , so delete the null file for the next start
-rm -rf $path/null >/dev/null 2>&1
-logo
-file="$1"
-#check if user input is a remote or local file by searching for http word in the user input variable
-echo "$file" | grep "http" >/dev/null 2>&1
-if [ "$?" -eq "0" ]; then
-remotef
-else
-localf
-fi
diff --git a/iptv_check.py b/iptv_check.py
new file mode 100644
index 0000000..8d9bcb1
--- /dev/null
+++ b/iptv_check.py
@@ -0,0 +1,1664 @@
+#!/usr/bin/env python3
+# -*- coding: utf-8 -*-
+
+import sys
+import os
+import re
+import subprocess
+import tempfile
+import threading
+import signal
+import shutil
+from urllib.parse import urlparse, urljoin
+import argparse
+import logging
+import configparser
+from pathlib import Path
+import time
+import json
+
+# --- Third-party libraries ---
+import requests
+try:
+ from PIL import Image
+except ImportError:
+ sys.exit("Pillow library not found. Please install it: pip install Pillow")
+try:
+ import pytesseract
+except ImportError:
+ sys.exit("pytesseract library not found. Please install it: pip install pytesseract")
+try:
+ from colorama import init, Fore, Style
+ init(autoreset=True)
+except ImportError:
+ class Fore: RED = ''; GREEN = ''; YELLOW = ''; BLUE = ''; CYAN = ''; RESET = ''
+ class Style: BRIGHT = ''; RESET_ALL = ''
+
+# --- GUI Components ---
+try:
+ import tkinter as tk
+ from tkinter import ttk, filedialog, scrolledtext, messagebox, simpledialog
+ GUI_AVAILABLE = True
+except ImportError:
+ GUI_AVAILABLE = False
+
+# --- Configuration & Constants ---
+VERSION = "3.0" # Add granular UI lock during processing
+USER_AGENT = "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/91.0.4472.124 Safari/537.36"
+AUDIO_USER_AGENT = "iTunes/9.1.1"
+MIN_FILE_SIZE_BYTES = 100
+DEFAULT_CAPTURE_DURATION = 4
+OCR_FRAME_EXTRACTION_TIMEOUT = 20
+WORKER_PROCESS_TIMEOUT_SECONDS = 30
+UNCHECKABLE_URL_LENGTH_THRESHOLD = 250
+UNCHECKABLE_KEYWORDS = ['token', 'auth', 'login', 'key', 'signature']
+TEMP_FILE_PREFIX = "iptv-check-temp-"
+YT_DLP_TIMEOUT_SECONDS = 20
+
+# --- Portable File Paths ---
+APP_DIR = Path(__file__).resolve().parent
+CONFIG_FILE_PATH = APP_DIR / "iptv_checker_config.ini"
+LINKS_DB_PATH = APP_DIR / "iptv_checker_links.ini"
+DEBUG_LOG_PATH = APP_DIR / "debug.log"
+
+# --- Language/Internationalization ---
+LANGUAGES = {}
+DEFAULT_LANG = "en"
+
+def load_languages():
+ global LANGUAGES
+ LANGUAGES = {
+ "en": {
+ "title": "IPTV-Check", "file": "File", "recheck_output": "Recheck Output File", "exit": "Exit",
+ "tools": "Tools", "website_finder": "Website M3U Finder...", "database": "Database",
+ "manage_links": "Manage Default Links...", "check_all_links": "Check All Default Links", "settings": "Settings",
+ "configure": "Configure...", "language": "Language", "debug": "Debug", "view_log": "View Debug Log",
+ "about_menu": "About", "creators": "Creators...", "update": "Update...", "m3u_input_label": "M3U File or URL:",
+ "output_file_label": "Output File:", "browse": "Browse...", "start_check": "Start Check",
+ "stop_save": "Stop & Save", "timeout_label": "Timeout (s):", "workers_label": "Workers:",
+ "remaining_label": "Remaining:", "log_display_label": "Log Display", "channel_name_radio": "Channel Name",
+ "channel_url_radio": "Channel URL", "options_label": "Options", "use_ocr_check": "Use OCR",
+ "skip_known_check": "Skip Known Good URLs", "search_label": "Search in Output File...",
+ "no_internet": "No Internet Connection. Waiting for connection...",
+ "tooltip_ocr": "If checked, uses OCR (Tesseract) to analyze a frame from video streams.\nThis helps detect error screens (e.g., 'Login required', geo-blocked).\nThis check is slower.",
+ "tooltip_timeout": "Network timeout in seconds for each stream check.", "tooltip_workers": "Number of parallel checks to run at once.",
+ "tooltip_log_display": "Changes the display format in the log view during a check.",
+ "tooltip_skip_known": "If checked, the app will read your output file first.\nAny stream URL from the new source that already exists in the output file will be skipped.\nThis prevents duplicates and speeds up checking large lists.",
+ "tooltip_channel_name": "In the log window, display the channel's name from the M3U file.",
+ "tooltip_channel_url": "In the log window, display the full URL of the channel's stream."
+ },
+ "pt": {
+ "title": "IPTV-Check", "file": "Arquivo", "recheck_output": "Verificar Novamente Arquivo de Saída", "exit": "Sair",
+ "tools": "Ferramentas", "website_finder": "Localizador de M3U em Websites...", "database": "Base de Dados",
+ "manage_links": "Gerir Links Padrão...", "check_all_links": "Verificar Todos os Links Padrão", "settings": "Definições",
+ "configure": "Configurar...", "language": "Idioma", "debug": "Depuração", "view_log": "Ver Registo de Depuração",
+ "about_menu": "Sobre", "creators": "Criadores...", "update": "Atualizar...", "m3u_input_label": "Arquivo M3U ou URL:",
+ "output_file_label": "Arquivo de Saída:", "browse": "Procurar...", "start_check": "Iniciar Verificação",
+ "stop_save": "Parar e Salvar", "timeout_label": "Timeout (s):", "workers_label": "Workers:",
+ "remaining_label": "Restantes:", "log_display_label": "Exibição do Registo", "channel_name_radio": "Nome do Canal",
+ "channel_url_radio": "URL do Canal", "options_label": "Opções", "use_ocr_check": "Usar OCR",
+ "skip_known_check": "Ignorar URLs já existentes", "search_label": "Pesquisar no Arquivo de Saída...",
+ "no_internet": "Sem Conexão à Internet. Aguardando conexão...",
+ "tooltip_ocr": "Se marcado, usa OCR (Tesseract) para analisar um frame dos streams de vídeo.\nAjuda a detetar ecrãs de erro (ex: 'Login necessário', bloqueio geográfico).\nEsta verificação é mais lenta.",
+ "tooltip_timeout": "Tempo limite de rede em segundos para cada verificação de stream.", "tooltip_workers": "Número de verificações paralelas a serem executadas de uma vez.",
+ "tooltip_log_display": "Altera o formato de exibição na vista de registo durante uma verificação.",
+ "tooltip_skip_known": "Se marcado, a aplicação lerá primeiro o seu arquivo de saída.\nQualquer URL de stream da nova fonte que já exista no arquivo de saída será ignorado.\nIsto evita duplicados e acelera a verificação de listas grandes.",
+ "tooltip_channel_name": "Na janela de registo, exibir o nome do canal do arquivo M3U.",
+ "tooltip_channel_url": "Na janela de registo, exibir o URL completo do stream do canal."
+ },
+ "es": {
+ "title": "IPTV-Check", "file": "Archivo", "recheck_output": "Revisar Archivo de Salida", "exit": "Salir",
+ "tools": "Herramientas", "website_finder": "Buscador de M3U en Sitios Web...", "database": "Base de Datos",
+ "manage_links": "Gestionar Enlaces Predeterminados...", "check_all_links": "Revisar Todos los Enlaces Predeterminados", "settings": "Ajustes",
+ "configure": "Configurar...", "language": "Idioma", "debug": "Depuración", "view_log": "Ver Registro de Depuración",
+ "about_menu": "Acerca de", "creators": "Creadores...", "update": "Actualizar...", "m3u_input_label": "Archivo M3U o URL:",
+ "output_file_label": "Archivo de Salida:", "browse": "Explorar...", "start_check": "Iniciar Revisión",
+ "stop_save": "Detener y Guardar", "timeout_label": "Timeout (s):", "workers_label": "Workers:",
+ "remaining_label": "Restantes:", "log_display_label": "Visualización del Registro", "channel_name_radio": "Nombre del Canal",
+ "channel_url_radio": "URL del Canal", "options_label": "Opciones", "use_ocr_check": "Usar OCR",
+ "skip_known_check": "Omitir URLs conocidas", "search_label": "Buscar en Archivo de Salida...",
+ "no_internet": "Sin Conexión a Internet. Esperando conexión...",
+ "tooltip_ocr": "Si está marcado, usa OCR (Tesseract) para analizar un fotograma de los flujos de video.\nAyuda a detectar pantallas de error (ej: 'Se requiere inicio de sesión', geobloqueado).\nEsta revisión es más lenta.",
+ "tooltip_timeout": "Tiempo de espera de red en segundos para cada revisión de flujo.", "tooltip_workers": "Número de revisiones paralelas para ejecutar a la vez.",
+ "tooltip_log_display": "Cambia el formato de visualización en la vista de registro durante una revisión.",
+ "tooltip_skip_known": "Si está marcado, la aplicación leerá primero su archivo de salida.\nCualquier URL de flujo de la nueva fuente que ya exista en el archivo de salida será omitida.\nEsto evita duplicados y acelera la revisión de listas grandes.",
+ "tooltip_channel_name": "En la ventana de registro, mostrar el nombre del canal del archivo M3U.",
+ "tooltip_channel_url": "En la ventana de registro, mostrar la URL completa del flujo del canal."
+ },
+ "fr": {
+ "title": "IPTV-Check", "file": "Fichier", "recheck_output": "Revérifier le Fichier de Sortie", "exit": "Quitter",
+ "tools": "Outils", "website_finder": "Chercheur de M3U sur Site Web...", "database": "Base de Données",
+ "manage_links": "Gérer les Liens par Défaut...", "check_all_links": "Vérifier Tous les Liens par Défaut", "settings": "Paramètres",
+ "configure": "Configurer...", "language": "Langue", "debug": "Débogage", "view_log": "Voir le Journal de Débogage",
+ "about_menu": "À propos", "creators": "Créateurs...", "update": "Mettre à jour...", "m3u_input_label": "Fichier M3U ou URL :",
+ "output_file_label": "Fichier de Sortie :", "browse": "Parcourir...", "start_check": "Démarrer la Vérification",
+ "stop_save": "Arrêter et Enregistrer", "timeout_label": "Timeout (s) :", "workers_label": "Workers :",
+ "remaining_label": "Restants :", "log_display_label": "Affichage du Journal", "channel_name_radio": "Nom de la Chaîne",
+ "channel_url_radio": "URL de la Chaîne", "options_label": "Options", "use_ocr_check": "Utiliser l'OCR",
+ "skip_known_check": "Ignorer les URL connues", "search_label": "Rechercher dans le Fichier de Sortie...",
+ "no_internet": "Pas de Connexion Internet. En attente de connexion...",
+ "tooltip_ocr": "Si coché, utilise l'OCR (Tesseract) pour analyser une image des flux vidéo.\nCela aide à détecter les écrans d'erreur (ex: 'Connexion requise', géo-bloqué).\nCette vérification est plus lente.",
+ "tooltip_timeout": "Délai d'attente réseau en secondes pour chaque vérification de flux.", "tooltip_workers": "Nombre de vérifications parallèles à exécuter en même temps.",
+ "tooltip_log_display": "Change le format d'affichage dans la vue du journal pendant une vérification.",
+ "tooltip_skip_known": "Si coché, l'application lira d'abord votre fichier de sortie.\nToute URL de flux de la nouvelle source qui existe déjà dans le fichier de sortie sera ignorée.\nCela évite les doublons et accélère la vérification des grandes listes.",
+ "tooltip_channel_name": "Dans la fenêtre du journal, afficher le nom de la chaîne du fichier M3U.",
+ "tooltip_channel_url": "Dans la fenêtre du journal, afficher l'URL complète du flux de la chaîne."
+ },
+ "it": {
+ "title": "IPTV-Check", "file": "File", "recheck_output": "Ricontrolla File di Output", "exit": "Esci",
+ "tools": "Strumenti", "website_finder": "Trova M3U su Sito Web...", "database": "Database",
+ "manage_links": "Gestisci Link Predefiniti...", "check_all_links": "Controlla Tutti i Link Predefiniti", "settings": "Impostazioni",
+ "configure": "Configura...", "language": "Lingua", "debug": "Debug", "view_log": "Visualizza Log di Debug",
+ "about_menu": "Informazioni", "creators": "Creatori...", "update": "Aggiorna...", "m3u_input_label": "File M3U o URL:",
+ "output_file_label": "File di Output:", "browse": "Sfoglia...", "start_check": "Avvia Controllo",
+ "stop_save": "Ferma e Salva", "timeout_label": "Timeout (s):", "workers_label": "Workers:",
+ "remaining_label": "Rimanenti:", "log_display_label": "Visualizzazione Log", "channel_name_radio": "Nome Canale",
+ "channel_url_radio": "URL Canale", "options_label": "Opzioni", "use_ocr_check": "Usa OCR",
+ "skip_known_check": "Salta URL conosciuti", "search_label": "Cerca nel File di Output...",
+ "no_internet": "Nessuna Connessione Internet. In attesa di connessione...",
+ "tooltip_ocr": "Se selezionato, utilizza l'OCR (Tesseract) per analizzare un frame dai flussi video.\nAiuta a rilevare schermate di errore (es. 'Login richiesto', geo-bloccato).\nQuesto controllo è più lento.",
+ "tooltip_timeout": "Timeout di rete in secondi per ogni controllo del flusso.", "tooltip_workers": "Numero di controlli paralleli da eseguire contemporaneamente.",
+ "tooltip_log_display": "Modifica il formato di visualizzazione nel log durante un controllo.",
+ "tooltip_skip_known": "Se selezionato, l'app leggerà prima il tuo file di output.\nQualsiasi URL di flusso dalla nuova fonte che esiste già nel file di output verrà saltato.\nCiò previene i duplicati e accelera il controllo di grandi liste.",
+ "tooltip_channel_name": "Nella finestra di log, visualizza il nome del canale dal file M3U.",
+ "tooltip_channel_url": "Nella finestra di log, visualizza l'URL completo del flusso del canale."
+ },
+ "de": {
+ "title": "IPTV-Check", "file": "Datei", "recheck_output": "Ausgabedatei erneut prüfen", "exit": "Beenden",
+ "tools": "Werkzeuge", "website_finder": "Website-M3U-Finder...", "database": "Datenbank",
+ "manage_links": "Standard-Links verwalten...", "check_all_links": "Alle Standard-Links prüfen", "settings": "Einstellungen",
+ "configure": "Konfigurieren...", "language": "Sprache", "debug": "Debug", "view_log": "Debug-Protokoll anzeigen",
+ "about_menu": "Über", "creators": "Entwickler...", "update": "Aktualisieren...", "m3u_input_label": "M3U-Datei oder URL:",
+ "output_file_label": "Ausgabedatei:", "browse": "Durchsuchen...", "start_check": "Prüfung starten",
+ "stop_save": "Stoppen & Speichern", "timeout_label": "Timeout (s):", "workers_label": "Workers:",
+ "remaining_label": "Verbleibend:", "log_display_label": "Protokollanzeige", "channel_name_radio": "Kanalname",
+ "channel_url_radio": "Kanal-URL", "options_label": "Optionen", "use_ocr_check": "OCR verwenden",
+ "skip_known_check": "Bekannte URLs überspringen", "search_label": "In Ausgabedatei suchen...",
+ "no_internet": "Keine Internetverbindung. Warte auf Verbindung...",
+ "tooltip_ocr": "Wenn aktiviert, wird OCR (Tesseract) verwendet, um einen Frame aus Videostreams zu analysieren.\nHilft bei der Erkennung von Fehlerbildschirmen (z.B. 'Login erforderlich', geo-geblockt).\nDiese Prüfung ist langsamer.",
+ "tooltip_timeout": "Netzwerk-Timeout in Sekunden für jede Stream-Prüfung.", "tooltip_workers": "Anzahl der gleichzeitig auszuführenden parallelen Prüfungen.",
+ "tooltip_log_display": "Ändert das Anzeigeformat in der Protokollansicht während einer Prüfung.",
+ "tooltip_skip_known": "Wenn aktiviert, liest die App zuerst Ihre Ausgabedatei.\nJede Stream-URL aus der neuen Quelle, die bereits in der Ausgabedatei vorhanden ist, wird übersprungen.\nDies verhindert Duplikate und beschleunigt die Prüfung großer Listen.",
+ "tooltip_channel_name": "Zeigt im Protokollfenster den Namen des Kanals aus der M3U-Datei an.",
+ "tooltip_channel_url": "Zeigt im Protokollfenster die vollständige URL des Kanal-Streams an."
+ },
+ "ru": {
+ "title": "IPTV-Check", "file": "Файл", "recheck_output": "Перепроверить выходной файл", "exit": "Выход",
+ "tools": "Инструменты", "website_finder": "Поиск M3U на сайтах...", "database": "База данных",
+ "manage_links": "Управление ссылками по умолчанию...", "check_all_links": "Проверить все ссылки по умолчанию", "settings": "Настройки",
+ "configure": "Настроить...", "language": "Язык", "debug": "Отладка", "view_log": "Просмотр журнала отладки",
+ "about_menu": "О программе", "creators": "Создатели...", "update": "Обновить...", "m3u_input_label": "Файл M3U или URL:",
+ "output_file_label": "Выходной файл:", "browse": "Обзор...", "start_check": "Начать проверку",
+ "stop_save": "Остановить и сохранить", "timeout_label": "Тайм-аут (с):", "workers_label": "Потоки:",
+ "remaining_label": "Осталось:", "log_display_label": "Отображение журнала", "channel_name_radio": "Имя канала",
+ "channel_url_radio": "URL канала", "options_label": "Опции", "use_ocr_check": "Использовать OCR",
+ "skip_known_check": "Пропускать известные URL", "search_label": "Поиск в выходном файле...",
+ "no_internet": "Нет подключения к Интернету. Ожидание подключения...",
+ "tooltip_ocr": "Если отмечено, используется OCR (Tesseract) для анализа кадра из видеопотоков.\nЭто помогает обнаруживать экраны ошибок (например, 'Требуется вход', геоблокировка).\nЭта проверка медленнее.",
+ "tooltip_timeout": "Тайм-аут сети в секундах для каждой проверки потока.", "tooltip_workers": "Количество одновременных параллельных проверок.",
+ "tooltip_log_display": "Изменяет формат отображения в журнале во время проверки.",
+ "tooltip_skip_known": "Если отмечено, приложение сначала прочитает ваш выходной файл.\nЛюбой URL потока из нового источника, который уже существует в выходном файле, будет пропущен.\nЭто предотвращает дубликаты и ускоряет проверку больших списков.",
+ "tooltip_channel_name": "В окне журнала отображать имя канала из файла M3U.",
+ "tooltip_channel_url": "В окне журнала отображать полный URL потока канала."
+ },
+ "zh": {
+ "title": "IPTV-Check", "file": "文件", "recheck_output": "重新检查输出文件", "exit": "退出",
+ "tools": "工具", "website_finder": "网站 M3U 查找器...", "database": "数据库",
+ "manage_links": "管理默认链接...", "check_all_links": "检查所有默认链接", "settings": "设置",
+ "configure": "配置...", "language": "语言", "debug": "调试", "view_log": "查看调试日志",
+ "about_menu": "关于", "creators": "创作者...", "update": "更新...", "m3u_input_label": "M3U 文件或 URL:",
+ "output_file_label": "输出文件:", "browse": "浏览...", "start_check": "开始检查",
+ "stop_save": "停止并保存", "timeout_label": "超时 (秒):", "workers_label": "线程数:",
+ "remaining_label": "剩余:", "log_display_label": "日志显示", "channel_name_radio": "频道名称",
+ "channel_url_radio": "频道 URL", "options_label": "选项", "use_ocr_check": "使用 OCR",
+ "skip_known_check": "跳过已知良好的URL", "search_label": "在输出文件中搜索...",
+ "no_internet": "无网络连接。正在等待连接...",
+ "tooltip_ocr": "如果选中,将使用 OCR (Tesseract) 分析视频流中的一帧。\n这有助于检测错误屏幕(例如“需要登录”、“地理封锁”)。\n此检查速度较慢。",
+ "tooltip_timeout": "每次流检查的网络超时时间(秒)。", "tooltip_workers": "一次运行的并行检查数。",
+ "tooltip_log_display": "在检查期间更改日志视图中的显示格式。",
+ "tooltip_skip_known": "如果选中,应用程序将首先读取您的输出文件。\n新源中任何已存在于输出文件中的流 URL 都将被跳过。\n这样可以防止重复并加快检查大型列表的速度。",
+ "tooltip_channel_name": "在日志窗口中,显示 M3U 文件中的频道名称。",
+ "tooltip_channel_url": "在日志窗口中,显示频道的完整流 URL。"
+ }
+ }
+
+# --- Setup Debug Logging ---
+def setup_logging():
+ logging.basicConfig(filename=DEBUG_LOG_PATH, filemode='w', level=logging.DEBUG, format='%(asctime)s - %(levelname)s - %(message)s')
+ logging.getLogger("urllib3").setLevel(logging.WARNING)
+ logging.info(f"IPTV-Check v{VERSION} started.")
+
+# --- Dependency Checks ---
+FFMPEG_PATH = shutil.which('ffmpeg')
+FFPROBE_PATH = shutil.which('ffprobe')
+YT_DLP_PATH = shutil.which('yt-dlp')
+GIT_PATH = shutil.which('git')
+
+def find_and_set_tesseract_path():
+ path = shutil.which('tesseract');
+ if path: pytesseract.tesseract_cmd = path; return True
+ return False
+
+TESSERACT_INSTALLED = find_and_set_tesseract_path()
+OCR_FAILED_ONCE = False
+
+def check_dependencies():
+ essential_deps = {'ffmpeg': FFMPEG_PATH, 'ffprobe': FFPROBE_PATH, 'yt-dlp': YT_DLP_PATH}
+ optional_deps = {'tesseract': TESSERACT_INSTALLED}
+
+ missing_essential = [name for name, path in essential_deps.items() if not path]
+ missing_optional = [name for name, found in optional_deps.items() if not found]
+
+ return missing_essential, missing_optional
+
+# --- "The Janitor": Cleanup on Start ---
+def cleanup_stale_temp_files():
+ try:
+ temp_dir = tempfile.gettempdir()
+ for f_name in [f for f in os.listdir(temp_dir) if f.startswith(TEMP_FILE_PREFIX)]:
+ try: os.remove(os.path.join(temp_dir, f_name))
+ except OSError as e: logging.warning(f"Could not remove stale temp file: {f_name}. Reason: {e}")
+ except Exception as e:
+ logging.error(f"Error during initial temp file cleanup: {e}", exc_info=True)
+
+# --- Configuration & Database Management ---
+class IniManager:
+ def __init__(self, path):
+ self.path = path
+
+ def load(self, defaults_map=None):
+ config = configparser.ConfigParser()
+ if self.path.exists():
+ try:
+ config.read(self.path, encoding='utf-8')
+ except configparser.Error as e:
+ logging.error(f"Error reading config file {self.path}: {e}. A new one will be created.")
+ config = configparser.ConfigParser()
+
+ needs_save = False
+ if defaults_map:
+ for section, defaults in defaults_map.items():
+ if not config.has_section(section):
+ config.add_section(section)
+ for key, value in defaults.items():
+ config.set(section, key, value)
+ needs_save = True
+
+ if needs_save: self.save(config)
+
+ return {section.lower(): dict(config.items(section)) for section in config.sections()}
+
+ def save(self, config_obj):
+ try:
+ with open(self.path, 'w', encoding='utf-8') as configfile:
+ config_obj.write(configfile)
+ except Exception as e:
+ logging.error(f"Failed to save INI file at {self.path}: {e}", exc_info=True)
+ if GUI_AVAILABLE: messagebox.showerror("File Error", f"Could not save settings to {self.path}.\nPlease check permissions.")
+
+# --- Core Logic ---
+def sanitize_url_aggressively(url):
+ try:
+ m3u8_query_index = url.find('.m3u8?')
+ if m3u8_query_index != -1 and 'ads.' in url[m3u8_query_index:]:
+ sanitized_url = url[:m3u8_query_index + len('.m3u8')]; logging.info(f"Aggressively sanitized URL: '{url}' -> '{sanitized_url}'"); return sanitized_url
+ except Exception as e: logging.warning(f"Error during aggressive URL sanitization: {e}", exc_info=True)
+ return url
+
+def parse_m3u(content):
+ pattern = re.compile(r'#EXTINF:-1.*?group-title="([^"]*)"[^,]*?,([^\n]+)\n(?:#EXT[^\n]+\n)*(https?://[^\s]+)', re.IGNORECASE)
+ matches = pattern.findall(content)
+ streams = []
+
+ if not matches:
+ pattern = re.compile(r'#EXTINF:-1.*?,([^\n]+)\n(?:#EXT[^\n]+\n)*(https?://[^\s]+)')
+ matches = pattern.findall(content)
+ for title, url in matches:
+ streams.append({'title': title.strip(), 'url': url.strip(), 'group': 'General'})
+ else:
+ for group, title, url in matches:
+ streams.append({'title': title.strip(), 'url': url.strip(), 'group': group.strip() or "General"})
+
+ return streams
+
+def write_m3u_header(file_handle):
+ if file_handle: file_handle.write("#EXTM3U\n\n"); file_handle.flush()
+
+def write_m3u_entry(file_handle, stream_info):
+ if file_handle:
+ group = stream_info.get('group', 'General'); title = stream_info.get('title', 'Unknown'); url = stream_info.get('url', '')
+ file_handle.write(f"#EXTINF:-1 group-title=\"{group}\",{title}\n{url}\n\n"); file_handle.flush()
+
+def build_timeout_config(network_timeout_s):
+ return {"network_timeout_us": str(network_timeout_s * 1000000), "ffmpeg_flags": ['-analyzeduration', '5M', '-probesize', '5M'] if network_timeout_s >= 20 else []}
+
+# --- TOOLTIP CLASS (GUI ONLY) ---
+if GUI_AVAILABLE:
+ class ToolTip:
+ def __init__(self, widget, text):
+ self.widget = widget
+ self.text = text
+ self.tooltip_window = None
+ self.widget.bind("", self.show_tooltip)
+ self.widget.bind("", self.hide_tooltip)
+
+ def show_tooltip(self, event=None):
+ x, y, _, _ = self.widget.bbox("insert")
+ x += self.widget.winfo_rootx() + 25
+ y += self.widget.winfo_rooty() + 25
+
+ self.tooltip_window = tk.Toplevel(self.widget)
+ self.tooltip_window.wm_overrideredirect(True)
+ self.tooltip_window.wm_geometry(f"+{x}+{y}")
+
+ label = tk.Label(self.tooltip_window, text=self.text, justify='left',
+ background="#ffffe0", relief='solid', borderwidth=1,
+ font=("tahoma", "8", "normal"))
+ label.pack(ipadx=1)
+
+ def hide_tooltip(self, event=None):
+ if self.tooltip_window:
+ self.tooltip_window.destroy()
+ self.tooltip_window = None
+
+# --- GUI APPLICATION CLASSES (GUI ONLY) ---
+if GUI_AVAILABLE:
+ class BaseToplevel(tk.Toplevel):
+ def __init__(self, parent):
+ super().__init__(parent); self.transient(parent); self._create_context_menu()
+ def _create_context_menu(self):
+ self.entry_context_menu = tk.Menu(self, tearoff=0)
+ self.entry_context_menu.add_command(label="Cut", command=lambda: self.focus_get().event_generate("<>"))
+ self.entry_context_menu.add_command(label="Copy", command=lambda: self.focus_get().event_generate("<>"))
+ self.entry_context_menu.add_command(label="Paste", command=lambda: self.focus_get().event_generate("<>"))
+ def _show_context_menu(self, event):
+ widget = event.widget
+ try:
+ if self.clipboard_get(): self.entry_context_menu.entryconfig("Paste", state="normal")
+ else: self.entry_context_menu.entryconfig("Paste", state="disabled")
+ except tk.TclError: self.entry_context_menu.entryconfig("Paste", state="disabled")
+ if widget.selection_present(): self.entry_context_menu.entryconfig("Cut", state="normal"); self.entry_context_menu.entryconfig("Copy", state="normal")
+ else: self.entry_context_menu.entryconfig("Cut", state="disabled"); self.entry_context_menu.entryconfig("Copy", state="disabled")
+ self.entry_context_menu.tk_popup(event.x_root, event.y_root)
+
+ class AddPatternDialog(simpledialog.Dialog):
+ def body(self, master):
+ self.title("Add Stream Pattern")
+ ttk.Label(master, text="URL Pattern (e.g., .m3u8, /stream):").grid(row=0, sticky="w")
+ self.pattern_entry = ttk.Entry(master, width=30)
+ self.pattern_entry.grid(row=1, padx=5, pady=5)
+
+ ttk.Label(master, text="Stream Type:").grid(row=2, sticky="w")
+ self.type_var = tk.StringVar(value="video")
+ self.type_combo = ttk.Combobox(master, textvariable=self.type_var, values=["video", "audio"], state="readonly")
+ self.type_combo.grid(row=3, padx=5, pady=5)
+
+ return self.pattern_entry
+
+ def apply(self):
+ self.result = (self.pattern_entry.get().strip(), self.type_var.get())
+
+ class SettingsWindow(BaseToplevel):
+ def __init__(self, parent):
+ super().__init__(parent); self.title("Configure Settings"); self.parent = parent; self.config_manager = parent.config_manager
+
+ all_configs = self.config_manager.load({})
+ self.settings = all_configs.get('settings', {})
+ self.stream_patterns = all_configs.get('streampatterns', {})
+
+ self.notebook = ttk.Notebook(self); self.notebook.pack(fill=tk.BOTH, expand=True, padx=10, pady=10)
+ player_frame = ttk.Frame(self.notebook, padding="10"); self.notebook.add(player_frame, text='Player')
+ self.media_player_path = tk.StringVar(value=self.settings.get('mediaplayerpath', ''))
+ mp_frame = ttk.LabelFrame(player_frame, text="Media Player Executable Path", padding="5"); mp_frame.pack(fill=tk.X, expand=True, pady=5)
+ mp_entry = ttk.Entry(mp_frame, textvariable=self.media_player_path); mp_entry.pack(side=tk.LEFT, fill=tk.X, expand=True, padx=(0, 5))
+ mp_entry.bind("", self._show_context_menu); ttk.Button(mp_frame, text="Browse...", command=self._browse_player).pack(side=tk.LEFT)
+ types_frame = ttk.Frame(self.notebook, padding="10"); self.notebook.add(types_frame, text='Stream Patterns')
+ self.listbox = tk.Listbox(types_frame, height=10); self.listbox.pack(fill=tk.BOTH, expand=True, pady=5); self.populate_list()
+ btn_frame = ttk.Frame(types_frame); btn_frame.pack(fill=tk.X, pady=5)
+ ttk.Button(btn_frame, text="Add...", command=self.add_type).pack(side=tk.LEFT, expand=True, fill=tk.X, padx=2)
+ ttk.Button(btn_frame, text="Edit...", command=self.edit_type).pack(side=tk.LEFT, expand=True, fill=tk.X, padx=2)
+ ttk.Button(btn_frame, text="Remove", command=self.remove_type).pack(side=tk.LEFT, expand=True, fill=tk.X, padx=2)
+ button_frame = ttk.Frame(self); button_frame.pack(fill=tk.X, expand=True, padx=10, pady=(0, 10))
+ ttk.Button(button_frame, text="Save & Close", command=self.on_save).pack(side=tk.RIGHT)
+ self.grab_set()
+ def _browse_player(self):
+ path = filedialog.askopenfilename(title="Select Media Player Executable");
+ if path: self.media_player_path.set(path)
+ def populate_list(self):
+ self.listbox.delete(0, tk.END)
+ for ext, type_ in sorted(self.stream_patterns.items()): self.listbox.insert(tk.END, f"{ext}: {type_}")
+
+ def add_type(self):
+ dialog = AddPatternDialog(self)
+ if dialog.result:
+ pattern, type_ = dialog.result
+ if pattern:
+ self.stream_patterns[pattern] = type_
+ self.populate_list()
+
+ def edit_type(self):
+ selected_idx = self.listbox.curselection()
+ if not selected_idx: return
+ pattern, type_ = self.listbox.get(selected_idx[0]).split(': ', 1)
+ new_type = simpledialog.askstring("Edit Type", f"Enter new type for '{pattern}':", initialvalue=type_, parent=self)
+ if new_type and new_type.lower() in ['video', 'audio']:
+ self.stream_patterns[pattern] = new_type.lower(); self.populate_list()
+ else: messagebox.showerror("Invalid Type", "Type must be 'video' or 'audio'.", parent=self)
+ def remove_type(self):
+ selected_idx = self.listbox.curselection()
+ if not selected_idx: return
+ pattern, _ = self.listbox.get(selected_idx[0]).split(': ', 1)
+ if messagebox.askyesno("Confirm Remove", f"Remove pattern '{pattern}'?"): del self.stream_patterns[pattern]; self.populate_list()
+ def on_save(self):
+ self.settings['mediaplayerpath'] = self.media_player_path.get()
+ new_config = configparser.ConfigParser()
+ new_config['Settings'] = self.settings
+ new_config['StreamPatterns'] = self.stream_patterns
+ self.config_manager.save(new_config)
+ self.parent.load_settings(); self.destroy()
+
+ class WebsiteFinderWindow(BaseToplevel):
+ def __init__(self, parent):
+ super().__init__(parent); self.title("Website M3U Finder"); self.parent = parent; self.geometry("600x400")
+ body = ttk.Frame(self, padding="10"); body.pack(fill=tk.BOTH, expand=True)
+ top_frame = ttk.Frame(body); top_frame.pack(fill=tk.X, pady=(0, 10))
+ ttk.Label(top_frame, text="URL:").pack(side=tk.LEFT, padx=(0, 5)); self.url_var = tk.StringVar()
+ url_entry = ttk.Entry(top_frame, textvariable=self.url_var); url_entry.pack(side=tk.LEFT, fill=tk.X, expand=True)
+ url_entry.bind("", self._show_context_menu)
+ self.find_btn = ttk.Button(top_frame, text="Find M3Us", command=self.start_find); self.find_btn.pack(side=tk.LEFT, padx=(5, 0))
+ self.results_box = tk.Listbox(body); self.results_box.pack(fill=tk.BOTH, expand=True)
+ bottom_frame = ttk.Frame(body); bottom_frame.pack(fill=tk.X, pady=(10, 0))
+ self.status_var = tk.StringVar(value="Ready."); ttk.Label(bottom_frame, textvariable=self.status_var, anchor="w").pack(side=tk.LEFT)
+ self.add_to_db_btn = ttk.Button(bottom_frame, text="Add Selected to DB", state=tk.DISABLED, command=self.add_to_db); self.add_to_db_btn.pack(side=tk.RIGHT)
+ self.grab_set()
+ def start_find(self):
+ url = self.url_var.get().strip();
+ if not url: return
+ self.find_btn.config(state=tk.DISABLED); self.add_to_db_btn.config(state=tk.DISABLED)
+ self.results_box.delete(0, tk.END); self.status_var.set("Searching..."); self.update_idletasks()
+ threading.Thread(target=self._find_thread, args=(url,), daemon=True).start()
+ def _find_thread(self, url):
+ try:
+ self.parent.log(f"[*] Website Finder: Fetching {url}", "info")
+ r = requests.get(url, headers={'User-Agent': USER_AGENT}, timeout=15); r.raise_for_status()
+ valid_links = set()
+ if r.url.lower().endswith(('.m3u', '.m3u8')):
+ self.status_var.set("Found direct redirect to M3U file.")
+ self.results_box.insert(tk.END, r.url); valid_links.add(r.url)
+ else:
+ self.status_var.set("Scanning page for M3U links...")
+ pattern = re.compile(r'["\'](https?://[^\'" >]+?\.(?:m3u8?)|[^\'" >]+?\.(?:m3u8?))["\']'); found_links = pattern.findall(r.text)
+ for link in found_links:
+ full_url = urljoin(url, link); self.status_var.set(f"Validating: {full_url[:50]}...")
+ try:
+ head_r = requests.head(full_url, headers={'User-Agent': USER_AGENT}, timeout=5, allow_redirects=True)
+ if head_r.status_code == 200: valid_links.add(full_url); self.results_box.insert(tk.END, full_url)
+ except requests.RequestException: continue
+ if valid_links: self.status_var.set(f"Found {len(valid_links)} valid M3U link(s)."); self.add_to_db_btn.config(state=tk.NORMAL)
+ else: self.status_var.set("No valid M3U links found on page or via redirect.")
+ except Exception as e:
+ self.status_var.set(f"Error: {e}"); self.parent.log(f"[!] Website Finder Error: {e}", "red")
+ finally:
+ self.find_btn.config(state=tk.NORMAL)
+ def add_to_db(self):
+ selected_indices = self.results_box.curselection()
+ if not selected_indices: messagebox.showwarning("No Selection", "Please select one or more links to add.", parent=self); return
+ db_config = configparser.ConfigParser(); db_config.read(self.parent.links_db_manager.path)
+ if not db_config.has_section('DefaultLinks'): db_config.add_section('DefaultLinks')
+ links = dict(db_config.items('DefaultLinks')); added_count = 0
+ for idx in selected_indices:
+ url = self.results_box.get(idx)
+ try: name = Path(urlparse(url).path).stem.replace('-', ' ').replace('_', ' ').title()
+ except: name = f"link_{int(time.time())}"
+ if url not in links.values(): links[name.lower().replace(' ', '_')] = url; added_count += 1
+ db_config['DefaultLinks'] = links
+ self.parent.links_db_manager.save(db_config)
+ messagebox.showinfo("Success", f"Added {added_count} new link(s) to the database.", parent=self)
+
+ class LinksManagerWindow(BaseToplevel):
+ def __init__(self, parent):
+ super().__init__(parent); self.title("Default Links Database"); self.links_db_manager = parent.links_db_manager
+ body = ttk.Frame(self, padding="10"); body.pack(fill=tk.BOTH, expand=True)
+ self.listbox = tk.Listbox(body, height=15); self.listbox.pack(fill=tk.BOTH, expand=True, pady=5); self.populate_list()
+ btn_frame = ttk.Frame(body); btn_frame.pack(fill=tk.X, pady=5)
+ ttk.Button(btn_frame, text="Add...", command=self.add_link).pack(side=tk.LEFT, expand=True, fill=tk.X, padx=2)
+ ttk.Button(btn_frame, text="Edit...", command=self.edit_link).pack(side=tk.LEFT, expand=True, fill=tk.X, padx=2)
+ ttk.Button(btn_frame, text="Remove", command=self.remove_link).pack(side=tk.LEFT, expand=True, fill=tk.X, padx=2)
+ self.grab_set()
+ def populate_list(self):
+ self.listbox.delete(0, tk.END); self.links = self.links_db_manager.load({'DefaultLinks': {}}).get('defaultlinks', {})
+ for name, url in sorted(self.links.items()): self.listbox.insert(tk.END, f"{name}: {url}")
+
+ def add_link(self):
+ url = simpledialog.askstring("Add Link", "Enter the M3U URL:", parent=self)
+ if not url or not url.strip():
+ return
+
+ url = url.strip()
+
+ if url in self.links.values():
+ messagebox.showinfo("Duplicate", "This URL already exists in the database.", parent=self)
+ return
+
+ try:
+ parsed_url = urlparse(url)
+ path_stem = Path(parsed_url.path).stem
+ base_name = path_stem if path_stem and path_stem != '/' else parsed_url.hostname
+ if not base_name:
+ base_name = f"link_{int(time.time())}"
+ except Exception:
+ base_name = f"link_{int(time.time())}"
+
+ key = base_name.strip().lower().replace(' ', '_').replace('-', '_')
+ key = re.sub(r'\W+', '', key)
+
+ final_key = key
+ counter = 2
+ while final_key in self.links.keys():
+ final_key = f"{key}_{counter}"
+ counter += 1
+
+ self.links[final_key] = url
+ self.save_and_repopulate()
+ messagebox.showinfo("Success", f"Added link to database with name: {final_key}", parent=self)
+
+ def edit_link(self):
+ selected_idx = self.listbox.curselection();
+ if not selected_idx: return
+ name, url = self.listbox.get(selected_idx[0]).split(': ', 1); key = name
+
+ if key not in self.links:
+ key = name.lower().replace(' ', '_')
+ if key not in self.links:
+ messagebox.showerror("Error", "Could not find the selected link key in the database.", parent=self)
+ return
+
+ new_name = simpledialog.askstring("Edit Link", "Enter new name:", initialvalue=name, parent=self)
+ if not new_name or not new_name.strip(): return
+ new_url = simpledialog.askstring("Edit Link", "Enter new URL:", initialvalue=url, parent=self)
+ if not new_url or not new_url.strip(): return
+
+ del self.links[key]
+ self.links[new_name.strip().lower().replace(' ', '_')] = new_url.strip()
+ self.save_and_repopulate()
+
+ def remove_link(self):
+ selected_idx = self.listbox.curselection()
+ if not selected_idx: return
+ if not messagebox.askyesno("Confirm Remove", "Are you sure?"): return
+ name, _ = self.listbox.get(selected_idx[0]).split(': ', 1); key = name
+
+ if key not in self.links:
+ key = name.lower().replace(' ', '_')
+ if key not in self.links:
+ messagebox.showerror("Error", "Could not find the selected link key in the database.", parent=self)
+ return
+
+ del self.links[key]; self.save_and_repopulate()
+ def save_and_repopulate(self):
+ config = configparser.ConfigParser(); config['DefaultLinks'] = self.links
+ self.links_db_manager.save(config); self.populate_list()
+
+# --- BASE CLASS FOR CHECKING LOGIC ---
+class CheckerBase:
+ def __init__(self):
+ self.streams_to_check = []
+ self.active_processes = {}
+ self.is_running = False
+ self.processed_count = 0
+ self.online_count = 0
+ self.uncheckable_count = 0
+ self.journal_file = None
+ self.uncheckable_file = None
+ self.current_check_id = None
+ self.lock = threading.RLock() # FIX: Use a Re-entrant Lock to prevent deadlocks
+
+ self.config_manager = IniManager(CONFIG_FILE_PATH)
+ defaults = {'Settings': {}, 'StreamPatterns': {'.m3u8': 'video', '.m3u': 'video', '.ts': 'video', '.mp3': 'audio', '.aac': 'audio', '/stream': 'audio'}}
+ all_configs = self.config_manager.load(defaults)
+ self.stream_patterns = all_configs.get('streampatterns', {})
+
+ def _get_stream_type(self, url):
+ if not FFPROBE_PATH: return 'unknown'
+ try:
+ cmd = [FFPROBE_PATH, '-v', 'quiet', '-user_agent', AUDIO_USER_AGENT, '-i', url]
+ result = subprocess.run(cmd, capture_output=True, text=True, errors='ignore', timeout=10)
+ output = result.stderr
+ if "Stream #" in output and "Video:" in output: return 'video'
+ if "Stream #" in output and "Audio:" in output: return 'audio'
+ return 'unknown'
+ except (subprocess.TimeoutExpired, Exception):
+ return 'unknown'
+
+ def _perform_ocr_check(self, video_file_path):
+ temp_image_file = None
+ try:
+ with tempfile.NamedTemporaryFile(suffix=".png", prefix=TEMP_FILE_PREFIX, delete=False) as tf: temp_image_file = tf.name
+ subprocess.run([FFMPEG_PATH, '-y', '-hide_banner', '-loglevel', 'error', '-ss', '00:00:01', '-i', video_file_path, '-vframes', '1', temp_image_file], stdin=subprocess.DEVNULL, stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL, timeout=OCR_FRAME_EXTRACTION_TIMEOUT)
+ if os.path.exists(temp_image_file) and os.path.getsize(temp_image_file) > 0:
+ text = pytesseract.image_to_string(Image.open(temp_image_file)).lower()
+ if any(keyword in text for keyword in ["error", "login", "failed", "access denied", "unavailable", "not found"]): return "OFF (OCR: Error Screen)"
+ return "ON"
+ except Exception as ocr_error:
+ global OCR_FAILED_ONCE; logging.warning(f"OCR check failed: {ocr_error}", exc_info=True)
+ if not OCR_FAILED_ONCE: self.log(f"[!] OCR check failed. Assuming 'ON'.", "yellow"); OCR_FAILED_ONCE = True
+ return "ON (OCR Failed)"
+ finally:
+ if temp_image_file and os.path.exists(temp_image_file):
+ try: os.remove(temp_image_file)
+ except OSError: pass
+
+ def _force_kill_worker(self, pid, data):
+ try:
+ if os.name == 'posix':
+ os.killpg(os.getpgid(pid), signal.SIGKILL)
+ else:
+ subprocess.run(['taskkill', '/F', '/T', '/PID', str(pid)], capture_output=True, check=False)
+ data['proc'].wait(timeout=2)
+ except (ProcessLookupError, OSError, subprocess.TimeoutExpired): pass
+ finally:
+ if data and data.get('temp_file') and os.path.exists(data['temp_file']):
+ try: os.remove(data['temp_file'])
+ except OSError: pass
+
+ def log(self, message, tag=None, stream_id=None):
+ pass
+
+# --- GUI APPLICATION CLASS ---
+if GUI_AVAILABLE:
+ class AppGUI(tk.Tk, CheckerBase):
+ def __init__(self, cli_args, missing_optional_deps=None):
+ tk.Tk.__init__(self)
+ CheckerBase.__init__(self)
+ self.cli_args = cli_args
+ self.links_db_manager = IniManager(LINKS_DB_PATH)
+
+ self.lang_code = self.config_manager.load({'Settings': {'language': DEFAULT_LANG}}).get('settings', {}).get('language', DEFAULT_LANG)
+ if self.lang_code not in LANGUAGES:
+ self.lang_code = DEFAULT_LANG
+ self.i18n = LANGUAGES[self.lang_code]
+
+ self.title(f"{self.i18n.get('title')} {VERSION}")
+ self.geometry("900x700")
+
+ self.log_url_map = {}
+ self.is_rechecking = False
+ self.known_good_urls = set()
+
+ self.protocol("WM_DELETE_WINDOW", self.on_closing)
+ self._create_main_menu()
+ self._create_context_menu()
+ self.main_frame = ttk.Frame(self, padding="10")
+ self.main_frame.pack(fill=tk.BOTH, expand=True)
+ self._create_widgets()
+
+ if missing_optional_deps and 'tesseract' in missing_optional_deps:
+ messagebox.showwarning("Optional Dependency Missing",
+ "Tesseract OCR not found.\nThe OCR feature will be disabled.\n\nTo enable it, please install Tesseract for your OS (e.g., 'sudo apt install tesseract-ocr').")
+ self.ocr_check.config(state=tk.DISABLED)
+
+ self.load_settings()
+ self.after(500, self._periodic_internet_check)
+
+ def log(self, message, tag=None, stream_id=None):
+ # This is the GUI-specific implementation of the log method
+ if stream_id: self.log_view.insert(tk.END, message + "\n", (tag, stream_id))
+ else: self.log_view.insert(tk.END, message + "\n", tag)
+ self.log_view.see(tk.END); self.update_idletasks()
+
+ def load_settings(self):
+ defaults = {'Settings': {'mediaplayerpath': '', 'useocr': 'yes' if TESSERACT_INSTALLED else 'no',
+ 'skipknowngoodurls': 'no', 'language': 'en'},
+ 'StreamPatterns': {'.m3u8': 'video', '.m3u': 'video', '.ts': 'video', '.mp3': 'audio', '.aac': 'audio', '/stream': 'audio'}}
+ all_configs = self.config_manager.load(defaults)
+ self.settings = all_configs.get('settings', {})
+ self.stream_patterns = all_configs.get('streampatterns', {})
+ if hasattr(self, 'use_ocr_var'):
+ self.use_ocr_var.set(self.settings.get('useocr') == 'yes')
+ self.skip_knowngood_urls_var.set(self.settings.get('skipknowngoodurls') == 'yes')
+
+ def _check_internet_connection(self):
+ try:
+ requests.get("https://www.google.com", timeout=5, headers={'User-Agent': USER_AGENT})
+ return True
+ except requests.ConnectionError:
+ return False
+
+ def _periodic_internet_check(self):
+ has_internet = self._check_internet_connection()
+ if has_internet:
+ self.internet_status_label.pack_forget()
+ if self.start_button['state'] == tk.DISABLED and not self.is_running:
+ self._set_ui_state(True)
+ else:
+ self.internet_status_label.pack(side=tk.TOP, fill=tk.X)
+ if self.start_button['state'] == tk.NORMAL:
+ self._set_ui_state(False)
+ self.after(30000, self._periodic_internet_check)
+
+ def _set_ui_state(self, enabled):
+ state = tk.NORMAL if enabled else tk.DISABLED
+ self.start_button.config(state=state)
+ self.browse_button.config(state=state)
+ self.input_entry.config(state='normal' if enabled else 'disabled')
+ self.output_entry.config(state='normal' if enabled else 'disabled')
+ self.timeout_menu.config(state='readonly' if enabled else 'disabled')
+ self.workers_menu.config(state='readonly' if enabled else 'disabled')
+ search_file_exists = os.path.exists(self.output_var.get()) and os.path.getsize(self.output_var.get()) > 0
+ self.search_entry.config(state='normal' if enabled and search_file_exists else 'disabled')
+ for menu_name in ["File", "Tools", "Database", "Settings", "Debug", "About", "Language"]:
+ try: self.menu_bar.entryconfig(menu_name, state=state)
+ except tk.TclError: pass
+
+ def on_closing(self):
+ if self.is_running and messagebox.askyesno("Confirm Exit", "A check is running. Stop and exit?"): self.stop_processing(); self.destroy()
+ elif not self.is_running: self.destroy()
+
+ def _create_main_menu(self):
+ self.menu_bar = tk.Menu(self)
+ self.config(menu=self.menu_bar)
+
+ self.file_menu = tk.Menu(self.menu_bar, tearoff=0)
+ self.file_menu.add_command(label=self.i18n.get("recheck_output"), command=self.recheck_output_file)
+ self.file_menu.add_separator()
+ self.file_menu.add_command(label=self.i18n.get("exit"), command=self.on_closing)
+ self.menu_bar.add_cascade(label=self.i18n.get("file"), menu=self.file_menu)
+
+ self.tools_menu = tk.Menu(self.menu_bar, tearoff=0)
+ self.tools_menu.add_command(label=self.i18n.get("website_finder"), command=self.open_website_finder)
+ self.menu_bar.add_cascade(label=self.i18n.get("tools"), menu=self.tools_menu)
+
+ self.db_menu = tk.Menu(self.menu_bar, tearoff=0)
+ self.db_menu.add_command(label=self.i18n.get("manage_links"), command=self.open_links_manager)
+ self.db_menu.add_separator()
+ self.db_menu.add_command(label=self.i18n.get("check_all_links"), command=self.start_database_check)
+ self.menu_bar.add_cascade(label=self.i18n.get("database"), menu=self.db_menu)
+
+ settings_menu = tk.Menu(self.menu_bar, tearoff=0)
+ settings_menu.add_command(label=self.i18n.get("configure"), command=lambda: SettingsWindow(self))
+ self.menu_bar.add_cascade(label=self.i18n.get("settings"), menu=settings_menu)
+
+ self.lang_menu = tk.Menu(self.menu_bar, tearoff=0)
+ self.selected_lang = tk.StringVar(value=self.lang_code)
+ for lang_code in sorted(LANGUAGES.keys()):
+ self.lang_menu.add_radiobutton(label=lang_code.upper(), variable=self.selected_lang, value=lang_code, command=self.change_language)
+ self.menu_bar.add_cascade(label=self.i18n.get("language"), menu=self.lang_menu)
+
+ debug_menu = tk.Menu(self.menu_bar, tearoff=0)
+ debug_menu.add_command(label=self.i18n.get("view_log"), command=self._view_debug_log)
+ self.menu_bar.add_cascade(label=self.i18n.get("debug"), menu=debug_menu)
+
+ self.about_menu = tk.Menu(self.menu_bar, tearoff=0)
+ self.about_menu.add_command(label=self.i18n.get("creators"), command=self.show_creators)
+ self.about_menu.add_command(label=self.i18n.get("update"), command=self.update_app)
+ self.menu_bar.add_cascade(label=self.i18n.get("about_menu"), menu=self.about_menu)
+
+ def change_language(self):
+ new_lang = self.selected_lang.get()
+ if new_lang != self.lang_code:
+ if messagebox.askyesno("Change Language", "The application needs to restart to apply the language change. Restart now?"):
+ config = configparser.ConfigParser(); config.read(CONFIG_FILE_PATH, encoding='utf-8')
+ if not config.has_section('Settings'): config.add_section('Settings')
+ config.set('Settings', 'language', new_lang)
+ self.config_manager.save(config)
+ os.execl(sys.executable, sys.executable, *sys.argv)
+
+ def show_creators(self):
+ messagebox.showinfo("Creators", "Project Leader: peterpt\nCode Assistance by Gemini Pro Model\n\nhttps://github.com/peterpt/")
+
+ def update_app(self):
+ if not GIT_PATH:
+ messagebox.showerror("Update Error", "'git' command not found. Please update manually.")
+ return
+ if messagebox.askyesno("Confirm Update", "This will attempt to update the application from GitHub. Are you sure?"):
+ try:
+ self.log(">>> Attempting to update via git...", "info")
+ result = subprocess.run([GIT_PATH, 'pull'], capture_output=True, text=True, check=True, cwd=APP_DIR)
+ if "Already up to date." in result.stdout:
+ messagebox.showinfo("Update", "You are already using the latest version.")
+ self.log(">>> Already up to date.", "info")
+ else:
+ messagebox.showinfo("Update Successful", "Update complete. Please restart the application.")
+ self.log(">>> Update successful. Please restart.", "green")
+ except subprocess.CalledProcessError as e:
+ messagebox.showerror("Update Failed", f"An error occurred during update:\n\n{e.stderr}")
+ self.log(f"[!] Update failed: {e.stderr}", "red")
+
+ def _view_debug_log(self):
+ try:
+ if sys.platform == "win32": os.startfile(DEBUG_LOG_PATH)
+ elif sys.platform == "darwin": subprocess.run(["open", DEBUG_LOG_PATH])
+ else: subprocess.run(["xdg-open", DEBUG_LOG_PATH])
+ except Exception as e: self.log(f"[!] Could not open debug log: {e}", "red")
+
+ def _create_context_menu(self):
+ self.entry_context_menu = tk.Menu(self, tearoff=0); self.entry_context_menu.add_command(label="Cut", command=lambda: self.focus_get().event_generate("<>")); self.entry_context_menu.add_command(label="Copy", command=lambda: self.focus_get().event_generate("<>")); self.entry_context_menu.add_command(label="Paste", command=lambda: self.focus_get().event_generate("<>"))
+ self.log_context_menu = tk.Menu(self, tearoff=0); self.log_context_menu.add_command(label="Open in Player", command=self._open_in_player); self.log_context_menu.add_separator(); self.log_context_menu.add_command(label="Copy URL", command=self._copy_log_url)
+
+ def _show_context_menu(self, event):
+ widget = event.widget
+ try:
+ if self.clipboard_get(): self.entry_context_menu.entryconfig("Paste", state="normal")
+ else: self.entry_context_menu.entryconfig("Paste", state="disabled")
+ except tk.TclError:
+ self.entry_context_menu.entryconfig("Paste", state="disabled")
+ if widget.selection_present():
+ self.entry_context_menu.entryconfig("Cut", state="normal")
+ self.entry_context_menu.entryconfig("Copy", state="normal")
+ else:
+ self.entry_context_menu.entryconfig("Cut", state="disabled")
+ self.entry_context_menu.entryconfig("Copy", state="disabled")
+ self.entry_context_menu.tk_popup(event.x_root, event.y_root)
+
+ def _show_log_context_menu(self, event):
+ self.log_view.tag_remove("sel", "1.0", "end"); clicked_index = self.log_view.index(f"@{event.x},{event.y}")
+ line_tags = self.log_view.tag_names(clicked_index); stream_tag = next((tag for tag in line_tags if tag.startswith("stream_")), None)
+ if stream_tag and stream_tag in self.log_url_map:
+ line_start = self.log_view.index(f"{clicked_index} linestart"); line_end = self.log_view.index(f"{clicked_index} lineend")
+ self.log_view.tag_add("sel", line_start, line_end); self.log_context_menu.entryconfig("Open in Player", state="normal"); self.log_context_menu.entryconfig("Copy URL", state="normal")
+ else: self.log_context_menu.entryconfig("Open in Player", state="disabled"); self.log_context_menu.entryconfig("Copy URL", state="disabled")
+ self.log_context_menu.tk_popup(event.x_root, event.y_root)
+
+ def _get_url_from_selected_log(self):
+ sel_ranges = self.log_view.tag_ranges("sel")
+ if not sel_ranges: return None
+ tags = self.log_view.tag_names(sel_ranges[0]); stream_tag = next((tag for tag in tags if tag.startswith("stream_")), None)
+ return self.log_url_map.get(stream_tag)
+
+ def _open_in_player(self):
+ url = self._get_url_from_selected_log(); player_path = self.settings.get('mediaplayerpath')
+ if not player_path: self.log("[!] Media player path not configured in Settings.", "red"); return
+ if url:
+ try: self.log(f"[*] Opening in external player...", "info"); subprocess.Popen([player_path, url])
+ except Exception as e: self.log(f"[!] Failed to open media player: {e}", "red")
+
+ def _copy_log_url(self):
+ url = self._get_url_from_selected_log()
+ if url: self.clipboard_clear(); self.clipboard_append(url); self.log("[*] URL copied to clipboard.", "info")
+
+ def _create_widgets(self):
+ self.internet_status_label = ttk.Label(self, text=self.i18n.get("no_internet"),
+ foreground="white", background="red", anchor="center", padding=5)
+ io_frame = ttk.Frame(self.main_frame); io_frame.pack(fill=tk.X, pady=5); io_frame.columnconfigure(1, weight=1)
+ ttk.Label(io_frame, text=self.i18n.get("m3u_input_label")).grid(row=0, column=0, sticky="w", padx=5)
+ self.input_var = tk.StringVar(value=self.cli_args.file or ''); self.input_entry = ttk.Entry(io_frame, textvariable=self.input_var)
+ self.input_entry.grid(row=0, column=1, sticky="we")
+ self.input_entry.bind("", self._show_context_menu)
+ self.browse_button = ttk.Button(io_frame, text=self.i18n.get("browse"), command=self.browse_file); self.browse_button.grid(row=0, column=2, padx=5)
+ ttk.Label(io_frame, text=self.i18n.get("output_file_label")).grid(row=1, column=0, sticky="w", padx=5, pady=5)
+ self.output_var = tk.StringVar(value=self.cli_args.output); self.output_entry = ttk.Entry(io_frame, textvariable=self.output_var)
+ self.output_entry.grid(row=1, column=1, sticky="we", pady=5); self.output_entry.bind("", self._show_context_menu)
+ control_frame = ttk.Frame(self.main_frame); control_frame.pack(fill=tk.X, pady=5)
+ self.start_button = ttk.Button(control_frame, text=self.i18n.get("start_check"), command=self.start_processing); self.start_button.pack(side="left", padx=5)
+ self.stop_button = ttk.Button(control_frame, text=self.i18n.get("stop_save"), command=self.stop_processing, state=tk.DISABLED); self.stop_button.pack(side="left", padx=5)
+ ttk.Label(control_frame, text=self.i18n.get("timeout_label")).pack(side="left", padx=(15, 5))
+ self.timeout_var = tk.StringVar(value=str(self.cli_args.timeout)); self.timeout_menu = ttk.Combobox(control_frame, textvariable=self.timeout_var, values=[str(i) for i in range(2, 31)], state="readonly", width=4); self.timeout_menu.pack(side="left")
+ ToolTip(self.timeout_menu, self.i18n.get("tooltip_timeout"))
+ ttk.Label(control_frame, text=self.i18n.get("workers_label")).pack(side="left", padx=(10, 5))
+ self.workers_var = tk.StringVar(value=str(self.cli_args.workers)); self.workers_menu = ttk.Combobox(control_frame, textvariable=self.workers_var, values=[str(i) for i in range(1, 21)], state="readonly", width=4); self.workers_menu.pack(side="left")
+ ToolTip(self.workers_menu, self.i18n.get("tooltip_workers"))
+ self.search_var = tk.StringVar(); self.search_var.trace_add("write", self._on_search_change)
+ self.search_entry = ttk.Entry(control_frame, textvariable=self.search_var, width=20)
+ self.search_entry.pack(side="left", padx=(10,0)); self.search_entry.insert(0, self.i18n.get("search_label")); self.search_entry.config(foreground="grey")
+ self.search_entry.bind("", self._on_search_focus_in); self.search_entry.bind("", self._on_search_focus_out)
+ self.search_entry.config(state=tk.DISABLED)
+ self.remaining_label = ttk.Label(control_frame, text=f"{self.i18n.get('remaining_label')} 0"); self.remaining_label.pack(side="right", padx=10)
+ options_frame = ttk.Frame(self.main_frame); options_frame.pack(fill=tk.X, pady=5)
+ log_display_frame = ttk.LabelFrame(options_frame, text=self.i18n.get("log_display_label"))
+ log_display_frame.pack(side="left", fill="x", expand=True, padx=(0,5))
+ self.log_display_var = tk.StringVar(value="name")
+ self.channel_name_radio = ttk.Radiobutton(log_display_frame, text=self.i18n.get("channel_name_radio"), variable=self.log_display_var, value="name")
+ self.channel_name_radio.pack(side="left", padx=10)
+ ToolTip(self.channel_name_radio, self.i18n.get("tooltip_channel_name"))
+ self.channel_url_radio = ttk.Radiobutton(log_display_frame, text=self.i18n.get("channel_url_radio"), variable=self.log_display_var, value="url")
+ self.channel_url_radio.pack(side="left", padx=10)
+ ToolTip(self.channel_url_radio, self.i18n.get("tooltip_channel_url"))
+ adv_frame = ttk.LabelFrame(options_frame, text=self.i18n.get("options_label")); adv_frame.pack(side="left", fill="x", expand=True, padx=(5,0))
+ self.use_ocr_var = tk.BooleanVar(); self.ocr_check = ttk.Checkbutton(adv_frame, text=self.i18n.get("use_ocr_check"), variable=self.use_ocr_var, command=self.save_checkbox_settings)
+ self.ocr_check.pack(side="left", padx=10)
+ if not TESSERACT_INSTALLED: self.ocr_check.config(state=tk.DISABLED)
+ ToolTip(self.ocr_check, self.i18n.get("tooltip_ocr"))
+ self.skip_knowngood_urls_var = tk.BooleanVar(); self.skip_check = ttk.Checkbutton(adv_frame, text=self.i18n.get("skip_known_check"), variable=self.skip_knowngood_urls_var, command=self.save_checkbox_settings)
+ self.skip_check.pack(side="left", padx=10)
+ ToolTip(self.skip_check, self.i18n.get("tooltip_skip_known"))
+ self.progress = ttk.Progressbar(self.main_frame, orient="horizontal", mode="determinate"); self.progress.pack(fill=tk.X, pady=5)
+ self.log_view = scrolledtext.ScrolledText(self.main_frame, wrap=tk.WORD, height=12); self.log_view.pack(fill=tk.BOTH, expand=True)
+ self.log_view.tag_config("green", foreground="#009900"); self.log_view.tag_config("red", foreground="#CC0000"); self.log_view.tag_config("yellow", foreground="#E69B00"); self.log_view.tag_config("info", foreground="#0073B7")
+ self.log_view.bind("", self._show_log_context_menu)
+
+ def _on_search_focus_in(self, event):
+ if self.search_var.get() == self.i18n.get("search_label"):
+ self.search_entry.delete(0, "end")
+ self.search_entry.config(foreground="black")
+
+ def _on_search_focus_out(self, event):
+ if not self.search_var.get():
+ self.search_entry.insert(0, self.i18n.get("search_label"))
+ self.search_entry.config(foreground="grey")
+
+ def _on_search_change(self, *args):
+ query = self.search_var.get().lower()
+ if self.is_running or not query or query == self.i18n.get("search_label").lower(): return
+ output_file = self.output_var.get()
+ if not os.path.exists(output_file): return
+ self.log_view.delete('1.0', tk.END)
+ try:
+ with open(output_file, 'r', encoding='utf-8', errors='ignore') as f: content = f.read()
+ found_streams = parse_m3u(content)
+ results = [s for s in found_streams if query in s['title'].lower()]
+ if results:
+ self.log(f"--- Found {len(results)} matches for '{query}' in {os.path.basename(output_file)} ---", "info")
+ for stream in results: self.log(f"[FOUND] {stream['title']}", "green")
+ else:
+ self.log(f"--- No matches found for '{query}' ---", "yellow")
+ except Exception as e:
+ self.log(f"[!] Error reading or parsing output file for search: {e}", "red")
+
+ def save_checkbox_settings(self):
+ config = configparser.ConfigParser(); config.read(self.config_manager.path, encoding='utf-8')
+ if not config.has_section('Settings'): config.add_section('Settings')
+ config.set('Settings', 'useocr', 'yes' if self.use_ocr_var.get() else 'no')
+ config.set('Settings', 'skipknowngoodurls', 'yes' if self.skip_knowngood_urls_var.get() else 'no')
+ self.config_manager.save(config); self.load_settings()
+
+ def browse_file(self):
+ filename = filedialog.askopenfilename(title="Select M3U File", filetypes=(("M3U files", "*.m3u*"),("All files", "*.*")))
+ if filename: self.input_var.set(filename)
+
+ def recheck_output_file(self):
+ self.start_processing(is_recheck=True)
+
+ def open_website_finder(self): WebsiteFinderWindow(self)
+ def open_links_manager(self): LinksManagerWindow(self)
+
+ def _set_ui_state_for_checking(self, is_starting):
+ """Locks or unlocks the UI elements based on whether a check is running."""
+ # Determine the new state for most widgets
+ state = tk.DISABLED if is_starting else tk.NORMAL
+ readonly_state = tk.DISABLED if is_starting else 'readonly'
+
+ # --- Control main window widgets ---
+ self.start_button.config(state=state)
+ self.browse_button.config(state=state)
+ self.input_entry.config(state='normal' if not is_starting else 'disabled')
+ self.output_entry.config(state='normal' if not is_starting else 'disabled')
+ self.timeout_menu.config(state=readonly_state)
+ self.workers_menu.config(state=readonly_state)
+ self.channel_name_radio.config(state=state)
+ self.channel_url_radio.config(state=state)
+ self.skip_check.config(state=state)
+
+ # Special handling for OCR check to respect Tesseract installation status
+ if is_starting:
+ self.ocr_check.config(state=tk.DISABLED)
+ else:
+ self.ocr_check.config(state=tk.NORMAL if TESSERACT_INSTALLED else tk.DISABLED)
+
+ # Control the Stop button (it has the opposite logic)
+ self.stop_button.config(state=tk.NORMAL if is_starting else tk.DISABLED)
+
+ # --- Control specific, disruptive menu items ---
+ self.file_menu.entryconfig(self.i18n.get("recheck_output"), state=state)
+ self.tools_menu.entryconfig(self.i18n.get("website_finder"), state=state)
+ self.db_menu.entryconfig(self.i18n.get("check_all_links"), state=state)
+ self.about_menu.entryconfig(self.i18n.get("update"), state=state)
+
+ # Control the entire language menu cascade, as changing language restarts the app
+ self.menu_bar.entryconfig(self.i18n.get("language"), state=state)
+
+ def start_database_check(self):
+ if self.is_running: return
+ self.log_view.delete('1.0', tk.END)
+ self._set_ui_state_for_checking(True)
+ self.log("--- Starting Database Check ---", "info")
+
+ def do_db_check():
+ self.log("[*] Loading all playlists from the database...", "info")
+ links = self.links_db_manager.load().get('defaultlinks', {})
+ if not links:
+ self.log("[!] No links found in the database.", "yellow")
+ self.after(0, self.stop_processing)
+ return
+ all_content = ""
+ for name, url in links.items():
+ try:
+ self.log(f" -> Downloading '{name}'...", "info")
+ r = requests.get(url, headers={'User-Agent': USER_AGENT}, timeout=20)
+ r.raise_for_status()
+ all_content += r.content.decode('utf-8', errors='ignore') + "\n"
+ except Exception as e:
+ self.log(f"[!] Failed to download '{name}': {e}", "red")
+ if all_content:
+ self.input_var.set("[Database Check]")
+ all_streams = parse_m3u(all_content)
+ self.after(0, self._start_check_internal, all_streams, False)
+ else:
+ self.log("[!] Database check failed: No valid playlists could be downloaded.", "red")
+ self.after(0, self.stop_processing)
+
+ threading.Thread(target=do_db_check, daemon=True).start()
+
+ def start_processing(self, is_recheck=False):
+ if self.is_running: return
+ input_path = self.output_var.get() if is_recheck else self.input_var.get()
+ if not input_path or input_path == "[Database Check]":
+ self.log("[!] Please provide a valid M3U file or URL.", "red")
+ return
+ self.log_view.delete('1.0', tk.END)
+ self._set_ui_state_for_checking(True)
+ if is_recheck:
+ self.log(f"--- Starting Recheck of: {os.path.basename(input_path)} ---", "info")
+ else:
+ self.log("--- Starting Manual Check ---", "info")
+
+ def do_start_check():
+ try:
+ if urlparse(input_path).scheme in ('http', 'https'):
+ self.log(f"[*] Downloading: {input_path}", "info")
+ r = requests.get(input_path, headers={'User-Agent': USER_AGENT}, timeout=20)
+ r.raise_for_status()
+ content = r.content.decode('utf-8', errors='ignore')
+ else:
+ if not os.path.exists(input_path):
+ self.after(0, lambda: messagebox.showerror("File Not Found", f"The file '{input_path}' does not exist."))
+ self.after(0, self.stop_processing)
+ return
+ self.log(f"[*] Reading local file: {input_path}", "info")
+ with open(input_path, 'r', encoding='utf-8', errors='ignore') as f:
+ content = f.read()
+
+ all_streams = parse_m3u(content)
+ self.after(0, self._start_check_internal, all_streams, is_recheck)
+
+ except requests.RequestException as e:
+ self.log(f"\n[!] Error downloading playlist: {e}", "red")
+ self.after(0, self.stop_processing)
+ except Exception as e:
+ self.log(f"\n[!] Error loading playlist: {e}", "red")
+ self.after(0, self.stop_processing)
+
+ threading.Thread(target=do_start_check, daemon=True).start()
+
+ def _start_check_internal(self, all_streams, is_recheck):
+ self.is_running = True
+ self.current_check_id = time.time()
+ self.is_rechecking = is_recheck
+ self.search_entry.config(state=tk.DISABLED)
+ output_path = self.output_var.get().strip()
+
+ if not output_path:
+ self.log("[!] Please provide an Output File name.", "red")
+ self.stop_processing()
+ return
+
+ self.progress['value'] = 0
+ self.processed_count = 0
+ self.uncheckable_count = 0
+ self.online_count = 0
+ self.log_url_map.clear()
+ self.known_good_urls.clear()
+ global OCR_FAILED_ONCE
+ OCR_FAILED_ONCE = False
+
+ logging.info(f"--- Starting new check with ID: {self.current_check_id} ---")
+
+ if self.skip_knowngood_urls_var.get() and not self.is_rechecking:
+ if os.path.exists(output_path):
+ output_filename = os.path.basename(output_path)
+ self.log(f"[*] Comparing against output file ('{output_filename}') to skip duplicates...", "info")
+ try:
+ with open(output_path, 'r', encoding='utf-8', errors='ignore') as f: content = f.read()
+ self.known_good_urls = {s['url'] for s in parse_m3u(content)}
+ self.log(f" -> Found {len(self.known_good_urls)} URLs in the output file to be skipped.", "info")
+ except Exception as e:
+ self.log(f"[!] Could not read existing output file to check for duplicates: {e}", "yellow")
+
+ self.streams_to_check = [s for s in all_streams if s['url'] not in self.known_good_urls]
+
+ if self.known_good_urls:
+ skipped_count = len(all_streams) - len(self.streams_to_check)
+ if skipped_count > 0:
+ self.log(f"[*] Skipped {skipped_count} streams that are already in the output file.", "info")
+
+ if not self.streams_to_check:
+ log_msg = "[!] No new streams to check." if not self.is_rechecking else "[!] No streams found in file to recheck."
+ self.log(log_msg, "yellow")
+ self.stop_processing()
+ return
+
+ part_file_path = f"{output_path}.part"; uncheckable_file_path = "uncheckable.m3u"
+ self.journal_file = open(part_file_path, "w", encoding='utf-8-sig'); self.uncheckable_file = open(uncheckable_file_path, "w", encoding='utf-8-sig')
+ write_m3u_header(self.journal_file); write_m3u_header(self.uncheckable_file)
+
+ self.total_stream_count = len(self.streams_to_check)
+ self.progress['maximum'] = self.total_stream_count
+ self.remaining_label.config(text=f"{self.i18n.get('remaining_label')} {self.total_stream_count}");
+ self.log(f"[*] Found {self.total_stream_count} new streams to check. Starting...", "info")
+ self._monitor_workers()
+
+ def stop_processing(self):
+ self.is_running = False
+ self.current_check_id = None
+ self.log(">>> Sending stop signal and cleaning up...", "yellow")
+
+ active_procs = list(self.active_processes.items())
+ self.active_processes.clear()
+ for pid, data in active_procs:
+ self._force_kill_worker(pid, data)
+ self.log(">>> All workers terminated.", "yellow")
+
+ if self.journal_file:
+ self.journal_file.close()
+ self.journal_file = None
+ if self.uncheckable_file:
+ self.uncheckable_file.close()
+ self.uncheckable_file = None
+
+ output_path = self.output_var.get().strip(); part_file_path = f"{output_path}.part"
+
+ if self.is_rechecking:
+ if os.path.exists(part_file_path) and os.path.getsize(part_file_path) > 15:
+ shutil.move(part_file_path, output_path)
+ self.log(f"[+] Playlist cleaned and saved to: {output_path}", "green")
+ else:
+ if os.path.exists(output_path): os.remove(output_path)
+ if os.path.exists(part_file_path): os.remove(part_file_path)
+ self.log(f"[!] No working streams found. Output file '{output_path}' removed.", "yellow")
+ else:
+ if os.path.exists(part_file_path) and os.path.getsize(part_file_path) > 15:
+ with open(part_file_path, 'r', encoding='utf-8-sig') as part_f:
+ new_content = part_f.read()
+
+ new_streams_count = len(re.findall(r'#EXTINF', new_content))
+ output_needs_header = not os.path.exists(output_path) or os.path.getsize(output_path) == 0
+
+ with open(output_path, 'a', encoding='utf-8-sig') as main_f:
+ if output_needs_header:
+ main_f.write("#EXTM3U\n\n")
+ part_content_no_header = new_content.replace("#EXTM3U\n\n", "", 1)
+ main_f.write(part_content_no_header)
+
+ self.log(f"[+] Appended {new_streams_count} new working streams to: {output_path}", "green")
+
+ if os.path.exists(part_file_path):
+ os.remove(part_file_path)
+
+ if self.uncheckable_count > 0: self.log(f"[!] {self.uncheckable_count} streams were saved to 'uncheckable.m3u'", "yellow")
+
+ self.remaining_label.config(text=f"{self.i18n.get('remaining_label')} 0")
+ self._set_ui_state_for_checking(False)
+
+ search_file_exists = os.path.exists(self.output_var.get()) and os.path.getsize(self.output_var.get()) > 0
+ self.search_entry.config(state='normal' if search_file_exists else 'disabled')
+
+ if self.input_var.get() == "[Database Check]":
+ self.input_var.set("")
+
+ def _monitor_workers(self):
+ if not self.is_running:
+ return
+
+ pids_to_remove = []
+ now = time.time()
+ for pid, data in self.active_processes.items():
+ if data['proc'].poll() is not None:
+ self._process_result(data)
+ pids_to_remove.append(pid)
+ elif (now - data['start_time']) > WORKER_PROCESS_TIMEOUT_SECONDS:
+ logging.warning(f"Worker PID {pid} for URL {data['stream_info']['url']} timed out. Forcing termination.")
+ self._force_kill_worker(pid, data)
+ self.after(0, self._handle_worker_failure, data['stream_info'], "(Timeout)", data['check_id'])
+ pids_to_remove.append(pid)
+
+ for pid in pids_to_remove:
+ if pid in self.active_processes:
+ del self.active_processes[pid]
+
+ max_workers = int(self.workers_var.get())
+ if len(self.active_processes) < max_workers and self.streams_to_check:
+ self._launch_worker(self.streams_to_check.pop(0), self.current_check_id)
+
+ if not self.streams_to_check and not self.active_processes:
+ self.log("\n--- Check Complete ---", "info")
+ self.stop_processing()
+ return
+
+ self.after(100, self._monitor_workers)
+
+ def _handle_worker_failure(self, stream_info, reason, check_id):
+ if check_id != self.current_check_id:
+ logging.warning(f"Discarding stale worker failure from a previous check ({check_id}).")
+ return
+
+ self.processed_count += 1
+ self.progress['value'] = self.processed_count
+ self.remaining_label.config(text=f"{self.i18n.get('remaining_label')} {self.total_stream_count - self.processed_count}")
+ display_text = stream_info['title'] if self.log_display_var.get() == 'name' else stream_info['url']
+ stream_id_tag = f"stream_{self.processed_count}"
+ self.log_url_map[stream_id_tag] = stream_info['url']
+ self.log(f"[{'OFF ' + reason:^15}] {display_text}", "red", stream_id=stream_id_tag)
+ logging.info(f"Stream offline: [{reason}] {stream_info['title']} ({stream_info['url']})")
+
+ def _launch_worker(self, stream_info, check_id):
+ def run_in_thread():
+ try:
+ if check_id != self.current_check_id: return
+
+ final_url = sanitize_url_aggressively(stream_info['url']) if stream_info.get('is_retry') else stream_info['url']
+
+ if 'youtube.com/' in final_url or 'youtu.be/' in final_url:
+ try:
+ yt_cmd = [YT_DLP_PATH, '--get-url', final_url]
+ logging.debug(f"Executing yt-dlp command: {' '.join(yt_cmd)}")
+ result = subprocess.run(yt_cmd, capture_output=True, text=True, timeout=YT_DLP_TIMEOUT_SECONDS)
+ if result.returncode == 0 and result.stdout.strip():
+ final_url = result.stdout.strip().splitlines()[0]
+ logging.debug(f"yt-dlp found direct URL: {final_url}")
+ else:
+ raise RuntimeError(f"yt-dlp failed: {result.stderr.strip()}")
+ except Exception as e:
+ logging.error(f"yt-dlp failed for {stream_info['url']}: {e}")
+ self.after(0, self._handle_worker_failure, stream_info, "(YouTube Error)", check_id)
+ return
+
+ check_type = None
+ for pattern, type_ in self.stream_patterns.items():
+ if pattern in final_url:
+ check_type = type_
+ break
+
+ if check_type is None and re.search(r':\d+(?:/[^.]*)?$', final_url):
+ check_type = 'audio'
+
+ if check_type is None:
+ probe_result = self._get_stream_type(final_url)
+ check_type = 'video' if probe_result == 'video' else 'audio'
+
+ self.after(0, self._schedule_process, stream_info, final_url, check_type, check_id)
+
+ except Exception as e:
+ logging.error(f"Error in worker thread for {stream_info['url']}: {e}", exc_info=True)
+ self.after(0, self._handle_worker_failure, stream_info, "(Launch Error)", check_id)
+
+ threading.Thread(target=run_in_thread, daemon=True).start()
+
+ def _schedule_process(self, stream_info, final_url, check_type, check_id):
+ if check_id != self.current_check_id:
+ logging.warning(f"Discarding stale process schedule from a previous check ({check_id}).")
+ return
+
+ temp_file = None
+ try:
+ proc = None; probe_type = 'ffprobe'
+ use_ffmpeg = check_type == 'video' and self.use_ocr_var.get()
+
+ popen_kwargs = {'stdin': subprocess.DEVNULL, 'stdout': subprocess.PIPE, 'stderr': subprocess.PIPE, 'text': True, 'errors': 'ignore'}
+ if os.name == 'posix': popen_kwargs['start_new_session'] = True
+ else: popen_kwargs['creationflags'] = subprocess.CREATE_NEW_PROCESS_GROUP
+
+ if use_ffmpeg:
+ probe_type = 'ffmpeg'
+ with tempfile.NamedTemporaryFile(suffix=".mp4", prefix=TEMP_FILE_PREFIX, delete=False) as tf: temp_file = tf.name
+
+ ffmpeg_cmd = [FFMPEG_PATH, '-y', '-hide_banner'] + ['-user_agent', USER_AGENT, '-timeout', str(build_timeout_config(int(self.timeout_var.get()))['network_timeout_us'])] + build_timeout_config(int(self.timeout_var.get()))['ffmpeg_flags'] + ['-t', str(DEFAULT_CAPTURE_DURATION), '-i', final_url] + ['-c', 'copy', '-bsf:a', 'aac_adtstoasc', temp_file]
+ proc = subprocess.Popen(ffmpeg_cmd, **popen_kwargs)
+ else:
+ user_agent = AUDIO_USER_AGENT if check_type == 'audio' else USER_AGENT
+ ffprobe_cmd = [FFPROBE_PATH, '-v', 'error', '-user_agent', user_agent, '-timeout', str(build_timeout_config(int(self.timeout_var.get()))['network_timeout_us']), '-i', final_url]
+ proc = subprocess.Popen(ffprobe_cmd, **popen_kwargs)
+
+ self.active_processes[proc.pid] = {"proc": proc, "stream_info": stream_info, "temp_file": temp_file, "start_time": time.time(), "check_type": check_type, "probe_type": probe_type, "check_id": check_id}
+
+ except Exception as e:
+ logging.error(f"Error scheduling process for {stream_info['url']}: {e}", exc_info=True)
+ if temp_file and os.path.exists(temp_file):
+ try: os.remove(temp_file)
+ except OSError: pass
+ self.after(0, self._handle_worker_failure, stream_info, "(Schedule Error)", check_id)
+
+ def _process_result(self, data):
+ check_id = data['check_id']
+ if check_id != self.current_check_id:
+ logging.warning(f"Discarding stale process result from a previous check ({check_id}).")
+ if data['temp_file'] and os.path.exists(data['temp_file']):
+ try: os.remove(data['temp_file'])
+ except OSError: pass
+ return
+
+ proc = data['proc']; stream_info = data['stream_info']; temp_file = data['temp_file']
+ display_text = stream_info['title'] if self.log_display_var.get() == 'name' else stream_info['url']
+ tag = "red"; detailed_status = "OFF"
+
+ try:
+ stdout, stderr = proc.communicate()
+ logging.debug(f"[{data['probe_type'].upper()}] stdout for {stream_info['url']}:\n{stdout}")
+ logging.debug(f"[{data['probe_type'].upper()}] stderr for {stream_info['url']}:\n{stderr}")
+
+ if data['probe_type'] == 'ffprobe':
+ if proc.returncode == 0: detailed_status = "ON"
+ else: detailed_status = "OFF (Probe Error)"
+ else: # ffmpeg
+ if proc.returncode == 0 and os.path.exists(temp_file) and os.path.getsize(temp_file) >= MIN_FILE_SIZE_BYTES:
+ if data['check_type'] == 'video' and self.use_ocr_var.get():
+ detailed_status = self._perform_ocr_check(temp_file)
+ else:
+ detailed_status = "ON"
+ else:
+ detailed_status = "OFF (Capture Error)"
+ except Exception as e:
+ detailed_status = "OFF (Processing Error)"
+ logging.error(f"Error processing result for {stream_info['url']}: {e}", exc_info=True)
+
+ self.processed_count += 1
+ self.progress['value'] = self.processed_count
+ self.remaining_label.config(text=f"{self.i18n.get('remaining_label')} {self.total_stream_count - self.processed_count}")
+
+ gui_status_text = "OFF"
+ if "ON" in detailed_status:
+ self.online_count += 1
+ if data['check_type'] == 'audio': stream_info['group'] = 'Radios'
+ write_m3u_entry(self.journal_file, stream_info)
+ tag = "green"; gui_status_text = "ON"
+ else:
+ url = stream_info['url']
+ if len(url) > UNCHECKABLE_URL_LENGTH_THRESHOLD or any(kw in url.lower() for kw in UNCHECKABLE_KEYWORDS):
+ write_m3u_entry(self.uncheckable_file, stream_info)
+ self.uncheckable_count += 1
+
+ stream_id_tag = f"stream_{self.processed_count}"
+ self.log_url_map[stream_id_tag] = stream_info['url']
+ self.log(f"[{gui_status_text:^15}] {display_text}", tag, stream_id=stream_id_tag)
+
+ if temp_file and os.path.exists(temp_file):
+ try: os.remove(temp_file)
+ except OSError as e: logging.warning(f"Could not remove temp file {temp_file}: {e}")
+
+# --- CLI APPLICATION CLASS ---
+class AppCLI(CheckerBase):
+ def __init__(self, args):
+ super().__init__()
+ self.args = args
+ self.links_db_manager = IniManager(LINKS_DB_PATH)
+ self.total_streams = 0
+
+ def log(self, message, tag=None):
+ color_map = {"green": Fore.GREEN, "red": Fore.RED, "yellow": Fore.YELLOW, "info": Fore.CYAN}
+ color = color_map.get(tag, "")
+ with self.lock:
+ print(f"{color}{message}{Style.RESET_ALL}")
+
+ def run(self):
+ print(f"{Style.BRIGHT}{Fore.CYAN}--- IPTV-Check v{VERSION} (CLI Mode) ---{Style.RESET_ALL}")
+ signal.signal(signal.SIGINT, self._signal_handler)
+ content = self._get_content()
+ if not content: return
+ all_streams = parse_m3u(content)
+ if not all_streams:
+ self.log("[!] No streams found in the provided source.", "yellow")
+ return
+ is_recheck = bool(self.args.recheck)
+ output_path = self.args.recheck if is_recheck else self.args.output
+ known_good_urls = set()
+ if not is_recheck and not self.args.no_skip:
+ if os.path.exists(output_path):
+ self.log(f"[*] Comparing against output file ('{os.path.basename(output_path)}') to skip duplicates...", "yellow")
+ try:
+ with open(output_path, 'r', encoding='utf-8', errors='ignore') as f: existing_content = f.read()
+ known_good_urls = {s['url'] for s in parse_m3u(existing_content)}
+ self.log(f" -> Found {len(known_good_urls)} URLs in the output file to be skipped.", "info")
+ except Exception as e:
+ self.log(f"[!] Could not read existing output file: {e}", "red")
+ self.streams_to_check = [s for s in all_streams if s['url'] not in known_good_urls]
+ if known_good_urls:
+ skipped_count = len(all_streams) - len(self.streams_to_check)
+ if skipped_count > 0:
+ self.log(f"[*] Skipped {skipped_count} streams that are already in the output file.", "info")
+ if not self.streams_to_check:
+ self.log("[!] No new streams to check.", "yellow")
+ return
+ self.log(f"[*] Found {len(self.streams_to_check)} new streams to check. Starting...", "green")
+ part_file_path = f"{output_path}.part"; uncheckable_file_path = "uncheckable.m3u"
+ self.journal_file = open(part_file_path, "w", encoding='utf-8-sig')
+ self.uncheckable_file = open(uncheckable_file_path, "w", encoding='utf-8-sig')
+ write_m3u_header(self.journal_file); write_m3u_header(self.uncheckable_file)
+ self.total_streams = len(self.streams_to_check)
+ self.is_running = True
+ self.current_check_id = time.time()
+
+ queue = self.streams_to_check[:]
+ threads = []
+ for _ in range(self.args.workers):
+ thread = threading.Thread(target=self._worker, args=(queue,))
+ thread.daemon = True
+ thread.start()
+ threads.append(thread)
+
+ while any(t.is_alive() for t in threads):
+ time.sleep(0.5)
+ # This loop allows Ctrl+C to be detected
+
+ self.is_running = False # Ensure all threads stop after finishing their current item
+ for t in threads:
+ t.join()
+
+ self._finalize_check(output_path, is_recheck)
+
+ def _signal_handler(self, sig, frame):
+ if self.is_running:
+ print(f"\n{Style.BRIGHT}{Fore.YELLOW}>>> Ctrl+C detected. Stopping launch of new checks. Please wait for active checks to finish...{Style.RESET_ALL}")
+ self.is_running = False
+
+ def _get_content(self):
+ content = ""
+ input_path = self.args.file or self.args.recheck
+ try:
+ if input_path:
+ if urlparse(input_path).scheme in ('http', 'https'):
+ print(f"[*] Downloading: {input_path}")
+ r = requests.get(input_path, headers={'User-Agent': USER_AGENT}, timeout=20); r.raise_for_status()
+ content = r.content.decode('utf-8', errors='ignore')
+ else:
+ operation_message = "Re-checking file" if self.args.recheck else "Reading local file"
+ print(f"[*] {operation_message}: {input_path}")
+ with open(input_path, 'r', encoding='utf-8', errors='ignore') as f: content = f.read()
+ elif self.args.database:
+ print("[*] Loading all playlists from the database...")
+ links = self.links_db_manager.load().get('defaultlinks', {})
+ if not links:
+ print(f"{Fore.RED}[!] No links found in the database.{Style.RESET_ALL}"); return None
+ for name, url in links.items():
+ try:
+ print(f" -> Downloading '{name}'...")
+ r = requests.get(url, headers={'User-Agent': USER_AGENT}, timeout=20); r.raise_for_status()
+ content += r.content.decode('utf-8', errors='ignore') + "\n"
+ except Exception as e:
+ print(f"{Fore.RED}[!] Failed to download '{name}': {e}{Style.RESET_ALL}")
+ except Exception as e:
+ print(f"{Style.BRIGHT}{Fore.RED}\n[!] Error loading playlist: {e}{Style.RESET_ALL}"); return None
+ return content
+
+ def _worker(self, queue):
+ while self.is_running:
+ try:
+ with self.lock:
+ if not queue: break
+ stream_info = queue.pop(0)
+ except IndexError:
+ break
+
+ if not self.is_running: break
+
+ final_url, check_type = self._prepare_stream(stream_info)
+ if final_url is None: continue
+ self._execute_check(stream_info, final_url, check_type)
+
+ def _prepare_stream(self, stream_info):
+ try:
+ final_url = sanitize_url_aggressively(stream_info['url'])
+ if 'youtube.com/' in final_url or 'youtu.be/' in final_url:
+ yt_cmd = [YT_DLP_PATH, '--get-url', final_url]
+ result = subprocess.run(yt_cmd, capture_output=True, text=True, timeout=YT_DLP_TIMEOUT_SECONDS)
+ if result.returncode == 0 and result.stdout.strip():
+ final_url = result.stdout.strip().splitlines()[0]
+ else: raise RuntimeError(f"yt-dlp failed: {result.stderr.strip()}")
+ check_type = None
+ for pattern, type_ in self.stream_patterns.items():
+ if pattern in final_url: check_type = type_; break
+ if check_type is None and re.search(r':\d+(?:/[^.]*)?$', final_url): check_type = 'audio'
+ if check_type is None:
+ probe_result = self._get_stream_type(final_url)
+ check_type = 'video' if probe_result == 'video' else 'audio'
+ return final_url, check_type
+ except Exception as e:
+ logging.error(f"Error preparing stream {stream_info['url']}: {e}")
+ self._handle_cli_failure(stream_info, "(Prepare Error)")
+ return None, None
+
+ def _execute_check(self, stream_info, final_url, check_type):
+ temp_file = None; detailed_status = "OFF"
+ try:
+ use_ffmpeg = check_type == 'video' and self.args.ocr
+ popen_kwargs = {'stdin': subprocess.DEVNULL, 'stdout': subprocess.PIPE, 'stderr': subprocess.PIPE, 'text': True, 'errors': 'ignore'}
+ if os.name == 'posix': popen_kwargs['start_new_session'] = True
+ else: popen_kwargs['creationflags'] = subprocess.CREATE_NEW_PROCESS_GROUP
+
+ if use_ffmpeg:
+ with tempfile.NamedTemporaryFile(suffix=".mp4", prefix=TEMP_FILE_PREFIX, delete=False) as tf: temp_file = tf.name
+ ffmpeg_cmd = [FFMPEG_PATH, '-y', '-hide_banner'] + ['-user_agent', USER_AGENT, '-timeout', str(build_timeout_config(self.args.timeout)['network_timeout_us'])] + build_timeout_config(self.args.timeout)['ffmpeg_flags'] + ['-t', str(DEFAULT_CAPTURE_DURATION), '-i', final_url] + ['-c', 'copy', '-bsf:a', 'aac_adtstoasc', temp_file]
+ proc = subprocess.Popen(ffmpeg_cmd, **popen_kwargs)
+ else:
+ user_agent = AUDIO_USER_AGENT if check_type == 'audio' else USER_AGENT
+ ffprobe_cmd = [FFPROBE_PATH, '-v', 'error', '-user_agent', user_agent, '-timeout', str(build_timeout_config(self.args.timeout)['network_timeout_us']), '-i', final_url]
+ proc = subprocess.Popen(ffprobe_cmd, **popen_kwargs)
+
+ stdout, stderr = proc.communicate(timeout=WORKER_PROCESS_TIMEOUT_SECONDS)
+
+ if proc.returncode == 0:
+ if use_ffmpeg and os.path.exists(temp_file) and os.path.getsize(temp_file) >= MIN_FILE_SIZE_BYTES:
+ detailed_status = self._perform_ocr_check(temp_file)
+ elif not use_ffmpeg:
+ detailed_status = "ON"
+ except subprocess.TimeoutExpired:
+ proc.kill()
+ detailed_status = "OFF (Timeout)"
+ except Exception as e:
+ logging.error(f"Error executing check for {final_url}: {e}")
+ detailed_status = "OFF (Execution Error)"
+ finally:
+ if temp_file and os.path.exists(temp_file):
+ try: os.remove(temp_file)
+ except OSError: pass
+
+ self._handle_cli_result(stream_info, detailed_status, check_type)
+
+ def _handle_cli_failure(self, stream_info, reason):
+ with self.lock:
+ self.processed_count += 1
+ display_text = stream_info['title'] if self.args.log_format == 'name' else stream_info['url']
+ self.log(f"[{Fore.RED}{reason:^15}{Fore.RESET}] {display_text}")
+
+ def _handle_cli_result(self, stream_info, detailed_status, check_type):
+ with self.lock:
+ self.processed_count += 1
+ display_text = stream_info['title'] if self.args.log_format == 'name' else stream_info['url']
+
+ if "ON" in detailed_status:
+ self.online_count += 1
+ if check_type == 'audio': stream_info['group'] = 'Radios'
+ write_m3u_entry(self.journal_file, stream_info)
+ self.log(f"[{Fore.GREEN}{'ON':^15}{Fore.RESET}] {display_text}", tag="green")
+ else:
+ self.log(f"[{Fore.RED}{detailed_status:^15}{Fore.RESET}] {display_text}", tag="red")
+ url = stream_info['url']
+ if len(url) > UNCHECKABLE_URL_LENGTH_THRESHOLD or any(kw in url.lower() for kw in UNCHECKABLE_KEYWORDS):
+ write_m3u_entry(self.uncheckable_file, stream_info)
+ self.uncheckable_count += 1
+
+ def _finalize_check(self, output_path, is_recheck):
+ print(f"\n{Style.BRIGHT}{Fore.CYAN}--- Check Complete ---{Style.RESET_ALL}")
+
+ if self.journal_file: self.journal_file.close()
+ if self.uncheckable_file: self.uncheckable_file.close()
+
+ part_file_path = f"{output_path}.part"
+
+ if is_recheck:
+ if os.path.exists(part_file_path) and os.path.getsize(part_file_path) > 15:
+ shutil.move(part_file_path, output_path)
+ print(f"{Fore.GREEN}[+] Playlist cleaned and saved to: {output_path}{Style.RESET_ALL}")
+ else:
+ if os.path.exists(output_path): os.remove(output_path)
+ if os.path.exists(part_file_path): os.remove(part_file_path)
+ print(f"{Fore.YELLOW}[!] No working streams found. Output file '{output_path}' removed.{Style.RESET_ALL}")
+ else:
+ if os.path.exists(part_file_path) and os.path.getsize(part_file_path) > 15:
+ with open(part_file_path, 'r', encoding='utf-8-sig') as part_f: new_content = part_f.read()
+ output_needs_header = not os.path.exists(output_path) or os.path.getsize(output_path) == 0
+ with open(output_path, 'a', encoding='utf-8-sig') as main_f:
+ if output_needs_header: main_f.write("#EXTM3U\n\n")
+ part_content_no_header = new_content.replace("#EXTM3U\n\n", "", 1)
+ main_f.write(part_content_no_header)
+ print(f"{Fore.GREEN}[+] Appended {self.online_count} new working streams to: {output_path}{Style.RESET_ALL}")
+
+ if os.path.exists(part_file_path): os.remove(part_file_path)
+ if self.uncheckable_count > 0: print(f"{Fore.YELLOW}[!] {self.uncheckable_count} streams were saved to 'uncheckable.m3u'{Style.RESET_ALL}")
+
+ print(f"\n{Style.BRIGHT}Summary: {self.online_count} Online, {self.total_streams - self.online_count} Offline, {self.total_streams} Total.{Style.RESET_ALL}")
+
+# --- MAIN APPLICATION ENTRY POINT ---
+def main():
+ setup_logging(); cleanup_stale_temp_files(); load_languages()
+ missing_essential, missing_optional = check_dependencies()
+
+ parser = argparse.ArgumentParser(description=f"IPTV-Check v{VERSION}.", add_help=False)
+ parser.add_argument('-h', '--help', action='help', default=argparse.SUPPRESS, help='Show this help message and exit.')
+ parser.add_argument('-gui', '--gui', action='store_true', help='Launch the graphical user interface.')
+ input_group = parser.add_argument_group('CLI Input Options (choose one)')
+ input_group = input_group.add_mutually_exclusive_group()
+ input_group.add_argument('-f', '--file', help='Path or URL to the M3U playlist file.')
+ input_group.add_argument('-d', '--database', action='store_true', help='Use the default links database as input.')
+ input_group.add_argument('-r', '--recheck', help='Re-check an existing output file (e.g., updated.m3u).')
+ cli_opts = parser.add_argument_group('CLI General Options')
+ cli_opts.add_argument('-o', '--output', default='updated.m3u', help='Output file for working streams.')
+ cli_opts.add_argument('-w', '--workers', type=int, default=10, help='Number of parallel workers (1-20).')
+ cli_opts.add_argument('-t', '--timeout', type=int, default=5, help='Network timeout in seconds for each stream.')
+ cli_opts.add_argument('--log-format', choices=['name', 'url'], default='name', help='Log output format for the CLI progress bar.')
+ cli_opts.add_argument('--ocr', action='store_true', help='Enable OCR checking for video streams.')
+ cli_opts.add_argument('--no-skip', action='store_true', help='Disable skipping of known good URLs found in the output file.')
+ args = parser.parse_args()
+
+ is_cli_mode = args.file or args.database or args.recheck
+
+ if args.gui:
+ if not GUI_AVAILABLE:
+ print(f"{Fore.RED}{Style.BRIGHT}[!] GUI mode requires Tkinter, which could not be imported.{Style.RESET_ALL}"); sys.exit(1)
+ if missing_essential:
+ error_msg = (f"FATAL ERROR: The following required programs are not installed or not in your system's PATH:\n\n"
+ f"{', '.join(missing_essential)}\n\n"
+ "Please install them and ensure they are accessible to run the application.")
+ logging.critical(f"Missing essential dependencies: {', '.join(missing_essential)}")
+ root = tk.Tk(); root.withdraw(); messagebox.showerror("Fatal Dependency Error", error_msg)
+ sys.exit(1)
+ app = AppGUI(args, missing_optional)
+ app.mainloop()
+ elif is_cli_mode:
+ if missing_essential:
+ error_msg = (f"FATAL ERROR: The following required programs are not installed or not in your system's PATH:\n\n"
+ f"{', '.join(missing_essential)}\n\n"
+ "Please install them and ensure they are accessible to run the application.")
+ logging.critical(f"Missing essential dependencies: {', '.join(missing_essential)}")
+ print(f"{Fore.RED}{Style.BRIGHT}{error_msg}{Style.RESET_ALL}")
+ sys.exit(1)
+ if args.recheck and args.output != 'updated.m3u' and not any(arg in sys.argv for arg in ['-o', '--output']):
+ args.output = args.recheck
+
+ cli_app = AppCLI(args)
+ cli_app.run()
+
+ else:
+ parser.print_help()
+ print("\nTo start the graphical interface, run:\npython3 iptv_check.py --gui")
+ sys.exit(0)
+
+if __name__ == "__main__":
+ main()
diff --git a/iptv_checker_config.ini b/iptv_checker_config.ini
new file mode 100644
index 0000000..515cb2c
--- /dev/null
+++ b/iptv_checker_config.ini
@@ -0,0 +1,10 @@
+[Settings]
+
+[StreamPatterns]
+.m3u8 = video
+.m3u = video
+.ts = video
+.mp3 = audio
+.aac = audio
+/stream = audio
+
diff --git a/readme.md b/readme.md
index 24850ef..895780e 100644
--- a/readme.md
+++ b/readme.md
@@ -1,21 +1,169 @@
-# IPTV-CHECK 1.0
+# IPTV-Check v3.0
-Iptv-check allows you to input a valid iptv file (m3u) to be checked if the video streams are still working or not .
-In case valid urls were found , then the script will create a new iptv (m3u) file with those urls .
+## Checking url with m3u
+
-# Screenshots
-
+## Checking current iptv lists in urls database
+
-
+## CLI mode
+
-# Requirements
+## Description
+IPTV-Check is a powerful, cross-platform tool for validating M3U playlists. Originally a popular Bash script, v3.0 is a complete architectural rewrite in Python, offering a full Graphical User Interface (GUI), high-performance parallel stream checking, and advanced validation features.
-- wget
+It reads an M3U playlist from a local file or URL, checks each stream to see if it's online, and saves the working streams to a new, clean M3U file.
-# Install Requirements
+* Key Features
-- apt-get install wget
+This is a major upgrade from the previous Bash version, designed for speed, accuracy, and user-friendliness.
-# Tool Instalation
+ Dual Mode Operation
-- git clone https://github.com/peterpt/IPTV-CHECK.git && cd IPTV-CHECK && ./iptv-check
+ GUI Mode: A user-friendly graphical interface for easy, intuitive operation.
+
+ CLI Mode: A powerful command-line interface perfect for automation and scripting.
+
+* High-Performance Concurrency
+
+Utilizes multiple workers to check dozens of streams in parallel, dramatically reducing the time it takes to validate large playlists from hours to minutes.
+
+ Advanced OCR Validation
+
+ (Optional) Uses Tesseract OCR to analyze a video frame from each stream. This unique feature detects "soft" errors like login prompts, geo-blocks, or on-screen error messages that a simple connection check would miss, ensuring a higher quality final playlist.
+
+ Built-in GUI Tools
+
+ Website M3U Finder: Scans any website URL to automatically discover and validate direct links to .m3u and .m3u8 playlists.
+
+ Links Database Manager: Create, save, and manage a personal database of your favorite M3U playlist URLs for quick access and checking.
+
+ Efficient & Smart Checking
+
+ Skip Duplicates: To speed up processing new lists, the app can read your existing output file and skip checking any streams that are already known to be good.
+
+ YouTube Support: Automatically resolves youtube.com links to their direct, playable stream URLs using yt-dlp.
+
+ Uncheckable Filter: Intelligently isolates streams with temporary tokens, signatures, or authentication keys into a separate uncheckable.m3u file for manual review.
+
+ Cross-Platform & Multilingual
+
+ Fully compatible with Windows, macOS, and Linux.
+
+ The GUI is available in 8 languages (EN, PT, ES, FR, IT, DE, RU, ZH), with a simple structure to support more translations.
+
+Requirements
+## 1. External Dependencies
+
+The following command-line tools must be installed on your system and accessible in your system's PATH for the application to function.
+
+```sh
+ apt install git ffmpeg yt-dlp python3-tk tesseract-ocr libtesseract-dev tesseract-ocr-en
+```
+ Git: (Optional) Required for using the self-updating feature from the GUI's "About" menu.
+
+2. Python Dependencies
+
+The script requires Python 3.7+ and several third-party libraries. You can install them using the provided requirements.txt file. The required libraries are:
+
+ requests
+ Pillow
+ pytesseract
+ colorama
+
+## Installation
+
+- Clone the repository to your local machine:
+```
+git clone https://github.com/peterpt/iptv-check.git
+cd iptv-check
+```
+
+- Install the required Python3 libraries using pip:
+```
+pip install -r requirements.txt
+```
+Ensure all External Dependencies are installed correctly and that their locations are in your system's PATH.
+
+## Usage
+### GUI Mode (Recommended)
+
+For the best and most user-friendly experience, run the application with the --gui flag.
+```sh
+python3 iptv_check.py --gui
+```
+
+The graphical interface provides easy access to all features, including the Website Finder and Links Database. Tooltips are available for all major options to guide you.
+
+### Command-Line (CLI) Mode
+
+For automation, scripting, or use in a server environment, the CLI provides full access to the core checking functionality.
+
+Basic Examples:
+```sh
+# Check a remote URL and save working streams to updated.m3u
+python3 iptv_check.py -f "http://example.com/playlist.m3u"
+
+# Check a local file and specify a different output file
+python3 iptv_check.py -f "/path/to/your/playlist.m3u" -o "my_checked_list.m3u"
+
+# Re-check an existing output file to clean out any links that have gone offline
+python3 iptv_check.py -r "my_checked_list.m3u"
+
+# Check all playlists stored in your personal links database
+python3 iptv_check.py -d
+
+```
+
+#### Advanced Example:
+
+```sh
+# Use 20 workers, a 10-second timeout, and enable OCR checking for the highest quality results
+python3 iptv_check.py -f "playlist.m3u" -w 20 -t 10 --ocr
+```
+
+
+### All CLI Arguments:
+```
+ -h, --help Show the help message and exit.
+ -gui, --gui Launch the graphical user interface.
+
+CLI Input Options (choose one):
+ -f FILE, --file FILE Path or URL to the M3U playlist file.
+ -d, --database Use the default links database as input.
+ -r RECHECK, --recheck RECHECK
+ Re-check an existing output file (e.g., updated.m3u).
+
+CLI General Options:
+ -o OUTPUT, --output OUTPUT
+ Output file for working streams (default: updated.m3u).
+ -w WORKERS, --workers WORKERS
+ Number of parallel workers (1-20) (default: 10).
+ -t TIMEOUT, --timeout TIMEOUT
+ Network timeout in seconds for each stream (default: 5).
+ --log-format {name,url}
+ Log output format for the CLI (default: name).
+ --ocr Enable OCR checking for video streams.
+ --no-skip Disable skipping of known good URLs.
+```
+
+
+### Configuration
+
+The application will automatically create the following configuration files in its directory on the first run:
+
+ iptv_checker_config.ini: Stores your settings, such as language preference, the path to an external media player (for the GUI), and stream pattern definitions.
+
+ iptv_checker_links.ini: Stores the URLs for the Links Database feature.
+
+### Old versions can be downloaed in :
+
+ https://github.com/peterpt/IPTV-CHECK/releases
+
+### License
+
+This project is licensed under the MIT License.
+
+### Credits
+ Project Leader & Creator: peterpt
+ Code Assistance by: Gemini Pro Model
diff --git a/requirements.txt b/requirements.txt
new file mode 100644
index 0000000..5b9b830
--- /dev/null
+++ b/requirements.txt
@@ -0,0 +1,4 @@
+requests
+Pillow
+pytesseract
+colorama