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
hi i would like to be able to send an url command to my pc from kodi i was wondering if its possible to map a key press to send http://192.168.1.103:8080/?screen with out anything els showing on kodi's end because that command puts my pc's screen in to sleep mode and a keypress would be prefect i found a way to map it to my fav but its not the best way because its trying to open a music folder at that location and end up opening a blank folder
Use WOL (Wake On LAN) http://kodi.wiki/view/Wake_on_lan

There are also several addons for it, including at least one advanced http://kodi.wiki/view/Add-on:Advanced_Wake_On_Lan

http://forum.kodi.tv/showthread.php?tid=121142
Apologies if I've missed the point but I don't think the WOL is the solution here.

There may be a simpler way of doing it, but I'd probably just write a very short python addon that calls that address. You can then map that addon to a key press.

There may even be an addon already that does this for you.
python addon sounds more like what i need but i have no idea where to start there and i have no python scriping skills (ive tryed)
(2015-06-25, 16:38)jesterod Wrote: [ -> ]python addon sounds more like what i need but i have no idea where to start there and i have no python scriping skills (ive tryed)
Is that a "please could you do it for me?"

Shouldn't take too long, but I probably won't have a chance until the weekend.
(2015-06-25, 23:03)el_Paraguayo Wrote: [ -> ]
(2015-06-25, 16:38)jesterod Wrote: [ -> ]python addon sounds more like what i need but i have no idea where to start there and i have no python scriping skills (ive tryed)
Is that a "please could you do it for me?"

Shouldn't take too long, but I probably won't have a chance until the weekend.

lol yes please but i also was searching on the addons area the ony ones i saw that might have worked where advanced launcher and command but i didnt get to try them yet had to go to bed and then to work
Addon is probably overkill, you can just use a simple script.

In a keymap file you put something like:


Code:
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<keymap>
    <Global>
        <keyboard>
            <c>XBMC.RunScript(special://home/my_script.py)</c>
        </keyboard>
    </Global>
</keymap>

This will trigger your code off the c key

Then have a file called my_script.py in the kodi home folder and in there put the code you want:

Code:
import urllib2
urllib2.urlopen('http://192.168.1.103:8080/?screen')
Yes. Much neater solution!

Depending on whether you have any other commands you want to run, you may want your script to accept arguments so you can bind different addresses to different keys while using the same script.
(2015-06-26, 10:34)el_Paraguayo Wrote: [ -> ]Yes. Much neater solution!

Depending on whether you have any other commands you want to run, you may want your script to accept arguments so you can bind different addresses to different keys while using the same script.

Indeed, I use exactly that approach to implement "changing tv channel" type functionality when playing live streams.
i cant get it to work i made a new folder in the storage area named it scripts and put the .py in it and put
Code:
<eight>XBMC.RunScript(special://home/scripts/Screen.py)</eight>
      </remote>
but its not doing anything

EDIT:
i fixed it i changed it to
Code:
<eight>XBMC.RunScript(/storage/Scripts/Screen.py)</eight>
      </remote>
and it works now thanks alot!!!

also how would one make the script accept arguments or give it click able options i use a remote for control an xbox dvd kit to be exact lol i started using kodi one the first gen xbox and just cant find a better remote i use the numbers for alot of things tho
Code:
<three>VolumeUp</three>
      <six>VolumeDown</six>
      <nine>Mute</nine>
      <zero>Screenshot</zero>
      <one>Queue</one>
      <two>XBMC.ActivateWindow(ShutdownMenu)</two>
      <four>ToggleWatched</four>
      <five>JumpSMS5</five>
      <seven>Delete</seven>
      <eight>XBMC.RunScript(/storage/Scripts/Screen.py)</eight>
Pass the parameter as a string like so:

Code:
<eight>XBMC.RunScript(/storage/Scripts/Screen.py,eight)</eight>
<nine>XBMC.RunScript(/storage/Scripts/Screen.py,nine)</nine>

Then in your script:

Code:
param = ''

if len(sys.argv) > 1:
    param = sys.argv[1]

if param == 'eight':
    doEight()

elif param == 'nine'
    doNine()

else:
    doNoParam()
ah i figured i would just make a new script for each key
i only have 2 free keys on the remote and thats if i remove mute(not that i use it really)
and thats 5 and 9
any way to make an onscreen popup that has selectable options?
(2015-06-26, 18:48)jesterod Wrote: [ -> ]ah i figured i would just make a new script for each key
i only have 2 free keys on the remote and thats if i remove mute(not that i use it really)
and thats 5 and 9
any way to make an onscreen popup that has selectable options?

You could bring up a select dialog in your script, and call different methods depending on the selection see here;

http://mirrors.xbmc.org/docs/python-docs...log-select
i cant figure out how to use that....
(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()
Pages: 1 2