Jump to content

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


t1m

Recommended Posts

  • 3 weeks later...
Thefalfr
On 8/30/2023 at 9:05 PM, Thefalfr said:

Is it possible to match by also using part of a group-title and not only tvg-type?

Is it possible?

Link to comment
Share on other sites

hooray4me
On 10/16/2023 at 1:02 AM, Thefalfr said:

Is it possible?

What is the use case for matching on group-title and tvg-type?

Link to comment
Share on other sites

  • 2 months later...
Thefalfr
On 10/19/2023 at 7:25 PM, hooray4me said:

What is the use case for matching on group-title and tvg-type?

My provider use group-title to filter movies vs tv-shows (series). Movies is picked up now but not series (tv-shows)

Movies:

#EXTINF:-1 tvg-id="" tvg-name="438 Days [PRE] [2019]" tvg-logo="http://XX.ZZ:2095/images/movies//f3gYSg0tCXQ6LGDlz002f2O1bBa.jpg" group-title="VOD: Old Popular Movies [Multi-Sub]",438 Days [PRE] [2019]
http://XX.ZZ:80/movie/eFXYy/eu47Y/49588.mkv

 

TV-Shows: (Has Series: in te beginning of group-title)

#EXTINF:-1 tvg-id="" tvg-name="The.Blacklist ar S06 The.Blacklist - S06E17" tvg-logo="http://XX.ZZ:2095/images/series/htJzeRcYI2ewMm4PTrg98UMXShe.jpg" group-title="Series: English [Arabic-Sub]",The.Blacklist ar S06 The.Blacklist - S06E17
http://XX.ZZ:80/series/eFXYy/eu47Y/137589.mp4

 

Link to comment
Share on other sites

bryan3301

