import clr clr.AddReference("Wtvision.Tools.Graphics") from Wtvision.Tools.Graphics import GraphicTemplateTimeline import Wtvision.Sports.Extensions clr.ImportExtensions(Wtvision.Sports.Extensions) from Wtvision.Clock.Interfaces import ClockTools from Wtvision.Clock.Enums import EClockMask from System import TimeSpan import helper def __onStart(graphicOnAirItem, momentExecution, workFlowtype): if not GameOnline.IsOnAir: momentExecution.Message = "Online isn't On Air!" momentExecution.Cancel = True return # Validate Extra Time before launching the graphic if not GameOnline.AdditionalTime or GameOnline.AdditionalTime <= 0: momentExecution.Message = "Extra Time is 0!" momentExecution.Cancel = True return teamCompOnAir = helper.getGraphics(IntelliflowController, GraphicTemplatesManager, OutputManager, "2 Team Compare", "23PT_LigaPortugal_LigaBetclic/ScoreBug", True) if teamCompOnAir: momentExecution.Message = "Team Stats On Air!" momentExecution.Cancel = True return if Globals["OnlineLTOnAir"]: momentExecution.Message = "LowerThird On Air!" momentExecution.Cancel = True return playerIDOnAir = helper.getGraphics(IntelliflowController, GraphicTemplatesManager, OutputManager, "Player ID", "23PT_LigaPortugal_LigaBetclic/ScoreBug", True) if playerIDOnAir: momentExecution.Message = "Player Stats On Air!" momentExecution.Cancel = True return if Globals["OnlineSubstitutionOnAir"]: momentExecution.Message = "Substitution On Air!" momentExecution.Cancel = True return False if GameOnline.Clock.ExtraTime <= TimeSpan.Zero: momentExecution.Message = "Only show graphic on end of the part!" momentExecution.Cancel = True return def __getData(graphicOnAirItem, viewBag, momentExecution): if GameOnline.AdditionalTime: minutes = GameOnline.AdditionalTime.ToString() print minutes #TOOK THE APOSTROPHE OUT## viewBag.SetString("tExtraTime", minutes) viewBag.SetTranslatedText("tPlusExtraTime", "{{Adicional time symbol}}.{{Online - ExtraTime}}|filter:ToUpper ") else: viewBag.SetString("tExtraTime", "") viewBag.SetString("tPlusExtraTime", "") clock = GameOnline.Clock time = clock.ElapsedTime - clock.ActivePart.EndAt if time.Minutes < 10: timeStr = time.ToString("m\:ss") else: timeStr = ClockTools.FormatTime(time, EClockMask.MMMSS) viewBag.SetString("tTime", timeStr) def __updateTitles(viewBag): if not GameOnline.AdditionalTime: #Core.StatusManager.Add("There's no valid value for extra minutes!") return if GameOnline.Clock.ExtraTime <= TimeSpan.Zero: return minutes = GameOnline.AdditionalTime.ToString() #viewData.SetString("SubTitle", minutes) viewBag.SetString("Title", "+%s minutes"% minutes ) def __beforeProgram(graphicOnAirItem, momentExecution): Project.EventsManager.UnsubscribeEvent("GameOnline.ClockTimeChanged", Script.Id) Project.EventsManager.SubscribeEvent("GameOnline.ClockTimeChanged", Script.Id, "__onClockTimeChanged", True) def __afterProgramOut(graphicOnAirItem, momentExecution): Project.EventsManager.UnsubscribeEvent("GameOnline.ClockTimeChanged", Script.Id) def __onClockTimeChanged(source, args): if GameOnline.IsOnAir: graphic = GraphicTemplatesManager.GetGraphicByName(Script.Name) graphicsOnAir = IntelliflowController.GetGraphicOnAirItems(graphic.Name, OutputManager.ActiveChannelOutput) if not graphicsOnAir or graphicsOnAir.Count <= 0: return clock = GameOnline.Clock time = clock.ElapsedTime - clock.ActivePart.EndAt if time.Minutes < 10: timeStr = time.ToString("m\:ss") else: timeStr = ClockTools.FormatTime(time, EClockMask.MMMSS) viewBag = IntelliflowController.CreateViewBag() viewBag.SetString("tTime", timeStr) for render in graphicsOnAir: render.Scene.FillTags(viewBag)