baseball_scorecard 0.0.2 → 0.0.3
Sign up to get free protection for your applications and to get access to all the features.
- data/baseball_scorecard.gemspec +0 -8
- data/images/baseball.png +0 -0
- data/images/bases-1-2-3.png +0 -0
- data/images/bases-1-2.png +0 -0
- data/images/bases-1-3.png +0 -0
- data/images/bases-1.png +0 -0
- data/images/bases-2-3.png +0 -0
- data/images/bases-2.png +0 -0
- data/images/bases-3.png +0 -0
- data/images/bases.png +0 -0
- data/{lib/baseball_scorecard/images/out_line.png → images/bases_bg.png} +0 -0
- data/images/bases_no_ba.png +0 -0
- data/images/grass.jpg +0 -0
- data/{lib/baseball_scorecard/images/out_fly.png → images/hit_1B.png} +0 -0
- data/{lib/baseball_scorecard/images/out_ground.png → images/hit_2B.png} +0 -0
- data/{lib/baseball_scorecard/images/hit_BB.png → images/hit_3B.png} +0 -0
- data/{lib/baseball_scorecard/images/error.png → images/hit_HR.png} +0 -0
- data/images/team_images/ana.png +0 -0
- data/images/team_images/ari.png +0 -0
- data/images/team_images/atl.png +0 -0
- data/images/team_images/bal.png +0 -0
- data/images/team_images/bos.png +0 -0
- data/images/team_images/cha.png +0 -0
- data/images/team_images/chn.png +0 -0
- data/images/team_images/cin.png +0 -0
- data/images/team_images/cle.png +0 -0
- data/images/team_images/col.png +0 -0
- data/images/team_images/det.png +0 -0
- data/images/team_images/flo.png +0 -0
- data/images/team_images/hou.png +0 -0
- data/images/team_images/kca.png +0 -0
- data/images/team_images/lan.png +0 -0
- data/images/team_images/mil.png +0 -0
- data/images/team_images/min.png +0 -0
- data/images/team_images/nya.png +0 -0
- data/images/team_images/nyn.png +0 -0
- data/images/team_images/oak.png +0 -0
- data/images/team_images/phi.png +0 -0
- data/images/team_images/pit.png +0 -0
- data/images/team_images/sdn.png +0 -0
- data/images/team_images/sea.png +0 -0
- data/images/team_images/sfn.png +0 -0
- data/images/team_images/sln.png +0 -0
- data/images/team_images/tba.png +0 -0
- data/images/team_images/tex.png +0 -0
- data/images/team_images/tor.png +0 -0
- data/images/team_images/was.png +0 -0
- data/lib/baseball_scorecard/card_generator.rb +158 -181
- data/lib/baseball_scorecard/images/hit_1B.png +0 -0
- data/lib/baseball_scorecard/images/hit_2B.png +0 -0
- data/lib/baseball_scorecard/images/hit_3B.png +0 -0
- data/lib/baseball_scorecard/images/hit_HR.png +0 -0
- data/lib/baseball_scorecard/images/team_images/ana.png +0 -0
- data/lib/baseball_scorecard/images/team_images/ari.png +0 -0
- data/lib/baseball_scorecard/images/team_images/atl.png +0 -0
- data/lib/baseball_scorecard/images/team_images/bal.png +0 -0
- data/lib/baseball_scorecard/images/team_images/bos.png +0 -0
- data/lib/baseball_scorecard/images/team_images/cha.png +0 -0
- data/lib/baseball_scorecard/images/team_images/chn.png +0 -0
- data/lib/baseball_scorecard/images/team_images/cin.png +0 -0
- data/lib/baseball_scorecard/images/team_images/cle.png +0 -0
- data/lib/baseball_scorecard/images/team_images/col.png +0 -0
- data/lib/baseball_scorecard/images/team_images/det.png +0 -0
- data/lib/baseball_scorecard/images/team_images/flo.png +0 -0
- data/lib/baseball_scorecard/images/team_images/hou.png +0 -0
- data/lib/baseball_scorecard/images/team_images/kca.png +0 -0
- data/lib/baseball_scorecard/images/team_images/lan.png +0 -0
- data/lib/baseball_scorecard/images/team_images/mil.png +0 -0
- data/lib/baseball_scorecard/images/team_images/min.png +0 -0
- data/lib/baseball_scorecard/images/team_images/nya.png +0 -0
- data/lib/baseball_scorecard/images/team_images/nyn.png +0 -0
- data/lib/baseball_scorecard/images/team_images/oak.png +0 -0
- data/lib/baseball_scorecard/images/team_images/phi.png +0 -0
- data/lib/baseball_scorecard/images/team_images/pit.png +0 -0
- data/lib/baseball_scorecard/images/team_images/sdn.png +0 -0
- data/lib/baseball_scorecard/images/team_images/sea.png +0 -0
- data/lib/baseball_scorecard/images/team_images/sfn.png +0 -0
- data/lib/baseball_scorecard/images/team_images/sln.png +0 -0
- data/lib/baseball_scorecard/images/team_images/tba.png +0 -0
- data/lib/baseball_scorecard/images/team_images/tex.png +0 -0
- data/lib/baseball_scorecard/images/team_images/tor.png +0 -0
- data/lib/baseball_scorecard/images/team_images/was.png +0 -0
- data/lib/baseball_scorecard/version.rb +1 -1
- data/lib/baseball_scorecard.rb +0 -1
- data/readme.txt +2 -2
- metadata +54 -35
- data/lib/baseball_scorecard/images/hit_HBP.png +0 -0
- data/lib/baseball_scorecard/images/hit_IBB.png +0 -0
- data/lib/baseball_scorecard/images/out_called.png +0 -0
- data/lib/baseball_scorecard/images/out_double-play.png +0 -0
- data/lib/baseball_scorecard/images/out_force.png +0 -0
- data/lib/baseball_scorecard/images/out_pop.png +0 -0
- data/lib/baseball_scorecard/images/out_strikes.png +0 -0
- data/lib/baseball_scorecard/images/out_triple-play.png +0 -0
- data/lib/baseball_scorecard/images/outs_1.png +0 -0
- data/lib/baseball_scorecard/images/outs_2.png +0 -0
- data/lib/baseball_scorecard/images/outs_3.png +0 -0
data/baseball_scorecard.gemspec
CHANGED
@@ -11,20 +11,12 @@ Gem::Specification.new do |s|
|
|
11
11
|
s.summary = %q{Baseball scorecard generator}
|
12
12
|
s.description = %q{Baseball scorecard generator}
|
13
13
|
|
14
|
-
# s.rubyforge_project = "baseball_scorecard"
|
15
|
-
|
16
14
|
s.files = `git ls-files`.split("\n")
|
17
15
|
s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
|
18
|
-
# s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
|
19
16
|
s.executables << 'scorecard'
|
20
17
|
s.require_paths = ["lib"]
|
21
|
-
|
22
|
-
# specify any dependencies here; for example:
|
23
|
-
# s.add_development_dependency "rspec"
|
24
|
-
# s.add_runtime_dependency "rest-client"
|
25
18
|
|
26
19
|
s.add_runtime_dependency "green_shoes"
|
27
|
-
s.add_runtime_dependency "hpricot"
|
28
20
|
s.add_runtime_dependency "gameday_api"
|
29
21
|
s.add_runtime_dependency "launchy"
|
30
22
|
end
|
data/images/baseball.png
ADDED
Binary file
|
Binary file
|
Binary file
|
Binary file
|
data/images/bases-1.png
ADDED
Binary file
|
Binary file
|
data/images/bases-2.png
ADDED
Binary file
|
data/images/bases-3.png
ADDED
Binary file
|
data/images/bases.png
ADDED
Binary file
|
Binary file
|
Binary file
|
data/images/grass.jpg
ADDED
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
@@ -8,7 +8,7 @@ end
|
|
8
8
|
module CardGenerator
|
9
9
|
|
10
10
|
def init_cards(game)
|
11
|
-
@
|
11
|
+
@image_dir = File.join(File.expand_path(File.dirname(__FILE__)), "images")
|
12
12
|
Thread.new{init_batting_arrays(game)}
|
13
13
|
end
|
14
14
|
|
@@ -157,78 +157,69 @@ module CardGenerator
|
|
157
157
|
else
|
158
158
|
bases << atbat.pitches[0].on_1b << atbat.pitches[0].on_2b << atbat.pitches[0].on_3b
|
159
159
|
end
|
160
|
-
bases_file = File.join(@
|
160
|
+
bases_file = File.join(@image_dir, 'bases')
|
161
161
|
bases.each_with_index{|b, i|
|
162
162
|
if b
|
163
163
|
bases_file << "-#{(i+1).to_s}"
|
164
164
|
end
|
165
165
|
}
|
166
|
-
bases_file
|
166
|
+
bases_file << '.png'
|
167
167
|
@elements << bases_file #[0]
|
168
|
-
|
168
|
+
|
169
|
+
event_image = nil
|
169
170
|
case atbat.event
|
170
171
|
when "Single"
|
171
|
-
event_image = File.join(@
|
172
|
+
note = "1B"; event_image = File.join(@image_dir, 'hit_1B.png')
|
172
173
|
get_fldg(atbat.des)
|
173
174
|
when "Double"
|
174
|
-
event_image = File.join(@
|
175
|
+
note = "2B"; event_image = File.join(@image_dir, 'hit_2B.png')
|
175
176
|
get_fldg(atbat.des)
|
176
177
|
when "Triple"
|
177
|
-
event_image = File.join(@
|
178
|
+
note = "3B"; event_image = File.join(@image_dir, 'hit_3B.png')
|
178
179
|
get_fldg(atbat.des)
|
179
180
|
when "Home Run"
|
180
|
-
event_image = File.join(@
|
181
|
+
note = "HR"; event_image = File.join(@image_dir, 'hit_HR.png')
|
181
182
|
get_fldg(atbat.des)
|
182
|
-
when "Walk"
|
183
|
-
|
184
|
-
when "
|
185
|
-
event_image = File.join(@imagedir, "hit_IBB.png")
|
186
|
-
when "Hit By Pitch"
|
187
|
-
event_image = File.join(@imagedir, "hit_HBP.png")
|
183
|
+
when "Walk"; note = "BB"
|
184
|
+
when "Intent Walk"; note = "IBB"
|
185
|
+
when "Hit By Pitch"; note = "HBP"
|
188
186
|
when "Strikeout"
|
189
187
|
if atbat.des.include?("called")
|
190
|
-
|
188
|
+
note = "KC"
|
191
189
|
else
|
192
|
-
|
190
|
+
note = "K"
|
193
191
|
end
|
194
|
-
when "Flyout"
|
195
|
-
|
196
|
-
|
197
|
-
when "
|
198
|
-
|
199
|
-
|
200
|
-
when "Pop Out"
|
201
|
-
event_image = File.join(@imagedir, "out_pop.png")
|
202
|
-
get_fldg(atbat.des)
|
203
|
-
when "Lineout"
|
204
|
-
event_image = File.join(@imagedir, "out_line.png")
|
205
|
-
get_fldg(atbat.des)
|
206
|
-
when "Forceout"
|
207
|
-
event_image = File.join(@imagedir, "out_force.png")
|
208
|
-
get_fldg(atbat.des)
|
209
|
-
when "Field Error"
|
210
|
-
event_image = File.join(@imagedir, "error.png")
|
211
|
-
get_fldg(atbat.des)
|
192
|
+
when "Flyout"; note = "F"; get_fldg(atbat.des)
|
193
|
+
when "Groundout"; note = "G"; get_fldg(atbat.des)
|
194
|
+
when "Pop Out"; note = "P"; get_fldg(atbat.des)
|
195
|
+
when "Lineout"; note = "L"; get_fldg(atbat.des)
|
196
|
+
when "Forceout"; note = "FO"; get_fldg(atbat.des)
|
197
|
+
when "Field Error"; note = "E"; get_fldg(atbat.des)
|
212
198
|
end #case
|
213
|
-
if atbat.event.include?("DP")
|
214
|
-
|
215
|
-
|
199
|
+
if atbat.event.include?("DP") || atbat.des.include?("double play")
|
200
|
+
note = "DP"; get_fldg(atbat.des)
|
201
|
+
end
|
202
|
+
if atbat.event.include?("TP") || atbat.des.include?("triple play")
|
203
|
+
note = "TP"; get_fldg(atbat.des)
|
204
|
+
end
|
205
|
+
if atbat.des.include?("sacrifice")
|
206
|
+
note = "SAC"; get_fldg(atbat.des)
|
207
|
+
end
|
208
|
+
if atbat.des.include?("fielder's choice")
|
209
|
+
note = "FC"; get_fldg(atbat.des)
|
216
210
|
end
|
217
|
-
if atbat.
|
218
|
-
|
219
|
-
get_fldg(atbat.des)
|
211
|
+
if atbat.des.include?("ground-rule")
|
212
|
+
note = "GR"; get_fldg(atbat.des)
|
220
213
|
end
|
221
214
|
|
222
|
-
@elements <<
|
215
|
+
@elements << note #[1]
|
216
|
+
@elements << event_image #[2]
|
223
217
|
|
224
|
-
|
218
|
+
outs = nil
|
225
219
|
unless atbat.o == "0" || atbat.o == last_atbat.o
|
226
|
-
|
227
|
-
outs_image = File.join(@imagedir, outsfile)
|
220
|
+
outs = atbat.o
|
228
221
|
end
|
229
|
-
@elements <<
|
230
|
-
|
231
|
-
@elements.insert(3, @fldg) if @fldg #[3]
|
222
|
+
@elements << outs #[3]
|
232
223
|
|
233
224
|
rbi = atbat.des.scan(/scores/).length
|
234
225
|
@elements.insert(4, rbi) unless rbi == 0 #[4]
|
@@ -249,156 +240,142 @@ module CardGenerator
|
|
249
240
|
@fldg = fldg.compact.join("-")
|
250
241
|
end
|
251
242
|
|
243
|
+
|
252
244
|
def init_html(home_or_away)
|
253
|
-
|
254
|
-
|
255
|
-
|
256
|
-
|
257
|
-
|
258
|
-
|
259
|
-
|
260
|
-
|
261
|
-
|
262
|
-
|
263
|
-
|
264
|
-
|
265
|
-
|
266
|
-
|
267
|
-
f.puts "<
|
268
|
-
|
269
|
-
|
270
|
-
f.puts "<
|
271
|
-
|
272
|
-
f.puts "</pre>"
|
273
|
-
f.puts "</h1>"
|
274
|
-
|
275
|
-
f.puts "<h2>"
|
276
|
-
f.puts "<pre style=\"color: white; font-family: arial; text-align: center\">"
|
277
|
-
f.puts @date
|
278
|
-
f.puts "</pre>"
|
279
|
-
f.puts "<img src=\"#{File.join(@imagedir, 'team_images', "#{team_abrev.downcase}.png")}\" style=\"position: absolute; left: 20; top:85\">"
|
280
|
-
f.puts "</h2>"
|
281
|
-
|
282
|
-
f.puts "<table>"
|
245
|
+
@status_line.text = "building html"
|
246
|
+
p "writing html"###
|
247
|
+
|
248
|
+
case home_or_away
|
249
|
+
when 'home'
|
250
|
+
batters = @home_batters; pitchers = @home_pitchers; team_abrev = @home_abrev
|
251
|
+
when 'away'
|
252
|
+
batters = @visiting_batters; pitchers = @visiting_pitchers; team_abrev = @visiting_abrev
|
253
|
+
end
|
254
|
+
|
255
|
+
File.open("scorecard_#{home_or_away}.html", "w"){|f|
|
256
|
+
|
257
|
+
f.puts '<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
|
258
|
+
"http://www.w3.org/TR/html4/loose.dtd">'
|
259
|
+
f.puts "<html>"
|
260
|
+
f.puts "<head>"
|
261
|
+
f.puts "<meta content=\"text/html; charset=ISO-8859-1\" http-equiv=\"content-type\">"
|
262
|
+
f.puts "<title>\"#{team_abrev} Scorecard\"</title>"
|
263
|
+
f.puts "</head>"
|
283
264
|
|
284
|
-
|
285
|
-
|
286
|
-
|
287
|
-
|
288
|
-
|
289
|
-
|
290
|
-
|
291
|
-
|
292
|
-
|
293
|
-
f.puts "</tr>"
|
265
|
+
bg_img = File.join(@image_dir, 'grass.jpg')
|
266
|
+
f.puts "<body style=\"background-image: url('file://#{bg_img}')\">"
|
267
|
+
f.puts "<h1 style=\"text-align: center; color: white; font-family: Arial\">"
|
268
|
+
f.puts "<big>#{@visiting_team} #{@visiting_score} - #{@home_team} #{@home_score}</big>"
|
269
|
+
f.puts "</h1>"
|
270
|
+
|
271
|
+
f.puts "<h2 style=\"text-align: center; color: white; font-family: Arial;\">"
|
272
|
+
f.puts "<big>#{@date}</big>"
|
273
|
+
f.puts "</h2>"#
|
294
274
|
|
295
|
-
|
296
|
-
|
275
|
+
f.puts "<img src=\"#{File.join(@image_dir, "team_images", "#{team_abrev.downcase}.png")}\" style=\"position: relative; top: -60px; left: 10px;\">"
|
276
|
+
|
277
|
+
f.puts "<table style=\"position: relative; top: -55px; text-align: left; width: 100px;\" cellpadding=\"2\" cellspacing=\"2\">"
|
278
|
+
f.puts "<tbody>"
|
279
|
+
|
297
280
|
f.puts "<tr>"
|
298
|
-
|
299
|
-
|
300
|
-
|
301
|
-
|
302
|
-
f.puts "</
|
281
|
+
f.puts "<td></td>"
|
282
|
+
inning_num = 1
|
283
|
+
@game.innings.length.times{
|
284
|
+
f.puts "<td style=\"vertical-align: top; font-family: Arial; color: white; text-align: center; width: 75px; font-weight: bold;\">"
|
285
|
+
f.puts "<big>#{inning_num}</big>"
|
303
286
|
f.puts "</td>"
|
304
|
-
|
305
|
-
|
306
|
-
|
307
|
-
|
308
|
-
|
309
|
-
|
310
|
-
|
311
|
-
|
312
|
-
|
313
|
-
|
314
|
-
|
315
|
-
|
316
|
-
|
317
|
-
|
287
|
+
inning_num += 1
|
288
|
+
}
|
289
|
+
f.puts "</tr>"
|
290
|
+
|
291
|
+
batters.each_with_index{|batter, batter_index|
|
292
|
+
unless batter.batting_order == 0
|
293
|
+
f.puts "<tr>"
|
294
|
+
|
295
|
+
f.puts "<td title=\"#{batter.stats}\">"
|
296
|
+
f.puts "<pre style=\"font-family: Arial; color: white; padding-right: 7px; font-weight: bold; text-align: right;\"><big>#{batter.batting_order}\n#{batter.name}\n##{batter.number} #{batter.position}</big></pre>"
|
297
|
+
f.puts "</td>"
|
298
|
+
|
299
|
+
batter.innings.each_with_index{|inning, inning_index|
|
300
|
+
if inning.empty?
|
301
|
+
f.puts "<td style=\"width: 96px; height: 96px;\">"
|
302
|
+
f.puts "<img src=\"#{File.join(@image_dir, 'bases_no_ba.png')}\" style=\"position: relative; top: 0; left: 0\"></img>"##
|
303
|
+
f.puts "</td>"
|
318
304
|
else
|
319
|
-
|
320
|
-
|
321
|
-
|
322
|
-
f.puts "<img src=\"#{File.join(@imagedir, 'bases_bg.png')}\" style=\"position: absolute; top: 0; left: 0\"></img>"
|
323
|
-
f.puts "<img src= #{@elements[1]} style=\"position: absolute; top: 0; left: 0\"></img>" if @elements[1]
|
324
|
-
f.puts "<img src= #{@elements[0]} style=\"position: absolute; top: 0; left: 0\"></img>"
|
325
|
-
f.puts "<img src= #{@elements[2]} style=\"position: absolute; top: 69; left: 69\"></img>" if @elements[2]
|
326
|
-
f.puts "<pre style=\"position: absolute; top: -7; left: 7; font-family: arial; font-size: small\">"
|
327
|
-
f.puts "#{atbat.b}-#{atbat.s}"
|
328
|
-
f.puts "</pre>"
|
329
|
-
if @fldg
|
330
|
-
f.puts "<pre style=\"position: absolute; top: 60; left: 7; font-family: arial; font-size: small\">"
|
331
|
-
f.puts @fldg
|
332
|
-
f.puts "</pre>"
|
333
|
-
end
|
334
|
-
if @elements[4]
|
335
|
-
f.puts "<pre style=\"position: absolute; top: -7; left: 65; font-family: arial; font-size: small\">"
|
336
|
-
f.puts @elements[4]
|
337
|
-
f.puts "</pre>"
|
338
|
-
f.puts "<pre style=\"position: absolute; top: -1; left: 72; font-family: arial; font-size: x-small\">"
|
339
|
-
f.puts "RBI"
|
340
|
-
f.puts "</pre>"
|
341
|
-
end
|
305
|
+
atbat = batter.innings[inning_index][-1]
|
306
|
+
get_elements(home_or_away, batter_index, inning_index)
|
307
|
+
description = ""
|
342
308
|
if batter.innings[inning_index].length > 1
|
343
|
-
|
344
|
-
|
345
|
-
|
309
|
+
batter.innings[inning_index].each_with_index{|ab, ab_index|
|
310
|
+
description << "At Bat #{ab_index + 1}: #{ab.des}\n"
|
311
|
+
}
|
312
|
+
else
|
313
|
+
description = atbat.des
|
346
314
|
end
|
347
|
-
|
348
|
-
f.puts "<
|
349
|
-
|
350
|
-
|
351
|
-
|
352
|
-
|
353
|
-
|
354
|
-
|
355
|
-
|
356
|
-
|
357
|
-
|
358
|
-
|
359
|
-
|
315
|
+
f.puts "<td style=\"width: 96px; height: 96px;\" title=\"#{description}\">"
|
316
|
+
f.puts "<div style=\"position: relative; width: 96px; height: 96px; background-transparent;\">"
|
317
|
+
bases_bg = File.join(@image_dir, 'bases_bg.png')
|
318
|
+
f.puts "<img src=\"#{bases_bg}\" width=\"96px\" height=\"96px\" style=\"position: absolute; top: 0; left: 0\">"
|
319
|
+
f.puts "<img src=\"#{@elements[2]}\" width=\"96px\" height=\"96px\" style=\"position: absolute; top: 0; left: 0\">" if @elements[2]
|
320
|
+
f.puts "<img src=\"#{@elements[0]}\" width=\"96px\" height=\"96px\" style=\"position: absolute; top: 0; left: 0\">"
|
321
|
+
|
322
|
+
f.puts "<p style=\"font-family: Arial; text-align: center; position: absolute; top: 21px; width: 96px; font-weight: bold;\"><big>#{@elements[1]}</big></p>"
|
323
|
+
f.puts "<p style=\"font-family: Arial; position: absolute; top: -12px; text-align: left; padding-left: 7px;\"><small>#{atbat.b}-#{atbat.s}</small></p>"
|
324
|
+
f.puts "<p style=\"font-family: Arial; position: absolute; top: 56px; text-align: left; padding-left: 7px;\"><small>#{@fldg}</small></p>" if @fldg
|
325
|
+
f.puts "<p style=\"font-family: Arial; position: absolute; top: -12px; width: 89px; text-align: right;\"><small>#{@elements[4]}<small>RBI</small></small></p>" if @elements[4]
|
326
|
+
f.puts "<p style=\"font-family: Arial; position: absolute; top: 53px; width: 85px; text-align: right; color: rgb(153, 0, 0); font-weight: bold;\">#{@elements[3]}</p>" if @elements[3]
|
327
|
+
f.puts "<p style=\"font-family: Arial; text-align: center; position: absolute; top: 37px; width: 93px; color: rgb(0, 153, 0);\">+AB</p>" if batter.innings[inning_index].length > 1
|
328
|
+
f.puts "<p style=\"font-family: Arial; text-align: center; position: absolute; top: 7px; width: 96px; color: rgb(0, 153, 0);\">SB</p>" if atbat.des.include?('steals')
|
329
|
+
f.puts "</div>" #ab_cell
|
330
|
+
f.puts "</td>"
|
331
|
+
end #if inning.empty?
|
332
|
+
} #batter.innings.each_with_index
|
333
|
+
f.puts "</tr>"
|
334
|
+
end #unless
|
335
|
+
} #batters.each_with_index
|
336
|
+
f.puts "</tbody>"
|
360
337
|
f.puts "</table>"
|
361
338
|
|
362
339
|
f.puts "<hr style=\"padding-top: 10\"></hr>"
|
363
340
|
f.puts "<h2 style=\"color: white; font-family: arial; text-align: center\">Pitching</h2>"
|
364
|
-
|
365
|
-
f.puts "<table>"
|
366
|
-
|
367
|
-
f.puts "<tr>"
|
368
|
-
f.puts "<td></td>"
|
369
|
-
%w[W-L ERA IP AB K BB H R ER].each{|entry|
|
370
|
-
f.puts "<td style=\"width: 150; color: white; font-family: arial; font-size: 125%; text-align: center\">"
|
371
|
-
f.puts entry
|
372
|
-
f.puts "</td>"
|
373
|
-
}
|
374
|
-
f.puts "</tr>"
|
375
341
|
|
376
|
-
|
377
|
-
|
378
|
-
|
379
|
-
|
380
|
-
|
381
|
-
|
382
|
-
|
383
|
-
|
384
|
-
|
385
|
-
f.puts "<td style=\"width: 150; text-align: center\">#{pitcher.so}</td>"
|
386
|
-
f.puts "<td style=\"width: 150; text-align: center\">#{pitcher.bb}</td>"
|
387
|
-
f.puts "<td style=\"width: 150; text-align: center\">#{pitcher.h}</td>"
|
388
|
-
f.puts "<td style=\"width: 150; text-align: center\">#{pitcher.r}</td>"
|
389
|
-
f.puts "<td style=\"width: 150; text-align: center\">#{pitcher.er}</td>"
|
342
|
+
f.puts "<table>"
|
343
|
+
|
344
|
+
f.puts "<tr>"
|
345
|
+
f.puts "<td></td>"
|
346
|
+
%w[W-L ERA IP AB K BB H R ER].each{|entry|
|
347
|
+
f.puts "<td style=\"width: 150; color: white; font-family: arial; font-size: 125%; text-align: center\">"
|
348
|
+
f.puts entry
|
349
|
+
f.puts "</td>"
|
350
|
+
}
|
390
351
|
f.puts "</tr>"
|
391
|
-
|
392
|
-
|
352
|
+
|
353
|
+
pitchers.each{|pitcher|
|
354
|
+
f.puts "<tr style=\"color: white; font-family: arial\">"
|
355
|
+
f.puts "<td style=\"font-size: 125%; text-align: right; padding-right: 20\">"
|
356
|
+
f.puts pitcher.pitcher_name
|
357
|
+
f.puts "</td>"
|
358
|
+
f.puts "<td style=\"width: 150px; text-align: center\">#{pitcher.w}-#{pitcher.l}</td>"
|
359
|
+
f.puts "<td style=\"width: 150px; text-align: center\">#{pitcher.era}</td>"
|
360
|
+
f.puts "<td style=\"width: 150px; text-align: center\">#{pitcher.inn}</td>"
|
361
|
+
f.puts "<td style=\"width: 150px; text-align: center\">#{pitcher.bf}</td>"
|
362
|
+
f.puts "<td style=\"width: 150px; text-align: center\">#{pitcher.so}</td>"
|
363
|
+
f.puts "<td style=\"width: 150px; text-align: center\">#{pitcher.bb}</td>"
|
364
|
+
f.puts "<td style=\"width: 150px; text-align: center\">#{pitcher.h}</td>"
|
365
|
+
f.puts "<td style=\"width: 150px; text-align: center\">#{pitcher.r}</td>"
|
366
|
+
f.puts "<td style=\"width: 150px; text-align: center\">#{pitcher.er}</td>"
|
367
|
+
f.puts "</tr>"
|
368
|
+
}
|
369
|
+
f.puts "</table>"
|
393
370
|
|
394
|
-
|
395
|
-
|
371
|
+
f.puts "</body>"
|
372
|
+
f.puts "</html>"
|
396
373
|
|
397
|
-
|
374
|
+
} #close file
|
398
375
|
|
399
|
-
|
400
|
-
|
401
|
-
|
402
|
-
end #init_html()
|
376
|
+
@status_line.text = "html built"
|
377
|
+
p "html built"##
|
378
|
+
Launchy.open("./scorecard_#{home_or_away}.html")
|
379
|
+
end #init_html()
|
403
380
|
|
404
381
|
end #module CardGenerator
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
data/lib/baseball_scorecard.rb
CHANGED
data/readme.txt
CHANGED
@@ -8,7 +8,7 @@ Hey there -
|
|
8
8
|
|
9
9
|
INSTALL:
|
10
10
|
|
11
|
-
gem install
|
11
|
+
gem install baseball_scorecard
|
12
12
|
|
13
13
|
RUN (in terminal):
|
14
14
|
|
@@ -51,7 +51,7 @@ scorecard
|
|
51
51
|
|
52
52
|
I've noticed that this works best for recent games, as not all of the data necessary to generate the scorecards is available for older games - for example, I tried creating cards for the 2004 ALCS game 7 for the screenshot (being a Red Sox fan,) and it didn't work :( - Had to go back a couple of weeks to find a game that we won instead!
|
53
53
|
|
54
|
-
So
|
54
|
+
So I guess that's about it... I've still got some work to do on the thing, but hopefully it'll mostly work!
|
55
55
|
|
56
56
|
Go Shoes...
|
57
57
|
Go Sox!!!
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: baseball_scorecard
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.3
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,11 +9,11 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-05-
|
12
|
+
date: 2012-05-15 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: green_shoes
|
16
|
-
requirement: &
|
16
|
+
requirement: &84839580 !ruby/object:Gem::Requirement
|
17
17
|
none: false
|
18
18
|
requirements:
|
19
19
|
- - ! '>='
|
@@ -21,21 +21,10 @@ dependencies:
|
|
21
21
|
version: '0'
|
22
22
|
type: :runtime
|
23
23
|
prerelease: false
|
24
|
-
version_requirements: *
|
25
|
-
- !ruby/object:Gem::Dependency
|
26
|
-
name: hpricot
|
27
|
-
requirement: &77452510 !ruby/object:Gem::Requirement
|
28
|
-
none: false
|
29
|
-
requirements:
|
30
|
-
- - ! '>='
|
31
|
-
- !ruby/object:Gem::Version
|
32
|
-
version: '0'
|
33
|
-
type: :runtime
|
34
|
-
prerelease: false
|
35
|
-
version_requirements: *77452510
|
24
|
+
version_requirements: *84839580
|
36
25
|
- !ruby/object:Gem::Dependency
|
37
26
|
name: gameday_api
|
38
|
-
requirement: &
|
27
|
+
requirement: &84839360 !ruby/object:Gem::Requirement
|
39
28
|
none: false
|
40
29
|
requirements:
|
41
30
|
- - ! '>='
|
@@ -43,10 +32,10 @@ dependencies:
|
|
43
32
|
version: '0'
|
44
33
|
type: :runtime
|
45
34
|
prerelease: false
|
46
|
-
version_requirements: *
|
35
|
+
version_requirements: *84839360
|
47
36
|
- !ruby/object:Gem::Dependency
|
48
37
|
name: launchy
|
49
|
-
requirement: &
|
38
|
+
requirement: &84839140 !ruby/object:Gem::Requirement
|
50
39
|
none: false
|
51
40
|
requirements:
|
52
41
|
- - ! '>='
|
@@ -54,7 +43,7 @@ dependencies:
|
|
54
43
|
version: '0'
|
55
44
|
type: :runtime
|
56
45
|
prerelease: false
|
57
|
-
version_requirements: *
|
46
|
+
version_requirements: *84839140
|
58
47
|
description: Baseball scorecard generator
|
59
48
|
email:
|
60
49
|
- jakekaiden@gmail.com
|
@@ -69,6 +58,52 @@ files:
|
|
69
58
|
- baseball_scorecard.gemspec
|
70
59
|
- bin/scorecard
|
71
60
|
- gameday_copyright.txt
|
61
|
+
- images/baseball.png
|
62
|
+
- images/bases-1-2-3.png
|
63
|
+
- images/bases-1-2.png
|
64
|
+
- images/bases-1-3.png
|
65
|
+
- images/bases-1.png
|
66
|
+
- images/bases-2-3.png
|
67
|
+
- images/bases-2.png
|
68
|
+
- images/bases-3.png
|
69
|
+
- images/bases.png
|
70
|
+
- images/bases_bg.png
|
71
|
+
- images/bases_no_ba.png
|
72
|
+
- images/grass.jpg
|
73
|
+
- images/hit_1B.png
|
74
|
+
- images/hit_2B.png
|
75
|
+
- images/hit_3B.png
|
76
|
+
- images/hit_HR.png
|
77
|
+
- images/team_images/ana.png
|
78
|
+
- images/team_images/ari.png
|
79
|
+
- images/team_images/atl.png
|
80
|
+
- images/team_images/bal.png
|
81
|
+
- images/team_images/bos.png
|
82
|
+
- images/team_images/cha.png
|
83
|
+
- images/team_images/chn.png
|
84
|
+
- images/team_images/cin.png
|
85
|
+
- images/team_images/cle.png
|
86
|
+
- images/team_images/col.png
|
87
|
+
- images/team_images/det.png
|
88
|
+
- images/team_images/flo.png
|
89
|
+
- images/team_images/hou.png
|
90
|
+
- images/team_images/kca.png
|
91
|
+
- images/team_images/lan.png
|
92
|
+
- images/team_images/mil.png
|
93
|
+
- images/team_images/min.png
|
94
|
+
- images/team_images/nya.png
|
95
|
+
- images/team_images/nyn.png
|
96
|
+
- images/team_images/oak.png
|
97
|
+
- images/team_images/phi.png
|
98
|
+
- images/team_images/pit.png
|
99
|
+
- images/team_images/sdn.png
|
100
|
+
- images/team_images/sea.png
|
101
|
+
- images/team_images/sfn.png
|
102
|
+
- images/team_images/sln.png
|
103
|
+
- images/team_images/tba.png
|
104
|
+
- images/team_images/tex.png
|
105
|
+
- images/team_images/tor.png
|
106
|
+
- images/team_images/was.png
|
72
107
|
- lib/baseball_scorecard.rb
|
73
108
|
- lib/baseball_scorecard/card_generator.rb
|
74
109
|
- lib/baseball_scorecard/images/baseball.png
|
@@ -82,27 +117,11 @@ files:
|
|
82
117
|
- lib/baseball_scorecard/images/bases.png
|
83
118
|
- lib/baseball_scorecard/images/bases_bg.png
|
84
119
|
- lib/baseball_scorecard/images/bases_no_ba.png
|
85
|
-
- lib/baseball_scorecard/images/error.png
|
86
120
|
- lib/baseball_scorecard/images/grass.jpg
|
87
121
|
- lib/baseball_scorecard/images/hit_1B.png
|
88
122
|
- lib/baseball_scorecard/images/hit_2B.png
|
89
123
|
- lib/baseball_scorecard/images/hit_3B.png
|
90
|
-
- lib/baseball_scorecard/images/hit_BB.png
|
91
|
-
- lib/baseball_scorecard/images/hit_HBP.png
|
92
124
|
- lib/baseball_scorecard/images/hit_HR.png
|
93
|
-
- lib/baseball_scorecard/images/hit_IBB.png
|
94
|
-
- lib/baseball_scorecard/images/out_called.png
|
95
|
-
- lib/baseball_scorecard/images/out_double-play.png
|
96
|
-
- lib/baseball_scorecard/images/out_fly.png
|
97
|
-
- lib/baseball_scorecard/images/out_force.png
|
98
|
-
- lib/baseball_scorecard/images/out_ground.png
|
99
|
-
- lib/baseball_scorecard/images/out_line.png
|
100
|
-
- lib/baseball_scorecard/images/out_pop.png
|
101
|
-
- lib/baseball_scorecard/images/out_strikes.png
|
102
|
-
- lib/baseball_scorecard/images/out_triple-play.png
|
103
|
-
- lib/baseball_scorecard/images/outs_1.png
|
104
|
-
- lib/baseball_scorecard/images/outs_2.png
|
105
|
-
- lib/baseball_scorecard/images/outs_3.png
|
106
125
|
- lib/baseball_scorecard/images/team_images/ana.png
|
107
126
|
- lib/baseball_scorecard/images/team_images/ari.png
|
108
127
|
- lib/baseball_scorecard/images/team_images/atl.png
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|