sportdb-formats 2.0.2 → 2.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +1 -1
- data/Manifest.txt +2 -20
- data/Rakefile +2 -7
- data/bin/fbchk +173 -0
- data/lib/sportdb/formats/quick_match_linter.rb +201 -0
- data/lib/sportdb/formats/version.rb +2 -2
- data/lib/sportdb/formats.rb +10 -269
- metadata +11 -85
- data/bin/fbx +0 -146
- data/lib/sportdb/formats/country/country_reader.rb +0 -142
- data/lib/sportdb/formats/csv/goal.rb +0 -192
- data/lib/sportdb/formats/csv/goal_parser_csv.rb +0 -28
- data/lib/sportdb/formats/csv/match_parser_csv.rb +0 -490
- data/lib/sportdb/formats/csv/match_status_parser.rb +0 -90
- data/lib/sportdb/formats/datafile.rb +0 -59
- data/lib/sportdb/formats/event/event_reader.rb +0 -119
- data/lib/sportdb/formats/ground/ground_reader.rb +0 -289
- data/lib/sportdb/formats/league/league_outline_reader.rb +0 -176
- data/lib/sportdb/formats/league/league_reader.rb +0 -152
- data/lib/sportdb/formats/match/conf_parser.rb +0 -132
- data/lib/sportdb/formats/match/match_parser.rb +0 -735
- data/lib/sportdb/formats/search/sport.rb +0 -372
- data/lib/sportdb/formats/search/structs.rb +0 -116
- data/lib/sportdb/formats/search/world.rb +0 -157
- data/lib/sportdb/formats/team/club_reader.rb +0 -318
- data/lib/sportdb/formats/team/club_reader_history.rb +0 -203
- data/lib/sportdb/formats/team/club_reader_props.rb +0 -90
- data/lib/sportdb/formats/team/wiki_reader.rb +0 -108
data/lib/sportdb/formats.rb
CHANGED
@@ -1,17 +1,15 @@
|
|
1
1
|
## 3rd party gems
|
2
|
-
require 'sportdb/structs'
|
3
|
-
require 'sportdb/parser'
|
4
|
-
require '
|
2
|
+
# require 'sportdb/structs'
|
3
|
+
# require 'sportdb/parser'
|
4
|
+
require 'sportdb/quick'
|
5
5
|
|
6
6
|
|
7
7
|
require 'zip' ## todo/check: if zip is alreay included in a required module
|
8
8
|
|
9
9
|
|
10
|
-
## note - add cocos (code commons)
|
11
|
-
##
|
12
|
-
## pulls in read_csv & parse_csv etc.
|
13
|
-
require 'cocos'
|
14
10
|
|
11
|
+
## todo/check
|
12
|
+
## - logutils already added via quick!!
|
15
13
|
|
16
14
|
require 'logutils'
|
17
15
|
module SportDb
|
@@ -26,10 +24,8 @@ end
|
|
26
24
|
# our own code
|
27
25
|
require_relative 'formats/version' # let version always go first
|
28
26
|
|
29
|
-
require_relative 'formats/datafile'
|
30
|
-
require_relative 'formats/datafile_package'
|
31
27
|
require_relative 'formats/package'
|
32
|
-
|
28
|
+
require_relative 'formats/datafile_package'
|
33
29
|
|
34
30
|
|
35
31
|
## let's put test configuration in its own namespace / module
|
@@ -46,271 +42,16 @@ end # module SportDb
|
|
46
42
|
|
47
43
|
|
48
44
|
|
49
|
-
|
50
|
-
# define search services apis (move to its own gem later - why? why not?)
|
51
|
-
|
52
|
-
module SportDb
|
53
|
-
module Import
|
54
|
-
|
55
|
-
class Configuration
|
56
|
-
def world() @world ||= WorldSearch.new( countries: DummyCountrySearch.new ); end
|
57
|
-
def world=(world) @world = world; end
|
58
|
-
|
59
|
-
## todo/fix - add/move catalog here from sportdb-catalogs!!!
|
60
|
-
## def catalog() @catalog ||= Catalog.new; end
|
61
|
-
## def catalog(catalog) @catalog = catalog; end
|
62
|
-
end # class Configuration
|
63
|
-
|
64
|
-
## e.g. use config.catalog -- keep Import.catalog as a shortcut (for "read-only" access)
|
65
|
-
## def self.catalog() config.catalog; end
|
66
|
-
def self.world() config.world; end
|
67
|
-
|
68
|
-
## lets you use
|
69
|
-
## SportDb::Import.configure do |config|
|
70
|
-
## config.catalog_path = './catalog.db'
|
71
|
-
## end
|
72
|
-
def self.configure() yield( config ); end
|
73
|
-
def self.config() @config ||= Configuration.new; end
|
74
|
-
end # module Import
|
75
|
-
end # module SportDb
|
76
|
-
|
77
|
-
|
78
|
-
require_relative 'formats/search/world'
|
79
|
-
require_relative 'formats/search/sport'
|
80
|
-
require_relative 'formats/search/structs'
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
module Sports
|
85
|
-
## note: just forward to SportDb::Import configuration!!!!!
|
86
|
-
## keep Sports module / namespace "clean" - why? why not?
|
87
|
-
## that is, only include data structures (e.g. Match,League,etc) for now - why? why not?
|
88
|
-
def self.configure() yield( config ); end
|
89
|
-
def self.config() SportDb::Import.config; end
|
90
|
-
end # module Sports
|
91
|
-
|
92
|
-
|
93
|
-
###
|
94
|
-
# csv (tabular dataset) support / machinery
|
95
|
-
require_relative 'formats/csv/match_status_parser'
|
96
|
-
require_relative 'formats/csv/goal'
|
97
|
-
require_relative 'formats/csv/goal_parser_csv'
|
98
|
-
require_relative 'formats/csv/match_parser_csv'
|
99
|
-
|
100
|
-
|
101
|
-
### add convenience shortcut helpers
|
102
|
-
module Sports
|
103
|
-
class Match
|
104
|
-
def self.read_csv( path, headers: nil, filters: nil, converters: nil, sep: nil )
|
105
|
-
SportDb::CsvMatchParser.read( path,
|
106
|
-
headers: headers,
|
107
|
-
filters: filters,
|
108
|
-
converters: converters,
|
109
|
-
sep: sep )
|
110
|
-
end
|
111
|
-
|
112
|
-
def self.parse_csv( txt, headers: nil, filters: nil, converters: nil, sep: nil )
|
113
|
-
SportDb::CsvMatchParser.parse( txt,
|
114
|
-
headers: headers,
|
115
|
-
filters: filters,
|
116
|
-
converters: converters,
|
117
|
-
sep: sep )
|
118
|
-
end
|
119
|
-
end # class Match
|
120
|
-
end # module Sports
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
module SportDb
|
130
|
-
module Import
|
131
|
-
Season = ::Season ## add a convenience alias for top-level Season class
|
132
|
-
|
133
|
-
## add "old" convenience aliases for structs - why? why not?
|
134
|
-
## todo/check: just use include Sports !!!!
|
135
|
-
Country = ::Sports::Country
|
136
|
-
League = ::Sports::League
|
137
|
-
Group = ::Sports::Group
|
138
|
-
Round = ::Sports::Round
|
139
|
-
Match = ::Sports::Match
|
140
|
-
Matchlist = ::Sports::Matchlist
|
141
|
-
Goal = ::Sports::Goal
|
142
|
-
Team = ::Sports::Team
|
143
|
-
NationalTeam = ::Sports::NationalTeam
|
144
|
-
Club = ::Sports::Club
|
145
|
-
Standings = ::Sports::Standings
|
146
|
-
TeamUsage = ::Sports::TeamUsage
|
147
|
-
|
148
|
-
Ground = ::Sports::Ground
|
149
|
-
|
150
|
-
Player = ::Sports::Player
|
151
|
-
|
152
|
-
EventInfo = ::Sports::EventInfo
|
153
|
-
|
154
|
-
|
155
|
-
class Team
|
156
|
-
## add convenience lookup helper / method for name by season for now
|
157
|
-
## use clubs history - for now kept separate from struct - why? why not?
|
158
|
-
def name_by_season( season )
|
159
|
-
## note: returns / fallback to "regular" name if no records found in history
|
160
|
-
SportDb::Import.catalog.clubs_history.find_name_by( name: name, season: season ) || name
|
161
|
-
end
|
162
|
-
end # class Team
|
163
|
-
|
164
|
-
end # module Import
|
165
|
-
end # module SportDb
|
166
|
-
|
167
|
-
|
168
|
-
require_relative 'formats/match/match_parser'
|
169
|
-
require_relative 'formats/match/conf_parser'
|
170
|
-
|
171
|
-
|
172
|
-
|
173
|
-
require_relative 'formats/country/country_reader'
|
174
|
-
|
175
|
-
|
176
|
-
## add convenience helper
|
177
|
-
module SportDb
|
178
|
-
module Import
|
179
|
-
class Country
|
180
|
-
def self.read( path ) CountryReader.read( path ); end
|
181
|
-
def self.parse( txt ) CountryReader.parse( txt ); end
|
182
|
-
end # class Country
|
183
|
-
end # module Import
|
184
|
-
end # module SportDb
|
185
|
-
|
186
|
-
|
187
|
-
require_relative 'formats/league/league_reader'
|
188
|
-
require_relative 'formats/league/league_outline_reader'
|
189
|
-
|
190
|
-
##
|
191
|
-
## add convenience helper / short-cuts
|
192
|
-
module SportDb
|
193
|
-
module Import
|
194
|
-
class League
|
195
|
-
def self.read( path ) LeagueReader.read( path ); end
|
196
|
-
def self.parse( txt ) LeagueReader.parse( txt ); end
|
197
|
-
end # class League
|
198
|
-
end # module Import
|
199
|
-
end # module SportDb
|
200
|
-
|
201
|
-
|
202
|
-
require_relative 'formats/team/club_reader'
|
203
|
-
require_relative 'formats/team/club_reader_props'
|
204
|
-
require_relative 'formats/team/wiki_reader'
|
205
|
-
|
206
|
-
require_relative 'formats/team/club_reader_history'
|
207
|
-
require_relative 'formats/team/club_index_history'
|
208
|
-
|
209
|
-
|
210
|
-
###
|
211
|
-
# add convenience helpers / shortcuts
|
212
|
-
module SportDb
|
213
|
-
module Import
|
214
|
-
|
215
|
-
class Club
|
216
|
-
def self.read( path ) ClubReader.read( path ); end
|
217
|
-
def self.parse( txt ) ClubReader.parse( txt ); end
|
218
|
-
|
219
|
-
def self.read_props( path ) ClubPropsReader.read( path ); end
|
220
|
-
def self.parse_props( txt ) ClubPropsReader.parse( txt ); end
|
221
|
-
## todo/check: use ClubProps.read and ClubProps.parse convenience alternate shortcuts - why? why not?
|
222
|
-
end # class Club
|
223
|
-
|
224
|
-
end # module Import
|
225
|
-
end # module SportDb
|
226
|
-
|
227
|
-
|
228
|
-
require_relative 'formats/event/event_reader'
|
229
|
-
|
230
|
-
## add convenience helper
|
231
|
-
module SportDb
|
232
|
-
module Import
|
233
|
-
class EventInfo
|
234
|
-
def self.read( path ) EventInfoReader.read( path ); end
|
235
|
-
def self.parse( txt ) EventInfoReader.parse( txt ); end
|
236
|
-
end # class EventInfo
|
237
|
-
end # module Import
|
238
|
-
end # module SportDb
|
239
|
-
|
240
|
-
|
241
|
-
|
242
|
-
require_relative 'formats/ground/ground_reader'
|
45
|
+
require_relative 'formats/quick_match_linter'
|
243
46
|
|
244
47
|
|
48
|
+
# require_relative 'formats/team/club_reader_history'
|
49
|
+
# require_relative 'formats/team/club_index_history'
|
245
50
|
|
246
51
|
|
247
52
|
|
248
53
|
### auto-configure builtin lookups via catalog.db(s)
|
249
|
-
require 'sportdb/
|
250
|
-
|
251
|
-
|
252
|
-
module SportDb
|
253
|
-
module Import
|
254
|
-
|
255
|
-
class Configuration
|
256
|
-
## note: add more configs (open class), see sportdb-structs for original config!!!
|
257
|
-
|
258
|
-
###
|
259
|
-
# find a better name for setting - why? why not?
|
260
|
-
# how about catalogdb or ???
|
261
|
-
attr_reader :catalog_path
|
262
|
-
def catalog_path=(path)
|
263
|
-
@catalog_path = path
|
264
|
-
########
|
265
|
-
# reset database here to new path
|
266
|
-
CatalogDb::Metal::Record.database = path
|
267
|
-
|
268
|
-
## plus automagically set world search too (to use CatalogDb)
|
269
|
-
self.world = WorldSearch.new(
|
270
|
-
countries: CatalogDb::Metal::Country,
|
271
|
-
cities: CatalogDb::Metal::City,
|
272
|
-
)
|
273
|
-
|
274
|
-
@catalog_path
|
275
|
-
end
|
276
|
-
|
277
|
-
def catalog
|
278
|
-
@catalog ||= SportSearch.new(
|
279
|
-
leagues: CatalogDb::Metal::League,
|
280
|
-
national_teams: CatalogDb::Metal::NationalTeam,
|
281
|
-
clubs: CatalogDb::Metal::Club,
|
282
|
-
grounds: CatalogDb::Metal::Ground,
|
283
|
-
events: CatalogDb::Metal::EventInfo,
|
284
|
-
players: CatalogDb::Metal::Player, # note - via players.db !!!
|
285
|
-
)
|
286
|
-
end
|
287
|
-
|
288
|
-
###
|
289
|
-
# find a better name for setting - why? why not?
|
290
|
-
# how about playersdb or ???
|
291
|
-
attr_reader :players_path
|
292
|
-
def players_path=(path)
|
293
|
-
@players_path = path
|
294
|
-
########
|
295
|
-
# reset database here to new path
|
296
|
-
CatalogDb::Metal::PlayerRecord.database = path
|
297
|
-
|
298
|
-
@players_path
|
299
|
-
end
|
300
|
-
end # class Configuration
|
301
|
-
|
302
|
-
|
303
|
-
## e.g. use config.catalog -- keep Import.catalog as a shortcut (for "read-only" access)
|
304
|
-
def self.catalog() config.catalog; end
|
305
|
-
end # module Import
|
306
|
-
end # module SportDb
|
307
|
-
|
308
|
-
|
309
|
-
###
|
310
|
-
## add default/built-in catalog here - why? why not?
|
311
|
-
## todo/fix - set catalog_path on demand
|
312
|
-
## note: for now required for world search setup etc.
|
313
|
-
SportDb::Import.config.catalog_path = "#{FootballDb::Data.data_dir}/catalog.db"
|
54
|
+
require 'sportdb/search'
|
314
55
|
|
315
56
|
|
316
57
|
|
metadata
CHANGED
@@ -1,99 +1,43 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: sportdb-formats
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.
|
4
|
+
version: 2.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Gerald Bauer
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-
|
11
|
+
date: 2024-10-09 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
|
-
name: sportdb-
|
14
|
+
name: sportdb-search
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
17
|
- - ">="
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: 0.
|
19
|
+
version: 0.0.1
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - ">="
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: 0.
|
26
|
+
version: 0.0.1
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
|
-
name: sportdb-
|
28
|
+
name: sportdb-quick
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
31
|
- - ">="
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version: 0.2.
|
33
|
+
version: 0.2.0
|
34
34
|
type: :runtime
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
38
|
- - ">="
|
39
39
|
- !ruby/object:Gem::Version
|
40
|
-
version: 0.2.
|
41
|
-
- !ruby/object:Gem::Dependency
|
42
|
-
name: sportdb-catalogs
|
43
|
-
requirement: !ruby/object:Gem::Requirement
|
44
|
-
requirements:
|
45
|
-
- - ">="
|
46
|
-
- !ruby/object:Gem::Version
|
47
|
-
version: 1.2.2
|
48
|
-
type: :runtime
|
49
|
-
prerelease: false
|
50
|
-
version_requirements: !ruby/object:Gem::Requirement
|
51
|
-
requirements:
|
52
|
-
- - ">="
|
53
|
-
- !ruby/object:Gem::Version
|
54
|
-
version: 1.2.2
|
55
|
-
- !ruby/object:Gem::Dependency
|
56
|
-
name: date-formats
|
57
|
-
requirement: !ruby/object:Gem::Requirement
|
58
|
-
requirements:
|
59
|
-
- - ">="
|
60
|
-
- !ruby/object:Gem::Version
|
61
|
-
version: 1.0.2
|
62
|
-
type: :runtime
|
63
|
-
prerelease: false
|
64
|
-
version_requirements: !ruby/object:Gem::Requirement
|
65
|
-
requirements:
|
66
|
-
- - ">="
|
67
|
-
- !ruby/object:Gem::Version
|
68
|
-
version: 1.0.2
|
69
|
-
- !ruby/object:Gem::Dependency
|
70
|
-
name: cocos
|
71
|
-
requirement: !ruby/object:Gem::Requirement
|
72
|
-
requirements:
|
73
|
-
- - ">="
|
74
|
-
- !ruby/object:Gem::Version
|
75
|
-
version: 0.4.0
|
76
|
-
type: :runtime
|
77
|
-
prerelease: false
|
78
|
-
version_requirements: !ruby/object:Gem::Requirement
|
79
|
-
requirements:
|
80
|
-
- - ">="
|
81
|
-
- !ruby/object:Gem::Version
|
82
|
-
version: 0.4.0
|
83
|
-
- !ruby/object:Gem::Dependency
|
84
|
-
name: logutils
|
85
|
-
requirement: !ruby/object:Gem::Requirement
|
86
|
-
requirements:
|
87
|
-
- - ">="
|
88
|
-
- !ruby/object:Gem::Version
|
89
|
-
version: 0.6.1
|
90
|
-
type: :runtime
|
91
|
-
prerelease: false
|
92
|
-
version_requirements: !ruby/object:Gem::Requirement
|
93
|
-
requirements:
|
94
|
-
- - ">="
|
95
|
-
- !ruby/object:Gem::Version
|
96
|
-
version: 0.6.1
|
40
|
+
version: 0.2.0
|
97
41
|
- !ruby/object:Gem::Dependency
|
98
42
|
name: rubyzip
|
99
43
|
requirement: !ruby/object:Gem::Requirement
|
@@ -145,7 +89,7 @@ dependencies:
|
|
145
89
|
description: sportdb-formats - sport.db format and text utilities
|
146
90
|
email: gerald.bauer@gmail.com
|
147
91
|
executables:
|
148
|
-
-
|
92
|
+
- fbchk
|
149
93
|
extensions: []
|
150
94
|
extra_rdoc_files:
|
151
95
|
- CHANGELOG.md
|
@@ -156,30 +100,12 @@ files:
|
|
156
100
|
- Manifest.txt
|
157
101
|
- README.md
|
158
102
|
- Rakefile
|
159
|
-
- bin/
|
103
|
+
- bin/fbchk
|
160
104
|
- lib/sportdb/formats.rb
|
161
|
-
- lib/sportdb/formats/country/country_reader.rb
|
162
|
-
- lib/sportdb/formats/csv/goal.rb
|
163
|
-
- lib/sportdb/formats/csv/goal_parser_csv.rb
|
164
|
-
- lib/sportdb/formats/csv/match_parser_csv.rb
|
165
|
-
- lib/sportdb/formats/csv/match_status_parser.rb
|
166
|
-
- lib/sportdb/formats/datafile.rb
|
167
105
|
- lib/sportdb/formats/datafile_package.rb
|
168
|
-
- lib/sportdb/formats/event/event_reader.rb
|
169
|
-
- lib/sportdb/formats/ground/ground_reader.rb
|
170
|
-
- lib/sportdb/formats/league/league_outline_reader.rb
|
171
|
-
- lib/sportdb/formats/league/league_reader.rb
|
172
|
-
- lib/sportdb/formats/match/conf_parser.rb
|
173
|
-
- lib/sportdb/formats/match/match_parser.rb
|
174
106
|
- lib/sportdb/formats/package.rb
|
175
|
-
- lib/sportdb/formats/
|
176
|
-
- lib/sportdb/formats/search/structs.rb
|
177
|
-
- lib/sportdb/formats/search/world.rb
|
107
|
+
- lib/sportdb/formats/quick_match_linter.rb
|
178
108
|
- lib/sportdb/formats/team/club_index_history.rb
|
179
|
-
- lib/sportdb/formats/team/club_reader.rb
|
180
|
-
- lib/sportdb/formats/team/club_reader_history.rb
|
181
|
-
- lib/sportdb/formats/team/club_reader_props.rb
|
182
|
-
- lib/sportdb/formats/team/wiki_reader.rb
|
183
109
|
- lib/sportdb/formats/version.rb
|
184
110
|
homepage: https://github.com/sportdb/sport.db
|
185
111
|
licenses:
|
data/bin/fbx
DELETED
@@ -1,146 +0,0 @@
|
|
1
|
-
#!/usr/bin/env ruby
|
2
|
-
|
3
|
-
## tip: to test run:
|
4
|
-
## ruby -I ./lib -I ../parser/lib bin/fbx
|
5
|
-
|
6
|
-
|
7
|
-
## our own code
|
8
|
-
require 'sportdb/formats'
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
require 'optparse'
|
13
|
-
|
14
|
-
##
|
15
|
-
## read textfile
|
16
|
-
## and dump match parse results
|
17
|
-
##
|
18
|
-
## fbt ../openfootball/.../euro.txt
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
args = ARGV
|
24
|
-
opts = { debug: false,
|
25
|
-
outline: false }
|
26
|
-
|
27
|
-
parser = OptionParser.new do |parser|
|
28
|
-
parser.banner = "Usage: #{$PROGRAM_NAME} [options]"
|
29
|
-
|
30
|
-
##
|
31
|
-
## check if git has a offline option?? (use same)
|
32
|
-
## check for other tools - why? why not?
|
33
|
-
|
34
|
-
|
35
|
-
parser.on( "--verbose", "--debug",
|
36
|
-
"turn on verbose / debug output (default: #{opts[:debug]})" ) do |debug|
|
37
|
-
opts[:debug] = debug
|
38
|
-
end
|
39
|
-
|
40
|
-
parser.on( "--outline",
|
41
|
-
"turn on outline (only) output (default: #{opts[:outline]})" ) do |outline|
|
42
|
-
opts[:outline] = outline
|
43
|
-
end
|
44
|
-
end
|
45
|
-
parser.parse!( args )
|
46
|
-
|
47
|
-
puts "OPTS:"
|
48
|
-
p opts
|
49
|
-
puts "ARGV:"
|
50
|
-
p args
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
paths = if args.empty?
|
57
|
-
[
|
58
|
-
'../../../openfootball/euro/2021--europe/euro.txt',
|
59
|
-
'../../../openfootball/euro/2024--germany/euro.txt',
|
60
|
-
]
|
61
|
-
else
|
62
|
-
## check for directories
|
63
|
-
## and auto-expand
|
64
|
-
|
65
|
-
SportDb::Parser::Opts.expand_args( args )
|
66
|
-
end
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
SportDb::MatchParser.debug = true if opts[:debug]
|
75
|
-
|
76
|
-
|
77
|
-
## errors = []
|
78
|
-
|
79
|
-
|
80
|
-
paths.each_with_index do |path,i|
|
81
|
-
puts "==> [#{i+1}/#{paths.size}] reading >#{path}<..."
|
82
|
-
|
83
|
-
txt = read_text( path )
|
84
|
-
secs = SportDb::LeagueOutlineReader.parse( txt )
|
85
|
-
## pp secs
|
86
|
-
|
87
|
-
secs.each_with_index do |sec,j| ## sec(tion)s
|
88
|
-
season = sec[:season]
|
89
|
-
league = sec[:league]
|
90
|
-
stage = sec[:stage]
|
91
|
-
lines = sec[:lines]
|
92
|
-
|
93
|
-
puts " section #{j+1}/#{secs.size} - #{league.name} #{season}, #{stage} - #{lines.size} line(s)"
|
94
|
-
|
95
|
-
next if opts[:outline]
|
96
|
-
|
97
|
-
=begin
|
98
|
-
### check if event info availabe - use start_date;
|
99
|
-
## otherwise we have to guess (use a "synthetic" start_date)
|
100
|
-
event_info = catalog.events.find_by( season: season,
|
101
|
-
league: league )
|
102
|
-
|
103
|
-
start = if event_info && event_info.start_date
|
104
|
-
puts "event info found:"
|
105
|
-
puts " using start date from event: "
|
106
|
-
pp event_info
|
107
|
-
pp event_info.start_date
|
108
|
-
event_info.start_date
|
109
|
-
else
|
110
|
-
=end
|
111
|
-
start = if season.year?
|
112
|
-
Date.new( season.start_year, 1, 1 )
|
113
|
-
else
|
114
|
-
Date.new( season.start_year, 7, 1 )
|
115
|
-
end
|
116
|
-
|
117
|
-
parser = SportDb::MatchParser.new( lines,
|
118
|
-
start ) ## note: keep season start_at date for now (no need for more specific stage date need for now)
|
119
|
-
|
120
|
-
auto_conf_teams, matches, rounds, groups = parser.parse
|
121
|
-
|
122
|
-
puts ">>> #{auto_conf_teams.size} teams:"
|
123
|
-
pp auto_conf_teams
|
124
|
-
puts ">>> #{matches.size} matches:"
|
125
|
-
## pp matches
|
126
|
-
puts ">>> #{rounds.size} rounds:"
|
127
|
-
pp rounds
|
128
|
-
puts ">>> #{groups.size} groups:"
|
129
|
-
pp groups
|
130
|
-
end # each secs
|
131
|
-
end # each paths
|
132
|
-
|
133
|
-
=begin
|
134
|
-
if errors.size > 0
|
135
|
-
puts
|
136
|
-
pp errors
|
137
|
-
puts
|
138
|
-
puts "!! #{errors.size} parse error(s) in #{paths.size} datafiles(s)"
|
139
|
-
else
|
140
|
-
puts
|
141
|
-
puts "OK no parse errors found in #{paths.size} datafile(s)"
|
142
|
-
end
|
143
|
-
=end
|
144
|
-
|
145
|
-
puts "bye"
|
146
|
-
|