Jump to content

python script to convert m3u file to strm files with emby folder structure (free)


t1m

Recommended Posts

afogleson

OK i have a weird question... because as this topic and my "tool" imply the real use of the tool is to create the streams and do some possible filtering of those channels. So i have that accomplished for TV series, and i am moving to Both movies (a little harder but not unduly i dont think) and Live tv.

My problem right now is live tv. and this may be a little selfish but i expect not totally. what I want to do is

1. filter the M3u with live tv to the point where i have a "filtered" m3u that only contains the channels i want. (ie i would like to be able to pull the full file say nightly, and run it through my showOptions tool to filter out channels i dont want) to do that i want to get - out of emby - all the channels i have mapped to guide data. so the question is...

Is there an easy way to export the list of channels mapped to guide data in some consumable format? it does not have to be m3u of course but it has to be mappable to the m3u that is imported to emby so I can identify that channel in the original m3u to filter out the other ones.

here is a very simple example with only a couple channels

#EXTM3U
#EXTINF:-1 tvg-id="5.star.max.eastern.us" tvg-name="5.star.max.eastern.us" tvg-type="live" group-title="US" tvg-logo="https://media.tv4.live/5.star.max.eastern.us.png",5 Star Max (East)
https://tv4.live/api/stream/myemail/myPassword/livetv.epg/5.star.max.eastern.us.m3u8
#EXTINF:-1 tvg-id="ae.us.eastern.us" tvg-name="ae.us.eastern.us" tvg-type="live" group-title="US" tvg-logo="https://media.tv4.live/ae.us.eastern.us.png",A&E (East) US
https://tv4.live/api/stream/myemail/myPassword/livetv.epg/ae.us.eastern.us.m3u8
#EXTINF:-1 tvg-id="abc.news.live.us" tvg-name="abc.news.live.us" tvg-type="live" group-title="US" tvg-logo="https://media.tv4.live/abc.news.live.us.png",ABC News Live
https://tv4.live/api/stream/myemail/myPassword/livetv.epg/abc.news.live.us.m3u8

and lets say i have mapped 5.star.max.eastern.us and ae.us.eastern.us to guide data but i have no desire (or in my case guide data) to see abc.news.live.us so I want to dynamically (nightly probably) create the m3u as below.

#EXTM3U
#EXTINF:-1 tvg-id="5.star.max.eastern.us" tvg-name="5.star.max.eastern.us" tvg-type="live" group-title="US" tvg-logo="https://media.tv4.live/5.star.max.eastern.us.png",5 Star Max (East)
https://tv4.live/api/stream/myemail/myPassword/livetv.epg/5.star.max.eastern.us.m3u8
#EXTINF:-1 tvg-id="ae.us.eastern.us" tvg-name="ae.us.eastern.us" tvg-type="live" group-title="US" tvg-logo="https://media.tv4.live/ae.us.eastern.us.png",A&E (East) US
https://tv4.live/api/stream/myemail/myPassword/livetv.epg/ae.us.eastern.us.m3u8

