dave-p / TVH-API-docs

User-created documentation for the TVHeadend HTTP API
Other
64 stars 7 forks source link

mpegts/network/mux_create #5

Open zywek123 opened 1 year ago

zywek123 commented 1 year ago

Hello. How should I enter the parameters containing the mux configuration? I tried mpegts/network/mux_create?uuid=net&conf=json in python as well as mpegts/network/mux_create?uuid=net, json=json containing {"conf": {"keys"}} all taken from mpegts/network/mux_class including class, event, caption and even props still in config, also props without config and config without props, config without class, events and caption also does not work, I get 400 bad request. From src/api/mpegts.c I am not able to deduce much. Can I ask for an example or guide me what I am doing wrong?

dave-p commented 1 year ago

I've never tried to use that function, just documented it from the TVheadend source.

The work is done by input/mpegts/iptv/iptv.c, input/mpegts/mpegts_network.c or input/mpegts/mpegts_network_dvb.c depending on what kind of network you are adding a mux to.

I've tried to add another mux to my DVB-S setup through the API (using curl) but all attempts produce a 400 error. Unfortunately because of the way the api is written there is no information available on what went wrong.

dave-p commented 1 year ago

OK got it working.

I enabled debug and trace of the "http" subsystem of TVH, then added a new mux manually through the GUI. The debug log showed what the browser had sent to TVH when I added the mux. I could then replicate that using the api.

My curl command was curl -d uuid=62d279b29fff2de0ff1245dad5154500 -d @mux2.json "http://192.168.1.1:9981/api/mpegts/network/mux_create" and the file containing the JSON was

conf=
{"enabled":1,
"epg":0,
"epg_module_id":"",
"delsys":"DVBS",
"frequency":12440000,
"symbolrate":29500000,
"polarisation":"V",
"modulation":"QPSK",
"fec":"8/9",
"scan_state":0,
"charset":"",
"rolloff":"AUTO",
"pilot":"AUTO",
"dvb_satip_dvbc_freq":0,
"dvb_satip_dvbt_freq":0,
"tsid_zero":false,
"pmt_06_ac3":0,
"eit_tsid_nocheck":false,
"sid_filter":0,
"stream_id":-1,
"pls_mode":"ROOT",
"pls_code":1}

I was adding a DVB-S mux; other network types will need different parameters.

The trick of using http debug won't work for all APIs, as the GUI doesn't always seem to use that protocol.

I'll add more detail to the api docs later.