forked from rodeofx/shotgunEvents
-
Notifications
You must be signed in to change notification settings - Fork 122
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
For #45533, addressed PR comments (moved plugins to examples folder).
- Loading branch information
Raphael Matto
committed
Jan 3, 2018
1 parent
2725875
commit b8c14f7
Showing
78 changed files
with
198 additions
and
185 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
# logArgs.py | ||
|
||
This is an EXAMPLE PLUGIN. | ||
|
||
Use this plugin to determin if the Shotgun Event Daemon has been successfully | ||
installed. It will log all events in Shotgun by spitting out the event | ||
dictionary. | ||
|
||
## Args | ||
|
||
No settings. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
# sharedStateA.py | ||
|
||
This is an EXAMPLE PLUGIN. | ||
|
||
Global variable shared state. | ||
|
||
This plugin demoes how three callbacks can share state through a global variable. | ||
|
||
The shared state stores two counters one (sequential) will be incremented | ||
sequentially by each callback and will keep incrementing across event ids. | ||
|
||
The second counter (rotating) will be incremented by each successive callback | ||
but will be reset at each new event. | ||
|
||
## Args | ||
|
||
No settings. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
# sharedStateB.py | ||
|
||
This is an EXAMPLE PLUGIN. | ||
|
||
Args based shared state. | ||
|
||
This plugin demoes how three callbacks can share state through the args argument | ||
to registerCallback. | ||
|
||
The shared state stores two counters one (sequential) will be incremented | ||
sequentially by each callback and will keep incrementing across event ids. | ||
|
||
The second counter (rotating) will be incremented by each successive callback | ||
but will be reset at each new event. | ||
|
||
## Args | ||
|
||
No settings. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
# sharedStateC.py | ||
|
||
This is an EXAMPLE PLUGIN. | ||
|
||
Object based shared state. | ||
|
||
This example aims to show that you can store state in callable object instances. | ||
|
||
The shared state stores two counters one (sequential) will be incremented | ||
sequentially by each callback and will keep incrementing across event ids. | ||
|
||
The second counter (rotating) will be incremented by each successive callback | ||
but will be reset at each new event. | ||
|
||
## Args | ||
|
||
No settings. |
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,51 +1,64 @@ | ||
""" | ||
For detailed information please see | ||
# Copyright 2018 Autodesk, Inc. All rights reserved. | ||
# | ||
# Use of this software is subject to the terms of the Autodesk license agreement | ||
# provided at the time of installation or download, or which otherwise accompanies | ||
# this software in either electronic or hard copy form. | ||
# | ||
|
||
http://shotgunsoftware.github.com/shotgunEvents/api.html | ||
""" | ||
# See docs folder for detailed usage info. | ||
|
||
import os | ||
import logging | ||
|
||
|
||
def registerCallbacks(reg): | ||
"""Register all necessary or appropriate callbacks for this plugin.""" | ||
""" | ||
Register all necessary or appropriate callbacks for this plugin. | ||
""" | ||
|
||
# Specify who should recieve email notifications when they are sent out. | ||
# | ||
#reg.setEmails('me@mydomain.com') | ||
# reg.setEmails('me@mydomain.com') | ||
|
||
# Use a preconfigured logging.Logger object to report info to log file or | ||
# Use a preconfigured logging.Logger object to report info to a log file or | ||
# email. By default error and critical messages will be reported via email | ||
# and logged to file, all other levels are logged to file. | ||
# and logged to file, all other levels are logged to a file. | ||
# | ||
#reg.logger.debug('Loading logArgs plugin.') | ||
# reg.logger.debug('Loading logArgs plugin.') | ||
|
||
# Register a callback to into the event processing system. | ||
# | ||
# Arguments: | ||
# - Shotgun script name | ||
# - Shotgun script key | ||
# - Callable | ||
# - Argument to pass through to the callable | ||
# - A filter to match events to so the callable is only invoked when | ||
# appropriate | ||
# - Argument to pass through to the callable | ||
# | ||
#eventFilter = {'Shotgun_Task_Change': ['sg_status_list']} | ||
# eventFilter = {'Shotgun_Task_Change': ['sg_status_list']} | ||
eventFilter = None | ||
reg.registerCallback('$DEMO_SCRIPT_NAME$', '$DEMO_API_KEY$', logArgs, eventFilter, None) | ||
reg.registerCallback( | ||
os.environ["SGDAEMON_LOGARGS_NAME"], | ||
os.environ["SGDAEMON_LOGARGS_KEY"], | ||
logArgs, | ||
eventFilter, | ||
None, | ||
) | ||
|
||
# Set the logging level for this particular plugin. Let error and above | ||
# messages through but block info and lower. This is particularly usefull | ||
# Set the logging level for this particular plugin. Let debug and above | ||
# messages through (don't block info, etc). This is particularly usefull | ||
# for enabling and disabling debugging on a per plugin basis. | ||
reg.logger.setLevel(logging.ERROR) | ||
reg.logger.setLevel(logging.DEBUG) | ||
|
||
|
||
def logArgs(sg, logger, event, args): | ||
""" | ||
A callback that logs its arguments. | ||
@param sg: Shotgun instance. | ||
@param logger: A preconfigured Python logging.Logger object | ||
@param event: A Shotgun event. | ||
@param args: The args passed in at the registerCallback call. | ||
:param sg: Shotgun API handle. | ||
:param logger: Logger instance. | ||
:param event: A Shotgun EventLogEntry entity dictionary. | ||
:param args: Any additional misc arguments passed through this plugin. | ||
""" | ||
logger.info("%s" % str(event)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.