so i need to be able to export the channels i have already mapped (mostly because... well im lazy i dont want to manually click on a few hundred channels since i  already did all the work to map those.. i want to get rid of the ones i have NOT mapped

So can we see that data somewhere?

Link to comment
Share on other sites

afogleson

OK i found the data... just need to write a parser for that and then i can integrate it all.

for those who care (and i am on linux so i need to look where it is on say windows) I would suspect the same location as linux for mac. its in /var/lib/emby/config/livetv.xml 

Link to comment
Share on other sites

  • 3 weeks later...
outlaw69uk

I wish I knew how to make this work, downloaded everything, not a clue haha

If only there was a simple exe file that did it haha

Link to comment
Share on other sites

PackMan55

I've been using IPT since I started using this script in March and it's been fantastic  I'm now looking changing IPTV providers and the M3U files now look similar what @afogleson posted a couple weeks ago so the scrript no longer works. I've been trying to modify the m3u2strm.py file, but I've been unsuccessful as I am not great at programming

TV VOD example:

#EXTINF:-1 xui-id="6 digit number" tvg-name="Yellowstone S05E04" tvg-logo="https://image.tmdb.org/t/p/w1280/xrda67clIjyw4ERpy72uZ9DmVm0.jpg" group-title="Western",Yellowstone S05E04
http://my.url.address:NUMBER/play/filename#.mkv

Movie VOD example:

#EXTINF:-1 xui-id="6 digit number" tvg-name="Black Adam (2022)" tvg-logo="https://image.tmdb.org/t/p/w600_and_h900_bestv2/pFlaoHTZeyNkG83vxsAJiGzfSsa.jpg" group-title="New Releases",Black Adam (2022)
http://
my.url.address:NUMBER/play/filename#.mkv

Live TV:

#EXTINF:-1 xui-id="5 digit number" tvg-id="AnimalPlanet.ca" tvg-name="Animal Planet HD" tvg-logo="http://my.url.address:NUMBER/images/filename.png" group-title="CA | Documentaries",Animal Planet HD
http://my.url.address:NUMBER/play/filename-/ts

I don't need the Live TV channels and I can get an M3U file without them...and I like using Tivimate for the live TV.  For the On Demand I can get the Movies and series lumped in one file or I can keep them separate (if that helps anything)

Is there an easy way to get the script to work with my M3U file...or should I just look into Apollo? 

 

 

 

Link to comment
Share on other sites

afogleson
1 hour ago, PackMan55 said:

I've been using IPT since I started using this script in March and it's been fantastic  I'm now looking changing IPTV providers and the M3U files now look similar what @afogleson posted a couple weeks ago so the scrript no longer works. I've been trying to modify the m3u2strm.py file, but I've been unsuccessful as I am not great at programming

TV VOD example:

#EXTINF:-1 xui-id="6 digit number" tvg-name="Yellowstone S05E04" tvg-logo="https://image.tmdb.org/t/p/w1280/xrda67clIjyw4ERpy72uZ9DmVm0.jpg" group-title="Western",Yellowstone S05E04
http://my.url.address:NUMBER/play/filename#.mkv

Movie VOD example:

#EXTINF:-1 xui-id="6 digit number" tvg-name="Black Adam (2022)" tvg-logo="https://image.tmdb.org/t/p/w600_and_h900_bestv2/pFlaoHTZeyNkG83vxsAJiGzfSsa.jpg" group-title="New Releases",Black Adam (2022)
http://
my.url.address:NUMBER/play/filename#.mkv

Live TV:

#EXTINF:-1 xui-id="5 digit number" tvg-id="AnimalPlanet.ca" tvg-name="Animal Planet HD" tvg-logo="http://my.url.address:NUMBER/images/filename.png" group-title="CA | Documentaries",Animal Planet HD
http://my.url.address:NUMBER/play/filename-/ts

I don't need the Live TV channels and I can get an M3U file without them...and I like using Tivimate for the live TV.  For the On Demand I can get the Movies and series lumped in one file or I can keep them separate (if that helps anything)

Is there an easy way to get the script to work with my M3U file...or should I just look into Apollo? 

 

 

 

So are you just trying to get the VOD files (TV and Movie) to be in .strm format? I have not run the examples through my processor but they dont look "different" really other than some optional tags (xui-id for instance which even my program would need to deal with. I think i just need to put in a "unknown element" kind of thing)

Link to comment
Share on other sites

PackMan55
On 06/12/2022 at 17:07, afogleson said:

So are you just trying to get the VOD files (TV and Movie) to be in .strm format? I have not run the examples through my processor but they dont look "different" really other than some optional tags (xui-id for instance which even my program would need to deal with. I think i just need to put in a "unknown element" kind of thing)

Yeah if I can just get the VOD files into .strm format, I'll be set!

Link to comment
Share on other sites

afogleson
10 hours ago, ndejong5 said:

I am desperate to have my m3u converted .strm files. Is there a tutorial showing what to do?

So have you tried either of the 2 products that are in various places in the thread here. There is a python program and (mostly because i am much better with java and such than i am with python these days... a java one that is both a guy and command line driven (ie I literally use it nightly to export new movies and tv episodes from my provider. 

I am looking at some stuff for other providers since @PackMan55 gave some examples from his provider that are different than the one i have and that might cause a much "larger" refactor of my parser :)  not a bad thing but could take longer. 

so if you are using apollo as your IPTV provider then my java program works now to get the streams done. if you are not... and you can provide a snaitized example of your m3u (just globally replace user and password i dont need those) then i can take a look at whether your provider works (or just try my java one) 

 

 

 

Link to comment
Share on other sites

  • 1 month later...
ctyokley

So, not sure what happened or maybe i just left it off in some of my automation scripts, but is the CreateStreams working with live tv/ PPV events?...I could have sworn i had this working at one point in time ... but anywho...  

Asking because everytime i run a download m3u file now, it says it has "processed 0 entries in m3u". 

below is an example of my m3u file for PPV/NHL events
#EXTM3U
#EXTINF:-1 tvg-id="" tvg-name="NHL TV 01 | Montréal Canadiens vs Boston Bruins 07:00 PM" tvg-logo="" group-title="NHL",NHL TV 01 | Montréal Canadiens vs Boston Bruins 07:00 PM
#EXTGRP:NHL
https://someurl.com/blahblah/blahblahblah/channel1
#EXTINF:-1 tvg-id="" tvg-name="NHL TV 02 | Pittsburgh Penguins vs Florida Panthers 07:00 PM" tvg-logo="" group-title="NHL",NHL TV 02 | Pittsburgh Penguins vs Florida Panthers 07:00 PM
#EXTGRP:NHL
https://someurl.com/blahlbhablah/blahblahlbah/channel2
#EXTINF:-1 tvg-id="" tvg-name="NHL TV 03 | Philadelphia Flyers vs Los Angeles Kings 07:00 PM" tvg-logo="" group-title="NHL",NHL TV 03 | Philadelphia Flyers vs Los Angeles Kings 07:00 PM
#EXTGRP:NHL
https://someurl.com/blahblahblah/blahblahblah/channel3

It even does this for the VOD and TV OD section, but less concerned about these as i have those sections working with m3u2strm. 

Thoughts?

Link to comment
Share on other sites

afogleson
12 hours ago, ctyokley said:

So, not sure what happened or maybe i just left it off in some of my automation scripts, but is the CreateStreams working with live tv/ PPV events?...I could have sworn i had this working at one point in time ... but anywho...  

Asking because everytime i run a download m3u file now, it says it has "processed 0 entries in m3u". 

below is an example of my m3u file for PPV/NHL events
#EXTM3U
#EXTINF:-1 tvg-id="" tvg-name="NHL TV 01 | Montréal Canadiens vs Boston Bruins 07:00 PM" tvg-logo="" group-title="NHL",NHL TV 01 | Montréal Canadiens vs Boston Bruins 07:00 PM
#EXTGRP:NHL
https://someurl.com/blahblah/blahblahblah/channel1
#EXTINF:-1 tvg-id="" tvg-name="NHL TV 02 | Pittsburgh Penguins vs Florida Panthers 07:00 PM" tvg-logo="" group-title="NHL",NHL TV 02 | Pittsburgh Penguins vs Florida Panthers 07:00 PM
#EXTGRP:NHL
https://someurl.com/blahlbhablah/blahblahlbah/channel2
#EXTINF:-1 tvg-id="" tvg-name="NHL TV 03 | Philadelphia Flyers vs Los Angeles Kings 07:00 PM" tvg-logo="" group-title="NHL",NHL TV 03 | Philadelphia Flyers vs Los Angeles Kings 07:00 PM
#EXTGRP:NHL
https://someurl.com/blahblahblah/blahblahblah/channel3

It even does this for the VOD and TV OD section, but less concerned about these as i have those sections working with m3u2strm. 

Thoughts?

I thought i did this one... let me take a look tonight when i get home. i would (or should) have attached the version above but i dont see an attachment

Link to comment
Share on other sites

afogleson
On 1/25/2023 at 12:02 AM, ctyokley said:

So, not sure what happened or maybe i just left it off in some of my automation scripts, but is the CreateStreams working with live tv/ PPV events?...I could have sworn i had this working at one point in time ... but anywho...  

Asking because everytime i run a download m3u file now, it says it has "processed 0 entries in m3u". 

below is an example of my m3u file for PPV/NHL events
#EXTM3U
#EXTINF:-1 tvg-id="" tvg-name="NHL TV 01 | Montréal Canadiens vs Boston Bruins 07:00 PM" tvg-logo="" group-title="NHL",NHL TV 01 | Montréal Canadiens vs Boston Bruins 07:00 PM
#EXTGRP:NHL
https://someurl.com/blahblah/blahblahblah/channel1
#EXTINF:-1 tvg-id="" tvg-name="NHL TV 02 | Pittsburgh Penguins vs Florida Panthers 07:00 PM" tvg-logo="" group-title="NHL",NHL TV 02 | Pittsburgh Penguins vs Florida Panthers 07:00 PM
#EXTGRP:NHL
https://someurl.com/blahlbhablah/blahblahlbah/channel2
#EXTINF:-1 tvg-id="" tvg-name="NHL TV 03 | Philadelphia Flyers vs Los Angeles Kings 07:00 PM" tvg-logo="" group-title="NHL",NHL TV 03 | Philadelphia Flyers vs Los Angeles Kings 07:00 PM
#EXTGRP:NHL
https://someurl.com/blahblahblah/blahblahblah/channel3

It even does this for the VOD and TV OD section, but less concerned about these as i have those sections working with m3u2strm. 

Thoughts?

i was mistaken... this is in a format i have never seen if you can attach here (or email me afoglesonATgmail.com) some cleaned up example files (remove user and passowrd) I can have a look at generating a parser. this small example seems strange :) I think it wont be too hard... Ive been meaning to refactor the createstreams app to have a better parsing architecture. initially i did it just for me... but it has grown a little bit

  • Like 2
Link to comment
Share on other sites

requa3r0

I believe i have mentioned it before

This software does a perfect job converting a m3u to strm folders and files.

https://github.com/erdesigns-eu/M3U2STRM

I have made a script that cleans up a m3u for various imperfections before parsing it. Write me a pm if you would like the code.

Its written specifically to run in Termux on a android tv box, but could be quiclky be changed for any linux environments. It s jut a matter of chancing a few paths.

Just saying

Requa3r0

  • Like 2
Link to comment
Share on other sites

ctyokley
On 1/26/2023 at 5:28 PM, afogleson said:

i was mistaken... this is in a format i have never seen if you can attach here (or email me afoglesonATgmail.com) some cleaned up example files (remove user and passowrd) I can have a look at generating a parser. this small example seems strange :) I think it wont be too hard... Ive been meaning to refactor the createstreams app to have a better parsing architecture. initially i did it just for me... but it has grown a little bit

