示例#1
0
    def __draw_game(self, game, overview):
        self.canvas.Fill(*ledcolors.scoreboard.fill)

        # Draw the pregame renderer
        if Status.is_pregame(overview.status):
            pregame = Pregame(overview)
            renderer = PregameRenderer(self.canvas, pregame,
                                       self.data.config.coords["pregame"],
                                       self.scrolling_text_pos)
            self.__update_scrolling_text_pos(renderer.render())

        # Draw the final game renderer
        elif Status.is_complete(overview.status):
            final = Final(game)
            scoreboard = Scoreboard(overview)
            renderer = FinalRenderer(self.canvas, final, scoreboard,
                                     self.data.config, self.scrolling_text_pos)
            self.__update_scrolling_text_pos(renderer.render())

        # Draw the scoreboar renderer
        elif Status.is_irregular(overview.status):
            scoreboard = Scoreboard(overview)
            StatusRenderer(self.canvas, scoreboard, self.data.config).render()
        else:
            scoreboard = Scoreboard(overview)
            ScoreboardRenderer(self.canvas, scoreboard,
                               self.data.config).render()
        self.canvas = self.matrix.SwapOnVSync(self.canvas)
示例#2
0
  def __draw_game(self, game, overview):
    color = self.data.config.scoreboard_colors.color("default.background")
    self.canvas.Fill(color["r"], color["g"], color["b"])

    # Draw the pregame renderer
    if Status.is_pregame(overview.status):
      scoreboard = Scoreboard(overview)
      scroll_max_x = self.__max_scroll_x(self.data.config.layout.coords("pregame.scrolling_text"))
      pregame = Pregame(overview)
      renderer = PregameRenderer(self.canvas, pregame, scoreboard, self.data, self.scrolling_text_pos)
      self.__update_scrolling_text_pos(renderer.render())

    # Draw the final game renderer
    elif Status.is_complete(overview.status):
      scroll_max_x = self.__max_scroll_x(self.data.config.layout.coords("final.scrolling_text"))
      final = Final(game)
      scoreboard = Scoreboard(overview)
      renderer = FinalRenderer(self.canvas, final, scoreboard, self.data, self.scrolling_text_pos)
      self.__update_scrolling_text_pos(renderer.render())

    # Draw the scoreboar renderer
    elif Status.is_irregular(overview.status):
      scoreboard = Scoreboard(overview)
      if scoreboard.get_text_for_reason():
        scroll_max_x = self.__max_scroll_x(self.data.config.layout.coords("status.scrolling_text"))
        renderer = StatusRenderer(self.canvas, scoreboard, self.data, self.scrolling_text_pos)
        self.__update_scrolling_text_pos(renderer.render())
      else:
        StatusRenderer(self.canvas, scoreboard, self.data).render()
    else:
      scoreboard = Scoreboard(overview)
      ScoreboardRenderer(self.canvas, scoreboard, self.data).render()
    self.canvas = self.matrix.SwapOnVSync(self.canvas)
示例#3
0
  def __draw_game(self, game, overview):
    color = self.data.config.scoreboard_colors.color("default.background")
    self.canvas.Fill(color["r"], color["g"], color["b"])

    # Draw the pregame renderer
    if Status.is_pregame(overview.status):
      scoreboard = Scoreboard(overview)
      scroll_max_x = self.__max_scroll_x(self.data.config.layout.coords("pregame.scrolling_text"))
      pregame = Pregame(overview)
      renderer = PregameRenderer(self.canvas, pregame, scoreboard, self.data, self.scrolling_text_pos)
      self.__update_scrolling_text_pos(renderer.render())

    # Draw the final game renderer
    elif Status.is_complete(overview.status):
      scroll_max_x = self.__max_scroll_x(self.data.config.layout.coords("final.scrolling_text"))
      final = Final(game)
      scoreboard = Scoreboard(overview)
      renderer = FinalRenderer(self.canvas, final, scoreboard, self.data, self.scrolling_text_pos)
      self.__update_scrolling_text_pos(renderer.render())

    # Draw the scoreboar renderer
    elif Status.is_irregular(overview.status):
      scoreboard = Scoreboard(overview)
      if scoreboard.get_text_for_reason():
        scroll_max_x = self.__max_scroll_x(self.data.config.layout.coords("status.scrolling_text"))
        renderer = StatusRenderer(self.canvas, scoreboard, self.data, self.scrolling_text_pos)
        self.__update_scrolling_text_pos(renderer.render())
      else:
        StatusRenderer(self.canvas, scoreboard, self.data).render()
    else:
      scoreboard = Scoreboard(overview)
      ScoreboardRenderer(self.canvas, scoreboard, self.data).render()
    self.canvas = self.matrix.SwapOnVSync(self.canvas)
示例#4
0
    def render(self):
        if self.data.config.testing_mode:
            debug.info("Rendering in Testing Mode")
            while True:
                self.data.refresh_overview()
                self.scoreboard = Scoreboard(self.data.overview, self.data)
                ScoreboardRenderer(self.data, self.matrix,
                                   Scoreboard(self.data.games[0],
                                              self.data)).render()
                #self._draw_event_animation("goal", self.scoreboard.home_team.id, self.scoreboard.home_team.name)
                #PenaltyRenderer(self.data, self.matrix, self.sleepEvent, self.scoreboard.away_team).render()
                #TeamSummary(self.data, self.matrix, self.sleepEvent).render()
                sleep(1)
                debug.info("Testing Mode Refresh")

        if self.data.config.test_goal_animation:
            debug.info("Rendering in Testing Mode")
            while True:
                self._draw_event_animation("goal", id=9)

        while self.data.network_issues:
            Clock(self.data, self.matrix, self.sleepEvent, duration=60)
            self.data.refresh_data()

        while True:
            debug.info('Rendering...')
            #if self.status.is_offseason(self.data.date()):
            # Offseason (Show offseason related stuff)
            #debug.info("It's offseason")
            #self.__render_offday()
            if self.data.config.testScChampions:
                self.test_stanley_cup_champion(
                    self.data.config.testScChampions)

            else:
                # Season.
                if not self.data.config.live_mode:
                    debug.info("Live mode is off. Going through the boards")
                    self.__render_offday()
                elif self.data.is_pref_team_offday():
                    debug.info("Your preferred teams are Off today")
                    self.__render_offday()
                elif self.data.is_nhl_offday():
                    debug.info("There is no game in the NHL today")
                    self.__render_offday()
                else:
                    debug.info("Game Day Wooooo")
                    self.__render_game_day()

            self.data.refresh_data()
