def play(): if request.method == 'POST': jsondata = request.data data = json.loads(jsondata) #Load the new status of the ticket from the JSON payload new_status = data['changelog']['items'][0]['toString'] if (new_status == 'Done'): # if user_id is passed in as URL param if (request.values.get('user_id', None)): u = request.values.get('user_id', None) #checks to see which team member it is. This could be improved. if (u == 'user.name'): try: applescript.launch_script(teammember_script) return "playing first teammember's song" except applescript.AppleScriptError: return "Something has gone wrong with Applescript" elif (u == 'user.name'): try: applescript.launch_script(teammember2_script) return "playing teammember2's song" except applescript.AppleScriptError: return "Something has gone wrong with Applescript" elif (u == 'user.name'): try: applescript.launch_script(teammember3_script) return "playing teammember3's song" except applescript.AppleScriptError: return "Something has gone wrong with Applescript" elif u in other_team_members: try: applescript.launch_script(all_script) return "playing the default song" except applescript.AppleScriptError: return "Something has gone wrong with Applescript" #check to see if user_id is empty elif u is None: return "there was no user specified when this ticket was updated" else: return "Status not Done, do nothing"
def bug(): try: applescript.launch_script(bug_script) return "playing the bug creation song" except applescript.AppleScriptError: return "Something has gone wrong with Applescript"
# of this software and associated documentation files (the "Software"), to deal # in the Software without restriction, including without limitation the rights # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell # copies of the Software, and to permit persons to whom the Software is # furnished to do so, subject to the following conditions: # # The above copyright notice and this permission notice shall be included in # all copies or substantial portions of the Software. # # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN # THE SOFTWARE. """ This example make your mac say "Hello World" """ import applescript if __name__ == '__main__': try: applescript.launch_script("""say "Hello World" """) except applescript.AppleScriptError: print "Oups! Somethings wrong happened"
# The above copyright notice and this permission notice shall be included in # all copies or substantial portions of the Software. # # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN # THE SOFTWARE. """ This example creates a file named "helloworld.txt" on your desktop. """ import applescript script = """set desktop_path to (path to desktop as text) try set new_file to (desktop_path & "helloworkd.txt") as alias on error tell application "Finder" to make new file at alias desktop_path with properties {name:"helloworld.txt", creator type:"R*ch", file type:"TEXT"} end try""" if __name__ == '__main__': try: applescript.launch_script(script) except applescript.AppleScriptError: print "Oups! Somethings wrong happened"
# # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal # in the Software without restriction, including without limitation the rights # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell # copies of the Software, and to permit persons to whom the Software is # furnished to do so, subject to the following conditions: # # The above copyright notice and this permission notice shall be included in # all copies or substantial portions of the Software. # # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN # THE SOFTWARE. """ This example make your mac say "Hello World" """ import applescript if __name__ == '__main__': try: applescript.launch_script("""say "Hello World" """) except applescript.AppleScriptError: print "Oups! Somethings wrong happened"