OSMC 2016.01-1: remote-cli

Just testing this (very nice and useful idea, btw.) and so far I can connect typing

remote-cli 192.168.1.11 8080 user password,

but the online help suggest you may also safe a file

/home/osmc/cli-remote.conf
containing those login data in this form:
Alternatively, save a file called /home/osmc/cli_remote.conf with this: {"ip": <your_ip>, "port": <your_port>, "user" : <your_user>, "pssw": <your_pass<

It now just seems that this example is somewhat mistyped, at least I cannot figure out what this line really should look like…

Anyway, just a very minor glitch, but would be a nice feature for ‘my future convenience’ :grin:

Looks like missing closing curly bracket (and one > round the wrong way.
Everything in the <> including the <> would be replaced with your data (looks like a file in json format).

If this is not a typo it is your problem you used ‘-’ instead of ‘_’

Yeah, figured that already yesterday before posting here, but no luck with having

{"ip": 192.168.1.11, "port": 8080, "user": user, "pssw": password}

saved in the file

/home/osmc/cli_remote.conf (@fzinken: yeah, typo on my side, it’s named correctly on my pi’s…),

thus this posting…

What ever, it does work giving the connection data manually, so no big deal for me, especially having in mind that the OSMC team has to deal with other ‘customers’ at the moment yelling about somewhat ‘broken’ devices after the January update, and I don’t intend to chime in there :wink:

Nevermind, figured it out…

Two ‘bugs’ in /usr/bin/remote-cli:

  1. the python script expects another filename:
    Line 21 with open('/home/osmc/kodi_cli_remote.conf' , 'r') as f:

E_D_I_T: WRONG FROM HERE ON - FOR SOLUTION SEE NEXT POST

  1. the connection string inside that file must look like this (according to lines 12 to 18):
    {'ip': 'ip-address', 'port': '8080', 'user': 'username', 'pssw': 'password',}

Works as expected :slightly_smiling:

EDIT: screw that, it doesn’t :frowning:

I had put my connection data directly into the script (lines 12 to 18) and while testing further I forgot to revert that change… so, still no luck with the conf-file.

Ok, this is it:

/usr/bin/remote-cli:

Line 21:
another filename is expected ( kodi_cli_remote.conf)
instead of cli_remote.conf as stated in line 44

Line 24:
instead of
settings = json.load(single)
it has to be
settings = json.loads(single)
as there’s a string that has to be read and not a filestream anymore

Line 31:
instead of
{"ip": <your_ip>, "port": <your_port>, "user" : <your_user>, "pssw": <your_pass<
the line in kodi_cli_remote.conf must look like this:
{"ip": "your_ip", "port": "your_port", "user": "your_user", "pssw": "your_pass"}
f.e.
{"ip": "192.168.1.11", "port": "8080", "user": "xbmc", "pssw": "xbmc"}

Man, I should dig into Python, it looks nice :grinning:

Thanks for having a look at this.

The file is changed to /home/osmc/cli_remote.conf.

The file contents are described as {"ip": "your_ip", "port": "your_port", "user" : "your_user (optional)", "pssw": "your_pass (optional)"}

Also note, if you are using this script ON the device after SSH’ing into it, then you don’t need to pass it the IP address, the default 127.0.0.1 will work. The new way arguments are parsed will allow cli-remote p=8080 if you only want to change the port.

Similarly, the file could just contain {“port”: “8080”}, with the defaults used for the others.

Altogether, the on screen help reads,

Thank YOU (and this is the whole OSMC-Team, its communitiy and particularly Team Kodi!) for your efforts!

Just set up a Pi1 from scratch today utilizing a physical keyboard only till the point this remote-cli was available (connected to ethernet), since then using a ssh shell from my PC WITHOUT the need to hot-plug a keyboard, that sufficed to f.e. configure my WLAN (and anything else, keyboard unplugged from this point on!) really easy and fast while still using Kodi’s GUI!!
Really handy, I love it, tends to be ingenious!

Btw.: as I’m not familiar with Python and Json yet - was I right in stating that
settings = json.load(single)
was wrong and should have been replaced with
settings = json.loadS(single), as you didn’t mention that?

'cause I just had to read a bit (!?) about json.load() vs.jsons.load() before I decided to post this, so any statement might make me learn a little, whether it’s right or not…

Its odd, my version already had json.loads not json.load. Maybe the released version was a commit behind or something.

You can get the new version by going to MyOSMC - Updates - Manual Controls - Enter HotFix, and enter this code: osiqejusor

Thank you, sir!
Applied the hotfix and the config file now works as expected.

Could someone please clarify this, I’m getting to the command screen but nothing is registering, maybe I’m not putting in the right user or password?

Just need access to turn off master user as I don’t have a keyboard.

Thanks in advance!

What are you typing and what is being returned?

You need to ensure the http server is running in Settings → Services → Webserver → Allow control of Kodi via HTTP. The port, username and password are there too.