Android Question jsonrpc to XBMC

sigster

Active Member
Licensed User
Longtime User
Hi are anyone here who can help me with this :) Please

How can I send this to XBMC in B4A

B4X:
http://IP_ADDRESS:8080/jsonrpc?request={"id":"0","jsonrpc":"2.0","method":"Input.SendText","params":{"text":"MyTextHere","done":false}}

PS
was trying to compile app with empty form for Amazon Fire TV and it work well it go to the TV

Regards
Sigster
 

sigster

Active Member
Licensed User
Longtime User
I try this I get JobName = job2, Success = true but but nothing happened in XBMC


B4X:
  Dim job2 As HttpJob

  'Send a POST request
  job2.Initialize("Job2", Me)

    URLStr1 = "http://IP_ADDRESS:8080/"
    send_command = "jsonrpc?request={""id"":""0"",""jsonrpc"":""2.0"",""method"":""Input.SendText"",""params"":{""text"":""MyTextHere"",""done"":false}}"

'    Msgbox(URLStr1 & send_command,send_command)

        Dim job2 As HttpJob
        job2.Initialize("job2", Me)
        job2.PostString (URLStr1, send_command)

if I send this in Chrome from my PC and Mobile it work well

B4X:
http://IP_ADDRESS:8080/jsonrpc?request={"id":"0","jsonrpc":"2.0","method":"Input.SendText","params":{"text":"MyTextHere","done":false}}


Regards
Sigster
 
Last edited:
Upvote 0

sigster

Active Member
Licensed User
Longtime User
Hi

I am finish to fix this I can send to XBMC

but I have problem how to send this I am try to send text

{"id":"0","jsonrpc":"2.0","method":"Input.SendText","params":{"text":"MyTextHere","done":False}}


B4X:
        Dim postProdJob As HttpJob
        Dim m As Map
        postProdUrl = "http://YOUR_IPADDRESS:8080/jsonrpc" 
   
      'Get version
        'm.Initialize
        'm.Put("jsonrpc", "2.0")
        'm.Put("method", "JSONRPC.Version")
        'm.Put("id", "1")
     
      'Key down
      ' m.Initialize
      ' m.Put("jsonrpc", "2.0")
      ' m.Put("method", "Input.Down")
      ' m.Put("id", "1")       
     
        m.Initialize
        m.Put("id", "0")
        m.Put("jsonrpc", "2.0")
        m.Put("method", "Input.SendText")
        m.Put("params", "text", "YYY"))
        'm.Put("params", Array As String("text", "YYY"))     
        m.Put("done", false)     
     
                 
        Dim JSONGenerator As JSONGenerator
        JSONGenerator.Initialize(m) 
   
      postProdJob.Initialize("JOB2", Me)
      postProdJob.PostString(postProdUrl, JSONGenerator.ToString())
      postProdJob.GetRequest.SetContentType("application/json")                 
      postProdJob.Release

Regards
Sigster
 
Last edited:
Upvote 0

sigster

Active Member
Licensed User
Longtime User
Hi thanks

I don't have email about v3.80 I did use hotmail but I send email if it is possible to change into gmail

no email about download v3.80 :)

Register
Sigster
 
Last edited:
Upvote 0

sigster

Active Member
Licensed User
Longtime User
Hi

This is XBMC remote sample

then I try to read connection string from text file I save in settings in the app I get this error

java.lang.NumberFormatException: Invalid double: "http://My_IPADRESS:8080/jsonrpc"

PS
Send button don't work still try to find out how to and waiting for B4A 3.80 :)

Regards
Sigster
 

Attachments

  • xbmc_remote.zip
    77 KB · Views: 154
Upvote 0

DonManfred

Expert
Licensed User
Longtime User
Maybe you have buyed B4A in January 2012... Then the 2 Years of updates are gone... You should contact [email protected] and ask for an discount to get a new subscription
 
Upvote 0

sigster

Active Member
Licensed User
Longtime User
Hi

I get error on this line

postProdJob.PostString(Lab_ipaddress.Text, JSONGenerator.ToString())

I read connection string from txt file into Lab_ipaddress.text
= LoadINI_settings


Regards
Sigster
 
Upvote 0

sigster

Active Member
Licensed User
Longtime User
Hi

DonManfred, Erel Thanks for replay !

I add this to the code and it fine know

Dim connect_url As String = Lab_ipaddress.Text

B4X:
      Dim connect_url2 As String = Lab_ipaddress.Text        
      postProdJob.Initialize("JOB2", Me)
      postProdJob.PostString(connect_url, JSONGenerator.ToString())           
      postProdJob.GetRequest.SetContentType("application/json")                   
      postProdJob.Release


Regards
Sigster
 
Upvote 0

sigster

Active Member
Licensed User
Longtime User
Hi

Thanks Erel

Finish to find out how to send text to search box in XBMC


if someone download the zip source code and want to use it
in XBMC you need to go to System/Services/Remote control and check in "Allow programs on this system to control XBMC"


B4X:
        Dim job2 As HttpJob

        job2.Initialize("Job2", Me)
 
        Dim connect_url2 As String = Lab_ipaddress.Text & "jsonrpc?request="
        Dim send_command As String = "{""id"":""0"",""jsonrpc"":""2.0"",""method"":""Input.SendText"",""params"":{""text"":"""& Txt_senda_texta.Text &""",""done"":true}}"

        Dim job2 As HttpJob
        job2.Initialize("job2", Me)
        job2.PostString (connect_url2, send_command)
          job2.GetRequest.SetContentType("application/json")

Regards
Sigster
 
Upvote 0

Kevin L. Johnson

Member
Licensed User
Longtime User
Hello all,

I am trying to play several videos back to back from an Raspberry Pi running the latest XBMC (RaspBMC). However, I am wanting to use an android tablet to select some videos over the network (residing on a Network Attached Storage - NAS) into a que and tell the XBMC server to play them sequentially. I think the JSON-RPC to XBMC is the way to go, but am not really that familiar with JSON-RPC or XBMC.

I have an RPI based xbmc server up and running and will need to configure it to "Allow programs on this system to control XBMC" as sigster says above. I am also just now starting on the android code and will keep you posted if / as I run into any difficulties.

Any insights would be greatly appreciated along the way.
Thanks
Kevin
 
Upvote 0
Top