python recognized name of plugins?

Posted on
Sun Feb 26, 2017 6:07 am
Professor Falken offline
User avatar
Posts: 296
Joined: Mar 29, 2015

python recognized name of plugins?

Where do I find the "official" name of an installed plugin?

I mean the one I would use in a script like this:

Code: Select all
plugin = indigo.server.getPlugin("com.flyingdiver.indigoplugin.harmonyhub")
if plugin.isEnabled():
   plugin.restart()


I am looking to put some buttons on my control pages that reload plugins, and I found the above script that does that on the forum, but I can't figure out where to look for the correct name of the plugin to put in the script.

Thanks

Posted on
Sun Feb 26, 2017 7:25 am
FlyingDiver offline
Posts: 3614
Joined: Jun 07, 2014
Location: Southwest Florida, USA

Re: python recognized name of plugins?

In the Info.plist file inside the plugin bundle, in this section:

Code: Select all
    <key>CFBundleIdentifier</key>
    <string>com.flyingdiver.indigoplugin.myq</string>


Some will be specified in the plugin documentation as well.

joe (aka FlyingDiver)
my plugins: http://forums.indigodomo.com/viewforum.php?f=177

Posted on
Sun Feb 26, 2017 9:09 am
Professor Falken offline
User avatar
Posts: 296
Joined: Mar 29, 2015

Re: python recognized name of plugins?

Perfect.

Thanks a lot.

Posted on
Sun Feb 26, 2017 1:31 pm
DaveL17 offline
User avatar
Posts: 5102
Joined: Aug 20, 2013
Location: Chicago, IL, USA

Re: python recognized name of plugins?

@Autolog wrote a script that will list them all:

Code: Select all
import os
import plistlib

plugin_name_list = []
indigo_install_path = indigo.server.getInstallFolderPath()
plugin_folders = ['Plugins', 'Plugins (Disabled)']

for plugin_folder in plugin_folders:
    plugins_list = os.listdir(indigo_install_path + '/' + plugin_folder)

    for plugin in plugins_list:

        # Check for Indigo Plugins and exclude 'system' plugins
        if (plugin.lower().endswith('.indigoplugin')) and (not plugin[0:1] == '.'):

            # retrieve plugin Info.plist file
            pl = plistlib.readPlist(u"{0}/{1}/{2}/Contents/Info.plist".format(indigo_install_path, plugin_folder, plugin))
            cf_bundle_identifier = pl["CFBundleIdentifier"]

            # Don't include self (i.e. this plugin) in the plugin list
            cf_bundle_display_name = pl["CFBundleDisplayName"]

            # if disabled plugins folder, append 'Disabled' to name
            if plugin_folder == 'Plugins (Disabled)':
                cf_bundle_display_name += ' [Disabled]'

            plugin_name_list.append((cf_bundle_identifier, cf_bundle_display_name))

indigo.server.log(u"{0:=^80}".format(u" Installed Plugins "))
for thing in plugin_name_list:
    indigo.server.log(u'{0}'.format(thing))

I came here to drink milk and kick ass....and I've just finished my milk.

[My Plugins] - [My Forums]

Posted on
Sun Feb 26, 2017 5:40 pm
Professor Falken offline
User avatar
Posts: 296
Joined: Mar 29, 2015

Re: python recognized name of plugins?

Oh, that is really cool. Thanks.

Page 1 of 1

Who is online

Users browsing this forum: MSN [Bot] and 1 guest