dvbtransports json-config files and perl
Added by Pluto P over 11 years ago
Hi Adam, hi all,
i would like to manage (read and set minor changes) the tvheadend json-like config files. i mean the channels and the dvbtransports too.
I realize this is not a fully supported "way to manage configurations" but i have some difficultes making massive use of the webgui-services windows, it'is really big and it auto-refresesh when i'm changing it.
For example i would like to set the channels numbers or the prefcapid.
The files in the dvbtransports folder seem not to be json standard (i'm not a json expert, maybe i could be wrong..) :
for example in this file:
dvbtransports/_dev_dvb_adapter0_Conexant_CX24116_CX2411811900000_H/_dev_dvb_adapter0_Conexant_CX24116_CX2411811900000_H_2505
there are many children with the same name ("stream") :
[...cut...] "pcr": 164, "disabled": 0, "stream": { "pid": 164, "type": "H264", "position": 0, "width": 1920, "height": 1088, "duration": 3600 }, "stream": { "pid": 416, "type": "AC3", "position": 1, "language": "ita" }, "stream": { "pid": 417, "type": "AC3", "position": 2, "language": "und" }, "stream": { "pid": 1604, "type": "CA", "position": 262144, "caidlist": [ { "caid": 2329 } ] }, "stream": { "pid": 1704, "type": "CA", "position": 262144, "caidlist": [ { "caid": 2363 } ] }, [...cut...]
When i open the file with perl, it keeps only one "stream" child, like it was an associative array loosing double keys...
my question is:
are the config files not json compliance and i'm doing a wrong approach?
How can i manage that?
Thank you
Bye!!
Replies (3)
RE: dvbtransports json-config files and perl - Added by Anonymous over 11 years ago
are the config files not json compliance and i'm doing a wrong approach?
thay are not json files. json does not allow to store multiple keys in the same object.
How can i manage that?
you can not. it is broken.
i am curious is it some "old stuff" that was implemented some time ago and after using it was not removed from config files.
i would like some devs to explain to us how does it work. maybe tvheadend uses something different.
RE: dvbtransports json-config files and perl - Added by Adam Sutton over 11 years ago
No htsmsg format isn't entirely JSON compliant (though in most cases it is), tbh I'd completely forgotten that such things existed.
In this specific example I'd simple ignore the stream entries (or entry assuming your JSON parser just gives you the first/last value). These are easily re-generated by TVH. I'll see about removing this from the new DVB code.
Also you should bare in mind that all of these configuration files will soon have a big format change. Though I'm still struggling to get the DVB rewrite finished.
Adam
RE: dvbtransports json-config files and perl - Added by Anonymous over 11 years ago
Adam Sutton wrote:
Also you should bare in mind that all of these configuration files will soon have a big format change. Though I'm still struggling to get the DVB rewrite finished.
if i may suggest sqlite is well known and easy to access / modify.
thx for reply