IPTV66 IKS66 IPTV Simple Client EPG Fix for Kodi

IPTV66 Help here!

Luig

New member
Jan 9, 2016
14
1
0
yes i do
Instead of resolving the issues in the AutoIT version I have decided to scrap all that code and just start fresh in C#. The reason I started in AutoIt is because it's an easier language to get a grasp of and I'm incredibly rusty, up until recently I haven't really coded anything in about a year or two. To minimize errors I hard coded the link to the epg guide xml and the program now reads the m3u file directly from the link generated in your IPTV control panel. Since the program now requires more sensitive data to work I am releasing the source code with instructions on how to compile it for each operating system. That's right, this new version is compatible with Windows, Linux and Mac! I'm only releasing this basic CLI source code, all future releases will be closed source to keep script kiddies from stealing my work, renaming it and claiming it as their own work.

TL;DR: This EPG Fix CLI Tool​

Source Code​
Code:
using System;
using System.Text;
using System.Xml;
using System.Xml.Schema;
using System.IO;
using System.Net;

namespace EPGFix
{
	class Program
	{
		static void Main(string[] args)
		{

			Console.WriteLine ("Please input m3u url and press enter");
			string remoteUrl = Console.ReadLine();

			WebClient myWebClient = new WebClient();
			Console.WriteLine("Downloading " + remoteUrl);                        
			byte[] myDataBuffer = myWebClient.DownloadData (remoteUrl);
			Stream stream = new MemoryStream(myDataBuffer);

			string line;
			char delimiter = ',';
			string[] substrings;
			string[] names = {"",""};
			string[] data = {"",""};
			string[] url = {"",""};
			int counter = 0;

			System.IO.StreamReader file = 
				new System.IO.StreamReader(stream);
			while((line = file.ReadLine()) != null)
			{
				if (line.StartsWith("#EXTINF:")) 
				{
					if (counter > 0) {
						Array.Resize (ref names, names.Length + 1);
						Array.Resize (ref data, data.Length + 1);
						Array.Resize (ref url, url.Length + 1);
					}
					substrings = line.Split (delimiter);
					names [counter] = substrings [substrings.Length - 1];
					data [counter] = line;
					url [counter] = file.ReadLine();
					counter++;
				}
			}

			file.Close();

			Console.WriteLine("Download successful.");

			XmlReaderSettings settings = new XmlReaderSettings();
			settings.DtdProcessing = DtdProcessing.Ignore;
			settings.ValidationType = ValidationType.DTD;
			settings.ValidationEventHandler += new ValidationEventHandler (ValidationCallBack);
			XmlReader xmlReader = XmlReader.Create("http://epg.euyulio.org/", settings);
			XmlReader xmlReader2;
			int strIndex;
			string content;
			bool continueloop = false;
			string id;

			while(xmlReader.Read())
			{
				
				if((xmlReader.NodeType == XmlNodeType.Element) && (xmlReader.Name == "channel"))
				{
					if (xmlReader.HasAttributes)
					{
						
						id = xmlReader.GetAttribute ("id");
						xmlReader2 = xmlReader.ReadSubtree();
						while (xmlReader2.Read()) 
						{
							if (continueloop) {
								continueloop = false;
								break;
							}
							if ((xmlReader.NodeType == XmlNodeType.Element) && (xmlReader.Name == "display-name")) {
								content = xmlReader2.ReadElementContentAsString ();
								for (int strNumber = 0; strNumber < names.Length-1; strNumber++)
								{
									strIndex = names[strNumber].IndexOf(content);
									if (strIndex >= 0) {
										if (data[strNumber].StartsWith("#EXTINF:-1 tvg-id=" + '"' + '"')) {
											data[strNumber] = "#EXTINF:-1 tvg-id=" + '"' + id + data[strNumber].Substring(19);
											continueloop = true;
											break;
										}
										data[strNumber] = "#EXTINF:-1 tvg-id=" + '"' + id + data[strNumber].Substring (24);
										continueloop = true;
										break;
									}
								}
							}
						}
					}
				}
			}

			string path = Directory.GetCurrentDirectory();
			Console.WriteLine ("Please input new M3U Playlist name");

			System.IO.StreamWriter file2 = new System.IO.StreamWriter(path + @"/"+Console.ReadLine()+".m3u");
			file2.WriteLine("#EXTM3U");

			for (int strNumber = 0; strNumber < names.Length - 1; strNumber++) {
				file2.WriteLine (data [strNumber]);
				file2.WriteLine (url [strNumber]);
			}

			file.Close();
			Console.WriteLine ("New M3U file generated press any key to exit");
			Console.ReadKey();
		}

		private static void ValidationCallBack(object sender, ValidationEventArgs e) {
			Console.WriteLine("Loaded EPG Guide", e.Message);
		}
	}
}