示例#5
0
    def render(self):
        self.index = 0
        self.games = self.data.games
        self.num_games = len(self.games)
        try:
            while not self.sleepEvent.is_set():
                self.matrix.clear()
                if self.index >= (len(self.games)):
                    return
                    
                ScoreboardRenderer(self.data, self.matrix, Scoreboard(self.games[self.index], self.data)).render()
                self.show_indicator()
                self.matrix.render()

                if self.data.network_issues:
                    self.matrix.network_issue_indicator()
                
                if self.data.newUpdate and not self.data.config.clock_hide_indicators:
                    self.matrix.update_indicator()

                #sleep(self.rotation_rate)
                self.sleepEvent.wait(self.rotation_rate)

                self.index += 1

        except IndexError:
            print("no game to display, you set preferred teams only or NHL OFF DAY today")
            return
示例#6
0
 def print_game_data_debug(self):
     debug.log("Game Data Refreshed: %s",
               self.current_game._data["gameData"]["game"]["id"])
     debug.log("Pre: %s", Pregame(self.current_game,
                                  self.config.time_format))
     debug.log("Live: %s", Scoreboard(self.current_game))
     debug.log("Final: %s", Postgame(self.current_game))
示例#7
0
    def render(self):
        if self.data.config.testing_mode:
            debug.info("Rendering in Testing Mode")
            while True:
                self._draw_goal_animation()
                ScoreboardRenderer(self.data, self.matrix,
                                   Scoreboard(self.data.games[0],
                                              self.data)).render()
                self.matrix.render()
                data.refresh.daily(self.data)
                sleep(15)
                debug.info("Testing Mode Refresh")

        if self.data.config.test_goal_animation:
            debug.info("Rendering in Testing Mode")
            while True:
                self._draw_goal_animation()
                self.matrix.render()
                sleep(1)

        while self.data.network_issues:
            Clock(self.data, self.matrix, self.sleepEvent, duration=60)
            self.data.refresh_data()

        while True:
            try:
                debug.info('Rendering...')

                if self.status.is_offseason(self.data.date()):
                    # Offseason (Show offseason related stuff)
                    debug.info("It's offseason")
                    self.__render_offday()
                elif self.data.config.testScChampions:
                    self.test_stanley_cup_champion(
                        self.data.config.testScChampions)

                else:
                    # Season.
                    if not self.data.config.live_mode:
                        debug.info(
                            "Live mode is off. Going through the boards")
                        self.__render_offday()
                    elif self.data.is_pref_team_offday():
                        debug.info("Your preferred teams are Off today")
                        self.__render_offday()
                    elif self.data.is_nhl_offday():
                        debug.info("There is no game in the NHL today")
                        self.__render_offday()
                    else:
                        debug.info("Game Day Wooooo")
                        self.__render_game_day()

                self.data.refresh_data()

            except AttributeError as e:
                debug.log(f"ERROR WHILE RENDERING: {e}")
                debug.log("Refreshing data in a minute")
                self.boards.fallback(self.data, self.matrix, self.sleepEvent)
                self.data.refresh_data()
示例#8
0
 def __refresh_game(self, game, overview):
     """Draws the provided game on the canvas."""
     if overview.status == PRE_GAME or overview.status == SCHEDULED:
         pregame = Pregame(overview)
         renderer = PregameRenderer(self.canvas, pregame,
                                    self.current_scrolling_text_pos)
         self.__update_scrolling_text_pos(renderer.render())
     elif overview.status == GAME_OVER or overview.status == FINAL:
         final = Final(game)
         scoreboard = Scoreboard(overview)
         renderer = FinalRenderer(self.canvas, final, scoreboard,
                                  self.current_scrolling_text_pos)
         self.__update_scrolling_text_pos(renderer.render())
     else:
         scoreboard = Scoreboard(overview)
         ScoreboardRenderer(self.canvas, scoreboard).render()
     self.canvas = self.matrix.SwapOnVSync(self.canvas)
示例#9
0
    def __render_game_day(self):
        debug.info("Showing Game")
        # Initialize the scoreboard. get the current status at startup
        self.data.refresh_overview()
        self.scoreboard = Scoreboard(self.data.overview, self.data.teams_info,
                                     self.data.config)
        self.away_score = self.scoreboard.away_team.goals
        self.home_score = self.scoreboard.home_team.goals
        while True:
            if self.data._is_new_day():
                debug.log('This is a new day')
                return

            if self.data.needs_refresh:
                print("refreshing")
                self.data.refresh_current_date()
                self.data.refresh_overview()
                self.data.refresh_games()
                self.data.refresh_standings()
                if self.data.network_issues:
                    self.matrix.network_issue_indicator()

            if self.status.is_live(self.data.overview.status):
                """ Live Game state """
                debug.info("Game is Live")
                self.scoreboard = Scoreboard(self.data.overview,
                                             self.data.teams_info,
                                             self.data.config)
                self.check_new_goals()
                self.__render_live(self.scoreboard)

            elif self.status.is_final(self.data.overview.status):
                """ Post Game state """
                debug.info("Game Over")
                self.scoreboard = Scoreboard(self.data.overview,
                                             self.data.teams_info,
                                             self.data.config)
                self.__render_postgame(self.scoreboard)

            elif self.status.is_scheduled(self.data.overview.status):
                """ Pre-game state """
                debug.info("Game is Scheduled")
                self.scoreboard = Scoreboard(self.data.overview,
                                             self.data.teams_info,
                                             self.data.config)
                self.__render_pregame(self.scoreboard)
示例#10
0
    def render(self):
        color = self.data.config.scoreboard_colors.color("default.background")
        self.canvas.Fill(color["r"], color["g"], color["b"])
        starttime = time.time()

        # Main and only loop
        while True:

            # If we need to refresh the overview data, do that
            if self.data.needs_refresh:
                self.data.refresh_overview()

            # Draw the current game
            self.__draw_game(self.data.current_game(), self.data.overview)

            # Check if we need to scroll until it's finished
            if self.data.config.rotation_scroll_until_finished == False:
                self.scrolling_finished = True

            # Set the refresh rate
            refresh_rate = self.data.config.scrolling_speed

            # If we're not scrolling anything, scroll is always finished.
            if Status.is_static(self.data.overview.status) and not Scoreboard(
                    self.data.overview).get_text_for_reason():
                self.scrolling_finished = True

            time.sleep(refresh_rate)
            endtime = time.time()
            time_delta = endtime - starttime
            rotate_rate = self.__rotate_rate_for_status(
                self.data.overview.status)

            # If we're ready to rotate, let's do it
            if time_delta >= rotate_rate and self.scrolling_finished:
                starttime = time.time()
                self.scrolling_finished = False
                self.data.needs_refresh = True

                if Status.is_fresh(self.data.overview.status):
                    self.scrolling_text_pos = self.canvas.width

                if self.__should_rotate_to_next_game(self.data.overview):
                    self.scrolling_text_pos = self.canvas.width
                    game = self.data.advance_to_next_game()

                if endtime - self.data.games_refresh_time >= GAMES_REFRESH_RATE:
                    self.data.refresh_games()

                if self.data.needs_refresh:
                    self.data.refresh_overview()

                if Status.is_complete(self.data.overview.status):
                    if Final(self.data.current_game()
                             ).winning_pitcher == 'Unknown':
                        self.data.refresh_games()
