Untitled

From Reliable Human, 23 Hours ago, written in Plain Text, viewed 2 times. This paste will run down the curtain in 3 Weeks.
URL https://paste.afonso.co/view/7e6f0284 Embed
Download Paste or View Raw
  1. def OnShowCreated(show, sourceMessage):
  2.     print "1. OnShowCreated"
  3.     # for x in stories:
  4.     #     x.Name = "Show Test"
  5.        
  6.     # for y in storyItems:
  7.     #     OnStoryItemAdded(y, None, None)
  8.  
  9. def OnShowDeleted(sourceMessage):
  10.     print "2. OnShowDeleted"
  11.  
  12. def OnStoryAdded(story, sourceMessage):
  13.     print "3. OnStoryAdded"
  14.     return
  15.     try:
  16.         #print "OuterXml {}".format(sourceMessage.OuterXml)
  17.  
  18.         stories = sourceMessage.GetElementsByTagName("story")
  19.         if not stories or stories.Count == 0:
  20.             return
  21.  
  22.         for st in stories:
  23.             try:
  24.                 storyIdTags = st.GetElementsByTagName("storyID")
  25.                 if not storyIdTags or storyIdTags.Count == 0:
  26.                     continue
  27.                 if storyIdTags[0].InnerXml == story.MosId:
  28.                     storyNumTags = st.GetElementsByTagName("storyNum")
  29.                     if storyNumTags.Count == 0:
  30.                         continue
  31.                     story.Name = "{} - {}".format(str(storyNumTags[0].InnerXml), story.Name)
  32.                     print "STORY NAME OVERRIDEN:" + story.Name
  33.             except Exception as e:
  34.                 print "MISSING ELEMENT %s"%e
  35.                 continue
  36.     except Exception as e:
  37.         print e
  38.  
  39.  
  40.  
  41. def OnStoryUpdated(story, sourceMessage):
  42.     print "4. OnStoryUpdated"
  43.     return
  44.     try:
  45.         #story.Name = "Story Test"
  46.         stories = sourceMessage.GetElementsByTagName("story")
  47.         if not stories or stories.Count == 0:
  48.             return
  49.  
  50.         for st in stories:
  51.             try:
  52.                 storyIdTags = st.GetElementsByTagName("storyID")
  53.                 if not storyIdTags or storyIdTags.Count == 0:
  54.                     continue
  55.                 if storyIdTags[0].InnerXml == story.MosId:
  56.                     storyNumTags = st.GetElementsByTagName("storyNum")
  57.                     if storyNumTags.Count == 0:
  58.                         continue
  59.                     story.Name = "{} - {}".format(str(storyNumTags[0].InnerXml), story.Name)
  60.                     print "STORY NAME OVERRIDEN:" + story.Name
  61.             except Exception as e:
  62.                 print "MISSING ELEMENT %s"%e
  63.                 continue
  64.     except Exception as e:
  65.         print e
  66.  
  67.  
  68. def OnStoryDeleted(eventArgs, studioServerApi):
  69.    
  70.     #print dir(eventArgs)
  71.    
  72.     stories = []
  73.     #for story in eventArgs.StoryIds:
  74.     #   print studioServerApi.LoadFromStoriesByMosId(story).Result
  75.        
  76.        
  77.    
  78.     print "5. OnStoryDeleted"
  79.  
  80. def OnStoryMoved(story, sourceMessage):
  81.     print "6. OnStoryMoved"
  82.  
  83. def OnStoryItemAdded(storyItem, story, sourceMessage):
  84.     print "7. OnStoryItemAdded"  
  85.     # storyItem.Name = "Mario_Story Item"
  86.     # storyItem.Caption = "Mario_Story Item"
  87.  
  88. def OnStoryItemUpdated(storyItem, story, sourceMessage):
  89.     print "8. OnStoryItemUpdated"
  90.     # storyItem.Name = "Mario_Story Item"
  91.     # storyItem.Caption = "Mario_Story Item"
  92.  
  93. def OnStoryItemRemoved(storyItem, story, sourceMessage):
  94.     print "9. OnStoryItemRemoved"
  95.  
  96. def OnShowMetadataReplaced(show, sourceMessage):
  97.     print "10. OnShowMetadataReplaced"
  98.  
  99.  
  100.  

Reply to "Untitled"

Here you can reply to the paste above