Jump to content

Plugin: Export VODS from .m3u - split m3u livetv, tvshows, movies (Going BETA!!)


Recommended Posts

mickle026
Posted

Ok so the main thing seems to be URL validation and extra elements in the m3u that some people have.

@gillmacca01 has sent me some data that will help me figure out what is different from my m3u (which this works fine with) than some other users.

I'm out at at a 80th birthday right now so won't get back on this till tomorrow, I have already simplified the URL check so that is working in my dev machine, and I have figured out the first stumbling block in @gillmacca01's file, so it shouldn't be too long before I can offer a solution that might work for many more people.

Please let me know what I ask for when I do, I am not interested in stealing anything from anyone, just only interested in making this work for whoever would like to use it.

  • Like 1
  • Thanks 1
BigIrn
Posted

1. Please delete the DLL we aren't supposed to be using from the first post.

2. I can DM you my m3u if it helps.

3. Trying this on my mac mini m4 here is my log:

01.Mar.2025 - 17:55:41 -----------------------------------------------------------------------
01.Mar.2025 - 17:55:41 Create Movie Stream Files From M3U Scheduled Task Triggered.
01.Mar.2025 - 17:55:41 -----------------------------------------------------------------------
01.Mar.2025 - 17:55:41 Input File 1: /Volumes/T9/media/VOD/tv_channels_b3e6755ebfe2.m3u
01.Mar.2025 - 17:55:41 -----------------------------------------------------------------------
01.Mar.2025 - 17:55:41 Create Movie Stream Files From M3U Scheduled Task Triggered.
01.Mar.2025 - 17:55:41 -----------------------------------------------------------------------
01.Mar.2025 - 17:55:41 Input File 1: /Volumes/T9/media/VOD/tv_channels_b3e6755ebfe2.m3u
01.Mar.2025 - 17:55:41 -----------------------[ Scanning Current Folders ]----------------------------
01.Mar.2025 - 17:55:41 directoryCount: Found 0 Folders in Output path.
01.Mar.2025 - 17:55:41 directoryCount: Found 0 Folders in Output path.
01.Mar.2025 - 17:55:41 ----------------------[ Reading M3U File Contents ]----------------------------
01.Mar.2025 - 17:55:41 ----------------------[ Reading M3U File Contents ]----------------------------
01.Mar.2025 - 17:55:41 --------------------------------------------------------------------------------
01.Mar.2025 - 17:55:41 Checking to see if input path is an URL.
01.Mar.2025 - 17:55:41 Checking to see if input path is an URL.
01.Mar.2025 - 17:55:42 Valid URI schema check failed. Reading as a Local File.
01.Mar.2025 - 17:55:42 Reading input file.....
01.Mar.2025 - 17:55:42 Valid URI schema check failed. Reading as a Local File.
01.Mar.2025 - 17:55:42 Reading input file.....
01.Mar.2025 - 17:55:42 Saved '/Volumes/T9/media/M3UFiles/LiveTV/LiveTV.m3u'
01.Mar.2025 - 17:55:42 Saved '/Volumes/T9/media/M3UFiles/LiveTV/LiveTV.m3u'
01.Mar.2025 - 17:55:42 Saved '/Volumes/T9/media/M3UFiles/Movies/Movies.m3u'
01.Mar.2025 - 17:55:42 Saved '/Volumes/T9/media/M3UFiles/Movies/Movies.m3u'
01.Mar.2025 - 17:55:42 Saved '/Volumes/T9/media/M3UFiles/TV Shows/TV Shows.m3u'
01.Mar.2025 - 17:55:42 Saved '/Volumes/T9/media/M3UFiles/TV Shows/TV Shows.m3u'
01.Mar.2025 - 17:55:42 DEBUG: Returned contentsList
01.Mar.2025 - 17:55:42 DEBUG: Returned contentsList
01.Mar.2025 - 17:55:42 The output directory is empty.
01.Mar.2025 - 17:55:42 The output directory is empty.
01.Mar.2025 - 17:55:42 -----------------------[ Updating Output Folder ]-------------------------------
01.Mar.2025 - 17:55:42 -----------------------[ Updating Output Folder ]-------------------------------
01.Mar.2025 - 17:55:42 --------------------------------------------------------------------------------
01.Mar.2025 - 17:55:42 --------------------------------------------------------------------------------
01.Mar.2025 - 17:55:42 Finished this import.
01.Mar.2025 - 17:55:42 Finished this import.
01.Mar.2025 - 17:55:42 No Input File 2
01.Mar.2025 - 17:55:42 No Input File 3
01.Mar.2025 - 17:55:42 No Input File 3