Hey! Sorry i'm just now getting back to you! I have attached the m3u i download daily specifically of NHL of IPT.. Let me know what you think... Like i said... i thought i had this working at one point. 

NHL.2023.01.31.m3u

Link to comment
Share on other sites

On 1/28/2023 at 2:51 PM, requa3r0 said:

I believe i have mentioned it before

This software does a perfect job converting a m3u to strm folders and files.

https://github.com/erdesigns-eu/M3U2STRM

I have made a script that cleans up a m3u for various imperfections before parsing it. Write me a pm if you would like the code.

Its written specifically to run in Termux on a android tv box, but could be quiclky be changed for any linux environments. It s jut a matter of chancing a few paths.

Just saying

Requa3r0

Can you help get your script to work with iptorrent m3u? Here is an example

 

#EXTM3U
#EXTINF:0 group-title="Movie VOD",HD : All My Puny Sorrows 2021
#EXTGRP:Movie VOD
https://domain.com/movie/username/password/10018823


 

Edited by navy12
Link to comment
Share on other sites

afogleson
19 hours ago, navy12 said:

Can you help get your script to work with iptorrent m3u? Here is an example

 

#EXTM3U
#EXTINF:0 group-title="Movie VOD",HD : All My Puny Sorrows 2021
#EXTGRP:Movie VOD
https://domain.com/movie/username/password/10018823


 

