Untitled

From Smelly Penguin, 2 Weeks ago, written in Plain Text, viewed 2 times. This paste will explode in 1 Week.
URL https://paste.afonso.co/view/28d13d19 Embed
Download Paste or View Raw
  1. import clr
  2. clr.AddReference("Wtvision.Tools.Graphics")
  3. from Wtvision.Tools.Graphics import GraphicTemplateTimeline
  4.  
  5. import Wtvision.Sports.Extensions
  6. clr.ImportExtensions(Wtvision.Sports.Extensions)  
  7. from Wtvision.Clock.Interfaces import ClockTools
  8. from Wtvision.Clock.Enums import EClockMask
  9.  
  10. from System import TimeSpan
  11. import helper
  12.  
  13.  
  14. def __onStart(graphicOnAirItem, momentExecution, workFlowtype):
  15.         if not GameOnline.IsOnAir:
  16.                 momentExecution.Message = "Online isn't On Air!"
  17.                 momentExecution.Cancel = True
  18.                 return
  19.        
  20.         # Validate Extra Time before launching the graphic
  21.  
  22.         if not GameOnline.AdditionalTime or GameOnline.AdditionalTime <= 0:
  23.                 momentExecution.Message = "Extra Time is 0!"
  24.                 momentExecution.Cancel = True
  25.                 return
  26.                
  27.         teamCompOnAir = helper.getGraphics(IntelliflowController, GraphicTemplatesManager, OutputManager, "2 Team Compare", "23PT_LigaPortugal_LigaBetclic/ScoreBug", True)
  28.         if teamCompOnAir:
  29.                 momentExecution.Message = "Team Stats On Air!"
  30.                 momentExecution.Cancel = True
  31.                 return
  32.        
  33.         if Globals["OnlineLTOnAir"]:
  34.                 momentExecution.Message = "LowerThird On Air!"
  35.                 momentExecution.Cancel = True
  36.                 return
  37.        
  38.         playerIDOnAir = helper.getGraphics(IntelliflowController, GraphicTemplatesManager, OutputManager, "Player ID", "23PT_LigaPortugal_LigaBetclic/ScoreBug", True)
  39.         if playerIDOnAir:
  40.                 momentExecution.Message = "Player Stats On Air!"
  41.                 momentExecution.Cancel = True
  42.                 return
  43.        
  44.         if Globals["OnlineSubstitutionOnAir"]:
  45.                 momentExecution.Message = "Substitution On Air!"
  46.                 momentExecution.Cancel = True
  47.                 return False
  48.        
  49.         if GameOnline.Clock.ExtraTime <= TimeSpan.Zero:
  50.                 momentExecution.Message = "Only show graphic on end of the part!"
  51.                 momentExecution.Cancel = True
  52.                 return
  53.  
  54.  
  55. def __getData(graphicOnAirItem, viewBag, momentExecution):
  56.         if GameOnline.AdditionalTime:
  57.                 minutes = GameOnline.AdditionalTime.ToString()
  58.                 print minutes
  59.                
  60.                 #TOOK THE APOSTROPHE OUT##
  61.                 viewBag.SetString("tExtraTime", minutes)
  62.                 viewBag.SetTranslatedText("tPlusExtraTime", "{{Adicional time symbol}}.{{Online - ExtraTime}}|filter:ToUpper ")
  63.         else:
  64.                 viewBag.SetString("tExtraTime", "")
  65.                 viewBag.SetString("tPlusExtraTime", "")
  66.  
  67.         clock = GameOnline.Clock
  68.         time = clock.ElapsedTime - clock.ActivePart.EndAt
  69.         if time.Minutes < 10:
  70.                 timeStr = time.ToString("m\:ss")
  71.         else:
  72.                 timeStr = ClockTools.FormatTime(time, EClockMask.MMMSS)
  73.         viewBag.SetString("tTime", timeStr)
  74.  
  75.  
  76. def __updateTitles(viewBag):
  77.         if not GameOnline.AdditionalTime:
  78.                 #Core.StatusManager.Add("There's no valid value for extra minutes!")
  79.                 return
  80.        
  81.         if GameOnline.Clock.ExtraTime <= TimeSpan.Zero:
  82.                 return
  83.                
  84.         minutes = GameOnline.AdditionalTime.ToString()
  85.  
  86.         #viewData.SetString("SubTitle", minutes)
  87.         viewBag.SetString("Title",  "+%s minutes"% minutes )
  88.  
  89.  
  90. def __beforeProgram(graphicOnAirItem, momentExecution):
  91.         Project.EventsManager.UnsubscribeEvent("GameOnline.ClockTimeChanged", Script.Id)
  92.        
  93.         Project.EventsManager.SubscribeEvent("GameOnline.ClockTimeChanged", Script.Id, "__onClockTimeChanged", True)
  94.  
  95.  
  96. def __afterProgramOut(graphicOnAirItem, momentExecution):
  97.         Project.EventsManager.UnsubscribeEvent("GameOnline.ClockTimeChanged", Script.Id)
  98.  
  99.  
  100. def __onClockTimeChanged(source, args):
  101.         if GameOnline.IsOnAir:
  102.                 graphic = GraphicTemplatesManager.GetGraphicByName(Script.Name)
  103.                 graphicsOnAir = IntelliflowController.GetGraphicOnAirItems(graphic.Name, OutputManager.ActiveChannelOutput)
  104.  
  105.                 if not graphicsOnAir or graphicsOnAir.Count <= 0:
  106.                         return
  107.                        
  108.                 clock = GameOnline.Clock
  109.                 time = clock.ElapsedTime - clock.ActivePart.EndAt
  110.                 if time.Minutes < 10:
  111.                         timeStr = time.ToString("m\:ss")
  112.                 else:
  113.                         timeStr = ClockTools.FormatTime(time, EClockMask.MMMSS)
  114.                
  115.                
  116.                 viewBag = IntelliflowController.CreateViewBag()
  117.                 viewBag.SetString("tTime", timeStr)
  118.        
  119.                 for render in graphicsOnAir:
  120.                         render.Scene.FillTags(viewBag)
  121.  
  122.  
  123.  

Reply to "Untitled"

Here you can reply to the paste above