I have the Docker container (https://hub.docker.com/r/hooray4rob/ustreamgen) configured and running; however, I am not seeing any results. I am hoping someone can provide some advice. Here is what I am trying to accomplish.

  • My IPTV provider provides one M3U tile and one EPG file. This file contains Live TV, VOD shows, and Movies.
  • I am running an Emby server, and right now, everything shows under Live TV. My goal is to create a custom M3U file for Live TV only, then have a M3U to STRM solution parse the original file and make STRM files for the VODs and Movies. This way, the Emby interface is much cleaner and organized.
  • I would like the M3U file processed at least once per day to keep current.
  • My M3U files are as follows:

Live TV Channels:

#EXTINF:-1,USA A&E UHD
http://xxxxxxxxxx.xx:80/xxxxx/xxxxx/175784.ts
#EXTINF:-1,USA AccuWeather
http://xxxxxxxxxx.xx:80/xxxxx/xxxxx/175785.ts

VODs - Notice the "series" in the URL:

#EXTINF:-1,Four More Shots Please S02E04
http://xxxxxxxxxx.xx:80/series/xxxxx/xxxxx/918853.mp4
#EXTINF:-1,Four More Shots Please S02E05
http://xxxxxxxxxx.xx:80/series/xxxxx/xxxxx/2166705.mp4

Movies - Notice "movie" in the URL:

#EXTINF:-1,Changing the Game (2019)
http://xxxxxxxxxx.xx:80/movie/xxxxx/xxxxx/2720918.mp4
#EXTINF:-1,2 Days in New York (2012)
http://xxxxxxxxxx.xx:80/movie/xxxxx/xxxxx/2720920.mp4

Any help would be MUCH appreciated. I am open to using this script, the Docker container above, or another solution.

Edited by bryan3301
Link to comment
Share on other sites

bryan3301

I have not made any progress and am hoping someone much smarter than I with scripting (Python) and M3U/IPTV can help me out. Thank you so much in advance!

 

On 12/31/2023 at 8:52 AM, Thefalfr said:

My provider use group-title to filter movies vs tv-shows (series). Movies is picked up now but not series (tv-shows)

Movies:

#EXTINF:-1 tvg-id="" tvg-name="438 Days [PRE] [2019]" tvg-logo="http://XX.ZZ:2095/images/movies//f3gYSg0tCXQ6LGDlz002f2O1bBa.jpg" group-title="VOD: Old Popular Movies [Multi-Sub]",438 Days [PRE] [2019]
http://XX.ZZ:80/movie/eFXYy/eu47Y/49588.mkv

 

TV-Shows: (Has Series: in te beginning of group-title)

#EXTINF:-1 tvg-id="" tvg-name="The.Blacklist ar S06 The.Blacklist - S06E17" tvg-logo="http://XX.ZZ:2095/images/series/htJzeRcYI2ewMm4PTrg98UMXShe.jpg" group-title="Series: English [Arabic-Sub]",The.Blacklist ar S06 The.Blacklist - S06E17
http://XX.ZZ:80/series/eFXYy/eu47Y/137589.mp4

 

 

Link to comment
Share on other sites

fbrassin
On 9/28/2023 at 4:11 AM, hooray4me said:

I've tried this but when i give docker-compose up i have this error:

 ✔ Container ustreamgen  Created                                                                                                                                                               0.0s
Attaching to ustreamgen
ustreamgen  | /bin/bash: /root/initialize_cron.sh: Permission denied
ustreamgen exited with code 126
 

What could i try to do?

Tnx

 

Link to comment
Share on other sites

  • 2 weeks later...
hooray4me
On 1/13/2024 at 1:36 AM, fbrassin said:

I've tried this but when i give docker-compose up i have this error:

 ✔ Container ustreamgen  Created                                                                                                                                                               0.0s
Attaching to ustreamgen
ustreamgen  | /bin/bash: /root/initialize_cron.sh: Permission denied
ustreamgen exited with code 126
 

What could i try to do?

Tnx

 

set the UID and GID to a real user with the correct permissions. If you are running with the first created user, this will usually be UID=1000 and GID= 1000

  • Like 1
Link to comment
Share on other sites

  • 1 month later...

Support for tvg-url and url-tvg is in Emby Server 4.8.3+:

 

Link to comment
Share on other sites

  • 1 month later...
Rom1toul1

Hello,

I tried to start hooray4rob/ustreamgen

But it does not work. There is the log : 

hooray4rob-ustreamgen-1

date stream content
2024/04/15 16:17:22 stdout no crontab for root
2024/04/15 16:17:22 stdout IndexError: list index out of range
2024/04/15 16:17:22 stdout     gid = sys.argv[10]
2024/04/15 16:17:22 stdout   File "main.py", line 27, in <module>
2024/04/15 16:17:22 stdout Traceback (most recent call last):

 

I am lost. I don't know where the problem come from... Can someone help me?

 

Thanks you,

Link to comment
Share on other sites

hooray4me
11 minutes ago, Rom1toul1 said:

Hello,

I tried to start hooray4rob/ustreamgen

But it does not work. There is the log : 

hooray4rob-ustreamgen-1

date stream content
2024/04/15 16:17:22 stdout no crontab for root
2024/04/15 16:17:22 stdout IndexError: list index out of range
2024/04/15 16:17:22 stdout     gid = sys.argv[10]
2024/04/15 16:17:22 stdout   File "main.py", line 27, in <module>
2024/04/15 16:17:22 stdout Traceback (most recent call last):

 

I am lost. I don't know where the problem come from... Can someone help me?

 

Thanks you,

Can you provide a sanitized version of your docker-compose.yaml file?

also try this version
ghcr.io/hooray4me/ustreamgen:v1.37 

Link to comment
Share on other sites

Rom1toul1

Thank you,

 

I use Docker for Synology and I don't know where can I find docker-compose.yaml

Can you help me?

Link to comment
Share on other sites

Webdoc

Hello, trying out your docker v1.42 latest and I am getting the following

version: "3"
services:
  streamgen:
    image: ghcr.io/hooray4me/ustreamgen:latest
    container_name: ustreamgen
    command: /root/initialize_cron.sh
    env_file: .env
    volumes:
      - /data-pool/usenet-automation/config/ustreamgen/tv:/tv
      - /data-pool/usenet-automation/config/ustreamgen/movies:/movies
      - ./logs:/logs
    restart: unless-stopped

TZ=Europe/London #Optional timezone.
PUID=0 #Optional UserID of the account that will run the service
PGID=0 #Optional GroupID of the account that will run the service
UID=0 #Optional UserID for file permissions. Default: 1000
GID=0 #Optional GroupID for file permissions. Default: 1000
UNAME=root #Optional name of UID. If used MUST match id of UID. Default: root
GROUP=users #Optional name of GID. If used MUST match id of GID. Default: root
SINGLELIST=false #A single list is used for all movies, tv shows and events. Default: false
SINGLELISTURL=http://*************/get.php?username=**********&password=**********&type=m3u_plus&output=ts/movies #Full M3U Provider URL for all content in one list **SINGLELIST must be true
CRONHOUR=0 #0-23 # sets the hour of the day the script will run again for all content in 1 list **SINGLELIST must be true
CRONMINUTE=10 #0-59 # sets the minute of the day the script will run again for all content 1 list **SINGLELIST must be true
MOVIES=true #A seperate list is used for movies. Default: false
MOVIEURL=http://*************/get.php?username=**********&password=**********&type=m3u_plus&output=ts/movies #Full M3U Provider URL for Movies **MOVIES must be true
MOVIECRONHOUR=0 #0-23 # sets the hour of the day the script will run again for movies **MOVIES must be true
MOVIECRONMINUTE=20 #0-59 # sets the minute of the day the script will run again for movies **MOVIES must be true
TVSHOWS=true #A seperate list is used for tv shows. Default: true
TVSHOWURL=http://*************/get.php?username=**********&password=**********&type=m3u_plus&output=ts/tvshows/ # Full M3U Provider URL for TV Shows **TVSHOWS must be true
TVCRONHOUR=0 #0-23 # sets the hour of the day the script will run again for tv shows **TVSHOWS must be true
TVCRONMINUTE=10 #0-59 # sets the minute of the day the script will run again for tv shows **TVSHOWS must be true
EVENTS=false #A seperate list is used for events. Default: false
EVENTURL=http://*************/get.php?username=**********&password=**********&type=m3u_plus&output=ts/events/ #Full M3U Provider URL for Events **EVENTS must be true
EVENTCRONHOUR=0 #0-23 # sets the hour of the day the script will run again for events **EVENTS must be true
EVENTCRONMINUTE=30 #0-59 # sets the minute of the day the script will run again for events **EVENTS must be true
APOLLO=false #Optional change to true if your Provider is Apollo. Default: false

WARN[0000] /data-pool/usenet-automation/config/ustreamgen/compose.yml: `version` is obsolete  
[+] Running 1/0
✔ Container ustreamgen  Running

But no strm files I have pointed to new tv&movies folders, but they are empty, where am I going wrong?

Thanks

Link to comment
Share on other sites

hooray4me
On 4/16/2024 at 11:34 AM, Webdoc said:

Hello, trying out your docker v1.42 latest and I am getting the following

version: "3"
services:
  streamgen:
    image: ghcr.io/hooray4me/ustreamgen:latest
    container_name: ustreamgen
    command: /root/initialize_cron.sh
    env_file: .env
    volumes:
      - /data-pool/usenet-automation/config/ustreamgen/tv:/tv
      - /data-pool/usenet-automation/config/ustreamgen/movies:/movies
      - ./logs:/logs
    restart: unless-stopped

TZ=Europe/London #Optional timezone.
PUID=0 #Optional UserID of the account that will run the service
PGID=0 #Optional GroupID of the account that will run the service
UID=0 #Optional UserID for file permissions. Default: 1000
GID=0 #Optional GroupID for file permissions. Default: 1000
UNAME=root #Optional name of UID. If used MUST match id of UID. Default: root
GROUP=users #Optional name of GID. If used MUST match id of GID. Default: root
SINGLELIST=false #A single list is used for all movies, tv shows and events. Default: false
SINGLELISTURL=http://*************/get.php?username=**********&password=**********&type=m3u_plus&output=ts/movies #Full M3U Provider URL for all content in one list **SINGLELIST must be true
CRONHOUR=0 #0-23 # sets the hour of the day the script will run again for all content in 1 list **SINGLELIST must be true
CRONMINUTE=10 #0-59 # sets the minute of the day the script will run again for all content 1 list **SINGLELIST must be true
MOVIES=true #A seperate list is used for movies. Default: false
MOVIEURL=http://*************/get.php?username=**********&password=**********&type=m3u_plus&output=ts/movies #Full M3U Provider URL for Movies **MOVIES must be true
MOVIECRONHOUR=0 #0-23 # sets the hour of the day the script will run again for movies **MOVIES must be true
MOVIECRONMINUTE=20 #0-59 # sets the minute of the day the script will run again for movies **MOVIES must be true
TVSHOWS=true #A seperate list is used for tv shows. Default: true
TVSHOWURL=http://*************/get.php?username=**********&password=**********&type=m3u_plus&output=ts/tvshows/ # Full M3U Provider URL for TV Shows **TVSHOWS must be true
TVCRONHOUR=0 #0-23 # sets the hour of the day the script will run again for tv shows **TVSHOWS must be true
TVCRONMINUTE=10 #0-59 # sets the minute of the day the script will run again for tv shows **TVSHOWS must be true
EVENTS=false #A seperate list is used for events. Default: false
EVENTURL=http://*************/get.php?username=**********&password=**********&type=m3u_plus&output=ts/events/ #Full M3U Provider URL for Events **EVENTS must be true
EVENTCRONHOUR=0 #0-23 # sets the hour of the day the script will run again for events **EVENTS must be true
EVENTCRONMINUTE=30 #0-59 # sets the minute of the day the script will run again for events **EVENTS must be true
APOLLO=false #Optional change to true if your Provider is Apollo. Default: false

WARN[0000] /data-pool/usenet-automation/config/ustreamgen/compose.yml: `version` is obsolete  
[+] Running 1/0
✔ Container ustreamgen  Running

But no strm files I have pointed to new tv&movies folders, but they are empty, where am I going wrong?

Thanks

why are you trying to use 0 as th id's? and what platform are you trying to run this on?

Link to comment
Share on other sites

hooray4me
On 4/15/2024 at 12:28 PM, Rom1toul1 said:

Thank you,

 

I use Docker for Synology and I don't know where can I find docker-compose.yaml

Can you help me?

See this guide for ustreamgen on Synology 

 

Link to comment
Share on other sites

Webdoc
49 minutes ago, hooray4me said:

why are you trying to use 0 as th id's? and what platform are you trying to run this on?

Hello thanks for the reply, should the 0 be 1000

Running in docker on fedora Linux 39

When I do get this running does your script put the strm files in series name and season folders?

Thanks again.

Link to comment
Share on other sites

hooray4me

¯\_(ツ)_/¯ on fedora, but on ubuntu you can cat /etc/passwd and see users and their id's. you want to match the owner of the folders you create, ie tvshows, with the ID in the docker compose file... yes it should create the structures in the folders.

if emby is installed here too, might match with the emby user...

Edited by hooray4me
Link to comment
Share on other sites

Webdoc

I have gotten a little further on but after terminal sets up the docker container it seems to hang at the following point

Attaching to ustreamgen
ustreamgen   | no crontab for root

My .env file follows minus the provider link which I set as singlelist

TZ=urope/London #Optional timezone.
PUID=1000 #Optional UserID of the account that will run the service
PGID=1000 #Optional GroupID of the account that will run the service
UID=1000 #Optional UserID for file permissions. Default: 1000
GID=1000 #Optional GroupID for file permissions. Default: 1000
UNAME=webdoc #Optional name of UID. If used MUST match id of UID. Default: root
GROUP=webdoc #Optional name of GID. If used MUST match id of GID. Default: root
SINGLELIST=true #A single list is used for all movies, tv shows and events. Default: false
SINGLELISTURL=#Full M3U Provider URL for all content in one list **SINGLELIST must be true
CRONHOUR=0 #0-23 # sets the hour of the day the script will run again for all content in 1 list **SINGLELIST must be true
CRONMINUTE=10 #0-59 # sets the minute of the day the script will run again for all content 1 list **SINGLELIST must be true
MOVIES=false #A seperate list is used for movies. Default: false
MOVIEURL= #Full M3U Provider URL for Movies **MOVIES must be true
MOVIECRONHOUR=0 #0-23 # sets the hour of the day the script will run again for movies **MOVIES must be true
MOVIECRONMINUTE=20 #0-59 # sets the minute of the day the script will run again for movies **MOVIES must be true
TVSHOWS=false #A seperate list is used for tv shows. Default: true
TVSHOWURL= # Full M3U Provider URL for TV Shows **TVSHOWS must be true
TVCRONHOUR=0 #0-23 # sets the hour of the day the script will run again for tv shows **TVSHOWS must be true
TVCRONMINUTE=10 #0-59 # sets the minute of the day the script will run again for tv shows **TVSHOWS must be true
EVENTS=false #A seperate list is used for events. Default: false
EVENTURL= #Full M3U Provider URL for Events **EVENTS must be true
EVENTCRONHOUR=0 #0-23 # sets the hour of the day the script will run again for events **EVENTS must be true
EVENTCRONMINUTE=30 #0-59 # sets the minute of the day the script will run again for events **EVENTS must be true
APOLLO=false #Optional change to true if your Provider is Apollo. Default: false

What am I still doing wrong?

Thanks again

Link to comment
Share on other sites

hooray4me
43 minutes ago, Webdoc said:

I have gotten a little further on but after terminal sets up the docker container it seems to hang at the following point

Attaching to ustreamgen
ustreamgen   | no crontab for root

My .env file follows minus the provider link which I set as singlelist

TZ=urope/London #Optional timezone.
PUID=1000 #Optional UserID of the account that will run the service
PGID=1000 #Optional GroupID of the account that will run the service
UID=1000 #Optional UserID for file permissions. Default: 1000
GID=1000 #Optional GroupID for file permissions. Default: 1000
UNAME=webdoc #Optional name of UID. If used MUST match id of UID. Default: root
GROUP=webdoc #Optional name of GID. If used MUST match id of GID. Default: root
SINGLELIST=true #A single list is used for all movies, tv shows and events. Default: false
SINGLELISTURL=#Full M3U Provider URL for all content in one list **SINGLELIST must be true
CRONHOUR=0 #0-23 # sets the hour of the day the script will run again for all content in 1 list **SINGLELIST must be true
CRONMINUTE=10 #0-59 # sets the minute of the day the script will run again for all content 1 list **SINGLELIST must be true
MOVIES=false #A seperate list is used for movies. Default: false
MOVIEURL= #Full M3U Provider URL for Movies **MOVIES must be true
MOVIECRONHOUR=0 #0-23 # sets the hour of the day the script will run again for movies **MOVIES must be true
MOVIECRONMINUTE=20 #0-59 # sets the minute of the day the script will run again for movies **MOVIES must be true
TVSHOWS=false #A seperate list is used for tv shows. Default: true
TVSHOWURL= # Full M3U Provider URL for TV Shows **TVSHOWS must be true
TVCRONHOUR=0 #0-23 # sets the hour of the day the script will run again for tv shows **TVSHOWS must be true
TVCRONMINUTE=10 #0-59 # sets the minute of the day the script will run again for tv shows **TVSHOWS must be true
EVENTS=false #A seperate list is used for events. Default: false
EVENTURL= #Full M3U Provider URL for Events **EVENTS must be true
EVENTCRONHOUR=0 #0-23 # sets the hour of the day the script will run again for events **EVENTS must be true
EVENTCRONMINUTE=30 #0-59 # sets the minute of the day the script will run again for events **EVENTS must be true
APOLLO=false #Optional change to true if your Provider is Apollo. Default: false

What am I still doing wrong?

Thanks again

TZ is missing E at beginning... and does wobdoc user ID equal 1000 on the host system?

Link to comment
Share on other sites

Webdoc

yes 1000 is the id of that user

still getting error no crontab for root

now have ✔ Container ustreamgen  Started
but drops back to prompt with nothing else happening

Edited by Webdoc
Link to comment
Share on other sites

Webdoc

now getting attaching to ustreamgen, does this mean I am getting somewhere?

Link to comment
Share on other sites

Webdoc
16 minutes ago, Webdoc said:

now getting attaching to ustreamgen, does this mean I am getting somewhere?

Don't think it's doing anything just have a curser and its not dropped to a prompt, also ev and movies folders not getting any content

Link to comment
Share on other sites

hooray4me
19 minutes ago, Webdoc said:

Don't think it's doing anything just have a curser and its not dropped to a prompt, also ev and movies folders not getting any content

are you setting the singlelisturl? also the path to the folder for tvshows, is the wedoc user and group the owner? maybe also chmod 777 that folder.

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