ScheduledTask-[M3UToStrm]01.Mar.2025 - 17.55.41.txt

BigIrn
Posted

Ok so on Win11 I get this:

01.Mar.2025 - 17:32:14 Create Movie Stream Files From M3U Scheduled Task Triggered.
01.Mar.2025 - 17:32:14 -----------------------------------------------------------------------
01.Mar.2025 - 17:32:14 Input File 1: C:\VOD\tv_channels_b3e6755ebfe2.m3u
01.Mar.2025 - 17:32:14 -----------------------[ Scanning Current Folders ]----------------------------
01.Mar.2025 - 17:32:14 directoryCount: Found 1 Folders in Output path.
01.Mar.2025 - 17:32:14 -------------------------------------------------------------------------
01.Mar.2025 - 17:32:14 ----------------------[ Reading M3U File Contents ]----------------------------
01.Mar.2025 - 17:32:14 --------------------------------------------------------------------------------
01.Mar.2025 - 17:32:14 Checking to see if input path is an URL.
01.Mar.2025 - 17:32:16 Valid URI schema check failed. Reading as a Local File.
01.Mar.2025 - 17:32:16 Reading input file.....
01.Mar.2025 - 17:32:16 Saved 'C:\VOD\m3u\LiveTV\LiveTV.m3u'
01.Mar.2025 - 17:32:16 Saved 'C:\VOD\m3u\Movies\Movies.m3u'
01.Mar.2025 - 17:32:16 Saved 'C:\VOD\m3u\TV Shows\TV Shows.m3u'
01.Mar.2025 - 17:32:16 DEBUG: Returned contentsList
01.Mar.2025 - 17:32:16 The output directory is empty.
01.Mar.2025 - 17:32:16 -----------------------[ Updating Output Folder ]-------------------------------
01.Mar.2025 - 17:32:16 --------------------------------------------------------------------------------
01.Mar.2025 - 17:32:16 Finished this import.
01.Mar.2025 - 17:32:16 No Input File 2
01.Mar.2025 - 17:32:16 No Input File 3
01.Mar.2025 - 17:32:16 Valid URI schema check failed. Reading as a Local File.
01.Mar.2025 - 17:32:16 Reading input file.....
01.Mar.2025 - 17:32:17 Saved 'C:\VOD\m3u\LiveTV\LiveTV.m3u'
01.Mar.2025 - 17:32:17 Saved 'C:\VOD\m3u\Movies\Movies.m3u'
01.Mar.2025 - 17:32:17 Saved 'C:\VOD\m3u\TV Shows\TV Shows.m3u'
01.Mar.2025 - 17:32:17 DEBUG: Returned contentsList
01.Mar.2025 - 17:32:17 The output directory is empty.
01.Mar.2025 - 17:32:17 -----------------------[ Updating Output Folder ]-------------------------------
01.Mar.2025 - 17:32:17 --------------------------------------------------------------------------------
01.Mar.2025 - 17:32:17 Finished this import.
01.Mar.2025 - 17:32:17 No Input File 2

 

ScheduledTask-[M3UToStrm]01.Mar.2025 - 17.43.12.txt

BigIrn
Posted (edited)

I just noticed the raw m3u file is 116.7 mb that your plugin is using both local and url. The one I load into emby is only like 500 kb with just the US channels. Could that be a problem?

