The user creates/defines the Trigger instances in Indigo (which exposes your "Video Download Complete" trigger type in the UI). Normal flow then is to define both of these to track when Triggers are active/enabled in Indigo's UI:
- Code: Select all
def triggerStartProcessing(self, trigger):
if trigger.pluginTypeId == "videoDownloadCompleteEvent":
self.activeDownloadCompleteTriggers[trigger.id] = trigger
def triggerStopProcessing(self, trigger):
if trigger.pluginTypeId == "videoDownloadCompleteEvent":
del self.activeDownloadCompleteTriggers[trigger.id]
Then internally when a download is complete you can traverse your
self.activeDownloadCompleteTriggers dict and call
indigo.trigger.execute() on each value (trigger). So basically, you manage which triggers you are interested in manually and then execute them whenever those trigger conditions are internally met in the plugin (download complete in this case). You can store all of your plugin triggers in a single list/dict and figure out which ones "match" the given event, or have specific list/dicts for each trigger type (model I illustrated above).