Add recording with Python HTSP api
Added by Dag Johansson over 9 years ago
When i try to add a recording with Python htsp like this:
h=HTSPClient(('10.4.4.8',9982))
h.hello()
h.send("addDvrEntry",{'channelId': 437649270,'start':1438250400,'stop':1438254000,'disp_title':'test'})
I get this debug result:
2015-07-10 09:11:34 DEBUG : htsp tx:
2015-07-10 09:11:34 DEBUG : { 'clientname': 'HTSP PyClient', 'htspversion': 17, 'method': 'hello'}
2015-07-10 09:11:34 DEBUG : htsp.recv rx:
2015-07-10 09:11:34 DEBUG : { 'challenge': 'M\xe8?\xdc\x1b\xfb\xae\xe7\xcd~\xf1\xbd\xa2\x8e\n[oc\xf6\xect\x9b2o\xf6\xc3\x99\x94O\xe1\x80\xdf',
'htspversion': 20,
'language': 'swe',
'servercapability': [ 'caclient',
'tvadapters',
'satip_client',
'satip_server',
'trace'],
'servername': 'HTS Tvheadend',
'serverversion': '4.0.5'}
2015-07-10 09:11:34 DEBUG : htsp tx:
2015-07-10 09:11:34 DEBUG : { 'channelId': 437649270,
'disp_title': 'test',
'method': 'addDvrEntry',
'start': 1438250400,
'stop': 1438254000}
2015-07-10 09:11:34 DEBUG : htsp.recv rx:
2015-07-10 09:11:34 DEBUG : { 'error': 'Invalid arguments'}
Any idea whats wrong?
Replies (3)
RE: Add recording with Python HTSP api - Added by Ulrich Buck over 9 years ago
This is how I do it
1. In htsp.py I added a new method# Create a new DVR entry. Either eventId or channelId, start and stop must be specified
def addDvrEntry ( self, args = {} ):
self.send('addDvrEntry', args)
2. In the script cereating the DVR entry# Create a new DVR entry
args = {}
args['channelId'] = opts.channel
args['start'] = opts.start
args['stop'] = opts.stop
args['creator'] = opts.creator
args['priority'] = opts.priority
args['title'] = opts.title
prio = ['Important', 'High', 'Normal', 'Low', 'Unimportant', 'Not set']
log.info('Add DVR entry "%s" / Priority "%s"' % (args['title'], prio[args['priority']]))
htsp.addDvrEntry(args)
msg = htsp.recv()
if 'id' in msg:
print msg['id']
else:
print msg['success']
log.info(msg, pretty=True)
RE: Add recording with Python HTSP api - Added by Ulrich Buck over 9 years ago
Second answer
I guess 'disp_title' should be just 'title' in h.send(...)
RE: Add recording with Python HTSP api - Added by Dag Johansson over 9 years ago
The title-field was the problem, now its working.
HTSP documentation says that only cahnnelId, start and stop is required.
But title is required as well.
Thanks for help