when i finish up the work on the java tool that was in the post just before yours... it will handle that its the same problem

Link to comment
Share on other sites

ctyokley
8 minutes ago, afogleson said:

when i finish up the work on the java tool that was in the post just before yours... it will handle that its the same problem

That it will :) it's from the same source. I wasn't going to say anything, but figured I'd reply now. Thanks again for your work on this!

Link to comment
Share on other sites

7 hours ago, afogleson said:

when i finish up the work on the java tool that was in the post just before yours... it will handle that its the same problem

You're awesome thank you!

7 hours ago, ctyokley said:

That it will :) it's from the same source. I wasn't going to say anything, but figured I'd reply now. Thanks again for your work on this!

I thought so but wasn't 100% sure :)

Link to comment
Share on other sites

  • 2 weeks later...
Anielarias
On 2/2/2023 at 12:04 PM, afogleson said:

when i finish up the work on the java tool that was in the post just before yours... it will handle that its the same problem

any update for this tool ?

Link to comment
Share on other sites

afogleson
21 hours ago, Anielarias said:

any update for this tool ?

Yeah, sorry got bound up in some personal issues so im looking at it today

Link to comment
Share on other sites

afogleson
1 hour ago, afogleson said:

Yeah, sorry got bound up in some personal issues so im looking at it today

