Skip to content

Commit

Permalink
Keep track of coverage
Browse files Browse the repository at this point in the history
  • Loading branch information
zachwill committed Feb 28, 2012
1 parent 91b62fe commit c35ed2a
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
8 changes: 6 additions & 2 deletions boxscore.coffee
Expand Up @@ -13,6 +13,7 @@ scrape_box = (error, window) ->
attendance: 0
box: away: null, home: null
conference: {}
coverage: null
date: {}
final: away: null, home: null
half: away: null, home: null
Expand All @@ -32,18 +33,21 @@ scrape_box = (error, window) ->
store.teams.away.name = away
store.teams.home.name = home

# Now, time and location.
# Now for time and location.
info = $('.game-time-location > p')
location = info.eq(1).text()
store.location = location
time = info.eq(0).text().split(',')
[time, day] = [time.shift(), time.join(',')]
[time, day] = [time.shift(), $.trim(time.join(','))]
date_string = "#{day} #{time}"
store.date =
time: time,
day: day,
string: date_string,
epoch: +moment(date_string, 'MMMM D, YYYY h:mm A zz')
# And see if it was on TV.
coverage = $('.game-vitals > p > strong').text() or null
store.coverage = coverage

# Then grab the line score.
line = $('table.linescore')
Expand Down
1 change: 1 addition & 0 deletions example.json
Expand Up @@ -9,6 +9,7 @@
"game": true,
"name": "Sun Belt"
},
"coverage": "ESPN/ESPN3",
"date": {
"day": "January 7, 2012",
"epoch": 1325984400000,
Expand Down

0 comments on commit c35ed2a

Please sign in to comment.