示例#11
0
    def __render_game(self):
        while True:
            # If we need to refresh the overview data, do that
            if self.data.needs_refresh:
                self.data.refresh_overview()

            # Draw the current game
            self.__draw_game(self.data.current_game(), self.data.overview)

            # Check if we need to scroll until it's finished
            if self.data.config.rotation_scroll_until_finished == False:
                self.scrolling_finished = True

            # Set the refresh rate
            refresh_rate = self.data.config.scrolling_speed

            # Currently the only thing that's always static is the live scoreboard
            if Status.is_static(self.data.overview.status):
                self.scrolling_finished = True

            # If the status is irregular and there's no 'reason' text, finish scrolling
            if Status.is_irregular(self.data.overview.status) and Scoreboard(
                    self.data.overview).get_text_for_reason() is None:
                self.scrolling_finished = True

            time.sleep(refresh_rate)
            endtime = time.time()
            time_delta = endtime - self.starttime
            rotate_rate = self.__rotate_rate_for_status(
                self.data.overview.status)

            # If we're ready to rotate, let's do it
            if time_delta >= rotate_rate and self.scrolling_finished:
                self.starttime = time.time()
                self.scrolling_finished = False
                self.scrolling_period = 0.0
                self.data.needs_refresh = True

                if Status.is_fresh(self.data.overview.status):
                    self.scrolling_text_pos = self.canvas.width

                if self.__should_rotate_to_next_game(self.data.overview):
                    self.scrolling_text_pos = self.canvas.width
                    game = self.data.advance_to_next_game()

                if endtime - self.data.games_refresh_time >= GAMES_REFRESH_RATE:
                    self.data.refresh_games()

                if self.data.needs_refresh:
                    self.data.refresh_overview()

                if Status.is_complete(self.data.overview.status):
                    if Final(self.data.current_game()
                             ).winning_pitcher == 'Unknown':
                        self.data.refresh_games()
示例#12
0
def render_irregular_status(canvas,
                            layout: Layout,
                            colors: Color,
                            scoreboard: Scoreboard,
                            short_text,
                            text_pos=0):
    pos = 0
    if scoreboard.get_text_for_reason():
        pos = __render_scroll_text(canvas, layout, colors, scoreboard,
                                   text_pos)

    __render_game_status(canvas, layout, colors, scoreboard, short_text)

    return pos
示例#13
0
    def __init__(self) -> None:
        """
        Initialize the game, and create game resources.
        """
        pygame.init()

        self.settings = Settings()
        self.screen = pygame.display.set_mode(
            (self.settings.screen_width, self.settings.screen_height))

        pygame.display.set_caption("Alien invasion")

        # Create an instance to store game statistics and scoreboard.
        self.stats = GameStats(self)
        self.sb = Scoreboard(self)

        self.ship = Ship(self)
        self.bullets = pygame.sprite.Group()
        self.aliens = pygame.sprite.Group()

        self._create_fleet()

        # Make the play button
        self.play_button = Button(self, "Play")
    def render(self):
        self.index = 0
        self.games = self.data.games
        self.num_games = len(self.games)
        try:
            while True:
                self.matrix.clear()
                if self.index >= (len(self.games)):
                    return

                ScoreboardRenderer(self.data, self.matrix, Scoreboard(self.games[self.index], self.data.teams_info, self.data.config)).render()
                self.show_indicator()
                self.matrix.render()

                if self.data.network_issues:
                    self.matrix.network_issue_indicator()

                sleep(self.rotation_rate)
                self.index += 1

        except IndexError:
            print("NHL OFF DAY today")
            return