Edited by BigIrn
irPhunky
Posted

Sounds like a great plugin, I’ve not given it a try yet but I’ve built similar tools externally from Emby to do just this and found @iptv/playlist to be a great parser for m3u’s.

It may come in handy for you if you’re rolling your own parser at the moment.

mickle026
Posted
2 hours ago, irPhunky said:

Sounds like a great plugin, I’ve not given it a try yet but I’ve built similar tools externally from Emby to do just this and found @iptv/playlist to be a great parser for m3u’s.

It may come in handy for you if you’re rolling your own parser at the moment.

I can parse the m3u, thats not the problem, the problem is detecting what is a VOD and what isn't.  My own m3u files are easy, but some others don't seem to be made to work this way but made more for grouping as lists in a dedicated iptv player.

 

I posted an updated dll today, it has resolved a few problems.  There is still more to do.
 

gillmacca01
Posted

No change with latest dll

2 logs attached - 

URL is using the URL of the M3U file

downloaded is using a downloaded copy of the M3U fileURL.txtURL.txt

downloaded.txt

gillmacca01
Posted

Hold on, may have something here. Just tried it on my window laptop and it looks like it may be working. 

I can see it doing extra stuff in the logs, but not seeing it create the output folders. Let me investigate my end first

gillmacca01
Posted (edited)

I will send you a copy of the log (contains username/password so dont want to post here), it looks like it is working, but the split m3u files are still empty and the strm path is empty as well - this is run from my windows laptop.

If i delete the output folders, and run it again, no output folders are created. Do I need to wait for it to fully run before I see the folders and strm's?

 

Still don't understand why it looks like it may be working in windows, but on my QNAP it's not, but let's see if we can get it working on windows first, and then look at QNAP later

Edited by gillmacca01
gillmacca01
Posted (edited)

I have resolved why it was doing nothing on my QNAP.  It didn't like the path i was using. Changed it is processing the VOD's in the log

Still not creating output folders though

 

I have manually created the output folders, and restarted Emby and ran the plugin, but the folders are not populating, although it looks like it says they are, in the log

Edited by gillmacca01
gillmacca01
Posted

Update: the folders are slowly starting to populate 

mickle026
Posted (edited)

OK, i will explain the order which the plugin does things and why

1.  It reads the output folder and builds a list of what is there (nothing if its a first run)
2.  It reads the m3u file and creates a "class" list of items - class is a programming method that can hold many items, so it holds the tvg- id title etc, the url to the logo and the url to the media file etc.  Here it is decided whether the item is live-tv, movie or TV Show, using whatever it can detect in group-title and moviename/channelname. (the VOD inclusion words)
group-title="CHRISTMAS",EN| CHRISTMAS 1 4K
Currently I am removing the pipe in EN| , because it is an integral part of the next regex query in my code., so this would need to appear as "EN CHRISTMAS" in the inclusion words.  The pipe is basically an "or" in regex.  So the inputbox for inclusion words is either using the | directly or I replace commas with a pipe internally.  I will make this clearer in later builds.

The pipe is an array seperator in the regex query Regex.IsMatch(groupTitle, $@"^[\[\(]?vod|video on demand|movie|film|video|apple+ tv|netflix", RegexOptions.IgnoreCase)

3.  It checks the output directory for items that are no longer valid & removes them if the option is set.
4.  It creates the output directory files, folders and strm files (this might take a while)
5.  It creates the split m3u  files with the data it has

One thing to remember is that anything it doesn't detect as a movie or tv VOD will be output to the live tv m3u of the split m3u files.

It outputs everything at the moment, I have not built in an "ignore" option yet.

It does it in this order (and this way) so that it can keep the output folder up to date, and can remove obsolete items.

 

Remember this is created from my own app because I answered a forum post and said I already do that for my VODs, little did I know there are so many variants of m3u files or such huge sizes of m3u!
I will update this to whatever is needed though, it seems that it would be useful to many :) 

 

