def OnShowCreated(show, sourceMessage): print "1. OnShowCreated" # for x in stories: # x.Name = "Show Test" # for y in storyItems: # OnStoryItemAdded(y, None, None) def OnShowDeleted(sourceMessage): print "2. OnShowDeleted" def OnStoryAdded(story, sourceMessage): print "3. OnStoryAdded" return try: #print "OuterXml {}".format(sourceMessage.OuterXml) stories = sourceMessage.GetElementsByTagName("story") if not stories or stories.Count == 0: return for st in stories: try: storyIdTags = st.GetElementsByTagName("storyID") if not storyIdTags or storyIdTags.Count == 0: continue if storyIdTags[0].InnerXml == story.MosId: storyNumTags = st.GetElementsByTagName("storyNum") if storyNumTags.Count == 0: continue story.Name = "{} - {}".format(str(storyNumTags[0].InnerXml), story.Name) print "STORY NAME OVERRIDEN:" + story.Name except Exception as e: print "MISSING ELEMENT %s"%e continue except Exception as e: print e def OnStoryUpdated(story, sourceMessage): print "4. OnStoryUpdated" return try: #story.Name = "Story Test" stories = sourceMessage.GetElementsByTagName("story") if not stories or stories.Count == 0: return for st in stories: try: storyIdTags = st.GetElementsByTagName("storyID") if not storyIdTags or storyIdTags.Count == 0: continue if storyIdTags[0].InnerXml == story.MosId: storyNumTags = st.GetElementsByTagName("storyNum") if storyNumTags.Count == 0: continue story.Name = "{} - {}".format(str(storyNumTags[0].InnerXml), story.Name) print "STORY NAME OVERRIDEN:" + story.Name except Exception as e: print "MISSING ELEMENT %s"%e continue except Exception as e: print e def OnStoryDeleted(eventArgs, studioServerApi): #print dir(eventArgs) stories = [] #for story in eventArgs.StoryIds: # print studioServerApi.LoadFromStoriesByMosId(story).Result print "5. OnStoryDeleted" def OnStoryMoved(story, sourceMessage): print "6. OnStoryMoved" def OnStoryItemAdded(storyItem, story, sourceMessage): print "7. OnStoryItemAdded" # storyItem.Name = "Mario_Story Item" # storyItem.Caption = "Mario_Story Item" def OnStoryItemUpdated(storyItem, story, sourceMessage): print "8. OnStoryItemUpdated" # storyItem.Name = "Mario_Story Item" # storyItem.Caption = "Mario_Story Item" def OnStoryItemRemoved(storyItem, story, sourceMessage): print "9. OnStoryItemRemoved" def OnShowMetadataReplaced(show, sourceMessage): print "10. OnShowMetadataReplaced"