示例#15
0
    def __render_game_day(self):
        debug.info("Showing Game")
        # Initialize the scoreboard. get the current status at startup
        self.data.refresh_overview()
        self.scoreboard = Scoreboard(self.data.overview, self.data)
        self.away_score = self.scoreboard.away_team.goals
        self.home_score = self.scoreboard.home_team.goals
        # Cache to save goals and allow all the details to be collected on the API.
        self.goal_team_cache = []
        self.sleepEvent.clear()

        while not self.sleepEvent.is_set():

            if self.data._is_new_day():
                debug.log('This is a new day')
                return

            # Display the pushbutton board
            if self.data.pb_trigger:
                debug.info(
                    'PushButton triggered in game day loop....will display ' +
                    self.data.config.pushbutton_state_triggered1 + ' board')
                if not self.data.screensaver:
                    self.data.pb_trigger = False
                #Display the board from the config
                self.boards._pb_board(self.data, self.matrix, self.sleepEvent)

            # Display the Weather Alert board
            if self.data.wx_alert_interrupt:
                debug.info(
                    'Weather Alert triggered in game day loop....will display weather alert board'
                )
                self.data.wx_alert_interrupt = False
                #Display the board from the config
                self.boards._wx_alert(self.data, self.matrix, self.sleepEvent)

            # Display the screensaver board
            if self.data.screensaver:
                if not self.data.pb_trigger:
                    debug.info('Screensaver triggered in game day loop....')
                    #self.data.wx_alert_interrupt = False
                    #Display the board from the config
                    self.boards._screensaver(self.data, self.matrix,
                                             self.sleepEvent)
                else:
                    self.data.pb_trigger = False

            if self.status.is_live(self.data.overview.status):
                """ Live Game state """
                #blocks the screensaver from running if game is live
                self.data.screensaver_livegame = True
                debug.info("Game is Live")
                self.scoreboard = Scoreboard(self.data.overview, self.data)
                self.check_new_goals()
                self.__render_live(self.scoreboard)
                if self.scoreboard.intermission:
                    debug.info("Main event is in Intermission")
                    # Show Boards for Intermission
                    self.draw_end_period_indicator()
                    self.sleepEvent.wait(self.refresh_rate)
                    self.check_new_goals()
                    self.boards._intermission(self.data, self.matrix,
                                              self.sleepEvent)
                else:
                    self.sleepEvent.wait(self.refresh_rate)

            elif self.status.is_game_over(self.data.overview.status):
                print(self.data.overview.status)
                debug.info("Game Over")
                self.scoreboard = Scoreboard(self.data.overview, self.data)
                self.check_new_goals()
                if self.data.isPlayoff and self.stanleycup_round:
                    self.check_stanley_cup_champion()
                    if self.data.ScChampions_id:
                        StanleyCupChampions(self.data,
                                            self.data.ScChampions_id,
                                            self.matrix,
                                            self.sleepEvent).render()

                self.__render_postgame(self.scoreboard)

                self.sleepEvent.wait(self.refresh_rate)

            elif self.status.is_final(self.data.overview.status):
                """ Post Game state """
                debug.info("FINAL")
                self.scoreboard = Scoreboard(self.data.overview, self.data)
                self.check_new_goals()
                if self.data.isPlayoff and self.stanleycup_round:
                    self.check_stanley_cup_champion()
                    if self.data.ScChampions_id:
                        StanleyCupChampions(self.data, self.matrix,
                                            self.sleepEvent).render()
                self.__render_postgame(self.scoreboard)

                self.sleepEvent.wait(self.refresh_rate)
                if self.data._next_game():
                    debug.info("moving to the next preferred game")
                    return
                if not self.goal_team_cache:
                    self.boards._post_game(self.data, self.matrix,
                                           self.sleepEvent)

            elif self.status.is_scheduled(self.data.overview.status):
                """ Pre-game state """
                debug.info("Game is Scheduled")
                self.scoreboard = Scoreboard(self.data.overview, self.data)
                self.__render_pregame(self.scoreboard)
                #sleep(self.refresh_rate)
                self.sleepEvent.wait(self.refresh_rate)
                self.boards._scheduled(self.data, self.matrix, self.sleepEvent)

            elif self.status.is_irregular(self.data.overview.status):
                """ Pre-game state """
                debug.info("Game is irregular")
                self.scoreboard = Scoreboard(self.data.overview, self.data)
                self.__render_irregular(self.scoreboard)
                #sleep(self.refresh_rate)
                self.sleepEvent.wait(self.refresh_rate)
                self.boards._scheduled(self.data, self.matrix, self.sleepEvent)

            self.data.refresh_data()
            self.data.refresh_overview()
            if self.data.network_issues:
                self.matrix.network_issue_indicator()

            if self.data.newUpdate and not self.data.config.clock_hide_indicators:
                self.matrix.update_indicator()
