TVHeadend API
Added by Christian Behrmann over 10 years ago
Hi everybody,
i know that TVHeadend use http post for API but i was not able to find any kind of documents for it. Is there somewhere a list or a dokument of all API commands?
Thanks in advance
Replies (5)
RE: TVHeadend API - Added by Martin Bednar over 10 years ago
Are you by any chance looking for this : https://tvheadend.org/projects/tvheadend/wiki/Htsp
This is the primary means of communication with tvheadend, not http.
Serafean
RE: TVHeadend API - Added by Morten Trab about 10 years ago
Anywhere to get examples?
Can't seem to get how to do the communication?
I'm a .NET developer.
I can get some info's via HTTP API's, but would like to move it all to HTSP protocol.
RE: TVHeadend API - Added by Martin Bednar about 10 years ago
Hi,
Somewhere on the net once upon a time I found this attached file. I used it as a unit test for a basic impllementation. Afterwards I captured some packets and reconstituted them using wireshars. Hope it helps.
Everything else I needed was on the wiki. Here : https://tvheadend.org/projects/tvheadend/wiki/Htsmsgbinary
Serafean.
RE: TVHeadend API - Added by Morten Trab about 10 years ago
Helps absolutely no where
Your samples.c looks like som kind of ASM and the WIKI pages are just about gibberish to me :/
I hoped for some kind of example in .NET
RE: TVHeadend API - Added by Martin Bednar about 10 years ago
Basically, HTSP is a binary protocol. samples.c contains a few messages encoded using HTSP. I'll do the beginning of the first message for you here :
0x00, 0x00, 0x00, 0x7c are the four first bytes. as per the documentation, this is the root and the first element
||Length||4 byte integer||Total length of message (not including this length field itself) Here the length of the entire message is 0x7c (or 124 bytes).
Next we get into the body.
0x03 → the first byte tells us this part is of type 3. As per the docs : Str||3||UTF-8 encoded string. We expect a string...
0x0a → The second byte tells us the size of the name of the message. 0x0a = 10
0x00, 0x00, 0x00, 0x0c → next four bytes tell us the size of this body's payload. 0x0c = 12
0x63, 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x6e, 0x61, 0x6d, 0x65 ̣→ 10 bytes - The name of the message in UTF-8. in this case "clientname"
0x48, 0x54, 0x53, 0x20,0x53, 0x68, 0x6f, 0x77, 0x74, 0x69, 0x6d, 0x65 → 12 bytes. The payload => An UTF-8 string. "Showtime"
Then comes a second message body. And a third, fourth ... until we read all 124 bytes of the message.
I hope this helps. I know it took me a day or two just to understand the protocol. Don't give up
Serafean.