So I figured out how to write a node.js tls connection to the TiVo using this code:
Sure enough it responds with:
However when I try to run this:
I get back:
So my first question to anyone that has experience with MindRPC, does this error message mean that the IOS app doesnt have the rights to do a simple search? Or does it mean I am not stringing my first bodyAuthenticate correctly with my second query to request do the search.
Given its specific about a partnerID I am going to assume the IOS app cert I am using doesnt have rights to search. If that is the case, is there another way I can search for a show name? I noticed kmttg pulls the entire collection (which takes a long time), is that the only way to get the data?
Could someone help me with what command is needed to pull all data if that is what is needed (I will cache it locally every "x" mins if needed).
Finally while I have your attention, do you know the specific rpc command needed to start playing a specific show?
Thanks in advance!!
Code:
var tls = require('tls');
var fs = require('fs');
process.env.NODE_TLS_REJECT_UNAUTHORIZED = "0";
var options = {
host : "192.168.1.1"
,rejectUnauthorized: false
,port : 1413
,pfx : fs.readFileSync('c:\\temp\\xxxxxxxx.p12')
,passphrase : "xxxxxxxx"
,ca : [fs.readFileSync('c:\\temp\\tivo.ca'), fs.readFileSync('c:\\temp\\tivo.int')]
,secureProtocol: "TLSv1_1_method"
};
var sessionID = Math.floor(Math.random() * (2612256 - 2539520) + 2539520).toString(16)
var eol = "\r\n";
var header = "Type: request" + eol;
header = header + "RpcId: 1" + eol;
header = header + "SchemaVersion: 17" + eol;
header = header + "Content-Type: application/json" + eol;
header = header + "RequestType: bodyAuthenticate" + eol;
header = header + "ResponseCount: single" + eol;
header = header + "BodyId: " + eol;
header = header + "X-ApplicationName: Quicksilver" + eol;
header = header + "X-ApplicationVersion: 1.2" + eol;
header = header + "X-ApplicationSessionId: 0x" + sessionID + eol;
header = header + eol;
var body = '{"type":"bodyAuthenticate","credential":{"type":"makCredential","key":"0123456789"}}' + "\n"
var firstline = "MRPC/2 " + header.length + " " + body.length + eol
var client = this;
client.socket = tls.connect(options, function () {
client.socket.setEncoding('utf8');
client.socket.write(firstline + header + body);
var data = "";
client.socket.on('data', function (chunk) {
data += chunk;
console.log(data);
});
client.socket.on('end', function () {
client.socket.end();
});
client.socket.on('error', function (err) {
console.log("Error during TLS request");
console.log(err);
client.socket.end();
});
});
Code:
MRPC/2 75 119
Content-Type: application/json
IsFinal: true
RpcId: 1
Type: response
{"message": "Authentication successful", "status": "success", "type": "bodyAuthenticateResponse", "mediaAccessKey": ""}
Code:
MRPC/2 230 75
Type: request
RpcId: 1
SchemaVersion: 17
Content-Type: application/json
RequestType: offerSearch
ResponseCount: single
BodyId:
X-ApplicationName: Quicksilver
X-ApplicationVersion: 1.2
X-ApplicationSessionId: 0x26f44a
{"type": "offerSearch","title": "The Daily Show","orderBy": ["startTime"]}
Code:
{"code": "routingError", "text": "PartnerId 3976 does not have access to operation offerSearch.", "type": "error"}
Given its specific about a partnerID I am going to assume the IOS app cert I am using doesnt have rights to search. If that is the case, is there another way I can search for a show name? I noticed kmttg pulls the entire collection (which takes a long time), is that the only way to get the data?
Could someone help me with what command is needed to pull all data if that is what is needed (I will cache it locally every "x" mins if needed).
Finally while I have your attention, do you know the specific rpc command needed to start playing a specific show?
Thanks in advance!!
Aucun commentaire:
Enregistrer un commentaire