def _create_schedule(jsonf=None):
 day = ((60 * 60) * 24)
 if (jsonf is None):
  jsonf = _sched_json_file
 try:
  data = json.loads(open(jsonf).read())
 except IOError:
  return OrderedDict()
 d = OrderedDict()
 for (gsis_id, info) in data.get('games', []):
  d[gsis_id] = info
 last_updated = datetime.datetime.utcfromtimestamp(data.get('time', 0))
 if ((datetime.datetime.utcnow() - last_updated).total_seconds() >= day):
  if os.access(jsonf, os.W_OK):
   import nflgame.live
   import nflgame.update_sched
   (year, week) = nflgame.live.current_year_and_week()
   phase = nflgame.live._cur_season_phase
   nflgame.update_sched.update_week(d, year, phase, week)
   nflgame.update_sched.write_schedule(jsonf, d)
   last_updated = datetime.datetime.now()
 return (d, last_updated)

def _create_schedule ( jsonf = None ) : day = ( ( 60 * 60 ) * 24 ) if ( jsonf is None ) : jsonf = _sched_json_file try : data = json . loads ( open ( jsonf ) . read ( ) ) except IOError : return OrderedDict ( ) d = OrderedDict ( ) for ( gsis_id , info ) in data . get ( 'games' , [ ] ) : d [ gsis_id ] = info last_updated = datetime . datetime . utcfromtimestamp ( data . get ( 'time' , 0 ) ) if ( ( datetime . datetime . utcnow ( ) - last_updated ) . total_seconds ( ) >= day ) : if os . access ( jsonf , os . W_OK ) : import nflgame . live import nflgame . update_sched ( year , week ) = nflgame . live . current_year_and_week ( ) phase = nflgame . live . _cur_season_phase nflgame . update_sched . update_week ( d , year , phase , week ) nflgame . update_sched . write_schedule ( jsonf , d ) last_updated = datetime . datetime . now ( ) return ( d , last_updated )
returns an ordered dict of schedule data from the schedule .