예제 #1
0
    def handle(self, *args, **options):
        self.clean_prev_process()
        while True:
            curr_date = datetime.now()
            Mlb().save_games(date=curr_date.date())
            games = GameMLB.objects.filter(Day=curr_date.date())
            print curr_date
            for game in games:
                print game.GameID
                game_datetime = localtime(
                    game.DateTime).strftime('%Y-%m-%d %H:%M:%S')
                print game_datetime
                current_date = curr_date.replace(
                    tzinfo=self.utc).strftime('%Y-%m-%d %H:%M:%S')
                print current_date
                game_started = current_date > game_datetime
                print game_started
                if game_started:
                    is_game_pending = game.Status not in ('Final', 'Postponed',
                                                          'Canceled')
                    if is_game_pending:
                        print "getting Real Time Data... .. .. . . ."
                        Mlb().save_box_scores(date=curr_date.date())
                        time.sleep(5)

            time.sleep(60)
예제 #2
0
    def handle(self, *args, **options):
        # season : string  (Year of the season. Examples: 2017, 2018.)

        Mlb().save_player_seasons(season=options['season'])
예제 #3
0
 def handle(self, *args, **options):
     Mlb().create_teams()
 def handle(self, *args, **options):
     Mlb().save_box_scores(date=options['date'])
     print options['date']
예제 #5
0
 def handle(self, *args, **options):
     Mlb().save_dfs_slates(date=options['date'])
     print options['date']
 def handle(self, *args, **options):
     Mlb().save_player_games(date=options['date'])
     print options['date']
예제 #7
0
 def handle(self, *args, **options):
     Mlb().create_players()
예제 #8
0
 def handle(self, *args, **options):
     Mlb().create_stadiums()
    def handle(self, *args, **options):

        Mlb().save_standings(season=options['season'])
        print options['season']