home
products
contribute
download
documentation
forum
Home
Forums
New posts
Search forums
What's new
New posts
All posts
Latest activity
Members
Registered members
Current visitors
Donate
Log in
Register
What's new
Search
Search
Search titles only
By:
New posts
Search forums
Search titles only
By:
Menu
Log in
Register
Navigation
Install the app
Install
More options
Contact us
Close Menu
Forums
MediaPortal 1
MediaPortal 1 Talk
Scripting functions?
Contact us
RSS
JavaScript is disabled. For a better experience, please enable JavaScript in your browser before proceeding.
You are using an out of date browser. It may not display this or other websites correctly.
You should upgrade or use an
alternative browser
.
Reply to thread
Message
<blockquote data-quote="Tolriq" data-source="post: 679040" data-attributes="member: 107021"><p>Just to give you an idea, the code is not usable alone like this, but at least you have the required json parameters needed.</p><p></p><p>You can find the needed params value in the ipimp code for your needs. I don't use radio or EPG so can"t help on this part.</p><p></p><p>It use Jayrock for the json handling.</p><p></p><p>[CODE]public JsonObject IPimpCommand(CommandInfoIPimp command)</p><p> {</p><p> var error = new JsonObject();</p><p> error["result"] = false;</p><p></p><p> if (command == null)</p><p> return error;</p><p></p><p> lock (Locker)</p><p> {</p><p> var args = new JsonObject();</p><p> args["action"] = command.Action;</p><p> args["filter"] = command.Filter;</p><p> args["value"] = command.Value;</p><p> args["start"] = command.Start;</p><p> args["pagesize"] = command.PageSize;</p><p> args["shuffle"] = command.Shuffle;</p><p> args["enqueue"] = command.Enqueue;</p><p> args["tracks"] = command.Tracks;</p><p></p><p> if (command.Action != "ping" && command.Action != "nowplaying")</p><p> Log("COMMAND : " + args);</p><p> else</p><p> Trace("COMMAND : " + args);</p><p></p><p> var myCompleteMessage = "";</p><p></p><p> var webRequest = WebRequest.Create(GetApiPath());</p><p> webRequest.Method = "POST";</p><p></p><p> var byteArray = Encoding.UTF8.GetBytes(args.ToString());</p><p> webRequest.ContentType = "application/x-www-form-urlencoded";</p><p> webRequest.ContentLength = byteArray.Length;</p><p></p><p> try</p><p> {</p><p> var datastream = webRequest.GetRequestStream();</p><p> {</p><p> datastream.Write(byteArray, 0, byteArray.Length);</p><p> datastream.Close();</p><p></p><p> var webResponse = webRequest.GetResponse();</p><p> if (webResponse != null)</p><p> {</p><p> using (var datastream2 = webResponse.GetResponseStream())</p><p> {</p><p> if (datastream2 != null)</p><p> {</p><p> var reader = new StreamReader(datastream2);</p><p> myCompleteMessage = reader.ReadToEnd();</p><p> }</p><p> }</p><p> webResponse.Close();</p><p> }</p><p> }</p><p> }</p><p> catch (Exception)</p><p> {</p><p> if (command.Action != "ping" && command.Action != "nowplaying")</p><p> Log("ERROR - COMMAND : " + args);</p><p> else</p><p> Trace("ERROR - COMMAND : " + args);</p><p> myCompleteMessage = error.ToString();</p><p> }</p><p></p><p> Trace(myCompleteMessage);</p><p> return (JsonObject)JsonConvert.Import(myCompleteMessage);</p><p> }</p><p> }[/CODE]</p></blockquote><p></p>
[QUOTE="Tolriq, post: 679040, member: 107021"] Just to give you an idea, the code is not usable alone like this, but at least you have the required json parameters needed. You can find the needed params value in the ipimp code for your needs. I don't use radio or EPG so can"t help on this part. It use Jayrock for the json handling. [CODE]public JsonObject IPimpCommand(CommandInfoIPimp command) { var error = new JsonObject(); error["result"] = false; if (command == null) return error; lock (Locker) { var args = new JsonObject(); args["action"] = command.Action; args["filter"] = command.Filter; args["value"] = command.Value; args["start"] = command.Start; args["pagesize"] = command.PageSize; args["shuffle"] = command.Shuffle; args["enqueue"] = command.Enqueue; args["tracks"] = command.Tracks; if (command.Action != "ping" && command.Action != "nowplaying") Log("COMMAND : " + args); else Trace("COMMAND : " + args); var myCompleteMessage = ""; var webRequest = WebRequest.Create(GetApiPath()); webRequest.Method = "POST"; var byteArray = Encoding.UTF8.GetBytes(args.ToString()); webRequest.ContentType = "application/x-www-form-urlencoded"; webRequest.ContentLength = byteArray.Length; try { var datastream = webRequest.GetRequestStream(); { datastream.Write(byteArray, 0, byteArray.Length); datastream.Close(); var webResponse = webRequest.GetResponse(); if (webResponse != null) { using (var datastream2 = webResponse.GetResponseStream()) { if (datastream2 != null) { var reader = new StreamReader(datastream2); myCompleteMessage = reader.ReadToEnd(); } } webResponse.Close(); } } } catch (Exception) { if (command.Action != "ping" && command.Action != "nowplaying") Log("ERROR - COMMAND : " + args); else Trace("ERROR - COMMAND : " + args); myCompleteMessage = error.ToString(); } Trace(myCompleteMessage); return (JsonObject)JsonConvert.Import(myCompleteMessage); } }[/CODE] [/QUOTE]
Insert quotes…
Verification
Post reply
Forums
MediaPortal 1
MediaPortal 1 Talk
Scripting functions?
Contact us
RSS
Top
Bottom