OS Specific Requirements​

Windows: .NET Framework 4.5 must be installed
Linux: Mono must be installed (Follow install instructions Here)
Mac: Mono must be installed (Follow install instructions Here)​

General Requirements​

Link to M3U Playlist as generated by your IPTV control panel
A way to host the new generated m3u file with the updated channel parameters. I personally use 000webhost.com because it's free, fast and reliable but any webhost that offers direct linking should work.
Knowledge of using Kodi and Web Control Panels helps alot but not really needed
Last but not least my handy dandy App​

Windows Instructions​

1. Double click on epgfix.exe
2. Copy and paste M3U URL and press enter
3. Type the name of the new file and press enter
4. Press any key to exit
5. Upload M3U file to a webhost

Linux and Mac Instructions​
1. Open Terminal
2. Type "cd location/of/epgfixfolder" I keep mine in documents so it would be "cd Documents"
2. Type "mono epgfix.exe" and press enter
3. Copy and paste M3U URL and press enter
4. Type the name of the new file and press enter
5. Press any key to exit
6. Upload M3U file to a webhost

Kodi Instructions​

1. Open up Kodi's IPTV Simple Client Settings (My Addons -> PVR Clients-> PVR IPTV Simple Client -> Configure -> General Settings) Under: M3U Play List URL enter the url to where you uploaded your playlist, I would also disable "Cache m3u at local storage" as it can cause issues
2. In the same menu you should see another submenu or tab called EPG Settings. Under that tab you'll find XMLTV URL, you need to enter the following with out parenthesis "http://epg.euyulio.org" Also turn off "Cache XMLTV at local storage".
3. If you did everything you can disable and re-enable the IPTV Simple Client and you should start seeing that lonely EPG start populating. If that doesn't work you can either try restarting Kodi and/or clearing the old tv data in Kodi's TV settings

How to compile on Windows