示例#16
0
class AlienInvasion:
    """
    Overall class to manage game assets and behavior.
    """
    def __init__(self) -> None:
        """
        Initialize the game, and create game resources.
        """
        pygame.init()

        self.settings = Settings()
        self.screen = pygame.display.set_mode(
            (self.settings.screen_width, self.settings.screen_height))

        pygame.display.set_caption("Alien invasion")

        # Create an instance to store game statistics and scoreboard.
        self.stats = GameStats(self)
        self.sb = Scoreboard(self)

        self.ship = Ship(self)
        self.bullets = pygame.sprite.Group()
        self.aliens = pygame.sprite.Group()

        self._create_fleet()

        # Make the play button
        self.play_button = Button(self, "Play")

    def run_game(self):
        """
        Start the main loop for the game.
        """
        while True:
            self._check_events()

            if self.stats.game_active:
                self.ship.update()
                self._update_bullets()
                self._update_aliens()

            self._update_screen()

    def _check_events(self):
        """
        Respond to keypresses and mouse events.
        """
        for event in pygame.event.get():
            if event.type == pygame.QUIT:
                sys.exit()
            elif event.type == pygame.KEYDOWN:
                self._check_keydown_events(event)
            elif event.type == pygame.KEYUP:
                self._check_keyup_events(event)
            elif event.type == pygame.MOUSEBUTTONDOWN:
                mouse_pos = pygame.mouse.get_pos()
                self._check_play_button(mouse_pos)

    def _check_play_button(self, mouse_pos):
        """
        Start a new game when the player clicks play.
        """
        button_clicked = self.play_button.rect.collidepoint(mouse_pos)
        if button_clicked and not self.stats.game_active:
            # Reset the game settings.
            self.settings.initialize_dynamic_settings()

            # Reset the game statistics.
            self.stats.reset_stats()
            self.stats.game_active = True
            self.sb.prep_score()
            self.sb.prep_level()
            self.sb.prep_ships()

            # Get rid of any remaining aliens and bullets.
            self.aliens.empty()
            self.bullets.empty()

            # Create a new fleet and center the ship.
            self._create_fleet()
            self.ship.center_ship()

            # Hide the mouse cursor.
            pygame.mouse.set_visible(False)

    def _check_keydown_events(self, event):
        """
        Respond to keypresses.
        """
        if event.key == pygame.K_RIGHT:
            self.ship.moving_right = True
        elif event.key == pygame.K_LEFT:
            self.ship.moving_left = True
        elif event.key == pygame.K_q:
            sys.exit()
        elif event.key == pygame.K_SPACE:
            self._fire_bullet()

    def _check_keyup_events(self, event):
        """
        Respond to keyreleases.
        """
        if event.key == pygame.K_RIGHT:
            self.ship.moving_right = False
        elif event.key == pygame.K_LEFT:
            self.ship.moving_left = False

    def _fire_bullet(self):
        """
        Create a new bullet and add it to the bullets group.
        """
        if len(self.bullets) < self.settings.bullets_allowed:
            new_bullet = Bullet(self)
            self.bullets.add(new_bullet)

    def _update_bullets(self):
        """
        Update position of bullets and get rid of old bullets.
        """
        # Update bullets positions.
        self.bullets.update()

        # Get rid of bullets that have disappeared.
        for bullet in self.bullets.copy():
            if bullet.rect.bottom <= 0:
                self.bullets.remove(bullet)

        self._check_bullet_alien_collisions()

    def _check_bullet_alien_collisions(self):
        """
        Respond to bullet-alien collisions.
        """
        # Remove any bullets and aliens that have collided.
        collisions = pygame.sprite.groupcollide(self.bullets, self.aliens,
                                                True, True)

        if collisions:
            for aliens in collisions.values():
                self.stats.score += self.settings.alien_points * len(aliens)
            self.sb.prep_score()
            self.sb.check_high_score()

        if not self.aliens:
            # Destroy existing bullets and create new fleet.
            self.bullets.empty()
            self._create_fleet()
            self.settings.increase_speed()

            # Increase level.
            self.stats.level += 1
            self.sb.prep_level()

    def _update_aliens(self):
        """
        Check if the fleet is at an edge,
            then update the positions of all aliens in the fleet.
        """
        self._check_fleet_edges()
        self.aliens.update()

        # Look for alien-ship collisions.
        if pygame.sprite.spritecollideany(self.ship, self.aliens):
            self._ship_hit()

        # Look for aliens hitting the bottom of the screen.
        self._check_aliens_bottom()

    def _ship_hit(self):
        """
        Respond to the ship being hit by an alien.
        """
        if self.stats.ships_left > 0:
            # Decrement ships_left, and update scoreboard.
            self.stats.ships_left -= 1
            self.sb.prep_ships()

            # Get rid of any remaining aliens and bullets.
            self.aliens.empty()
            self.bullets.empty()

            # Create a new fleet and center the ship.
            self._create_fleet()
            self.ship.center_ship()

            # Pause
            sleep(1.0)
        else:
            self.stats.game_active = False
            pygame.mouse.set_visible(True)

    def _check_aliens_bottom(self):
        """
        Check if any aliens has reach the bottom of the screen.
        """
        screen_rect = self.screen.get_rect()
        for alien in self.aliens.sprites():
            if alien.rect.bottom >= screen_rect.bottom:
                # Treat this the same as if the ship got hit.
                self._ship_hit()
                break

    def _create_fleet(self):
        """
        Create the fleet of aliens.
        """
        # Create an alien and find the number of aliens in a row.
        # Spacing between each alien is equal to one alien width.
        alien = Alien(self)
        alien_width, alien_height = alien.rect.size
        available_space_x = self.settings.screen_width - (2 * alien_width)
        number_aliens_x = available_space_x // (2 * alien_width)

        # Determine the number of rows of aliens that fit on the screen.
        ship_height = self.ship.rect.height
        available_space_y = (self.settings.screen_height - (3 * alien_height) -
                             ship_height)
        number_rows = available_space_y // (2 * alien_height)

        # Create full fleet of aliens.
        for row_number in range(number_rows):
            for alien_number in range(number_aliens_x):
                self._create_alien(alien_number, row_number)

    def _create_alien(self, alien_number, row_number):
        # Create an alien and place it in the row.
        alien = Alien(self)
        alien_width, alien_height = alien.rect.size
        alien.x = alien_width + 2 * alien_width * alien_number
        alien.rect.x = alien.x
        alien.rect.y = alien_height + 2 * alien_height * row_number
        self.aliens.add(alien)

    def _check_fleet_edges(self):
        """
        Respond appropriately if any aliens have reached an edge.
        """
        for alien in self.aliens.sprites():
            if alien.check_edges():
                self._change_fleet_direction()
                break

    def _change_fleet_direction(self):
        """
        Drop the entire fleet and change the fleet's direction.
        """
        for alien in self.aliens.sprites():
            alien.rect.y += self.settings.fleet_drop_speed
        self.settings.fleet_direction *= -1

    def _update_screen(self):
        """
        Update images on the screen, and flip to the new screen.
        """
        self.screen.fill(self.settings.bg_color)
        self.ship.blitme()
        for bullet in self.bullets.sprites():
            bullet.draw_bullet()
        self.aliens.draw(self.screen)

        # Draw the score information.
        self.sb.show_score()

        # Draw the play button if the game is inactive.
        if not self.stats.game_active:
            self.play_button.draw_button()

        pygame.display.flip()
