Untitled

From Cobalt Ostrich, 2 Weeks ago, written in Python, viewed 3 times. This paste will perish in 1 Week.
URL https://paste.afonso.co/view/b3af75c3 Embed
Download Paste or View Raw
  1. from System import DateTime, TimeSpan
  2. import StaticLib
  3.  
  4. def __getData(graphicOnAirItem, viewBag, momentExecution):
  5.  
  6.         homeTeam = Game.HomeTeam
  7.         awayTeam = Game.AwayTeam
  8.        
  9.         #TEAM COLORS#
  10.         homeTeamColor = StaticLib.GetColors(homeTeam)
  11.         awayTeamColor = StaticLib.GetColors(awayTeam)
  12.         viewBag.SetString("vHomeTeamColor", homeTeamColor[0])
  13.         viewBag.SetString("vHomeTeamTextColor", homeTeamColor[1])
  14.         viewBag.SetString("vAwayTeamColor", awayTeamColor[0])
  15.         viewBag.SetString("vAwayTeamTextColor", awayTeamColor[1])
  16.         viewBag.SetFloat("vTextType", 1)
  17.        
  18.         hour = Game.DateTime.Hour
  19.         print hour
  20.         minute = Game.DateTime.Minute
  21.         formatted_minute = str(minute).zfill(2)
  22.         viewBag.SetTranslatedText("tGamePart", "{{Kick off }}.{{GAME ID}}|filter:ToUpper  %s:%s" % (hour, formatted_minute))
  23.        
  24.        
  25.         clockValue = (Game.DateTime.ToLocalTime().TimeOfDay - DateTime.Now.TimeOfDay)
  26.         if clockValue > TimeSpan.Zero:
  27.                
  28.                 if clockValue.Hours > 0:
  29.                         clockValue = clockValue.ToString("hh\:mm\:ss")
  30.                 else:
  31.                         clockValue = clockValue.ToString("mm\:ss")
  32.         else:
  33.                 clockValue = "00:00"
  34.                
  35.         viewBag.SetString("tClock", clockValue)
  36.         folder = StaticLib.GetCompetitionFolder(Project)
  37.         #HomeTeam
  38.         viewBag.SetTranslatedText("tHomeTeamName", "{{Score Bug - " + homeTeam.RefName + "}}|filter:ToUpper ")
  39.         viewBag.SetImage("lgHomeTeamLogo",  "Images/DAZN/_Logos/TeamLogosSimple/Big/belgium/%s/%s.png" % (folder,homeTeam.RefName))
  40.         #AwayTeam
  41.         viewBag.SetTranslatedText("tAwayTeamName", "{{Score Bug - " + awayTeam.RefName + "}}|filter:ToUpper ")
  42.         viewBag.SetImage("lgAwayTeamLogo", "Images/DAZN/_Logos/TeamLogosSimple/Big/belgium/%s/%s.png" % (folder,awayTeam.RefName))
  43.        
  44. def TimeChanged(eventArguments):
  45.         graphic = GraphicTemplatesManager.GetGraphicByName(Script.Name)
  46.         graphicsOnAir = IntelliflowController.GetGraphicOnAirItems(graphic.Name, OutputManager.ActiveChannelOutput)
  47.         if not graphicsOnAir or graphicsOnAir.Count <= 0:
  48.                 return
  49.  
  50.         clockValue = (Game.DateTime.ToLocalTime().TimeOfDay - DateTime.Now.TimeOfDay)
  51.         if clockValue > TimeSpan.Zero:
  52.                 if clockValue.Hours > 0:
  53.                         clockValue = clockValue.ToString("hh\:mm\:ss")
  54.                 else:
  55.                         clockValue = clockValue.ToString("mm\:ss")
  56.         else:
  57.                 clockValue = "00:00"
  58.                
  59.         for render in graphicsOnAir:
  60.                 render.Scene.FillText("tClock", clockValue)
  61.                
  62.        
  63. def __beforeProgram(graphicOnAirItem, momentExecution):
  64.         Script.Features["Timer"].TimerInterval = 500
  65.         Script.Features["Timer"].StartTimer()
  66.        
  67. def __afterPanic(graphicOnAirItem, momentExecution):
  68.         Script.Features["Timer"].StopTimer()
  69.        
  70. def __afterProgramOut(graphicOnAirItem, momentExecution):
  71.         Script.Features["Timer"].StopTimer()

Reply to "Untitled"

Here you can reply to the paste above