(self)
Refresh the current list of games of the day.

            self.games : List of all the games happening today
            self.pref_games : List of games which the preferred teams are ordered by priority.

            If the user want's to rotate only his preferred games between the periods and during the day, save those
            only. Lastly, If if not an Off day for the pref teams, reorder the list in order of preferred teams and load
            the first game as the main event.

            TODO:
                Add the option to start the earliest game in the preferred game list but change to the top one as soon as it start.
Refresh the current list of games of the day.
Refresh the current list of games of the day .
def refresh_games(self):
        """
            Refresh the current list of games of the day.

            self.games : List of all the games happening today
            self.pref_games : List of games which the preferred teams are ordered by priority.

            If the user want's to rotate only his preferred games between the periods and during the day, save those
            only. Lastly, If if not an Off day for the pref teams, reorder the list in order of preferred teams and load
            the first game as the main event.

            TODO:
                Add the option to start the earliest game in the preferred game list but change to the top one as soon as it start.
        """
        attempts_remaining = 5
        while attempts_remaining > 0:
            try:
                self.games = nhl_api.day(self.year, self.month, self.day)
                self.pref_games = filter_list_of_games(self.games, self.pref_teams)
                if self.config.preferred_teams_only and self.pref_teams:
                    self.games = self.pref_games
                if not self.is_pref_team_offday() and self.config.live_mode:
                    self.pref_games = prioritize_pref_games(self.pref_games, self.pref_teams)
                    self.check_all_pref_games_final()

                    self.check_game_priority()

                self.network_issues = False
                break

            except ValueError as error_message:
                self.network_issues = True
                debug.error("Failed to refresh the list of games. {} attempt remaining.".format(attempts_remaining))
                debug.error(error_message)
                attempts_remaining -= 1
                sleep(NETWORK_RETRY_SLEEP_TIME)

            except IndexError as error_message:
                debug.error(error_message)
                debug.info("All preferred games are Final, showing the top preferred game")
                #self.current_game_index = 0
                self.all_pref_games_final = True
                self.refresh_games()
def refresh_games ( self ) : attempts_remaining = 5 while attempts_remaining > 0 : try : self . games = nhl_api . day ( self . year , self . month , self . day ) self . pref_games = filter_list_of_games ( self . games , self . pref_teams ) if self . config . preferred_teams_only and self . pref_teams : self . games = self . pref_games if not self . is_pref_team_offday ( ) and self . config . live_mode : self . pref_games = prioritize_pref_games ( self . pref_games , self . pref_teams ) self . check_all_pref_games_final ( ) self . check_game_priority ( ) self . network_issues = False break except ValueError as error_message : self . network_issues = True debug . error ( "Failed to refresh the list of games. {} attempt remaining." . format ( attempts_remaining ) ) debug . error ( error_message ) attempts_remaining -= 1 sleep ( NETWORK_RETRY_SLEEP_TIME ) except IndexError as error_message : debug . error ( error_message ) debug . info ( "All preferred games are Final, showing the top preferred game" ) #self.current_game_index = 0 self . all_pref_games_final = True self . refresh_games ( )