示例#17
0
    def __render_game_day(self):
        debug.info("Showing Game")
        # Initialize the scoreboard. get the current status at startup
        self.data.refresh_overview()
        self.scoreboard = Scoreboard(self.data.overview, self.data)
        self.away_score = self.scoreboard.away_team.goals
        self.home_score = self.scoreboard.home_team.goals
        self.sleepEvent.clear()

        while not self.sleepEvent.is_set():

            if self.data._is_new_day():
                debug.log('This is a new day')
                return

            # Display the pushbutton board
            if self.data.pb_trigger:
                debug.info(
                    'PushButton triggered in game day loop....will display ' +
                    self.data.config.pushbutton_state_triggered1 + ' board')
                self.data.pb_trigger = False
                #Display the board from the config
                self.boards._pb_board(self.data, self.matrix, self.sleepEvent)

            if self.status.is_live(self.data.overview.status):
                """ Live Game state """
                debug.info("Game is Live")
                self.scoreboard = Scoreboard(self.data.overview, self.data)
                self.check_new_goals()
                self.__render_live(self.scoreboard)
                if self.scoreboard.intermission:
                    debug.info("Main event is in Intermission")
                    # Show Boards for Intermission
                    self.draw_end_period_indicator()
                    #sleep(self.refresh_rate)
                    self.sleepEvent.wait(self.refresh_rate)
                    self.boards._intermission(self.data, self.matrix,
                                              self.sleepEvent)
                else:
                    self.sleepEvent.wait(self.refresh_rate)

            elif self.status.is_game_over(self.data.overview.status):
                debug.info("Game Over")
                self.scoreboard = Scoreboard(self.data.overview, self.data)
                self.__render_postgame(self.scoreboard)
                # sleep(self.refresh_rate)
                self.sleepEvent.wait(self.refresh_rate)

            elif self.status.is_final(self.data.overview.status):
                """ Post Game state """
                debug.info("FINAL")
                self.scoreboard = Scoreboard(self.data.overview, self.data)
                self.__render_postgame(self.scoreboard)
                #sleep(self.refresh_rate)
                self.sleepEvent.wait(self.refresh_rate)
                if self.data._next_game():
                    debug.info("moving to the next preferred game")
                    return
                self.boards._post_game(self.data, self.matrix, self.sleepEvent)

            elif self.status.is_scheduled(self.data.overview.status):
                """ Pre-game state """
                debug.info("Game is Scheduled")
                self.scoreboard = Scoreboard(self.data.overview, self.data)
                self.__render_pregame(self.scoreboard)
                #sleep(self.refresh_rate)
                self.sleepEvent.wait(self.refresh_rate)
                self.boards._scheduled(self.data, self.matrix, self.sleepEvent)

            elif self.status.is_irregular(self.data.overview.status):
                """ Pre-game state """
                debug.info("Game is irregular")
                self.scoreboard = Scoreboard(self.data.overview, self.data)
                self.__render_irregular(self.scoreboard)
                #sleep(self.refresh_rate)
                self.sleepEvent.wait(self.refresh_rate)
                self.boards._scheduled(self.data, self.matrix, self.sleepEvent)

            sleep(5)
            self.data.refresh_data()
            self.data.refresh_overview()
            if self.data.network_issues:
                self.matrix.network_issue_indicator()
    def render(self):
        for team_id in self.preferred_teams:
            self.team_id = team_id
            team_colors = self.data.config.team_colors
            bg_color = team_colors.color("{}.primary".format(team_id))
            txt_color = team_colors.color("{}.text".format(team_id))
            prev_game = self.teams_info[team_id].previous_game
            next_game = self.teams_info[team_id].next_game

            try:
                if prev_game:
                    prev_game_id = self.teams_info[team_id].previous_game.dates[0]["games"][0]["gamePk"]
                    prev_game_scoreboard = Scoreboard(nhl_api.overview(prev_game_id), self.teams_info, self.data.config)
                else:
                    prev_game_scoreboard = False

                self.data.network_issues = False
            except ValueError:
                prev_game_scoreboard = False
                self.data.network_issues = True

            try:
                if next_game:
                    next_game_id = self.teams_info[team_id].next_game.dates[0]["games"][0]["gamePk"]
                    next_game_scoreboard = Scoreboard(nhl_api.overview(next_game_id), self.teams_info, self.data.config)
                else:
                    next_game_scoreboard = False

                self.data.network_issues = False
            except ValueError:
                next_game_scoreboard = False
                self.data.network_issues = True

            stats = self.teams_info[team_id].stats
            im_height = 67
            team_abbrev = self.teams_info[team_id].abbreviation
            logo_coord = self.layout._get_summary_logo_coord(team_id)
            team_logo = Image.open(get_file('assets/logos/{}.png'.format(team_abbrev)))

            i = 0
            image = self.draw_team_summary(stats, prev_game_scoreboard, next_game_scoreboard, bg_color, txt_color,
                                           im_height)

            self.matrix.clear()
            self.matrix.draw_image((0, 0), image)
            self.matrix.draw_image((logo_coord["x"], logo_coord["y"]), team_logo.convert("RGB"))
            self.matrix.render()
            if self.data.network_issues:
                self.matrix.network_issue_indicator()
            sleep(5)

            # Move the image up until we hit the bottom.
            while i > -(im_height - self.matrix.height):
                i -= 1

                self.matrix.clear()
                self.matrix.draw_image((0, i), image)
                self.matrix.draw_image((logo_coord["x"], logo_coord["y"]), team_logo.convert("RGB"))
                self.matrix.render()
                if self.data.network_issues:
                    self.matrix.network_issue_indicator()
                sleep(0.3)
            # Show the bottom before we change to the next table.
            sleep(5)
示例#19
0
    def draw_series_table(self, series):

        color_top_bg = self.team_colors.color("{}.primary".format(
            series.top_team.id))
        color_top_team = self.team_colors.color("{}.text".format(
            series.top_team.id))

        color_bottom_bg = self.team_colors.color("{}.primary".format(
            series.bottom_team.id))
        color_bottom_team = self.team_colors.color("{}.text".format(
            series.bottom_team.id))

        # Table
        self.matrix.draw.line([(0, 21), (self.matrix.width, 21)],
                              width=1,
                              fill=(150, 150, 150))

        # use rectangle because I want to keep symmetry for the background of team's abbrev
        self.matrix.draw.rectangle([0, 14, 12, 20],
                                   fill=(color_top_bg['r'], color_top_bg['g'],
                                         color_top_bg['b']))
        self.matrix.draw_text((1, 15),
                              series.top_team.abbrev,
                              font=self.font,
                              fill=(color_top_team['r'], color_top_team['g'],
                                    color_top_team['b']))

        self.matrix.draw.rectangle([0, 22, 12, 28],
                                   fill=(color_bottom_bg['r'],
                                         color_bottom_bg['g'],
                                         color_bottom_bg['b']))
        self.matrix.draw_text(
            (1, 23),
            series.bottom_team.abbrev,
            font=self.font,
            fill=(color_bottom_team['r'], color_bottom_team['g'],
                  color_bottom_team['b']))

        rec_width = 0
        top_row = 15
        bottom_row = 23
        loosing_color = (150, 150, 150)

        # text offset for loosing score if the winning team has a score of 10 or higher and loosing team
        # have a score lower then 10
        """
            TODO: Grabbing all the games of a series cause delay up to 15 sec for certain users. I think its time to put all the data
            refresh into a thread and refresh everything from there
            . 
        """
        offset_correction = 0
        for game in series.games:
            attempts_remaining = 5
            while attempts_remaining > 0:
                try:
                    # Request the game overview
                    overview = nhl_api.overview(game["gameId"])

                    # get the scoreboard
                    scoreboard = Scoreboard(overview, self.data)

                    if self.data.status.is_final(overview.status) and hasattr(
                            scoreboard, "winning_team"):
                        if scoreboard.winning_team == series.top_team.id:
                            winning_row = top_row
                            loosing_row = bottom_row
                            winning_team_color = color_top_team
                            winning_bg_color = color_top_bg
                        else:
                            winning_row = bottom_row
                            loosing_row = top_row
                            winning_team_color = color_bottom_team
                            winning_bg_color = color_bottom_bg

                        # Look loosing score text needs an offset
                        if len(str(scoreboard.winning_score)) == 2 and len(
                                str(scoreboard.winning_score)) == 1:
                            offset_correction = 1

                        self.matrix.draw_text(
                            ((rec_width + 15 + offset_correction),
                             loosing_row),
                            str(scoreboard.loosing_score),
                            font=self.font,
                            fill=loosing_color,
                            backgroundColor=None,
                            backgroundOffset=[1, 1, 1, 1])

                        position = self.matrix.draw_text(
                            (rec_width + 15, winning_row),
                            str(scoreboard.winning_score),
                            font=self.font,
                            fill=(winning_team_color['r'],
                                  winning_team_color['g'],
                                  winning_team_color['b']),
                            backgroundColor=(winning_bg_color['r'],
                                             winning_bg_color['g'],
                                             winning_bg_color['b']),
                            backgroundOffset=[1, 1, 1, 1])

                        # Increment
                        rec_width += (position["size"][0] + 4)
                    break

                except ValueError as error_message:
                    self.data.network_issues = True
                    debug.error(
                        "Failed to get the Games for the {} VS {} series: {} attempts remaining"
                        .format(series.top_team.abbrev,
                                series.bottom_team.abbrev, attempts_remaining))
                    debug.error(error_message)
                    attempts_remaining -= 1
                    self.sleepEvent.wait(1)
                except KeyError as error_message:
                    debug.error(
                        "Failed to get the overview for game id {}. Data unavailable or is TBD"
                        .format(game["gameId"]))
                    debug.error(error_message)
                    break
            # If one of the request for player info failed after 5 attempts, return an empty dictionary
            if attempts_remaining == 0:
                return False