1. Download and install Mono 32-bit from Here
2. Open up Notepad and copy paste Source Code above into Notepad
3. Save As "epgfix.cs" make sure to "Save as type" is set to "All files (*.*)" and close Notepad
4. Open Mono x86 Command Prompt <--- It should appear in your start menu after you install Mono
5. Type "cd path\to\epgfix" and press enter (I keep my in documents so for me it's "cd C:\Users\Username\Documents" replace Username with your computer username)
6. Type "mcs epgfix.cs" and press enter

How to compile on Linux

1. Make sure if you have Mono installed, refer to Linux Requirement section.
2. Open up your text editor and copy paste Source Code above into it
3. Save As "epgfix.cs" make sure to "Save type" is set to "All files (*.*)" and close your text editor
4. Open Terminal
5. Type "cd path\to\epgfix" and press enter (I keep my in documents so for me it's "cd C:\Users\Username\Documents" replace Username with your computer username)
6. Type "mcs epgfix.cs" and press enter

How to compile on Mac

I'm gonna edit this later when I get access to a Mac computer but I'm sure it's roughly the same steps as Linux Instructions.


I'm still providing a download link to the compiled version below for the people that don't want to go through extra steps to compile it


Credits for the EPG XML go to Euyulio and Viper8690 : GitHub

I have personally tested this program in several different computers and it's working on both Linux and Windows. I currently don't have access to a Mac computer but it should work aswell. Please feel free to report any bugs you might encounter and I'm working on a GUI and to get the features I had in AutoIt back in the C# but I won't release it until thoroughly tested. I'll edit this post with video tutorials when I get around to making them.
 
  • Like
Reactions: crazed 9.6
Np man, I wouldn't have made it this far if the other cat hadn't shared his work lol. Got around to making a quick video to show the working EPG, not the best but it should do for now as a proof of concept and a quick visual how too of what you need to do. I used the web browser uploader for the file but Filezilla and other FTP clients work on 000webhost. My end game is to have a program that can fully customize the playlists and to have a built in self updater/uploader or maybe even a small built in localhost server that and a newer looking UI. I'm open to suggestions as far as feature requests tho.
 
Thanks looks promising. I have opened a account with 000webhost.com and downloaded your program. I need to trim down my m3u list in notepad and then i think i will be ready to test it out later today.
 
If you mean trim down all those movie and tv show links this app does it for you, leave everything unchecked and you get nothing but tv channels. It even trims out all the non working channels at the time and by that I mean the ones with a url of "http://lol" If you mean all foreign channels I'm still working on the code for that lol.
 
If you mean trim down all those movie and tv show links this app does it for you, leave everything unchecked and you get nothing but tv channels. It even trims out all the non working channels at the time and by that I mean the ones with a url of "http://lol" If you mean all foreign channels I'm still working on the code for that lol.

thanks i will give that a try and let you know.
 
OK i am almost there. i was one click away from uploading my newplaylist to 000webhost.com and it suddenly occurred to me that my playlist contains my donation number.

so the big question is how secure is the web host? i am not going to give out my donation number to anyone.
 
It's a single file and there are billions of random m3u files out there so I doubt you'll have any issues, if you are still worried you can rename the playlist file to something like "algebra_class1.m3u" and you should be fine.
 
It's a single file and there are billions of random m3u files out there so I doubt you'll have any issues, if you are still worried you can rename the playlist file to something like "algebra_class1.m3u" and you should be fine.

After it not working for me i found a malware virus on my pc i removed it. did it come from downloading the above exe file? not positive but pretty sure/

edit: to be fair i had some problems opening the 000webhost site after registering it wouldn't take my password i eventually found another page that worked. it may have been some kind of misdirect and infected my pc during that process unrelated to the download.

just saying proceed with caution.
 
Last edited:
If you got that alert when you first opened my app it might be a false positive, if you got it after the program was closed then you got it from somewhere else. I used the AutoIt scripting language to make the program because it's what I'm more familiar with and the compiled builds sometimes come up with false postives. I'm making this mainly for my personal use (and to help out my dad in Mexico) I just thought it would be nice to share it. I chose to modify the m3u file first because it's structure is much simpler than the epg one, this way I can get it automated alot faster. Once it's fully automated I will start working on modifying the epg file instead. Once all that's done and I optimize my code I will port it to a more professional language like C#. Since I'm coding this by myself this is my fastest coarse of action, as you can see from the pic below I am still pouring all my spare time and resources into completing this project. If you're still concerned about using it you can wait till I complete the epg parsing code or the C# port.

wHQKXFbTSXuHzebvV1rktQ.png


Edit: I also changed the named to IPTV EPG Fix because I found it also works with Rocket m3u lists :)

2nd Edit: Any software I make is completely portable and doesn't require installation unless I code it C# then you are required to have .NET Framework installed which most people already do.
 
Can you give me any more info like which checkboxes you chose and did you use the latest version or the first one I released? If you used the latest version the checkboxes are no longer optional, if you don't choose anything it will spit out a file just like the one you mentioned. If using the latest I suggest you check the boxes in the TV Filter list of the channel groups you still want in your m3u file before you hit start. Please get back to me if this works or doesn't work for you so I can keep trying to fix the issue.

Edit: I updated the written instructions on the main page to reflect changes in latest version. I'll update the instructional video as soon as I finish coding the FTP portion of this app.
 
After it not working for me i found a malware virus on my pc i removed it. did it come from downloading the above exe file? not positive but pretty sure/

edit: to be fair i had some problems opening the 000webhost site after registering it wouldn't take my password i eventually found another page that worked. it may have been some kind of misdirect and infected my pc during that process unrelated to the download.

just saying proceed with caution.

file is 100% clean .......

<~ checked personally & no i don't know who Luig is ........
 
Can you give me any more info like which checkboxes you chose and did you use the latest version or the first one I released? If you used the latest version the checkboxes are no longer optional, if you don't choose anything it will spit out a file just like the one you mentioned. If using the latest I suggest you check the boxes in the TV Filter list of the channel groups you still want in your m3u file before you hit start. Please get back to me if this works or doesn't work for you so I can keep trying to fix the issue.

Edit: I updated the written instructions on the main page to reflect changes in latest version. I'll update the instructional video as soon as I finish coding the FTP portion of this app.
Hi,
thnx for replying.
I did it with none checked at first then second time I did with random sections checked to see if that was the reason.
Second time I simply got three instances of the EXTM3U header and nothing else in the file.
I guess I dont have the latest version since the check boxes in version 1.1 are still optional.
Where can I get the latest version pls.?
 
V1.1 is the latest version. That's interesting, I'll write up a custom version with debugging code when I get home from work and send it to you in a pm so we can try to sort this bug out. The only way I was able to recreate the error was but leaving everything unchecked. Any more input would greatly help like are you running it from a local folder like downloads, documents or desktop? What version of windows you are using and anything else you think might help.
 
V1.1 is the latest version. That's interesting, I'll write up a custom version with debugging code when I get home from work and send it to you in a pm so we can try to sort this bug out. The only way I was able to recreate the error was but leaving everything unchecked. Any more input would greatly help like are you running it from a local folder like downloads, documents or desktop? What version of windows you are using and anything else you think might help.
Hi,
im running it from downloads.Windows 10 desktop.
I tried to add an epg from provider as well but I got the 'invalid epg file' error.
How would I download an epg correctly to be used with this type of software from the URL.?
The way I tried was to right click, save as and made it an xml file.
 
For the correct epg xml right click [xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxthen Save link as and save it. Another thing is when you generate your link from iks66 or rocket make sure you generate the generic m3u playlist plus options and not the regular generic one.
 
Last edited by a moderator: