If you have ever used a VOD from an IPTV provider that did not have images, then this might be the answer for you. This is a guide on how to modify your m3u VOD list to add poster images for Movies/TV Series, in your IPTV players, such as TiViMate and MyIPTV Player, with a python script. It will change your player from this:
And transform it into this:
What is happening?
The python script uses your IPTV provided m3u (either a url or a file) for VOD to search TMDB for the poster of the movie and tv shows via api calls. It then uses the info from the original m3u and rebuilds the m3u file, adding the images url from TMDB. You then host your file on something like Google Drive and add that link to your IPTV player channel list or you can simply keep the file on local or network storage.
What you will need
- The python script (the link will be posted below).
- Create a TMDB account so you can have your own api key.
- Some place to host a link to your finished m3u or it can be used on local machine or network share.
- A device to run script on (your desktop, server, raspberry pi, laptop)
Let’s start
Create an account on TMDB and once logged in, go to your settings and then api section. This is where you will snag your API Key (v3 auth) to add to your script.
If you do not have python installed, you need to do that now. Most Linux distros have it. You can simply type the following and it will return the version. If you do not have it installed then you will need to install it. Just search for install python “insert your flavor of linux”. Windows will most likely not have it installed but you can search how to install for it as well. There are tons of guides on these. If you get stuck message me.
python -V
or
python3 -V
If you are using Linux you need to download the Linux version and if Windows the Windows version. The great thing about python is that it mostly does not care what the host is. but there are some slight differences between the two. Here are the links:
Download VOD Images script for Windows | ![]() |
Download VOD Images script for Linux | ![]() |
If you prefer to copy and paste or see what is in it first, you can find both here:
https://notposted.com/vod-image-python-script-windows-and-linux-versions/
Modify the script before use
You only have to modify 3 variables in this script to make it work for you. They are all in a section that looks something like the image below. You will put your Api key from TMDB in the first one, your IPTV url in the next and the last one is the output location for your m3u file. I sent mine to the google drive folder on my pc, which syncs to the cloud. However, you can just save it locally or on a network share as well. Just keep in mind you will need to update this as often as you want to sync to your provider.
You will also see in the comments that you can just use a saved m3u from your provider as well. Just modify the script per the instructions in those comments.
Once you have modified the file you can just run the file to make sure it is working. For windows I use Visual Studio Code as my editor, and when testing, but you can just right click the script and open with python and it will kick it off. You can actually see the size increasing as it writes to it by looking in the folder you are saving it to.
For Linux you will run it with
python3 vodimage.py
Linux
Since I am using google drive, I wanted to spend a little more time on Linux as it requires some more steps before working properly. But before I get into the share, let’s first talk about what you need installed. Most of the imports you will have installed, and for anything that does not allow the script to run, you will get an error message and just follow the steps for these next couple of items in a similar fashion and you should be good.
For Ipytv you will need to install it like this
sudo pip install m3u-ipytv
And for tmdbv3api
sudo pip install tmdbv3api
Now on to the google drive. For this I had to share the google drive folder on my pc to the network. Right click the google drive folder, permissions, sharing tab, share with Everyone user with write permission. Keep in mind that if you use your pc and it is offline, then it cannot write to that folder. See the next section, on how get a downloadable link for the m3u file that you saved to your google drive.
How to create downloadable link from google drive
This assumes you already have a google account. If not, you will need to get one first. Go to https://drive.google.com, find the m3u that you saved there, right click and get link, set access to anyone with link, copy link. This link is a sharable link that a person would enter in their browser and have to click on download to get the file. For our purposes we want it to be downloadable for our player. To convert the link, take the original that will look something like this
https://drive.google.com/file/d/1K8TwI968WXXXXXYYYYYP72qbbx5F3qAekuBw/view?usp=sharing
Copy everything after d/ all the way to /view and paste it in between id=……….&export, like the line below
https://drive.google.com/u/0/uc?id=1K8TwI968WXXXXXYYYYYP72qbbx5F3qAekuBw&export=download
This newly created link is what you will add to your player in the channels playlist section.
Tiny CC
I then take that link above, from Google Drive, and I add create a small URL at https://tiny.cc/, because I am not typing all of that into Tivi Mate with a remote control. Nope.
File instead of url
If you decide to create a local m3u on a network share, just modify the script like it says in the variables section. You can leave the variable name as M3Uurl if you like, just change the output location for that variable to where you will store the file and make sure your IPTV app (TiVi Mate, etc) can access that location.
Set it up to run on a schedule
Linux
I logged in with the user I wanted to run the python script. I created a directory in the home directory and placed the script there.
sudo mkdir python
Make sure python is installed if you have not already. Make sure you have installed both m3u-ipytv and tmdbv3api. After you have tested the script works, you want to make sure the file is ready for a schedule. First, in the python folder you created make sure it is executable by
sudo chmod +x VODimagesLinux.py
If you plan to use google drive, then you need to mount it if you have not done so already. This is for the file path in the script. It would be something like
/mnt/google/
Follow these steps to set up the auto mapping of this network share
//servername/sharename /media/windowsshare cifs username=msusername,password=mspassword,iocharset=utf8 0 0
This is not a good idea however: /etc/fstab is readable by everyone and so is your Windows password in it. The way around this is to use a credentials file. This is a file that contains just the username and password.
Using a text editor, create a file for your remote servers logon credential:
nano ~/.smbcredentials
Enter your Windows username and password in the file:
username=msusername password=mspassword
Save the file, exit the editor.
Change the permissions of the file to prevent unwanted access to your credentials:
chmod 600 ~/.smbcredentials
Then edit your /etc/fstab file (with root privileges) to add this line (replacing the insecure line in the example above, if you added it):
//servername/sharename /media/windowsshare cifs credentials=/home/linuxsername/.smbcredentials,iocharset=utf8 0 0
Save the file, exit the editor.
Finally, test the fstab entry by issuing:
sudo mount -a
If there are no errors, you should test how it works after a reboot. Your remote share should mount automatically.
Now let’s check if you have crontab installed
sudo crontab -l
and if not then
sudo apt-get install crontab
Now let’s add a cronjob
sudo crontab -e
At the bottom of this file add something similar to this
* */6 * * * /home/yourusername/python/VODimageLinux.py
With the above settings it will run every 6 hours. Here is a chart that you can see how to configure it how you like
Windows
Scheduling in the task scheduler is pretty straight forward so I will just post a link to a guide on how to schedule it for those that don’t. If you need help after reading this reach out to me.
https://www.askpython.com/python/examples/execute-python-windows-task-scheduler
Player
In your player you only need to add the link or the path (if local network) to the playlist section. There is no need for an EPG. As a matter of fact in TiviMate you will select VOD. If you have a VOD m3u that has both TV Series and Movies, then they will show up together and in their own sections.
Final thoughts
This came from my own disappointment in not having the images. It is a real pain to read the names of each. I do not always get a full “Picture” of what the movie is about, without a picture (pun intended). I am not a developer, as any real developer will see if they look at this code. I am very open to fixes and suggestions by someone that knows what they are doing. I have enough knowledge to be dangerous. I had java and c++ classes in college and mess around with it for projects like these but never enough to be any good at it.
Some issues I am aware of
I do not really have any error checking or logging in the script. I may try to put some in later and if I do, I will update the download files. Another issue I ran into was that I am searching TMDB by name, which with the m3u I was provided, sometimes has entries like 720p, etc. If I sent that Api call to TMDB it would not find it for obvious reasons. I could have used the ID for each, but that would require finding it first and since that is not part of the m3u, it would just mean another step. So as a workaround I am creating filters in the script to pull out some of that before sending to TMDB. Things like S01E09 or 720p, but as the m3u changes there will be things the filter is not counting for. However, as it is, I am getting really close to the full number of shows in the m3u.
The script takes about 30 seconds to complete on a total of 500 shows and 2 minutes and 30 seconds on an m3u of 2000 shows. This is including the time to rebuild the list. I have tested this on TiVi Mate and My IPTV Player and they both work great.
Hopefully this will you to be able to add poster images for Movies/TV Series in your m3u files.
Find more on https://notposted.com
is there a way to rewind or go forward ? all you can do is pause. and that sometimes doesnt work and the movie starts all over
I think this is dependent on the player app and or device you are playing it on. For example, when I use MyIPTV player on a windows computer there is no FF or RW functionality and I get the same results that you described. However, when I use an Nvidia Shield Pro or a Firestick and I pair that with the Premium version of TiviMate, I have FF, RW and Pause functionality that works perfectly.
So this works pretty well but I do have one issue. My VOD m3u file from my provider has 5,426 movies but when I run it through this script I come back with 1992 movies. Any ideas
Hi Alex. My guess is that the VOD m3u from your provider has some extra entries in the title section and when it searches TMDB it cannot find the correct movie. If you download your providers .m3u and open it with something like notepad ++ you might be able to see these entries. If there are repetitive ones, you could modify the script to remove those parts that are not part of the title. For example, the one I worked with was formated like “HD : StarWars ” in all of the entries as part of the title name, so I filtered that out with the script. Look in the section called “# if Movie filter title”. There is one for tv shows as well. In this section you would add 2 more lines for each entry, so the next would be t3 = and next line title3 =. Just follow what I have already done. Then when you have your last titlex replace what is in the parenthesis of the line below those that says search = movieobj.search(). Another possibility is there is no poster id for it. Let me know if you have any more questions.
Script is broken for TV shows. Only movies work 🙁
Hey James. Thanks for the heads up. There was an issue with how the script was handling blank spaces and I have modified it to address that. You can download the script again or if you copied it from the page, you could do that again as well. Please let me know if you have any more issues with this new version.
You’re awesome thank you! I’ll report back shortly
Works for Movies but still broken for TV shows
I downloaded the Linux and Windows versions, and both tested to work fine. Did you modify the variables section after downloading for the items like file path, etc? If you open the .m3u where the script saves it, does it have links to the TMDB url under the tv shows?
(On February 9, 2023) I have updated the script to address some missing movies/tv shows not being added to the final .m3u.
Any way to have this output each movie as an strm file to be used with Emby for example?
I can look into it if I get some free time, but this script should work fine for Emby as well. I know it does in Jellyfin and Plex. I have not tested in Emby.