HTS-Protokoll
Added by Rüdiger Gubler over 9 years ago
Hi,
can someone please explain me the HTSP.
Is there an example in C# exsiting?
Yours Rüdiger
Replies (10)
RE: HTS-Protokoll - Added by Ulrich Buck over 9 years ago
Have you looked at https://tvheadend.org/projects/tvheadend/wiki/Htsp ?
Note / follow the links mentioned there:
For information about the HTSP wire format please read HTSMSG binary format If you're looking to develop a new client, there are several existing client implementations from which you might be able to gain knowledge: XBMC Showtime TVHGuide PyHTSP (This is a demo client and is WIP, it has limited functionality).
An example in C# should be found here: https://github.com/adamsutton/xbmc-pvr-addons/tree/master/addons/pvr.tvh
RE: HTS-Protokoll - Added by Rüdiger Gubler over 9 years ago
I can handle the hello and authenticate now, but I can't find a method to list all available channels (TV-Senders).
How can I get these information?
RE: HTS-Protokoll - Added by Ulrich Buck over 9 years ago
to list all available channels
Use the "enableAsyncMetadata" method. An "initialSync" will start, which will provide, among other, the available channels via the "channelAdd" reply. You can stop reading the replies once "initialSyncCompleted" is received.
Look at the following Python code, which I use in a script to generate xmltv data (adopted from the PyHTSP demo client). Note that there is a small error in the Wiki HTSP documentation: the reply received is initialSyncCompleted, not initialSyncComplete; "d" is added at the end.
# Enable async args = {} if opts.epg: args['epg'] = 1 if opts.update != None: args['lastUpdate'] = opts.update htsp.enableAsyncMetadata(args) # Process messages chanNum={} chanAdd=[] evenAdd=[] while True: msg = htsp.recv() if 'method' in msg: if msg['method'] == 'channelAdd': chanNum[msg['channelId']]=msg['channelNumber'] chanAdd.append(msg) # store 'channelAdd' message elif msg['method'] == 'eventAdd': msg['channelNumber']=chanNum[msg['channelId']] evenAdd.append(msg) # store 'eventAdd' message elif msg['method'] == 'initialSyncCompleted': break
RE: HTS-Protokoll - Added by Rüdiger Gubler over 9 years ago
Thank you, I tried this already yesterday and get only one or two channelAdd messages in 10min.
Any idea what is the reason for this?
Edit: I attached a 30min communication log
HTScom.log (9.92 KB) HTScom.log |
RE: HTS-Protokoll - Added by Ulrich Buck over 9 years ago
The Channel and Event information I receive in this way is limited to the channels I have mapped and numbered in the TVH web interface.
Generating the xmltv data for the 55 channels I have mapped and 8799 associated epg entries takes about 15 seconds on my rather slow QNAP TS-212 NAS (ARM). It is only about 3 seconds on my Intel i3 notebook.
Another guess, which might influence the results: in https://github.com/adamsutton/tvheadend/blob/master/lib/py/tvh/htsp.py I changed
HTSP_PROTO_VERSION = 6to version 17, which my TVH uses.
RE: HTS-Protokoll - Added by Rüdiger Gubler over 9 years ago
... mapped and numbered in the TVH web interface.
I have numbered 385 TV and Radio channels. What du you mean with 'mapped'. The TVH-Plugin in XBMC/Kodi shows me all channels.
Generating the xmltv data for the 55 channels I have mapped and 8799 associated epg entries takes about 15 seconds on my rather slow QNAP TS-212 NAS (ARM). It is only about 3 seconds on my Intel i3 notebook.
I think its not an performance issue as only a few channel are send regardless the time I let the client run.
Another guess, which might influence the results: in https://github.com/adamsutton/tvheadend/blob/master/lib/py/tvh/htsp.py I changed [...] to version 17, which my TVH uses.
I tried from 6 to 17 every number - the same result.
RE: HTS-Protokoll - Added by Ulrich Buck over 9 years ago
... mapped and numbered: once you have done that the channel tab should look like the attached screen shot.
Since the "TVH-Plugin in XBMC/Kodi shows me all channels" it appears you have done that.
Otherwise I have no idea why you are only getting a few channels.
You might want to try the python script I use. I attach it. It will need the "TVH imports" fom here https://github.com/tvheadend/tvheadend/tree/master/lib/py/tvh plus python 2.7.
channeltab.png (108 KB) channeltab.png | channeltab | ||
htsp-xmltv.py (9.46 KB) htsp-xmltv.py | htsp-xmltv |
RE: HTS-Protokoll - Added by Rüdiger Gubler over 9 years ago
It looks like a problem in my socket reading code. The data might not processed continuously.
I must rewrite the complete socket stuff which needs some time as I'm a Java developer who tries to write C# code.
Most of my beloved java.nio.* classes must be replaced with C# ones.
RE: HTS-Protokoll - Added by Ulrich Buck over 9 years ago
Noted. Good luck with the new C# code. I cannot help with C#, being only a hobby programmer.
Out of curiosity: what do you intend to do with your C# HTS client?
RE: HTS-Protokoll - Added by Rüdiger Gubler over 9 years ago
I try to write a TVH-plugin for MediaBrowser.