示例#20
0
    def __draw_game(self):
        game = self.data.current_game
        bgcolor = self.data.config.scoreboard_colors.color(
            "default.background")
        self.canvas.Fill(bgcolor["r"], bgcolor["g"], bgcolor["b"])
        scoreboard = Scoreboard(game)
        layout = self.data.config.layout
        colors = self.data.config.scoreboard_colors
        teams.render_team_banner(
            self.canvas,
            layout,
            self.data.config.team_colors,
            scoreboard.home_team,
            scoreboard.away_team,
            self.data.config.full_team_names,
            self.data.config.short_team_names_for_runs_hits,
        )

        if status.is_pregame(game.status()):  # Draw the pregame information
            self.__max_scroll_x(layout.coords("pregame.scrolling_text"))
            pregame = Pregame(game, self.data.config.time_format)
            pos = pregamerender.render_pregame(
                self.canvas, layout, colors, pregame, self.scrolling_text_pos,
                self.data.config.pregame_weather)
            self.__update_scrolling_text_pos(pos, self.canvas.width)

        elif status.is_complete(game.status()):  # Draw the game summary
            self.__max_scroll_x(layout.coords("final.scrolling_text"))
            final = Postgame(game)
            pos = postgamerender.render_postgame(self.canvas, layout, colors,
                                                 final, scoreboard,
                                                 self.scrolling_text_pos)
            self.__update_scrolling_text_pos(pos, self.canvas.width)

        elif status.is_irregular(game.status()):  # Draw game status
            short_text = self.data.config.layout.coords(
                "status.text")["short_text"]
            if scoreboard.get_text_for_reason():
                self.__max_scroll_x(layout.coords("status.scrolling_text"))
                pos = irregular.render_irregular_status(
                    self.canvas, layout, colors, scoreboard, short_text,
                    self.scrolling_text_pos)
                self.__update_scrolling_text_pos(pos, self.canvas.width)
            else:
                irregular.render_irregular_status(self.canvas, layout, colors,
                                                  scoreboard, short_text)
                self.data.scrolling_finished = True

        else:  # draw a live game
            if scoreboard.homerun() or scoreboard.strikeout():
                self.animation_time += 1
            else:
                self.animation_time = 0

            loop_point = self.data.config.layout.coords("atbat")["loop"]
            self.scrolling_text_pos = min(self.scrolling_text_pos, loop_point)
            pos = gamerender.render_live_game(self.canvas, layout, colors,
                                              scoreboard,
                                              self.scrolling_text_pos,
                                              self.animation_time)
            self.__update_scrolling_text_pos(pos, loop_point)

        # Show network issues
        if self.data.network_issues:
            network.render_network_error(self.canvas, layout, colors)

        self.canvas = self.matrix.SwapOnVSync(self.canvas)
示例#21
0
    def render(self):
        for team_id in self.preferred_teams:
            self.team_id = team_id

            team = self.teams_info[team_id]
            team_data = Team(team.team_id, team.abbreviation, team.name)

            team_colors = self.data.config.team_colors
            bg_color = team_colors.color("{}.primary".format(team_id))
            txt_color = team_colors.color("{}.text".format(team_id))
            prev_game = team.previous_game
            next_game = team.next_game

            logo_renderer = LogoRenderer(self.matrix, self.data.config,
                                         self.layout.logo, team_data,
                                         'team_summary')

            try:
                if prev_game:
                    prev_game_id = self.teams_info[
                        team_id].previous_game.dates[0]["games"][0]["gamePk"]
                    prev_game_scoreboard = Scoreboard(
                        nhl_api.overview(prev_game_id), self.data)
                else:
                    prev_game_scoreboard = False

                self.data.network_issues = False
            except ValueError:
                prev_game_scoreboard = False
                self.data.network_issues = True

            try:
                if next_game:
                    next_game_id = self.teams_info[team_id].next_game.dates[0][
                        "games"][0]["gamePk"]
                    next_game_scoreboard = Scoreboard(
                        nhl_api.overview(next_game_id), self.data)
                else:
                    next_game_scoreboard = False

                self.data.network_issues = False
            except ValueError:
                next_game_scoreboard = False
                self.data.network_issues = True

            stats = team.stats
            im_height = 67
            team_abbrev = team.abbreviation
            team_logo = Image.open(
                get_file('assets/logos/{}.png'.format(team_abbrev)))

            i = 0

            if not self.sleepEvent.is_set():
                image = self.draw_team_summary(stats, prev_game_scoreboard,
                                               next_game_scoreboard, bg_color,
                                               txt_color, im_height)

            self.matrix.clear()

            logo_renderer.render()

            self.matrix.draw_image_layout(
                self.layout.info,
                image,
            )

            self.matrix.render()
            if self.data.network_issues:
                self.matrix.network_issue_indicator()
            self.sleepEvent.wait(5)

            # Move the image up until we hit the bottom.
            while i > -(im_height -
                        self.matrix.height) and not self.sleepEvent.is_set():
                i -= 1

                self.matrix.clear()

                logo_renderer.render()
                self.matrix.draw_image_layout(self.layout.info, image, (0, i))

                self.matrix.render()
                if self.data.network_issues:
                    self.matrix.network_issue_indicator()
                self.sleepEvent.wait(0.3)

            # Show the bottom before we change to the next table.
            self.sleepEvent.wait(5)
