if not game_end:

                        # Check score online and save score
                        new_score = nhl.fetch_score(team_id)

                        # If score change...
                        if new_score != old_score:
                            time.sleep(delay)
                            if new_score > old_score:
                                # save new score
                                print("GOAL!")
                                # activate_goal_light()
                                light.activate_goal_light()
                            old_score = new_score

                    else:
                        print("Game Over!")
                        old_score = 0  # Reset for new game
                        sleep("day")  # sleep till tomorrow
                else:
                    print("No Game Today!")
                    sleep("day")  # sleep till tomorrow
            else:
                print("OFF SEASON!")
                sleep("season")  # sleep till next season

    except KeyboardInterrupt:
        print("\nCtrl-C pressed")
        light.cleanup()
Example #2
0
                    if not game_end:
            
                        # Check score online and save score
                        new_score = nhl.fetch_score(team_id)

                        # If score change...
                        if new_score != old_score:
                            time.sleep(delay) 
                            if new_score > old_score:
                                # save new score
                                print("GOAL!")
                                # activate_goal_light()
                                light.activate_goal_light()
                            old_score = new_score
                            

                    else:
                        print("Game Over!")
                        old_score = 0 # Reset for new game
                        sleep("day")  # sleep till tomorrow
                else:
                    print("No Game Today!")
                    sleep("day")  # sleep till tomorrow
            else:
                print("OFF SEASON!")
                sleep("season")  # sleep till next season

    except KeyboardInterrupt:
        print("\nCtrl-C pressed")
        light.cleanup()