[RELEASE] Commands - Map multiple xbmc commands to one remote button

  Thread Rating:
  • 1 Vote(s) - 5 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Post Reply
AddonScriptorDE Offline
Skilled Python Coder
Posts: 767
Joined: May 2012
Reputation: 85
Location: Germany
Post: #46
(2013-12-18 17:10)isitmeor Wrote:  hi
how can I ad a py or sh script to this plugin
for example sh /storage/.config/vpn-config/openvpn.sh
tia
You can execute python scripts via RunScript(). But i'm not sure if .sh scripts are working.
You can find all available commands here...
find quote
isitmeor Offline
Senior Member
Posts: 141
Joined: May 2012
Reputation: 1
Post: #47
(2013-12-19 01:30)AddonScriptorDE Wrote:  
(2013-12-18 17:10)isitmeor Wrote:  hi
how can I ad a py or sh script to this plugin
for example sh /storage/.config/vpn-config/openvpn.sh
tia
You can execute python scripts via RunScript(). But i'm not sure if .sh scripts are working.
You can find all available commands here...

okay sh does not work, so I changed my script to a py script

as soon as i open this dialog box it
[Image: qaFyAYz.png]
This shows up in my log
12:46:01 T:140445192001344 ERROR: GetDirectory - Error getting plugin://script.commands/
12:46:01 T:140445192001344 ERROR: CGUIMediaWindow::GetDirectory(plugin://script.commands/) failed
(This post was last modified: 2013-12-22 14:06 by isitmeor.)
find quote
AddonScriptorDE Offline
Skilled Python Coder
Posts: 767
Joined: May 2012
Reputation: 85
Location: Germany
Post: #48
(2013-12-22 13:51)isitmeor Wrote:  
(2013-12-19 01:30)AddonScriptorDE Wrote:  
(2013-12-18 17:10)isitmeor Wrote:  hi
how can I ad a py or sh script to this plugin
for example sh /storage/.config/vpn-config/openvpn.sh
tia
You can execute python scripts via RunScript(). But i'm not sure if .sh scripts are working.
You can find all available commands here...

okay sh does not work, so I changed my script to a py script

as soon as i open this dialog box it
it... ?
Nothing happens when selecting the entry? Do you tested the script before? Could you try another script to help identify the problem?
Have you passed the full path to RunScript()?
(This post was last modified: 2014-01-05 02:39 by AddonScriptorDE.)
find quote
isitmeor Offline
Senior Member
Posts: 141
Joined: May 2012
Reputation: 1
Post: #49
(2014-01-05 02:38)AddonScriptorDE Wrote:  
(2013-12-22 13:51)isitmeor Wrote:  
(2013-12-19 01:30)AddonScriptorDE Wrote:  You can execute python scripts via RunScript(). But i'm not sure if .sh scripts are working.
You can find all available commands here...

okay sh does not work, so I changed my script to a py script

as soon as i open this dialog box it
it... ?
Nothing happens when selecting the entry? Do you tested the script before? Could you try another script to help identify the problem?
Have you passed the full path to RunScript()?
I will come back to this asap
find quote
sakos Offline
Senior Member
Posts: 138
Joined: Feb 2013
Reputation: 0
Post: #50
(2013-02-23 15:20)frank1119 Wrote:  I like this addon, but I wanted to execute commands defined with this addon directly from my RC, so I modified the script /home/pi/.xbmc/addons/script.commands/default.py

I added this

Code:
def executeFunc(key,func):
        importCommands(key)
        myCommandsTemp=[]
        for temp in myCommands:
          if temp.find(func+"###")>=0:
            command = temp[temp.find("###")+3:]
            if command.find("#")==-1:
              xbmc.executebuiltin(command)
            else:
              spl=command.split("#")
              for temp in spl:
                xbmc.executebuiltin(temp)

And I replaced

Code:
params=parameters_string_to_dict(sys.argv[2])
key=params.get('key')

if type(key)!=type(str()):
  key=''

if key != '':
    commandsMain('_'+key)
else:
    commandsMain('')

with

Code:
params=parameters_string_to_dict(sys.argv[2])
key=params.get('key')
func=params.get('func')
if type(key)!=type(str()):
  key=''
if type(func)!=type(str()):
  func=''

if func != '':
  if key != '':
      executeFunc('_'+key,func)
  else:
      executeFunc(''+key,func)
else:
  if key != '':
      commandsMain('_'+key)
  else:
      commandsMain('')

Now you can modify the keyboard.xml like this:

<one mod="ctrl,alt">RunPlugin(plugin://script.commands/?func=CycleSubs)</one>

I hope the original developer feels not offended... Blush

Hi,

I also applied this change to assign a remote key press directly to a combination of XBMC commands.
As I saw in this topic many other users need this functionality even if the original intention of this addon is different. I understand that there is a possibility to run scripts from XBMC however this looks too complex for a simple user who would like to acces two or three commands as a combined action.

I hope the author of this addon will appreciate this demand and include this change into the offical version.
find quote
AddonScriptorDE Offline
Skilled Python Coder
Posts: 767
Joined: May 2012
Reputation: 85
Location: Germany
Post: #51
(2014-01-11 16:22)sakos Wrote:  Hi,

I also applied this change to assign a remote key press directly to a combination of XBMC commands.
As I saw in this topic many other users need this functionality even if the original intention of this addon is different. I understand that there is a possibility to run scripts from XBMC however this looks too complex for a simple user who would like to acces two or three commands as a combined action.

I hope the author of this addon will appreciate this demand and include this change into the offical version.
Hi,
sure. I'll add it. Just totally forgot it...
find quote
matze2ooo Offline
Junior Member
Posts: 11
Joined: Oct 2013
Reputation: 0
Post: #52
Hi there

I am running XBMC on raspbmc (Raspberry Pi B) and have just installed the add-on. What I would like to achieve is remotly shutdown my Windows machine from the iOS XBMC remote control using the System.Exec function.

I am already able to remotly shutdown my machine via SSH by issuing: net rpc shutdown -I ip.address -U myuser%mypass. I first had to give the user myuser the remote shutdown privilege via gpedit.msc.

Anyhow, everytime I am trying to start the add-on from the iOS XBMC application the XBMC GUI freezes (I have added the add-on to the quick commands in the iOS remote). I did not yet came to the point where I was able to configure a specific command.

But the system itself keeps running. I do not see any processes going crazy on the device. I looks as if the add-on configuration screen is kind of "locking" the screen... hard to describe.

Any idea what I am doing wrong here? Thanks in advance!!!
(This post was last modified: 2014-09-04 23:08 by matze2ooo.)
find quote
LakersFan Offline
Senior Member
Posts: 296
Joined: Jan 2008
Reputation: 0
Post: #53
(2013-12-12 00:35)AddonScriptorDE Wrote:  SORRY! I totally forgot to look for this thread...

(2013-05-27 00:15)BenAtNVS Wrote:  
(2013-04-04 00:10)AddonScriptorDE Wrote:  [quote='BenAtNVS' pid='1385065' dateline='1364903351']
Thank you for this script.
I use the combination. I would wait until the first command before starting the second. is it possible? a timer perhaps?
(2013-04-02 16:31)evenzak Wrote:  I second that timer/wait idea. When I use combined commands like clean video library + run artwork downloader script, I would like to wait for the first command to complete before running the second command. If that isn't possible then a wait function or timer setting would be fantastic.
Yeah, great idea! I wanted to add this months ago but totally forgot it... Angel
Unfortunately its not possible to wait on a command to finish but i can implement a simple sleep command.


Something new ?Huh
Sorry, really forgot it. Will change some things on the addon this weekend.

I realize this thread is a few years old, but I just discovered it.Big Grin Did you ever get around to implementing this feature?
(This post was last modified: 2015-05-05 07:28 by LakersFan.)
find quote
invisable Offline
Senior Member
Posts: 174
Joined: Dec 2013
Reputation: 2
Post: #54
Many Thanks for this addon did you ever get around to adding the sleep command so that you could run combination scripts with a set delay between.

If not its no problem as I can create a python script that runs a Bash script on the pi quite easily.
Thanks again !!
find quote
opponent Offline
Junior Member
Posts: 5
Joined: Jul 2015
Reputation: 0
Post: #55
Hi Guys

I am new to Kodi and therefore need some help with this.

I would like to assign the back key on my remote to stop the video and than go back a level, similar to how it works on the apple tv

What do I configure the add-on, tried looking through the wiki but couldnt understand it
find quote
grossdm Offline
Junior Member
Posts: 14
Joined: Apr 2015
Reputation: 1
Location: Indiana (It's between Illinois and Ohio)
Tongue  RE: [RELEASE] Commands - Map multiple xbmc commands to one remote button
Post: #56
(2015-07-22 09:25)opponent Wrote:  Hi Guys

I am new to Kodi and therefore need some help with this.

I would like to assign the back key on my remote to stop the video and than go back a level, similar to how it works on the apple tv

What do I configure the add-on, tried looking through the wiki but couldnt understand it

Hey opponent,

I feel that I am not new to Kodi, but I am still learning.
For example, I've edited various XML files to get what I want from Kodi - including keymaps.

So far I can't figure out this addon, either.

It looks like it's been abandoned, so perhaps it's best to not use it.
find quote
simon261 Offline
Junior Member
Posts: 1
Joined: Nov 2016
Reputation: 0
Post: #57
(2012-06-16 18:08)AddonScriptorDE Wrote:  Hi,
i have less and less space left on my remote and could not always remember which key a command/script is mapped to.
With Commands you can map multiple xbmc commands to one remote button. Add popular commands from a list, any command from your favorites or enter a custom one.
A list of all available commands: http://wiki.xbmc.org/?title=List_of_Built_In_Functions

To use it you have to Woodcut Maps the following command to a remote key:
Code:
RunPlugin(plugin://script.commands)

If you want to map further keys with Commands, use this:
Code:
RunPlugin(plugin://script.commands/?key=ANYNAME)
ANYNAME - Choose whatever you want (Just for identification)

You can install the add-on from the xbmc.org eden repo (Program add-ons).
Please post further useful commands, so i can add them to the "command list".

[Image: screenshot010jbu7p.jpg]

Hi Addon,
I like the game its truly awesome. All they are amazing. Keep updating and entertaining us.
find quote
milkman dan Offline
Junior Member
Posts: 26
Joined: Sep 2012
Reputation: 0
Post: #58
So I am trying to get this to work so I can add popup notifications to keypresses with the Pandoki add-on (http://forum.kodi.tv/showthread.php?tid=205547)

Basically, when I thumbs up/down a song, I want to see a notification popup that verifies it. So I made a "enter command" did this in the scripts.command:

up###RunPlugin(plugin://plugin.audio.pandoki/?rate=up)#Notification(Pandora, Thumbs Up!, 5)

Then in my keyboard.xml I've got this:

<visualisation>
<keyboard>
<d>RunPlugin(plugin://script.commands/?key=up)</d>
</keyboard>
</visualisation>

I think I'm close. I get a popup window offering me "up" and if I click it, it does thumbs up it and show the notification. Just wondering if it can be set to do that automatically (no pop up)?

Any help is appreciated. And thanks for the great add-on.
find quote
pcextreme Offline
Junior Member
Posts: 1
Joined: May 2017
Reputation: 0
Post: #59
(2013-02-23 15:20)frank1119 Wrote:  I like this addon, but I wanted to execute commands defined with this addon directly from my RC, so I modified the script /home/pi/.xbmc/addons/script.commands/default.py

I added this

Code:
def executeFunc(key,func):
        importCommands(key)
        myCommandsTemp=[]
        for temp in myCommands:
          if temp.find(func+"###")>=0:
            command = temp[temp.find("###")+3:]
            if command.find("#")==-1:
              xbmc.executebuiltin(command)
            else:
              spl=command.split("#")
              for temp in spl:
                xbmc.executebuiltin(temp)

And I replaced

Code:
params=parameters_string_to_dict(sys.argv[2])
key=params.get('key')

if type(key)!=type(str()):
  key=''

if key != '':
    commandsMain('_'+key)
else:
    commandsMain('')

with

Code:
params=parameters_string_to_dict(sys.argv[2])
key=params.get('key')
func=params.get('func')
if type(key)!=type(str()):
  key=''
if type(func)!=type(str()):
  func=''

if func != '':
  if key != '':
      executeFunc('_'+key,func)
  else:
      executeFunc(''+key,func)
else:
  if key != '':
      commandsMain('_'+key)
  else:
      commandsMain('')

Now you can modify the keyboard.xml like this:

<one mod="ctrl,alt">RunPlugin(plugin://script.commands/?func=CycleSubs)</one>

I hope the original developer feels not offended... Blush

Big thanx to the developer and frank1119 for this patch! This addon is a lifesaver!
find quote
Post Reply