Untitled

From Dinis, 4 Days ago, written in Plain Text, viewed 3 times. This paste will give up the ghost in 3 Weeks.
URL https://paste.afonso.co/view/562e0616 Embed
Download Paste or View Raw
  1. # -*- encoding: utf-8 -*-
  2. import time
  3. from System.Threading import *
  4. from os import path
  5.  
  6. test = False
  7.  
  8. def Show():
  9.         if not __Checking(): return
  10.         Globals["ScorebugApiResultsOnAir"] = False
  11.         ToProgram()
  12.  
  13. def __Checking():
  14.         return True
  15.  
  16.  
  17. def __FillTags():
  18.         competitionColor = ProjectSettings["CompetitionColor"]
  19.         viewbag = []
  20.         sets = Globals["API"].data["Results"]["CurrentSet"]
  21.         backhand, drive = Globals["PadelHelper"].GetPlayers(ActiveObjects.HomeTeam)
  22.         listHomeTeam = []
  23.         listHomeTeam.append(drive.Names.OtherNames.ToUpper())
  24.         listHomeTeam.append(backhand.Names.OtherNames.ToUpper())
  25.         viewbag.append({"Name": "tHomeTeamName", "Value":  '/'.join(listHomeTeam), "Pipe": "", "ToUpper": False, "IsAdvert": False, "Translate": False, "Context": ""})
  26.         color = ActiveObjects.HomeTeam.Attributes["RGB"].Value.ToString() if ActiveObjects.HomeTeam.Attributes["RGB"] else "255, 255, 255"
  27.         viewbag.append({"Name": "vHomeTeamColor", "Value": color, "Pipe": "", "ToUpper": False, "IsAdvert": False, "Translate": False, "Context": ""})
  28.  
  29.         #24PT_FIP_WORLD PADEL CHAMPIONSHIP
  30.         _, homeCountryInitials, _, awayCountryInitials = Globals["PadelHelper"].GetCountryNameAndInitials()
  31.  
  32.         homeFlag = Globals["PadelHelper"].GetCountryFlag(homeCountryInitials if homeCountryInitials != None else "")
  33.         awayFlag = Globals["PadelHelper"].GetCountryFlag(awayCountryInitials if awayCountryInitials != None else "")
  34.         viewbag.append({"Name": "lgHomeTeamFlag", "Value": homeFlag, "Pipe": "", "ToUpper": False, "IsAdvert": False, "Translate": False, "Context": ""})
  35.         viewbag.append({"Name": "lgAwayTeamFlag", "Value": awayFlag, "Pipe": "", "ToUpper": False, "IsAdvert": False, "Translate": False, "Context": ""})
  36.  
  37.         ##
  38.  
  39.         # Tags: Away Players
  40.         backhand, drive = Globals["PadelHelper"].GetPlayers(ActiveObjects.AwayTeam)
  41.         listAwayTeam = []
  42.         listAwayTeam.append(drive.Names.OtherNames.ToUpper())
  43.         listAwayTeam.append(backhand.Names.OtherNames.ToUpper())
  44.         viewbag.append({"Name": "tAwayTeamName", "Value": '/'.join(listAwayTeam), "Pipe": "", "ToUpper": False, "IsAdvert": False, "Translate": False, "Context": ""})
  45.         color = ActiveObjects.AwayTeam.Attributes["RGB"].Value.ToString() if ActiveObjects.AwayTeam.Attributes["RGB"] else "255, 255, 255"
  46.         viewbag.append({"Name": "vAwayTeamColor", "Value": color, "Pipe": "", "ToUpper": False, "IsAdvert": False, "Translate": False, "Context": ""})
  47.         viewbag.append({"Name": "lgSponsor", "Value": Globals["PadelHelper"].GetOnlineSponsor(), "Pipe": "", "ToUpper": False, "IsAdvert": False, "Translate": False, "Context": ""})
  48.         viewbag.append({"Name": "vColor", "Value": competitionColor, "Pipe": "", "ToUpper": False, "IsAdvert": False, "Translate": False, "Context": ""})
  49.         viewbag.append({"Name": "vSets", "Value": str(sets), "Pipe": "", "ToUpper": False, "IsAdvert": False, "Translate": False, "Context": ""})
  50.  
  51.         #New Online Type 2 players service
  52.         viewbag.append({"Name": "vType", "Value": "2", "Pipe": "", "ToUpper": False, "IsAdvert": False, "Translate": False, "Context": ""})
  53.         #New tags PlayersNames
  54.         viewbag.append({"Name": "tHomePlayerName01", "Value": listHomeTeam[0], "Pipe": "", "ToUpper": False, "IsAdvert": False, "Translate": False, "Context": ""})
  55.         viewbag.append({"Name": "tHomePlayerName02", "Value": listHomeTeam[1], "Pipe": "", "ToUpper": False, "IsAdvert": False, "Translate": False, "Context": ""})
  56.         viewbag.append({"Name": "tAwayPlayerName01", "Value": listAwayTeam[0], "Pipe": "", "ToUpper": False, "IsAdvert": False, "Translate": False, "Context": ""})
  57.         viewbag.append({"Name": "tAwayPlayerName02", "Value": listAwayTeam[1], "Pipe": "", "ToUpper": False, "IsAdvert": False, "Translate": False, "Context": ""})
  58.  
  59.         if Globals["ConfigForm"].data["HashtagImage"] == True:
  60.                 viewbag.append({"Name": "vSponsor", "Value": "1", "Pipe": "", "ToUpper": False, "IsAdvert": False, "Translate": False, "Context": ""})
  61.         else:
  62.                 viewbag.append({"Name": "tSponsor", "Value": Globals["ConfigForm"].data["HashtagText"], "Pipe": "", "ToUpper": False, "IsAdvert": False, "Translate": False, "Context": ""})
  63.                 viewbag.append({"Name": "vSponsor", "Value": "2", "Pipe": "", "ToUpper": False, "IsAdvert": False, "Translate": False, "Context": ""})
  64.  
  65.         return viewbag
  66.  
  67.  
  68. def ToProgram():
  69.         if test: print "Chamei toProgram"
  70.         Globals["ScorebugApiResultsOnAir"] = True
  71.         viewbag = __FillTags()
  72.         popupTitle = Update()
  73.         UpdatePosition()
  74.         Globals["R3_Manager"].DoTransition("Scorebug")
  75.         Globals["R3_Manager"].ShowAnimation("Program", Script, "In", viewbag, "Scorebug")
  76.         partialHome = Globals["API"].data["Results"]["HomeTeam"]["CurrentGame"]
  77.         partialAway = Globals["API"].data["Results"]["AwayTeam"]["CurrentGame"]
  78.         currentSet = Globals["API"].data["Results"]["CurrentSet"]
  79.  
  80.         if (partialHome == "0" and partialAway == "0") or (partialHome == "" and partialAway == "") or (Globals["API"].data["Match Finished"]) or (Globals["API"].data["Results"]["Sets Finished"][int(currentSet)-1]):
  81.                 if test: print "Chamei ScoreZeroOut"
  82.                 ScoreZeroOut()
  83.         else:
  84.                 if not Globals["API"].data["Match Finished"]:
  85.                         ScoreZeroIn()
  86.  
  87.         Globals["R3_Manager"].OnAirScorebug = Script.RefName
  88.         Globals["R3_Manager"].OnAirScorebugStatus = None
  89.         if popupTitle:
  90.                 PopupIn(popupTitle)
  91.  
  92.         #timeSleep = int(ProjectSettings["SponsorTimeIn"])* 1000
  93.         #Thread.Sleep(timeSleep)
  94.  
  95.  
  96. def Update():
  97.         #print "Online API - Update"
  98.  
  99.         viewbag = []
  100.  
  101.         # Totais agregados definidos nos controlos numéricos do frmPadelScoreBoard.
  102.         frm = Globals["frmPadelScoreboard"]
  103.         homeAggregate = int(frm.Controls["btnHomeTotal"].Value)
  104.         awayAggregate = int(frm.Controls["btnAwayTotal"].Value)
  105.  
  106.         viewbag.append({"Name": "tHomeAggregate", "Value": str(homeAggregate), "Pipe": "", "ToUpper": False, "IsAdvert": False, "Translate": False, "Context": ""})
  107.         viewbag.append({"Name": "tAwayAggregate", "Value": str(awayAggregate), "Pipe": "", "ToUpper": False, "IsAdvert": False, "Translate": False, "Context": ""})
  108.  
  109.         aggregateVisibility = homeAggregate != 0 or awayAggregate != 0
  110.         viewbag.append({"Name": "vAggregateVisibility", "Value": aggregateVisibility, "Pipe": "", "ToUpper": False, "IsAdvert": False, "Translate": False, "Context": ""})
  111.  
  112.         #24PT_FIP_WORLD PADEL CHAMPIONSHIP
  113.         _, homeCountryInitials, _, awayCountryInitials = Globals["PadelHelper"].GetCountryNameAndInitials()
  114.  
  115.         homeFlag = Globals["PadelHelper"].GetCountryFlag(homeCountryInitials if homeCountryInitials != None else "")
  116.         awayFlag = Globals["PadelHelper"].GetCountryFlag(awayCountryInitials if awayCountryInitials != None else "")
  117.         viewbag.append({"Name": "lgHomeTeamFlag", "Value": homeFlag, "Pipe": "", "ToUpper": False, "IsAdvert": False, "Translate": False, "Context": ""})
  118.         viewbag.append({"Name": "lgAwayTeamFlag", "Value": awayFlag, "Pipe": "", "ToUpper": False, "IsAdvert": False, "Translate": False, "Context": ""})
  119.  
  120.         ##
  121.  
  122.         # Points and popup title come from the same controller update.
  123.         partialHome, partialAway, popupTitle = Globals["API"].scorebugPoints
  124.         updatePopup = Globals["R3_Manager"].OnAirScorebug == Script.RefName
  125.         if updatePopup:
  126.                 if not popupTitle:
  127.                         PopupOut()
  128.                 elif Globals["R3_Manager"].OnAirScorebugPopup:
  129.                         viewbag.append(__PopupTitleTag(popupTitle))
  130.  
  131.         viewbag.append({"Name": "tHomeTeamPoints", "Value": partialHome, "Pipe": "", "ToUpper": False, "IsAdvert": False, "Translate": False, "Context": ""})
  132.         viewbag.append({"Name": "tAwayTeamPoints", "Value": partialAway, "Pipe": "", "ToUpper": False, "IsAdvert": False, "Translate": False, "Context": ""})
  133.  
  134.         # SETS
  135.         sets = Globals["API"].data["Results"]["CurrentSet"]
  136.  
  137.         if (partialHome == "0" and partialAway == "0") or (partialHome == "" and partialAway == "") or (Globals["API"].data["Match Finished"]) or (Globals["API"].data["Results"]["Sets Finished"][int(sets)-1]):
  138.                 ScoreZeroOut()
  139.         else:
  140.                 if not Globals["API"].data["Match Finished"]:
  141.                         ScoreZeroIn()
  142.  
  143.         #lastWinner = "home" if lastGame == None or lastGame["Results"]["HomeTeam"]["CurrentGame"] > lastGame["Results"]["AwayTeam"]["CurrentGame"] else "away"
  144.  
  145.         setFinished = 0
  146.         for i in range(3):
  147.                 setValueHome = Globals["API"].data["Results"]["HomeTeam"]["Sets"][i]
  148.                 setValueAway = Globals["API"].data["Results"]["AwayTeam"]["Sets"][i]
  149.                 currentSet = Globals["API"].data["Results"]["CurrentSet"]
  150.  
  151.                 if not Globals["API"].data["Results"]["Sets Finished"][i]:
  152.                         #Todo: Graphic Neutral
  153.                         viewbag.append({"Name": "vSetWinner" + str(i+1).zfill(2), "Value": "3", "Pipe": "", "ToUpper": False, "IsAdvert": False, "Translate": False, "Context": ""})
  154.                 else:
  155.                         #Todo: Graphic Painting
  156.                         if setValueHome > setValueAway:
  157.                                 viewbag.append({"Name": "vSetWinner" + str(i+1).zfill(2), "Value": "1", "Pipe": "", "ToUpper": False, "IsAdvert": False, "Translate": False, "Context": ""})
  158.                         elif setValueHome < setValueAway:
  159.                                 viewbag.append({"Name": "vSetWinner" + str(i+1).zfill(2), "Value": "2", "Pipe": "", "ToUpper": False, "IsAdvert": False, "Translate": False, "Context": ""})
  160.                         elif setValueHome == 0 and setValueAway == 0:
  161.                                 viewbag.append({"Name": "vSetWinner" + str(i+1).zfill(2), "Value": "1", "Pipe": "", "ToUpper": False, "IsAdvert": False, "Translate": False, "Context": ""})
  162.  
  163.                 viewbag.append({"Name": "tHomeTeamSetPoints" + str(i+1).zfill(2), "Value": str(setValueHome), "Pipe": "", "ToUpper": False, "IsAdvert": False, "Translate": False, "Context": ""})
  164.                 viewbag.append({"Name": "tAwayTeamSetPoints" + str(i+1).zfill(2), "Value": str(setValueAway), "Pipe": "", "ToUpper": False, "IsAdvert": False, "Translate": False, "Context": ""})
  165.  
  166.                 if Globals["API"].data["Results"]["Sets Finished"][i]:
  167.                         viewbag.append({"Name": "vHomeTeamTextColor" + str(i+1).zfill(2), "Value": "255, 255, 255", "Pipe": "", "ToUpper": False, "IsAdvert": False, "Translate": False, "Context": ""})
  168.                         viewbag.append({"Name": "vAwayTeamTextColor" + str(i+1).zfill(2), "Value": "255, 255, 255", "Pipe": "", "ToUpper": False, "IsAdvert": False, "Translate": False, "Context": ""})
  169.                         setFinished += 1
  170.                 else:
  171.                         viewbag.append({"Name": "vHomeTeamTextColor" + str(i+1).zfill(2), "Value": "199, 165, 110", "Pipe": "", "ToUpper": False, "IsAdvert": False, "Translate": False, "Context": ""})
  172.                         viewbag.append({"Name": "vAwayTeamTextColor" + str(i+1).zfill(2), "Value": "199, 165, 110", "Pipe": "", "ToUpper": False, "IsAdvert": False, "Translate": False, "Context": ""})
  173.  
  174.         if Globals["ConfigForm"].data["ZeroOnNewSet"] or sets == 1:
  175.                 viewbag.append({"Name": "vSets", "Value": str(sets), "Pipe": "", "ToUpper": False, "IsAdvert": False, "Translate": False, "Context": ""})
  176.  
  177.         # SERVICE
  178.         if test: print "Data Match: %s " % Globals["API"].data["Match Finished"]
  179.         if Globals["API"].data["Match Finished"]:
  180.                 if test: print "Cai no match finish"
  181.                 ServiceOut()
  182.                 SetFinished()
  183.                 viewbag.append({"Name": "tHomeTeamPoints", "Value": "", "Pipe": "", "ToUpper": False, "IsAdvert": False, "Translate": False, "Context": ""})
  184.                 viewbag.append({"Name": "tAwayTeamPoints", "Value": "", "Pipe": "", "ToUpper": False, "IsAdvert": False, "Translate": False, "Context": ""})
  185.                 viewbag.append({"Name": "vPoints", "Value": "0", "Pipe": "", "ToUpper": False, "IsAdvert": False, "Translate": False, "Context": ""})
  186.                 viewbag.append({"Name": "vHomePlayerService", "Value": 0, "Pipe": "", "ToUpper": False, "IsAdvert": False, "Translate": False, "Context": ""})
  187.                 viewbag.append({"Name": "vAwayPlayerService", "Value": 0, "Pipe": "", "ToUpper": False, "IsAdvert": False, "Translate": False, "Context": ""})
  188.  
  189.         else:
  190.                 #print "Home Service: %s " % Globals["API"].data["Results"]["HomeTeam"]["Service"]
  191.                 #print "Away Service: %s " % Globals["API"].data["Results"]["AwayTeam"]["Service"]
  192.                 #if Globals["API"].data["Results"]["HomeTeam"]["Service"] > 0:
  193.                         #viewbag.append({"Name": "vService", "Value": "1", "Pipe": "", "ToUpper": False, "IsAdvert": False, "Translate": False, "Context": ""})
  194.                 #elif Globals["API"].data["Results"]["AwayTeam"]["Service"] > 0:
  195.                         #viewbag.append({"Name": "vService", "Value": "2", "Pipe": "", "ToUpper": False, "IsAdvert": False, "Translate": False, "Context": ""})
  196.                 #else:
  197.                         #viewbag.append({"Name": "vService", "Value": "0", "Pipe": "", "ToUpper": False, "IsAdvert": False, "Translate": False, "Context": ""})
  198.                 #newService
  199.  
  200.                 #NewService:
  201.                 viewbag.append({"Name": "vHomePlayerService", "Value": Globals["API"].data["Results"]["HomeTeam"]["Service"], "Pipe": "", "ToUpper": False, "IsAdvert": False, "Translate": False, "Context": ""})
  202.                 viewbag.append({"Name": "vAwayPlayerService", "Value": Globals["API"].data["Results"]["AwayTeam"]["Service"], "Pipe": "", "ToUpper": False, "IsAdvert": False, "Translate": False, "Context": ""})
  203.  
  204.         # Filling Tags...
  205.         if "R3_Manager" in Globals:
  206.                 for server in R3Servers:
  207.                         if server.Type.ToString() == "Program":
  208.                                 scene = server.GetGraphicScene(Script.Scene.Name)
  209.                                 scene.Slot = Globals["R3_Manager"].GetSlot("Scorebug")
  210.                                 language = server.Metadata["Language"]
  211.  
  212.                                 Globals["R3_Manager"].FillTags(server, scene, language, server.Name, viewbag)
  213.         if updatePopup and popupTitle:
  214.                 PopupIn(popupTitle)
  215.         HashTagAuto()
  216.         return popupTitle
  217.  
  218.  
  219. def UpdatePosition():
  220.         viewbag = []
  221.  
  222.         # Scene Positions & Scales
  223.         data = Globals["ScenesPositions"].GetScene(Script.RefName)
  224.         if data:
  225.                 viewbag.append({"Name": "vPosX", "Value": str(data["X"]), "Pipe": "", "ToUpper": False, "IsAdvert": False, "Translate": False, "Context": ""})
  226.                 viewbag.append({"Name": "vPosY", "Value": str(data["Y"]), "Pipe": "", "ToUpper": False, "IsAdvert": False, "Translate": False, "Context": ""})
  227.                 viewbag.append({"Name": "vScaleX", "Value": str(data["ScaleX"]), "Pipe": "", "ToUpper": False, "IsAdvert": False, "Translate": False, "Context": ""})
  228.                 viewbag.append({"Name": "vScaleY", "Value": str(data["ScaleY"]), "Pipe": "", "ToUpper": False, "IsAdvert": False, "Translate": False, "Context": ""})
  229.  
  230.         # Filling Tags...
  231.         if "R3_Manager" in Globals:
  232.                 for server in R3Servers:
  233.                         if server.Type.ToString() == "Program":
  234.                                 scene = server.GetGraphicScene(Script.Scene.Name)
  235.                                 scene.Slot = Globals["R3_Manager"].GetSlot("Online")
  236.                                 language = server.Metadata["Language"]
  237.  
  238.                                 Globals["R3_Manager"].FillTags(server, scene, language, server.Name, viewbag)
  239.  
  240.  
  241. def SetFinished():
  242.         if test: print "Chamei o set finished"
  243.         if Globals["R3_Manager"].OnAirScorebug != Script.RefName:
  244.                 return
  245.         if not Globals["ConfigForm"].data["ZeroOnNewSet"]:
  246.                 return
  247.         if not Globals["API"].data["Match Finished"]:
  248.                 viewbag = []
  249.                 Globals["R3_Manager"].ShowAnimation("Program", Script, "Sets_Out", viewbag, "Scorebug", 500)
  250.                 Update()
  251.                 Globals["R3_Manager"].ShowAnimation("Program", Script, "Sets_In", viewbag, "Scorebug", 500)
  252.         else:
  253.                 if test: print "ScorebugApiResultsOnAir %s " % Globals["ScorebugApiResultsOnAir"]
  254.                 if Globals["ScorebugApiResultsOnAir"]:
  255.                         Globals["R3_Manager"].ShowAnimation("Program", Script, "Result_Out", [], "Scorebug")
  256.                         Globals["ScorebugApiResultsOnAir"] = False
  257.  
  258.  
  259. def __PopupTitleTag(msg):
  260.         return {"Name": "tTitle", "Value": msg, "Pipe": "", "ToUpper": True, "IsAdvert": False, "Translate": True, "Context": "Online Scene"}
  261.  
  262.  
  263. def PopupIn(msg):
  264.         if not Globals["R3_Manager"].OnAirScorebugPopup and Globals["R3_Manager"].OnAirScorebug == Script.RefName:
  265.                 viewbag = [__PopupTitleTag(msg)]
  266.                 Globals["R3_Manager"].ShowAnimation("Program", Script, "Title_In", viewbag, "Scorebug")
  267.                 Globals["R3_Manager"].OnAirScorebugPopup = True
  268.  
  269.  
  270. def PopupOut():
  271.         if Globals["R3_Manager"].OnAirScorebugPopup:
  272.                 viewbag = []
  273.                 Globals["R3_Manager"].ShowAnimation("Program", Script, "Title_Out", viewbag, "Scorebug", 250)
  274.                 Globals["R3_Manager"].OnAirScorebugPopup = False
  275.  
  276.  
  277. def GoldPointIn():
  278.         if not Globals["R3_Manager"].OnAirScorebugGoldPoint and Globals["R3_Manager"].OnAirScorebug == Script.RefName:
  279.                 viewbag = []
  280.                 viewbag.append({"Name": "tGoldPointTitle", "Value": "Golden Point", "Pipe": "", "ToUpper": True, "IsAdvert": False, "Translate": True, "Context": "Online Scene"})
  281.                 Globals["R3_Manager"].ShowAnimation("Program", Script, "GoldPoint_In", viewbag, "Scorebug")
  282.                 Globals["R3_Manager"].OnAirScorebugGoldPoint = True
  283.  
  284.  
  285. def GoldPointOut():
  286.         if Globals["R3_Manager"].OnAirScorebugGoldPoint:
  287.                 viewbag = []
  288.                 Globals["R3_Manager"].ShowAnimation("Program", Script, "GoldPoint_Out", viewbag, "Scorebug")
  289.                 Globals["R3_Manager"].OnAirScorebugGoldPoint = False
  290.  
  291.  
  292. def ServiceIn():
  293.         viewbag = []
  294.         viewbag.append({"Name": "vServiceBall", "Value": "1", "Pipe": "", "ToUpper": False, "IsAdvert": False, "Translate": False, "Context": ""})
  295.         for server in R3Servers:
  296.                 if server.Type.ToString() == "Program":
  297.                         scene = server.GetGraphicScene(Script.Scene.Name)
  298.                         scene.Slot = Globals["R3_Manager"].GetSlot("Scorebug")
  299.                         language = server.Metadata["Language"]
  300.                         Globals["R3_Manager"].FillTags(server, scene, language, server.Name, viewbag)
  301.  
  302.  
  303. def ServiceOut():
  304.         viewbag = []
  305.         viewbag.append({"Name": "vService", "Value": "0", "Pipe": "", "ToUpper": False, "IsAdvert": False, "Translate": False, "Context": ""})
  306.         for server in R3Servers:
  307.                 if server.Type.ToString() == "Program":
  308.                         scene = server.GetGraphicScene(Script.Scene.Name)
  309.                         scene.Slot = Globals["R3_Manager"].GetSlot("Scorebug")
  310.                         language = server.Metadata["Language"]
  311.                         Globals["R3_Manager"].FillTags(server, scene, language, server.Name, viewbag)
  312.  
  313.  
  314. def ScoreZeroIn():
  315.         if test: print "Executei ScoreZeroIn"
  316.         if test: print 'Globals[ScorebugApiResultsOnAir"]: %s' % Globals["ScorebugApiResultsOnAir"]
  317.  
  318.         if Globals["ScorebugApiResultsOnAir"] == False:
  319.                 if test: print "Chamei result_in"
  320.                 Globals["R3_Manager"].ShowAnimation("Program", Script, "Result_In", [], "Scorebug")
  321.                 Globals["ScorebugApiResultsOnAir"] = True
  322.  
  323.  
  324. def ScoreZeroOut():
  325.         if test: print "Executei ScoreZeroOut"
  326.         if Globals["ScorebugApiResultsOnAir"]:
  327.                 Globals["R3_Manager"].ShowAnimation("Program", Script, "Result_Out", [], "Scorebug")
  328.                 if test: print 'Setei Globals["ScorebugApiResultsOnAir"] = False'
  329.                 Globals["ScorebugApiResultsOnAir"] = False
  330.  
  331.  
  332. def Out(wait=False):
  333.         if Globals["R3_Manager"].OnAirScorebug == Script.RefName:
  334.                 w = 1500 if wait else 0
  335.                 Scheduler.ClearScheduler("Online_API")
  336.                 PopupOut()
  337.                 GoldPointOut()
  338.                 HashtagOut()
  339.                 SponsorOnlineOut()
  340.                 Globals["R3_Manager"].ShowAnimation("Program", Script, "Out", [], "Scorebug", w)
  341.                 Globals["R3_Manager"].OnAirScorebug = None
  342.                 Globals["R3_Manager"].OnAirScorebugSponsor = False
  343.  
  344.  
  345. def __SecondsToString(sec):
  346.         hour = sec/3600
  347.         minutes = (sec - (hour*3600))/60
  348.         seconds = sec - (hour*3600) - (minutes*60)
  349.  
  350.         hourStr = (str(hour) + "h") if hour > 0 else ""
  351.         minStr = (str(minutes).zfill(2) + "min") if minutes > 0 else "00min"
  352.         return hourStr + " " + minStr # + ":" + str(seconds).zfill(2)
  353.  
  354.  
  355. #def SponsorIn():
  356.         #if Globals["API"].status == True:
  357.                 #if Globals["R3_Manager"].OnAirScorebug != Script.RefName:
  358.                         #return
  359.         #else:
  360.                 #if Globals["R3_Manager"].OnAirScorebug != "OnlineScore":
  361.                         #return
  362.         #if not Globals["R3_Manager"].OnAirScorebugHashtag:
  363.                 #Globals["R3_Manager"].OnAirScorebugHashtag = True
  364.                 #viewbag = []
  365.                 #folderName = ProjectSettings["ImagesFolderPath"]
  366.                 #viewbag.append({"Name": "lgSponsor", "Value": folderName + "\Sponsors\sponsor_online.png", "Pipe": "", "ToUpper": False, "IsAdvert": False, "Translate": False, "Context": ""})
  367.                 #Globals["R3_Manager"].ShowAnimation("Program", Script, "Sponsor_In", viewbag, "Scorebug")
  368.  
  369. #def Sponsor2setsIn():
  370.         #print "Sponsor2setsIn"
  371.         #print Globals["R3_Manager"].OnAirScorebug
  372.         #print "OnAirScorebugSponsor: %s " %Globals["R3_Manager"].OnAirScorebugSponsor
  373.         #Globals["SponsorOnAnimantion"] = True
  374.         #print "OnAir ScroreBug: %s" %Globals["R3_Manager"].OnAirScorebug
  375.         #print "Script Ref Name: %s" % Script.RefName
  376.  
  377.         #if Globals["API"]:
  378.                 #if Globals["API"].status == True:
  379.                         #if Globals["R3_Manager"].OnAirScorebug != Script.RefName:
  380.                                 #return
  381.                 #else:
  382.                         #if Globals["R3_Manager"].OnAirScorebug != "OnlineScore":
  383.                                 #return
  384.         #else:
  385.                 #if Globals["R3_Manager"].OnAirScorebug != "OnlineScore":
  386.                         #return
  387.  
  388.         #if not Globals["R3_Manager"].OnAirScorebugSponsor:
  389.                 #Globals["R3_Manager"].OnAirScorebugSponsor = True
  390.                 #viewbag = []
  391.                 #folderName = ProjectSettings["ImagesFolderPath"]
  392.                 ##logo = ProjectSettings["Sponsor2SetsLogo"]
  393.                 ##fullLogoPath = path.join(folderName,logo)
  394.                 #fullLogoPath = Globals["ConfigForm"].data["ImageSponsor"]
  395.  
  396.                 ##print fullLogoPath
  397.                 #viewbag.append({"Name": "lgSponsor", "Value": fullLogoPath, "Pipe": "", "ToUpper": False, "IsAdvert": False, "Translate": False, "Context": ""})
  398.                 #Globals["R3_Manager"].ShowAnimation("Program", Script, "Sponsor_In", viewbag, "Online_API")
  399.                 #print "Setei scheduller para tirar em 5...."
  400.                 #Scheduler.Add("Online_API", "Sponsor2SetsOut", Project.Name, None, 5 * 1000, "Online_API")
  401.  
  402. #def SponsorOut():
  403.         #if Globals["R3_Manager"].OnAirScorebugHashtag:
  404.                 #Globals["R3_Manager"].OnAirScorebugHashtag = False
  405.                 #viewbag = []
  406.                 #Globals["R3_Manager"].ShowAnimation("Program", Script, "Sponsor_Out", viewbag, "Online_API")
  407.                 ##Scheduler.Add("Online_API", "SponsorIn", Project.Name, None, 1 * 1000, "API")
  408.                 ##Globals["SponsorOnAnimantion"] = False
  409.  
  410.         #if Globals["R3_Manager"].OnAirScorebugSponsor:
  411.                 #Globals["R3_Manager"].OnAirScorebugSponsor = False
  412.                 #viewbag = []
  413.                 #Globals["R3_Manager"].ShowAnimation("Program", Script, "Sponsor_Out", viewbag, "Online_API")
  414.  
  415. #def Sponsor2SetsOut():
  416.         #print "OnAirScorebugHashtag: %s OnAirScorebugSponsor: %s" % (Globals["R3_Manager"].OnAirScorebugHashtag,Globals["R3_Manager"].OnAirScorebugSponsor)
  417.         #if Globals["R3_Manager"].OnAirScorebugHashtag:
  418.                 #Globals["R3_Manager"].OnAirScorebugHashtag = False
  419.                 #viewbag = []
  420.                 #Script.Scene.Show("SponsorOut")
  421.                 #Script.Scene.Wait("SponsorOut")
  422.                 #Script.Scene.Show("SponsorIn")
  423.  
  424.                 ###Globals["R3_Manager"].ShowAnimation("Program", Script, "Sponsor_Out", viewbag, "Online_API")
  425.                 ##Thread.Sleep(6)
  426.                 ##Script.Scene.Show("SponsorIn")
  427.                 ###Scheduler.Add("Online_API", "SponsorIn", Project.Name, None, 6 * 1000, "API")
  428.         ##else:
  429.                 ##Scheduler.Add("Online_API", "SponsorOut", Project.Name, None, 1 * 1000, "Online_API")
  430.  
  431.         #elif Globals["R3_Manager"].OnAirScorebugSponsor:
  432.                 #Globals["R3_Manager"].OnAirScorebugSponsor = False
  433.                 #viewbag = []
  434.                 ##Script.Scene.Show("SponsorOut")
  435.                 ##Script.Scene.Wait("SponsorOut")
  436.                 ##Script.Scene.Show("SponsorIn")
  437.  
  438.                 #Globals["R3_Manager"].ShowAnimation("Program", Script, "Sponsor_Out", viewbag, "Online_API")
  439.  
  440.                 ###Globals["R3_Manager"].ShowAnimation("Program", Script, "Sponsor_Out", viewbag, "Online_API")
  441.                 ##Script.Scene.Show("Sponsor_Out")
  442.  
  443.                 ###Scheduler.Add("Online_API", "SponsorIn", Project.Name, None, 6 * 1000, "Online_API")
  444.                 ##Thread.Sleep(6)
  445.                 ##Script.Scene.Show("SponsorIn")
  446.         ##else:
  447.                 ##Scheduler.Add("Online_API", "SponsorOut", Project.Name, None, 1 * 1000, "Online_API")
  448.         #Globals["SponsorOnAnimantion"] = False
  449.  
  450. #self.OnAirScorebugHashtag = None
  451. #self.OnAirScorebugSponsor = None
  452.  
  453. def HashtagIn():
  454.         #Verificação se os gráficos estão no ar: Online ou online da API
  455.         if Globals["API"]:
  456.                 if Globals["API"].status == True:
  457.                         if Globals["R3_Manager"].OnAirScorebug != Script.RefName:
  458.                                 return
  459.                 else:
  460.                         if Globals["R3_Manager"].OnAirScorebug != "OnlineScore":
  461.                                 return
  462.         else:
  463.                 if Globals["R3_Manager"].OnAirScorebug != "OnlineScore":
  464.                         return
  465.  
  466.         #Verifica se não está no ar
  467.         if not Globals["R3_Manager"].OnAirScorebugHashtag:
  468.                 #Seta o controle do hashtag para True
  469.                 Globals["R3_Manager"].OnAirScorebugHashtag = True
  470.                 #Cria uma viewBag Vazia
  471.                 viewbag = []
  472.                 #Pega o path da folder de imagens
  473.                 folderName = ProjectSettings["ImagesFolderPath"]
  474.                 imageName = "sponsor_online.png"
  475.                 #Preenche os dados da viewbag
  476.                 viewbag.append({
  477.                         "Name": "lgSponsor",
  478.                         "Value": Globals["ConfigForm"].data["ImageHashtag"],
  479.                         "Pipe": "",
  480.                         "ToUpper": False,
  481.                         "IsAdvert": False,
  482.                         "Translate": False,
  483.                         "Context": ""
  484.                 })
  485.                 #Chama a Timeline Sponsor_In desse script passando a viewbag
  486.                 Globals["R3_Manager"].ShowAnimation("Program", Script, "Sponsor_In", viewbag, "Scorebug")
  487.                 Globals["R3_Manager"].OnAirScorebugHashtag = True
  488.         #else:
  489.                 #print "Hashtag já está no ar!!!"
  490.  
  491.  
  492. def AggregateIn():
  493.         if Globals["R3_Manager"].OnAirScorebug != Script.RefName:
  494.                 return
  495.  
  496.         viewbag = []
  497.         Globals["R3_Manager"].ShowAnimation(
  498.                 "Program", Script, "Aggregate_In", viewbag, "Scorebug"
  499.         )
  500.  
  501.  
  502. def AggregateOut():
  503.         if Globals["R3_Manager"].OnAirScorebug != Script.RefName:
  504.                 return
  505.  
  506.         viewbag = []
  507.         Globals["R3_Manager"].ShowAnimation(
  508.                 "Program", Script, "Aggregate_Out", viewbag, "Scorebug"
  509.         )
  510.  
  511.  
  512. def HashtagOut():
  513.         #Verificação se os gráficos estão no ar: Online ou online da API
  514.         if Globals["API"]:
  515.                 if Globals["API"].status == True:
  516.                         if Globals["R3_Manager"].OnAirScorebug != Script.RefName:
  517.                                 return
  518.                 else:
  519.                         if Globals["R3_Manager"].OnAirScorebug != "OnlineScore":
  520.                                 return
  521.         else:
  522.                 if Globals["R3_Manager"].OnAirScorebug != "OnlineScore":
  523.                         return
  524.  
  525.         #Verifica se a Hastag está no ar
  526.         if Globals["R3_Manager"].OnAirScorebugHashtag:
  527.                 #Cria uma viewBag Vazia
  528.                 viewbag = []
  529.                 #Chama a timeline Sponsor_Out do gráfico
  530.                 Globals["R3_Manager"].ShowAnimation("Program", Script, "Sponsor_Out", viewbag, "Online_API", 500)
  531.                 #Seta a variável de controle da Hashtag como False
  532.                 Globals["R3_Manager"].OnAirScorebugHashtag = False
  533.         #else:
  534.                 #print "Hashtag não está no ar!!!"
  535.  
  536.  
  537. def HashtagChange(Number):
  538.         #Script.Scene.Show("Sponsor_Out")
  539.         #Script.Scene.Wait("Sponsor_Out")
  540.         #Globals["R3_Manager"].ShowAnimation("Program", Script, "Sponsor_Out", [], "Online_API",2)
  541.         #Globals["R3_Manager"].OnAirScorebugHashtag = False
  542.         Globals["R3_Manager"].OnAirScorebugSponsor = True
  543.         HashtagOut()
  544.         fullLogoPath = ""
  545.         if "R3_Manager" in Globals:
  546.                 for server in R3Servers:
  547.                         if server.Type.ToString() == "Program":
  548.                                 scene = server.GetGraphicScene(Script.Scene.Name)
  549.                                 scene.Slot = Globals["R3_Manager"].GetSlot("Lowerthird")
  550.                                 language = server.Metadata["Language"]
  551.                                 if server.Name == "GLOBAL":
  552.                                         fullLogoPath = Globals["ConfigForm"].data["ImageSponsorGlobal%s" % Number]
  553.                                 elif server.Name == "RESTRICTED":
  554.                                         fullLogoPath = Globals["ConfigForm"].data["ImageSponsorRestricted%s" % Number]
  555.                                 viewbag = []
  556.                                 viewbag.append({"Name": "lgSponsor", "Value": fullLogoPath, "Pipe": "", "ToUpper": False, "IsAdvert": False, "Translate": False, "Context": ""})
  557.                                 Globals["R3_Manager"].FillTags(server, scene, language, server.Name, viewbag)
  558.                                 #Script.Scene.Show("Sponsor_In")
  559.                         Globals["R3_Manager"].ShowAnimation("Program", Script, "Sponsor_In", [], "Online_API")
  560.                                 #Globals["R3_Manager"].ShowAnimation("Program", Script, "Sponsor_In", [], "Online_API")
  561.  
  562.  
  563. def SponsorOnlineIn(Number):
  564.         #Tempo para o sponsor sair do ar
  565.         timeToOut = 5
  566.         #Verificação se os gráficos estão no ar: Online ou online da API
  567.         if Globals["API"]:
  568.                 if Globals["API"].status == True:
  569.                         if Globals["R3_Manager"].OnAirScorebug != Script.RefName:
  570.                                 return
  571.                 else:
  572.                         if Globals["R3_Manager"].OnAirScorebug != "OnlineScore":
  573.                                 return
  574.         else:
  575.                 if Globals["R3_Manager"].OnAirScorebug != "OnlineScore":
  576.                         return
  577.  
  578.         if Globals["R3_Manager"].OnAirScorebugSponsor:
  579.                 #print "Sponsor já está no ar!"
  580.                 return
  581.  
  582.         Globals["R3_Manager"].OnAirScorebugSponsor = True
  583.  
  584.         #Cria uma viewBag Vazia
  585.         viewbag = []
  586.         #Pega o path da imagem
  587.         fullLogoPath = Globals["ConfigForm"].data["ImageHashtag"]
  588.         #Verifica se a Hastag está no ar
  589.         if Globals["R3_Manager"].OnAirScorebugHashtag:
  590.                 HashtagChange(Number)
  591.         else:
  592.                 #Preenche a viewbag
  593.                 #viewbag.append({"Name": "lgSponsor", "Value": fullLogoPath, "Pipe": "", "ToUpper": False, "IsAdvert": False, "Translate": False, "Context": ""})
  594.                 #Globals["R3_Manager"].ShowAnimation("Program", Script, "Sponsor_In", viewbag, "Online_API")
  595.                 if "R3_Manager" in Globals:
  596.                         for server in R3Servers:
  597.                                 if server.Type.ToString() == "Program":
  598.                                         scene = server.GetGraphicScene(Script.Scene.Name)
  599.                                         scene.Slot = Globals["R3_Manager"].GetSlot("Lowerthird")
  600.                                         language = server.Metadata["Language"]
  601.                                         if server.Name == "GLOBAL":
  602.                                                 fullLogoPath = Globals["ConfigForm"].data["ImageSponsorGlobal%s" % Number]
  603.                                         elif server.Name == "RESTRICTED":
  604.                                                 fullLogoPath = Globals["ConfigForm"].data["ImageSponsorRestricted%s" % Number]
  605.                                         viewbag = []
  606.                                         viewbag.append({"Name": "lgSponsor", "Value": fullLogoPath, "Pipe": "", "ToUpper": False, "IsAdvert": False, "Translate": False, "Context": ""})
  607.                                         Globals["R3_Manager"].FillTags(server, scene, language, server.Name, viewbag)
  608.                                 #Script.Scene.Show("Sponsor_In")
  609.                                 Globals["R3_Manager"].ShowAnimation("Program", Script, "Sponsor_In", [], "Online_API")
  610.  
  611.         if timeToOut != 0:
  612.                 Scheduler.Add("Online_API", "SponsorOnlineOut", Project.Name, None, timeToOut * 1000, "Online_API")
  613.  
  614.  
  615. def SponsorWTOnlineIn():
  616.         #Tempo para o sponsor sair do ar
  617.         timeToOut = 5
  618.  
  619.         #Cria uma viewBag Vazia
  620.         viewbag = []
  621.         #Pega o path da imagem
  622.         fullLogoPath = Globals["ConfigForm"].data["ImageSponsor"]
  623.  
  624.         #Preenche a viewbag
  625.         viewbag.append({"Name": "lgSponsor", "Value": fullLogoPath, "Pipe": "", "ToUpper": False, "IsAdvert": False, "Translate": False, "Context": ""})
  626.         Globals["R3_Manager"].ShowAnimation("Program", Script, "Sponsor_In", viewbag, "Online_API")
  627.  
  628.  
  629. def SponsorWTOnlineOut():
  630.         Globals["R3_Manager"].ShowAnimation("Program", Script, "Sponsor_Out", [], "Online_API")
  631.  
  632.  
  633. def SponsorOnlineOut():
  634.         #print "SponsorOnlineOut"
  635.         #Verificação se os gráficos estão no ar: Online ou online da API
  636.         if Globals["API"]:
  637.                 if Globals["API"].status == True:
  638.                         if Globals["R3_Manager"].OnAirScorebug != Script.RefName:
  639.                                 return
  640.                 else:
  641.                         if Globals["R3_Manager"].OnAirScorebug != "OnlineScore":
  642.                                 return
  643.         else:
  644.                 if Globals["R3_Manager"].OnAirScorebug != "OnlineScore":
  645.                         return
  646.  
  647.         #verifica se Sponsor está no ar
  648.         if Globals["R3_Manager"].OnAirScorebugSponsor:
  649.                 #Cria uma viewBag Vazia
  650.                 viewbag = []
  651.                 Globals["R3_Manager"].ShowAnimation("Program", Script, "Sponsor_Out", viewbag, "Online_API")
  652.                 Globals["R3_Manager"].OnAirScorebugSponsor = False
  653.  
  654.         #else:
  655.                 #print "Sponsor não está no ar!!!"
  656.  
  657.  
  658. def HashTagAuto():
  659.         if not Globals["ConfigForm"] and Globals["ConfigForm"].data["HashtagTimeIn"] or int(Globals["ConfigForm"].data["HashtagTimeIn"]) * 1000 == 0:
  660.                 return
  661.  
  662.         timeSleep = int(Globals["ConfigForm"].data["HashtagTimeIn"]) * 1000
  663.         #Verify if Scorebug is onair
  664.         if Globals["R3_Manager"].OnAirScorebug == "OnlineScore" or Globals["R3_Manager"].OnAirScorebug == "Online_API":
  665.                 if not Globals["R3_Manager"].OnAirScorebugHashtag and not Globals["R3_Manager"].OnAirScorebugSponsor:
  666.                         Scheduler.Add("Online_API", "HashtagIn", Project.Name, None, timeSleep, "Online_API_Hashtag")

Reply to "Untitled"

Here you can reply to the paste above