Project

General

Profile

Script to configure IPTV and Channels

Added by Yves Metivier almost 13 years ago

Hi,
I discovered recently tvheadend, and it's really a great tool, as I already use xbmc as frontend.
I use it only with IPTV, in France with Orange provider, with which there are more than hundred channels.
So I tried to write a perl script to configure channels automatically.
After looking at directory structure in $HOME/.hts/tvheadend,
I wrote a script that generated IPTV files (iptv_1, iptv_2, ...) and channels files (1, 2, 3, ...)
I restarted Web browser, and tvheadend, but those generated files were not taken into account.
Has anybody an idea?


Replies (7)

RE: Script to configure IPTV and Channels - Added by Phill Lavender almost 13 years ago

Hi, I've been meaning to do this for all my IPTV channel in spain, but never seem to have the time.

First off. Are you using a git version or the release version ? May not make any difference but useful to know.

Are the files created with the correct permission for the user running tvheadend i.e.: rwx----- 1 phill phill 425 Aug 30 18:38 iptv_1

Are the iptv_x files in ~/.hts/tvheadend/iptvservices/ and the channels (1,2,3) in ~/.hts/tvheadend/channels ?

Can you paste and example of the iptv_x and channel output from your script. Can you past your script ? (I could do with it to as I haven't mapped all my channels either)

iptv_x without any PIDs should look something like this:

{
"pmt": 0,
"port": 8208,
"interface": "eth1",
"group": "239.0.0.106",
"channelname": "NOVA",
"mapped": 1,
"pcr": 0,
"disabled": 0
}

Thanks

Phill

RE: Script to configure IPTV and Channels - Added by Phill Lavender almost 13 years ago

I just created 'iptv_50' file as above just changed its channlename to "NOVA2" and a channel file '85' (next sequential number in the channel directory) and gave it channel_number: 1100. Examples below.

Restarted tvheadend and all appears ok. So I think you have a permissions error or your not adding channel files sequentially.

iptv_50:

{
"pmt": 0,
"port": 8208,
"interface": "eth1",
"group": "239.0.0.100",
"channelname": "NOVA2",
"mapped": 1,
"pcr": 0,
"disabled": 0
}

Channel file, 85:

{
"name": "NOVA2",
"tags": [
23,
22,
6,
5
],
"dvr_extra_time_pre": 0,
"dvr_extra_time_post": 0,
"channel_number": 1100
}

RE: Script to configure IPTV and Channels - Added by Yves Metivier almost 13 years ago

Here is what I tried this evening :

1/ generate both iptvtransports and channel files : tvheadend crashed (see joined log file)
2/ generate only iptvtransports files : OK
all channels appear in "Configuration" / "IPTV" web interface, and also in
"Configuration" / "Channels", of course whith channel number not set.
But what I want to do is to have channel number set, according to source file (m3u format)
I know that I can do it in two passes, but it would be better in one :-)
Joined are :
- My script (I know it is bad written, but I'm not a pro and the goal si to work, not to be beautiful!)
- m3u source file
- log
- files generated

test.gz (10.6 KB) test.gz

RE: Script to configure IPTV and Channels - Added by Phill Lavender almost 13 years ago

Ok. I can report I have no issue using your script on the latest git.

I only had to change the regex slightly for my playlist format:

#EXTINF:-1,[001] Tve
rtp::8208

It created the iptv_x and channel files.

I stopped tvheadend (kill -9 pid) deleted all the files in iptvservices (rm *) and channels (rm *), copied the files over and set permissions in each folder (chmod 777 *)

restarted tvheadend (./tvheadend &)

Phill

RE: Script to configure IPTV and Channels - Added by Mac Smith over 12 years ago

can I add a VID, AID or PID to the configuration

{
"pmt": 0,
"port": 8208,
"interface": "eth1",
"group": "239.0.0.100",
"channelname": "NOVA2",
"mapped": 1,
"pcr": 0,
"disabled": 0
}

RE: Script to configure IPTV and Channels - Added by Phill Lavender over 12 years ago

No reason why not, but why do you need to ? tvheadend will write the PIDS found to the iptv_x file once you invoke the channel.

Example below. tvheadend wrote all the 'stream' info automatically. I only configured the info shown in the above posts.

{
"pmt": 100,
"port": 8208,
"interface": "eth1",
"group": "239.0.0.76",
"channelname": "Tve",
"mapped": 1,
"pcr": 101,
"disabled": 0,
"stream": {
"pid": 101,
"type": "H264",
"position": 0,
"width": 544,
"height": 576
},
"stream": {
"pid": 201,
"type": "MPEG2AUDIO",
"position": 1,
"language": "Esp"
},
"stream": {
"pid": 202,
"type": "MPEG2AUDIO",
"position": 2,
"language": "VO"
},
"stream": {
"pid": 301,
"type": "TELETEXT",
"position": 3
},
"stream": {
"pid": 401,
"type": "DVBSUB",
"position": 1,
"language": "Esp"
},
"stream": {
"pid": 202,
"type": "MPEG2AUDIO",
"position": 2,
"language": "VO"
},
"stream": {
"pid": 301,
"type": "TELETEXT",
"position": 3
},
"stream": {
"pid": 401,
"type": "DVBSUB",
"position": 4,
"language": "ESP",
"compositionid": 1,
"ancillartyid": 0
}
}

RE: Script to configure IPTV and Channels - Added by Mac Smith over 12 years ago

Thanks,

The multicast I am getting contains 7 IPTV channel all on same ip & port. Thats the reason I would like to use HTS tvheadend to separate the streams using PID.

    (1-7/7)