Kodi Community Forum

Full Version: is it possible to send http commands from remote
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2
Thanks, this is quite useful.
I use a Cec remote, it only sends out basic functions. I currently use skip buttons while navigating to bring up context/and info.

I'm trying to take all the information from this thread all in. It would be nice if I can get the unused "pause" button to bring up a dialogue box with various options I could either use the options to run scripts or additional on screen keymaps that I havnt got room for.
Like updating library's etc.
have a look at this
http://forum.kodi.tv/showthread.php?tid=223773

when you launch favourites (opens favourite panel) you can then assign what button does once favourite panel is open. basically your using favourites like a control/shift key so it can almost double your keys and no programming needed or anything. I do this myself and its nice little speed dial
Thanks spoyser & MediaPi I've just had a look, a nice idea/ hack using the favourites for this function.
let me know if it works out for you (using the favourite thing)
if it interests you, you could do the same with the shutdown menu
<shutdownmenu>

I literally have 27 keys incorporated in 9 keys, cool right, but favourites will be enough

P.S. by the way the code for that hack was inspiried and done by Spoyser LOL the guy is a legend! dont tell him though he'll get a big head :p
Thanks I give it a go. I'm hoping to use this function eventually to control my lounge lights.

Completely unrelated but currently, I have my garden lights connected to a relay board on my old pi B. I have local switches in my garage but I have 2 way switched the lights to a cheap pi relay board.
So I generally just use a Android app to switch the relays/lights on and off. I'll probably have a little play see if I can switch my garden lights on from the Kodi menu.
Just for kicks and giggles Smile
nice Big Grin thats pretty sick invisable, let us know how it works out, sounds fun
invisible you prolly can with a win pc running eventghost thats what i wanted the way to hit the ?screen command its pointing to my pc to turn off the screen using kodi
(2015-06-28, 16:24)spoyser Wrote: [ -> ]
(2015-06-28, 15:03)jesterod Wrote: [ -> ]i cant figure out how to use that....

Code:
import xbmcgui
options = []
options.append("choice 0")
options.append("choice 1")
options.append("choice 2")
options.append("choice 3")
options.append("choice 4")
selection = xbmcgui.Dialog().select('Title', options)

if selection == 0:
    doChoice0()

elif selection == 1:
    doChoice1()

elif selection == 2:
    doChoice2()

elif selection == 3:
    doChoice3()

elif selection == 4:
    doChoice4()
where do i put the
Code:
urllib2.urlopen('http://192.168.1.103:8080/?screen')

EDIT:
nvm i figured it out thanks alot!!

any one know why when i press 5 i get no response but 8 works?
5 is just a test atm i made a different script for it and it wouldent do anything so i pointed it at a working script and still nothing
irw in shell shows the key being pressed and its mapped right in lirc
Code:
<five>XBMC.RunScript(/storage/Scripts/Screen.py</five>
<eight>XBMC.RunScript(/storage/Scripts/Screen.py)</eight>
(2015-06-29, 06:47)jesterod Wrote: [ -> ]
(2015-06-28, 16:24)spoyser Wrote: [ -> ]
(2015-06-28, 15:03)jesterod Wrote: [ -> ]i cant figure out how to use that....

Code:
import xbmcgui
options = []
options.append("choice 0")
options.append("choice 1")
options.append("choice 2")
options.append("choice 3")
options.append("choice 4")
selection = xbmcgui.Dialog().select('Title', options)

if selection == 0:
    doChoice0()

elif selection == 1:
    doChoice1()

elif selection == 2:
    doChoice2()

elif selection == 3:
    doChoice3()

elif selection == 4:
    doChoice4()
where do i put the
Code:
urllib2.urlopen('http://192.168.1.103:8080/?screen')

EDIT:
nvm i figured it out thanks alot!!

any one know why when i press 5 i get no response but 8 works?
5 is just a test atm i made a different script for it and it wouldent do anything so i pointed it at a working script and still nothing
irw in shell shows the key being pressed and its mapped right in lirc
Code:
<five>XBMC.RunScript(/storage/Scripts/Screen.py</five>
<eight>XBMC.RunScript(/storage/Scripts/Screen.py)</eight>

Do you have any other keymaps file?

Keymap files are applied in reverse alphabetical order so perhaps another keymap file is overriding yours.
only one remote file i changed it to cleanlibrary(video) and it works but it wont do the scripts
EDIT:
does the script need to have a certain name because i had it named Key5, Keyfive, and Key and all failed but i name it Screen and it works...
but still only with button 8
(2015-06-29, 09:06)jesterod Wrote: [ -> ]only one remote file i changed it to cleanlibrary(video) and it works but it wont do the scripts
EDIT:
does the script need to have a certain name because i had it named Key5, Keyfive, and Key and all failed but i name it Screen and it works...
but still only with button 8

Are you saying the 5 key works when bound to the cleanlibrary command but not a script? That would suggest the fault is either the path to the script or the contents is the script.

Try putting a simple print statement in the script (and nothing else) and see if it writes to the log.

Script can be called just about anything,
i thought the same thing thats why i pasted the same keybind from 8 onto 5 and only 8 would work so it was not the path... and theres no fault in the script because when i name it screen.py it works but again only on button 8
EDIT: i went back and looked at what i posted here and spotted my error i kept forgetting the )

so how would i send cleanlibrary(video) from the python script?
(2015-06-30, 01:55)jesterod Wrote: [ -> ]so how would i send cleanlibrary(video) from the python script?

import xbmc
xbmc.executebuiltin('cleanlibrary(video)')
thank you again lol
Pages: 1 2