* I forgot to mention that the 3 input files (if you use them) all add to the class list, so make 1 list internally.  It'll behave as if its all one.

Edited by mickle026
  • Thanks 1
gillmacca01
Posted (edited)

Just so I understand correctly, under inclusive words, if I put |EN| LATEST RELEASES (as the group is named), this will not work. I have to put EN LATEST RELEASES and only that group will be downloaded 

Am I correct here?

Edited by gillmacca01
mickle026
Posted (edited)

 

Yes

Otherwise the regex as it is currently programmed will include EN as an inclusion word separately, you will have 2 "EN" and "LATEST RELEASES", so my code currently detects and removes Pipes (effectively deletes it) from the group title or channel/moviename.

I'll have to figure out how to added them as a letter in the regex query, so they can be used in the inputbox, but for now this is how it works.

 

10 minutes ago, gillmacca01 said:

and only that group will be downloaded 

l am not sure if there is confusion here, it is all downloaded and processed.  The inlcusion part is what separates the vod from the live tv

 

 

Edited by mickle026
  • Thanks 1
gillmacca01
Posted
11 minutes ago, mickle026 said:

 

Yes

Otherwise the regex as it is currently programmed will include EN as an inclusion word separately, you will have 2 "EN" and "LATEST RELEASES", so my code currently detects and removes Pipes (effectively deletes it) from the group title or channel/moviename.

I'll have to figure out how to added them as a letter in the regex query, so they can be used in the inputbox, but for now this is how it works.

 

l am not sure if there is confusion here, it is all downloaded and processed.  The inlcusion part is what separates the vod from the live tv

 

 

Thanks for the confirmation. Confusion on my part. I thought if I added it the inclusion, it would only download and process latest releases.

So I will have to go into Emby afterwards and just add the folders I want to see...i can work with that

mickle026
Posted

I will add an ignore field eventually, so that those entries are not processed and files/folders are not created.

Such that you could add for example

"NL MOVIES" or "FR SHOWS" etc

and entries in the m3u with that this wouldn't get processed at all.  That would allow you for example to slim down your m3u to just what you want to have in it.

This way it would increase speed dramatically with m3u files that are rather big in size.

Output could then go for example from a 100+mb to a few 100kb

 

That's the aim..

  • Like 2
mickle026
Posted (edited)

 

 

image.jpeg.c28c49a1f836e6dae25eec5327fc6234.jpeg

Here is the latest build.  This is not in post 1 yet.

It now has ignore capability, and reverts away from Regex for the include words, so it takes the | pipe as part of the word (and needs it)

I think this way may be more suitable for everyone.

 

Let me know how it is functioning..

 


 

Edited by mickle026
gillmacca01
Posted (edited)

Latest build is missing the ignore part

Plus still cannot download via URL

Will the ignore part allow wildcards, example If I want to ignore |DE| Films & |DE| Series, etc, could I enter |DE|*?

Edited by gillmacca01
mickle026
Posted (edited)

