meshroom_external_plugins icon indicating copy to clipboard operation
meshroom_external_plugins copied to clipboard

Signal Notifications

Open gorenje opened this issue 2 years ago • 7 comments

Hi,

Thank you for providing so much background on how to build external plugins!

I noticed that you want to build a Telegram notification node which is a great idea. Since I'm a signal user, I built something that notifies me via signal and I thought I would let you know.

It's based on AsamK/signal-cli and is available here.

One thing I noticed was that it needs some input that is generated by the previous node (i.e. when the last node is completed, the notification is sent) else it gets triggered immediately. I used a file input since my last step generates a file output but it would be cleaner if it took any input as trigger - I didn't figure out how to do that.

Anyway, I hope this is of interest and thanks again for all the great work on Meshroom! :+1:

gorenje avatar Jul 17 '21 16:07 gorenje

Great to hear this Repository is of help for you! I didn´t have the time yet to finalize the Telegram node, so it is great you created a Signal node.

In: >commandLine = '/mnt/software/signal-cli-0.8.4.1/bin/signal-cli send {phonenumberValue} -m {messageValue}' you have a hardcoded path to the signal-cli.

To make it more versatile, you could replace it with a variable and let the user change the path if needed:

[commandLine = '{signalPathValue} send {phonenumberValue} -m {messageValue}' ... inputs = [ desc.File( name='signalPath', label='Signal CLI Path', description='''Path to Signal CLI.''', value=os.environ.get('Signal CLI',"/mnt/software/signal-cli-0.8.4.1/bin/signal-cli"), uid=[], group='', ),

(See PR1432 L36 for reference) Eventually we will have a Plugin Settings menu in Meshroom, where we could define those paths instead of within the nodes. https://github.com/alicevision/meshroom/pull/964

For the Input trigger, you could simply set the value to >value='', This will create a input that allows all kinds of input connectors from other nodes.

natowi avatar Jul 18 '21 08:07 natowi

Thank you for tips, I've made those changes.

I hope I got it right with uid=[0] --> I'm not really when I need to set that and when not. I.e. why verbose level has uid=[] and for phonenumber I'm using uid=[0] (which probably wrong!)

I had a look at https://github.com/natowi/meshroom_external_plugins/wiki/2-DevDoc is there some more documentation on defining inputs and outputs, and how to set dynamic values for outputs?

Cheers!

gorenje avatar Jul 18 '21 10:07 gorenje

Here is some more documentation: https://meshroom-manual.readthedocs.io/en/latest/feature-documentation/core/nodes.html

The uid argument is optional and controls if the parameter effects the node hash. The uid is not important in your case. It is used to mark settings that affect the output - [] has no impact on the uid, [0] has.

group='', - is not really needed here, I just copied an existing deskFile() snippet

You can check out the existing nodes for reference: https://github.com/alicevision/meshroom/tree/develop/meshroom/nodes/aliceVision

natowi avatar Jul 18 '21 13:07 natowi

Ok great, I've now updated and make a couple of changes:

  • I left the uid=[0] on the trigger since it seems to need if there is a connection to another node. Otherwise Meshroom errors out on a missing index error (for a mg file that had a connection)
  • I changed the type for the signal_cli_path parameter to being a string since then it's not shown (by default) as a connectable attribute in the graph editor (its only show in the attributes window)

I don't really know what to do next, do think it's worth making a PR to Meshroom? Or will there be a collection of external plugins like this one?

gorenje avatar Jul 19 '21 10:07 gorenje

Great, the issues you mentioned were my oversight.

This here is my "personal" collection of external plugins I like to share, as Meshroom does not have something like a plugin manager. I already have some ideas https://github.com/natowi/meshroom_external_plugins/wiki/Plugin-Manager-Draft but so far there was no need for a manager as there were so few external plugins. This may change.

You are welcome to open a PR in the Meshroom repository and we´ll see what the response is.

Maybe we can turn the node in a general purpose "Notification" node for Messengers (Signal, Telegram, Slack,...), Email and sound notification triggered by other nodes later on

natowi avatar Jul 19 '21 15:07 natowi

I've already got one PR open - which I find far more useful! I don't really want to spam the developers ;)

I'm inclined - if ok if you - just to leave this issue here and if other people find it interesting, then it can always be PR'ed into meshroom later.

gorenje avatar Jul 19 '21 16:07 gorenje

@gorenje It would be nice to create a "Notification" node with options to use Signal, Telegram, Email, etc.

fabiencastan avatar Oct 18 '21 12:10 fabiencastan