示例#22
0
    def __render_game_day(self):
        debug.info("Showing Game")
        # Initialize the scoreboard. get the current status at startup
        self.data.refresh_overview()
        self.scoreboard = Scoreboard(self.data.overview, self.data)
        self.away_score = self.scoreboard.away_team.goals
        self.home_score = self.scoreboard.home_team.goals
        self.away_penalties = self.scoreboard.away_team.penalties
        self.home_penalties = self.scoreboard.home_team.penalties

        # Announce a game today to /dev/shm/getNHL.txt.1
        home_name = self.scoreboard.home_team.name
        away_name = self.scoreboard.away_team.name
        stime = self.scoreboard.start_time
        f = open('/dev/shm/getNHL.txt.1', 'w')
        #f.write('Blues game today!')
        f.write('NHL: %s vs %s, %spm\n' % (home_name, away_name, stime))
        f.close()
        subprocess_cmd = 'sudo -H -u pi bash -c "rsync /dev/shm/getNHL.txt.1 [email protected]:/dev/shm/"'
        subprocess.run([subprocess_cmd], shell=True)

        # Cache to save goals and penalties and allow all the details to be collected on the API.
        self.goal_team_cache = []
        self.penalties_team_cache = []
        self.sleepEvent.clear()

        while not self.sleepEvent.is_set():

            if self.data._is_new_day():
                debug.log('This is a new day')
                return

            # Display the pushbutton board
            if self.data.pb_trigger:
                debug.info(
                    'PushButton triggered in game day loop....will display ' +
                    self.data.config.pushbutton_state_triggered1 + ' board')
                if not self.data.screensaver:
                    self.data.pb_trigger = False
                #Display the board from the config
                self.boards._pb_board(self.data, self.matrix, self.sleepEvent)

            # Display the Weather Alert board
            if self.data.wx_alert_interrupt:
                debug.info(
                    'Weather Alert triggered in game day loop....will display weather alert board'
                )
                self.data.wx_alert_interrupt = False
                #Display the board from the config
                self.boards._wx_alert(self.data, self.matrix, self.sleepEvent)

            # Display the screensaver board
            if self.data.screensaver:
                if not self.data.pb_trigger:
                    debug.info('Screensaver triggered in game day loop....')
                    #self.data.wx_alert_interrupt = False
                    #Display the board from the config
                    self.boards._screensaver(self.data, self.matrix,
                                             self.sleepEvent)
                else:
                    self.data.pb_trigger = False

            if self.status.is_live(self.data.overview.status):
                """ Live Game state """
                #blocks the screensaver from running if game is live
                self.data.screensaver_livegame = True
                debug.info("Game is Live")
                sbrenderer = ScoreboardRenderer(self.data, self.matrix,
                                                self.scoreboard)

                self.check_new_penalty()
                self.check_new_goals()
                self.__render_live(sbrenderer)
                if self.scoreboard.intermission:
                    debug.info("Main event is in Intermission")
                    # Show Boards for Intermission
                    self.draw_end_period_indicator()
                    self.sleepEvent.wait(self.refresh_rate)

                    self.check_new_penalty()
                    self.check_new_goals()
                    self.boards._intermission(self.data, self.matrix,
                                              self.sleepEvent)

                else:
                    self.sleepEvent.wait(self.refresh_rate)

            elif self.status.is_game_over(self.data.overview.status):
                debug.info("Game Over")
                sbrenderer = ScoreboardRenderer(self.data, self.matrix,
                                                self.scoreboard)
                self.check_new_goals()
                if self.data.isPlayoff and self.data.stanleycup_round:
                    self.check_stanley_cup_champion()
                    if self.data.ScChampions_id:
                        StanleyCupChampions(self.data, self.matrix,
                                            self.sleepEvent).render()

                self.__render_postgame(sbrenderer)

                self.sleepEvent.wait(self.refresh_rate)

            elif self.status.is_final(self.data.overview.status):
                """ Post Game state """
                debug.info("FINAL")
                sbrenderer = ScoreboardRenderer(self.data, self.matrix,
                                                self.scoreboard)
                self.check_new_goals()

                # Announce a game today to /dev/shm/getNHL.txt.1
                home_name = self.scoreboard.home_team.name
                away_name = self.scoreboard.away_team.name
                home_goals = self.scoreboard.home_team.goals
                away_goals = self.scoreboard.away_team.goals
                f = open('/dev/shm/getNHL.txt.1', 'w')
                #f.write('Blues game today!')
                f.write('%s %d, %s %d FINAL\n' %
                        (home_name, home_goals, away_name, away_goals))
                f.close()
                subprocess_cmd = 'sudo -H -u pi bash -c "rsync /dev/shm/getNHL.txt.1 [email protected]:/dev/shm/"'
                subprocess.run([subprocess_cmd], shell=True)

                if self.data.isPlayoff and self.data.stanleycup_round:
                    self.check_stanley_cup_champion()
                    if self.data.ScChampions_id:
                        StanleyCupChampions(self.data, self.matrix,
                                            self.sleepEvent).render()
                self.__render_postgame(sbrenderer)

                self.sleepEvent.wait(self.refresh_rate)
                if not self.goal_team_cache:
                    self.boards._post_game(self.data, self.matrix,
                                           self.sleepEvent)

            elif self.status.is_scheduled(self.data.overview.status):
                """ Pre-game state """
                debug.info("Game is Scheduled")
                sbrenderer = ScoreboardRenderer(self.data, self.matrix,
                                                self.scoreboard)
                self.__render_pregame(sbrenderer)
                #sleep(self.refresh_rate)
                self.sleepEvent.wait(self.refresh_rate)
                self.boards._scheduled(self.data, self.matrix, self.sleepEvent)
                #announce upcoming game
                home_name = self.scoreboard.home_team.name
                away_name = self.scoreboard.away_team.name
                stime = self.scoreboard.start_time
                f = open('/dev/shm/getNHL.txt.1', 'w')
                f.write('NHL: %s vs %s, %spm\n' %
                        (home_name, away_name, stime))
                f.close()
                subprocess_cmd = 'sudo -H -u pi bash -c "rsync /dev/shm/getNHL.txt.1 [email protected]:/dev/shm/"'
                subprocess.run([subprocess_cmd], shell=True)

            elif self.status.is_irregular(self.data.overview.status):
                """ Pre-game state """
                debug.info("Game is irregular")
                sbrenderer = ScoreboardRenderer(self.data, self.matrix,
                                                self.scoreboard)
                self.__render_irregular(sbrenderer)
                #sleep(self.refresh_rate)
                self.sleepEvent.wait(self.refresh_rate)
                self.boards._scheduled(self.data, self.matrix, self.sleepEvent)

            self.data.refresh_data()
            self.data.refresh_overview()
            self.scoreboard = Scoreboard(self.data.overview, self.data)
            if self.data.network_issues:
                self.matrix.network_issue_indicator()

            if self.data.newUpdate and not self.data.config.clock_hide_indicators:
                self.matrix.update_indicator()