TvHeadend - Add networks/muxes programmatically without using webgui
Added by Peter Wislander over 7 years ago
Is there a way to add muxes in tvheadend without using the webgui?
Unfortunately the muxes list in .hts/tvheadend/input/.../muxes are in binary format, otherwise I might have been able to drop custom muxes files there.
Replies (8)
RE: TvHeadend - Add networks/muxes programmatically without using webgui - Added by saen acro over 7 years ago
Files are TGZ compressed.
RE: TvHeadend - Add networks/muxes programmatically without using webgui - Added by Peter Wislander over 7 years ago
This is not working though:
tar -xvzf input/dvb/networks/.../muxes/02de05013ac4423a43199470f705b6cf
gzip: stdin: not in gzip format
tar: Child returned status 1
tar: Error is not recoverable: exiting now
RE: TvHeadend - Add networks/muxes programmatically without using webgui - Added by saen acro over 7 years ago
File header contain "GZIP"
RE: TvHeadend - Add networks/muxes programmatically without using webgui - Added by Joe User over 7 years ago
saen acro wrote:
File header contain "GZIP"
Yes, because it uses the zlib library, but it is not in a regular gzip or tgz file format.
You can build tvheadend without zlib, but then it will not be used for anything not just config files and I am not sure if it will read already compress config files...
Someone else posted they made a modification: [[http://tvheadend.org/boards/13/topics/13421?r=27033#message-27033]]
I made a feature request: [[http://tvheadend.org/boards/13/topics/13421?r=27033#message-27033]]
RE: TvHeadend - Add networks/muxes programmatically without using webgui - Added by Peter Wislander over 7 years ago
I just automated everything against the UI. It was a hell considering all the fcuked up generated id's, but works now. Took me 2 days.
I think that's the path for us for the future.
But I just can't believe that somehow it's assumed that everything should be done by manually clicking. The webgui should be like the last feature to implement and dropping config files should be the first thing to implement.
How are you guys even managing to use tvheadend?
All mouse clicking? Jeeezus. RSI 3.0.
RE: TvHeadend - Add networks/muxes programmatically without using webgui - Added by Joe User over 7 years ago
Peter Wislander wrote:
I just automated everything against the UI. It was a hell considering all the fcuked up generated id's, but works now. Took me 2 days.
I am also not to thrilled by the hash id's, but they have a purpose and can be useful. But a relational database probably would be better.
But I just can't believe that somehow it's assumed that everything should be done by manually clicking. The webgui should be like the last feature to implement and dropping config files should be the first thing to implement.
The config files are implemented, but the JSON has been converted to binary and compressed for performance reasons. But as noted before, the lack of user direct access to the config files needs to be addressed. In the meantime, the other thread I linked to shows how to go back to human readable config files.
How are you guys even managing to use tvheadend?
All mouse clicking? Jeeezus. RSI 3.0.
My setup is quite simple, so between the automatic detection capabilities and a few mouse clicks I am configured. But I recognize that more complex configurations are not so easy using just the web gui. If you look through the forum you will find users who have created scripts/progs to work directly with the config files or through the HTTP/HTSP interface API. Unfortunately the APIs are not well documented, but you can look in src/api for hints.
RE: TvHeadend - Add networks/muxes programmatically without using webgui - Added by Peter Wislander over 7 years ago
Hi,
I think the safest way for us is just to basically crawl the website and fill in the forms using js and submit. It's not easy and quite tedious but I've got an expensive web browser we can communicate with programmatically already being payed for and have now a decent programming api to fill in forms on tvheadend. Using that there should be no limit on what we can automate. The id's I was referring to wasn't the hashid's for the config files but actually for the id's in the DOM tree. There are no consistent id based selectors to use to find an element, and it's quite tedious to find a way to reliably get to an element, but we've found a way for the muxes and been adding 150 muxes several times in about 2 minutes.
The config files gzipped for performance reasons I don't really understand, since they have to be unzipped before being parsed anyway. In my head that should be more expensive. And the inconsistency between muxes configs, inputs and networks is also tedious to address. Only muxes are actually gzipped.
One folder containing configuration files should be created, and they should all lie there, rather than spread across various directories. The tvheadend hts folder is so small anyway and just introduces a lot of complexity with regards to figuring out what is a config file and what is not. /configs/{networks.json, muxes.json, tuners.json, settings.json, epg.json} and these can all reference each other within.
The problem becomes even more when you fill in muxes manually and you need to do it for several networks, and sometimes you uninstall tvheadend or something gets corrupted. Uninstall and reinstall the tv tuners and you have to click on 36 tuners to configure and enable them over and over again until your bug stops being a bug.
Just a few thoughts.
RE: TvHeadend - Add networks/muxes programmatically without using webgui - Added by Joe User over 7 years ago
Peter Wislander wrote:
The config files gzipped for performance reasons I don't really understand, since they have to be unzipped before being parsed anyway. In my head that should be more expensive.
Tvheadend runs on many different platforms and for most, the cpu overhead is trivial compared to the file reading time. Consider a device which uses an SD card...
Maybe better to continue this discussion here: [[http://tvheadend.org/issues/4498]]