sportdb-formats 2.0.1 → 2.0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +1 -1
- data/Manifest.txt +1 -0
- data/Rakefile +1 -1
- data/bin/fbx +146 -0
- data/lib/sportdb/formats/match/match_parser.rb +3 -1
- data/lib/sportdb/formats/version.rb +1 -1
- metadata +7 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 67f0ea27fe2c7a39512eab9728167881fb1b99b919492b3d513cb1a1ff46c787
|
4
|
+
data.tar.gz: a93978a81ec8cb8c9b639ff4842e5eb46d7ebc018031e4b37e8361b7ed80e8af
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 94d114bc6772b18e972449cd7ed0f0a890d737203e8e020655e446e4496e8b8e99985ac33c6da2579e27a52a863602ea561e2275f2e1852762355228b3d9383d
|
7
|
+
data.tar.gz: 4e645afc07ca5c73cda0308fe82211293160e2ebd3857770dc959ea41c684cbc2794e1c514f1fcf9e103f22294cc5d7879446632a9be06d2a04399b11daef5ed
|
data/CHANGELOG.md
CHANGED
data/Manifest.txt
CHANGED
data/Rakefile
CHANGED
data/bin/fbx
ADDED
@@ -0,0 +1,146 @@
|
|
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
|
+
|
@@ -617,9 +617,11 @@ class GoalStruct
|
|
617
617
|
|
618
618
|
elsif node_type == :'@' ||
|
619
619
|
node_type == :',' ||
|
620
|
-
node_type == :geo
|
620
|
+
node_type == :geo ||
|
621
|
+
node_type == :timezone
|
621
622
|
## e.g.
|
622
623
|
## [:"@"], [:geo, "Stade de France"], [:","], [:geo, "Saint-Denis"]]
|
624
|
+
## [:"@"], [:geo, "Arena de São Paulo"], [:","], [:geo, "São Paulo"], [:timezone, "(UTC-3)"]
|
623
625
|
more << node[1] if node_type == :geo
|
624
626
|
else
|
625
627
|
puts "!! PARSE ERROR - unexpected node type #{node_type} in match line; got:"
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: sportdb-formats
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.0.
|
4
|
+
version: 2.0.2
|
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-08-
|
11
|
+
date: 2024-08-24 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: sportdb-structs
|
@@ -30,14 +30,14 @@ dependencies:
|
|
30
30
|
requirements:
|
31
31
|
- - ">="
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version: 0.2.
|
33
|
+
version: 0.2.1
|
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.
|
40
|
+
version: 0.2.1
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: sportdb-catalogs
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
@@ -144,7 +144,8 @@ dependencies:
|
|
144
144
|
version: '4.1'
|
145
145
|
description: sportdb-formats - sport.db format and text utilities
|
146
146
|
email: gerald.bauer@gmail.com
|
147
|
-
executables:
|
147
|
+
executables:
|
148
|
+
- fbx
|
148
149
|
extensions: []
|
149
150
|
extra_rdoc_files:
|
150
151
|
- CHANGELOG.md
|
@@ -155,6 +156,7 @@ files:
|
|
155
156
|
- Manifest.txt
|
156
157
|
- README.md
|
157
158
|
- Rakefile
|
159
|
+
- bin/fbx
|
158
160
|
- lib/sportdb/formats.rb
|
159
161
|
- lib/sportdb/formats/country/country_reader.rb
|
160
162
|
- lib/sportdb/formats/csv/goal.rb
|