17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
|
# File 'lib/fbtok/fbx.rb', line 17
def self.main( args=ARGV )
opts = { debug: false,
outline: false }
parser = OptionParser.new do |parser|
parser.banner = "Usage: #{$PROGRAM_NAME} [options] DATAFILE"
parser.on( "--verbose", "--debug",
"turn on verbose / debug output (default: #{opts[:debug]})" ) do |debug|
opts[:debug] = debug
end
end
parser.parse!( args )
if opts[:debug]
puts "OPTS:"
p opts
puts "ARGV:"
p args
SportDb::MatchParser.debug = true
else
SportDb::MatchParser.debug = false
LogUtils::Logger.root.level = :info
end
args = [
'../../../openfootball/euro/2021--europe/euro.txt',
'../../../openfootball/euro/2024--germany/euro.txt',
] if args.empty?
pp args
paths = args
paths.each_with_index do |path,i|
puts "==> [#{i+1}/#{paths.size}] reading >#{path}<..."
txt = read_text( path )
parser = SportDb::MatchParser.new( txt, start: nil )
auto_conf_teams, matches, rounds, groups = parser.parse
puts ">>> #{auto_conf_teams.size} teams:"
pp auto_conf_teams
puts ">>> #{matches.size} matches:"
pp matches[0,2] puts "..."
puts ">>> #{rounds.size} rounds:"
pp rounds
puts ">>> #{groups.size} groups:"
pp groups
end
=begin
if errors.size > 0
puts
pp errors
puts
puts "!! #{errors.size} parse error(s) in #{paths.size} datafiles(s)"
else
puts
puts "OK no parse errors found in #{paths.size} datafile(s)"
end
=end
puts "bye"
end
|