Notice: This forum has been recovered from an old backup, so some content, links, and dates may be outdated. The forum is currently read-only while we restore sign-in and registration functionality. Details

If you find this forum valuable and would like to help keep it online, donations to help cover hosting and domain costs are greatly appreciated, but never expected. You can support the forum through Buy Me a Coffee or Ko-fi. Thank you for helping preserve the EventGhost community.

How do you know what to use in python script with plugins?

If you have a question or need help, this is the place to be.
Post Reply
eirik226
Experienced User
Posts: 142
Joined: Wed Nov 07, 2012 5:22 pm

How do you know what to use in python script with plugins?

Post by eirik226 »

Hey!

I've been trying to get a slider I have on my web server to control the volume of my Sonos.

Code: Select all

suffix = eg.event.suffix;
eg.globals.example='hejsan hoppsan';
try :
    volume = int(suffix[suffix.find(".")+1:]);
except Exception:
    volume = 0;
else:
    eg.plugins.Sonos.VolumeSet(volume, 0)
    eg.globals.masterVolumeStr = str(volume);
Now this is the part I am wondering about, you can call every plugin with a pyhon script - but how do you know what to use?

Code: Select all

eg.plugins.Sonos.VolumeSet(volume, 0)
Like this one - I understand that it's based on what actions the plugin actually has. But I can't figure out for example how I call the Sonos player ID.

I'm lacking "eg.plugins.Sonos.VolumeSet-SONOSPLAYERID(volume, 0)" here and can't figure out how to write it.

My examples are for the Sonos plugin - but my question is meant for all plugins - thanks in advance! :)
krambriw
Plugin Developer
Posts: 2570
Joined: Sat Jun 30, 2007 2:51 pm
Location: Stockholm, Sweden
Contact:

Re: How do you know what to use in python script with plugin

Post by krambriw »

OK, the trick is that

1) create a temporary macro with the action that you are looking for

2) right click the action and "copy as python"

3) Paste into your python script and you have the necessary python code

4) delete the temporary macro
eirik226
Experienced User
Posts: 142
Joined: Wed Nov 07, 2012 5:22 pm

Re: How do you know what to use in python script with plugin

Post by eirik226 »

Great! Thank you :) This really helped!
Post Reply