Try this one, it is downloading from an URL for me. 
The ignore is working, clear you internet cache files if you cannot see it (win 11 and edge is really weird for me)
Task triggered 2nd time by Emby internally is cancelled (Gawd knows why Emby is triggering it again exactly 20 seconds after the first one, I have come across this before but Luke just said no it doesn't, but yes it does!)

 

VODtoSTRMscheduledTask.dll

Edited by mickle026
mickle026
Posted (edited)
2 hours ago, gillmacca01 said:

Will the ignore part allow wildcards, example If I want to ignore |DE| Films & |DE| Series, etc, could I enter |DE|*?

I will have to look into how to do that, since i moved away from regex to allow the pipe | ,  .net string comparer does not support wildcards.  That means moving back to regex ...

Just so you know, currently the Ignore is an if string contains |DE| then it is ignored, so will ignore all |DE|
So I probably also need a don't ignore, so you can ignore all |DE|, but allow |DE| * Sports 

Edited by mickle026
BigIrn
Posted

Thanks! I can send my m3u so you can see if the format is interpreted by your code or how I can change my strings. I don’t really care if you need to use it for testing, I really appreciate your work!

How long should the code run for on average? I’m always afraid I’m locking the log file and interrupting the job  

mickle026
Posted (edited)
16 minutes ago, BigIrn said:

Thanks! I can send my m3u so you can see if the format is interpreted by your code or how I can change my strings. I don’t really care if you need to use it for testing, I really appreciate your work!

How long should the code run for on average? I’m always afraid I’m locking the log file and interrupting the job  

How long it runs for highly depends on how big the input file(s) are.

The last one I ran for a 135mb input file took 12 minutes before it started outputting folders and files.  From then it depends on the files system, the folder and file creation can go on for a long time..  The input file was huge though,=.
It takes only 4 or 5 mins for input files about 1megabyte.


If you use the last posted version in this thread rather than the first post dll, you will have the newest with the ignore and include for VOD detection text boxes.

Its up to you if you want to send your m3u, if you do then send it via dm, rather than posting it here.

Edited by mickle026
mickle026
Posted (edited)
23 minutes ago, BigIrn said:

 

Quote

Valid URI schema check failed.  Reading as a Local File.

That must be the dll in post 1 rather than the last one in this thread because I removed the valid uri schema check a couple of builds back, so that comment will not be written by the latest build.  In these logs it is also triggered twice, the latest build wont let that happen. (something going on either with browsers or Emby)
I have now updated the build in post 1.

03.Mar.2025 - 01:15:41 CreateMovieStrmsFromM3UTaskStarter method triggered.
03.Mar.2025 - 01:15:41 Inside Task.Run.
03.Mar.2025 - 01:15:41 -----------------------------------------------------------------------
03.Mar.2025 - 01:15:41 Create Movie Stream Files From M3U Scheduled Task Triggered.
03.Mar.2025 - 01:15:41 -----------------------------------------------------------------------
03.Mar.2025 - 01:15:41 Input File 1: E:\tv_channels_1e2c0f5699_plus.m3u
03.Mar.2025 - 01:15:41 -----------------------[ Scanning Current Folders ]----------------------------
03.Mar.2025 - 01:15:41 ----------------------[ Reading M3U File Contents ]----------------------------
03.Mar.2025 - 01:15:41 --------------------------------------------------------------------------------
03.Mar.2025 - 01:15:41 Checking to see if input path is an URL.
03.Mar.2025 - 01:15:42 Attempting to read input file from local.....
03.Mar.2025 - 01:15:42 Valid m3u linecount: 976818
03.Mar.2025 - 01:15:42 Processing [1]..Item Name: 4K ..... 

 

 

03.Mar.2025 - 03:38:21 CreateMovieStrmsFromM3UTaskStarter method triggered.
03.Mar.2025 - 03:38:21 Inside Task.Run.
03.Mar.2025 - 03:38:21 -----------------------------------------------------------------------
03.Mar.2025 - 03:38:21 Create Movie Stream Files From M3U Scheduled Task Triggered.
03.Mar.2025 - 03:38:21 -----------------------------------------------------------------------
03.Mar.2025 - 03:38:21 Input File 1: http://somesite.com/tv_channels_1e2c0f5699_plus.m3u
03.Mar.2025 - 03:38:21 -----------------------[ Scanning Current Folders ]----------------------------
03.Mar.2025 - 03:38:21 ----------------------[ Reading M3U File Contents ]----------------------------
03.Mar.2025 - 03:38:21 --------------------------------------------------------------------------------
03.Mar.2025 - 03:38:21 Checking to see if input path is an URL.
03.Mar.2025 - 03:38:27 Downloading input file... 5% completed.
03.Mar.2025 - 03:38:32 Downloading input file... 10% completed.
03.Mar.2025 - 03:38:37 Downloading input file... 15% completed.
03.Mar.2025 - 03:38:42 Downloading input file... 20% completed.
03.Mar.2025 - 03:38:47 Downloading input file... 25% completed.

 

Edited by mickle026

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