footballdata-api 0.4.3 → 0.4.5
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/lib/footballdata/convert.rb +21 -12
- data/lib/footballdata/mods.rb +3 -0
- data/lib/footballdata/prettyprint.rb +2 -0
- data/lib/footballdata/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4eef9e220606c9f5c1642b1b6f2dbec9aa1ebe1f21b27c79e5f7d6d3f46808f0
|
4
|
+
data.tar.gz: b6a3c80beec2d05fec8f5095ef312a7c203c42285b8335ee9c98302c3a17b7ce
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e8df71833510a8d936b40ab02d49d2a1f16b6d94d2dbd2b8c94bc90fc960c2ee0fb29d5adf74d3645f30a620d8327d9c6ed078b869524503fb9641d5581a849d
|
7
|
+
data.tar.gz: '098ed870e9c081485ac45f1cf3a3c697bbc922dd9f96f85ef046b1e1a8829bf07a6041761a10062cc47f28c9471c93bbb93a05f7bcf3c1e99228b438571cdad3'
|
data/CHANGELOG.md
CHANGED
data/lib/footballdata/convert.rb
CHANGED
@@ -38,10 +38,9 @@ STAGES = {
|
|
38
38
|
|
39
39
|
|
40
40
|
|
41
|
-
def self.team_autofill( name, teams: )
|
42
|
-
## note - no country for place holder teams
|
43
|
-
return name if name == 'N.N.'
|
44
41
|
|
42
|
+
|
43
|
+
def self.find_team_country_code( name, teams: )
|
45
44
|
## add (fifa) country code e.g.
|
46
45
|
## Liverpool FC => Liverpool FC (ENG)
|
47
46
|
## or Liverpool FC => Liverpool FC (URU)
|
@@ -59,7 +58,7 @@ def self.team_autofill( name, teams: )
|
|
59
58
|
exit 1
|
60
59
|
end
|
61
60
|
|
62
|
-
|
61
|
+
country.code
|
63
62
|
end
|
64
63
|
|
65
64
|
|
@@ -196,13 +195,6 @@ matches.each do |m|
|
|
196
195
|
teams[ team1 ] += 1
|
197
196
|
teams[ team2 ] += 1
|
198
197
|
|
199
|
-
####
|
200
|
-
# auto-add (fifa) country code if int'l club tournament
|
201
|
-
if clubs_intl
|
202
|
-
team1 = team_autofill( team1, teams: teams_by_name )
|
203
|
-
team2 = team_autofill( team2, teams: teams_by_name )
|
204
|
-
end
|
205
|
-
|
206
198
|
|
207
199
|
### mods - rename club names
|
208
200
|
unless mods.nil? || mods.empty?
|
@@ -210,6 +202,22 @@ matches.each do |m|
|
|
210
202
|
team2 = mods[ team2 ] if mods[ team2 ]
|
211
203
|
end
|
212
204
|
|
205
|
+
####
|
206
|
+
# auto-add (fifa) country code if int'l club tournament
|
207
|
+
if clubs_intl
|
208
|
+
## note - use "original" name (not moded) for lookup
|
209
|
+
team1_org = m['homeTeam']['name']
|
210
|
+
team2_org = m['awayTeam']['name']
|
211
|
+
if team1_org ## note - ignore no team/placeholder (e.g. N.N)
|
212
|
+
country_code = find_team_country_code( team1_org, teams: teams_by_name )
|
213
|
+
team1 = "#{team1} (#{country_code})"
|
214
|
+
end
|
215
|
+
if team2_org ## note - ignore no team/placeholder (e.g. N.N)
|
216
|
+
country_code = find_team_country_code( team2_org, teams: teams_by_name )
|
217
|
+
team2 = "#{team2} (#{country_code})"
|
218
|
+
end
|
219
|
+
end
|
220
|
+
|
213
221
|
|
214
222
|
|
215
223
|
comments = ''
|
@@ -221,7 +229,8 @@ matches.each do |m|
|
|
221
229
|
stats['status'][m['status']] += 1 ## track status counts
|
222
230
|
|
223
231
|
case m['status']
|
224
|
-
when 'SCHEDULED', 'TIMED'
|
232
|
+
when 'SCHEDULED', 'TIMED',
|
233
|
+
'PAUSED', 'IN_PLAY' ## IN_PLAY, PAUSED
|
225
234
|
ft = ''
|
226
235
|
ht = ''
|
227
236
|
when 'FINISHED'
|
data/lib/footballdata/mods.rb
CHANGED
@@ -12,6 +12,9 @@ module Footballdata
|
|
12
12
|
'br.1' => {
|
13
13
|
'América FC' => 'América Mineiro', # in year 2018 ??
|
14
14
|
},
|
15
|
+
'copa.l' => {
|
16
|
+
'América FC' => 'América Mineiro', # in year 2022
|
17
|
+
},
|
15
18
|
'pt.1' => {
|
16
19
|
'Vitória SC' => 'Vitória Guimarães', ## avoid easy confusion with Vitória SC <=> Vitória FC
|
17
20
|
'Vitória FC' => 'Vitória Setúbal',
|
data/lib/footballdata/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: footballdata-api
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.4.
|
4
|
+
version: 0.4.5
|
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-07 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: football-timezones
|