Ok this seems to work... it might not work for all cases and it is quite hacky. I really need to handle the parser better. I just have not gotten to it yet.

CreateStreams-1.0.zip

Link to comment
Share on other sites

  • 4 weeks later...
Przemek

Hi, @afoglesonCan I use Your script if I have VOD library from my IPTV provider? My links to movies/series looks like that:
`http://iptv.....it:80/movie/username/password/32187.mkv`

Regards.

Link to comment
Share on other sites

afogleson
2 hours ago, Przemek said:

Hi, @afoglesonCan I use Your script if I have VOD library from my IPTV provider? My links to movies/series looks like that:
`http://iptv.....it:80/movie/username/password/32187.mkv`

Regards.

It should work. really its more about the format of the M3U file but it should work now. i think i am handling all the "normal" stuff. if you try it and it does not create the strm files. just attach a santized version of an M3U file and i can have a look at it

Link to comment
Share on other sites

Przemek
15 minutes ago, afogleson said:

It should work. really its more about the format of the M3U file but it should work now. i think i am handling all the "normal" stuff. if you try it and it does not create the strm files. just attach a santized version of an M3U file and i can have a look at it

Thanks for fast answer. Can You tell me how to start with that because I don't understand how can I convert my vod library?

Link to comment
Share on other sites

afogleson
11 minutes ago, Przemek said:

Thanks for fast answer. Can You tell me how to start with that because I don't understand how can I convert my vod library?

The easiest initial way is to just run the tool. it will pop up a gui to use.

you can point that to either a url to the M3u or a physical file. that file can either be an M3U or a list of urls. if the latter it looks like so

#urls
https://tvnow.best/api/list/USERNAME/pASSWORD/m3u8/tvshows/1
https://tvnow.best/api/list/USERNAME/pASSWORD/m3u8/tvshows/2

and you can have as many urls as you want to M3U files in it.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...