worldfootball 0.2.0 → 0.2.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 +6 -1
- data/config/leagues_america.csv +70 -0
- data/config/leagues_asia.csv +7 -3
- data/config/leagues_europe.csv +47 -0
- data/config/leagues_middle_east.csv +5 -0
- data/config/leagues_pacific.csv +8 -0
- data/config/rounds.csv +16 -0
- data/config/stages.csv +64 -0
- data/lib/worldfootball/build.rb +21 -41
- data/lib/worldfootball/convert.rb +8 -0
- data/lib/worldfootball/leagues.rb +10 -3
- data/lib/worldfootball/mods.rb +15 -2
- data/lib/worldfootball/stages.rb +47 -0
- data/lib/worldfootball/version.rb +1 -1
- data/lib/worldfootball.rb +3 -1
- metadata +8 -3
- data/lib/worldfootball/config.rb +0 -85
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 0c86445bc20b0caf099381fbae9fbf39fa270a66323883873956632759c3ac4f
|
|
4
|
+
data.tar.gz: b25de731e07a047ac3562bb21d5ea2c26c6eae0eab18ad9ba4d9607a5868b242
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 791384fb869d7ee752b5558b3929a8c55785150ab6308fbbb69f736e832de6911f6cc3ca630af32dad3ace29d83a795dd8d2cd54524966a792d160ffedd92430
|
|
7
|
+
data.tar.gz: 5494cb8022f2be71c73da4ff3a42fd84e844116b003b52f1108f075bd7371cf774379fcd9d9db4571453b91bfedc8090533ccd7395b827d3b0a9545c5c551749
|
data/CHANGELOG.md
CHANGED
data/Manifest.txt
CHANGED
|
@@ -3,13 +3,17 @@ Manifest.txt
|
|
|
3
3
|
README.md
|
|
4
4
|
Rakefile
|
|
5
5
|
bin/wfb
|
|
6
|
+
config/leagues_america.csv
|
|
6
7
|
config/leagues_asia.csv
|
|
7
8
|
config/leagues_europe.csv
|
|
9
|
+
config/leagues_middle_east.csv
|
|
10
|
+
config/leagues_pacific.csv
|
|
11
|
+
config/rounds.csv
|
|
12
|
+
config/stages.csv
|
|
8
13
|
lib/worldfootball.rb
|
|
9
14
|
lib/worldfootball/build-parse_score.rb
|
|
10
15
|
lib/worldfootball/build.rb
|
|
11
16
|
lib/worldfootball/cache.rb
|
|
12
|
-
lib/worldfootball/config.rb
|
|
13
17
|
lib/worldfootball/convert.rb
|
|
14
18
|
lib/worldfootball/convert_reports.rb
|
|
15
19
|
lib/worldfootball/download.rb
|
|
@@ -18,5 +22,6 @@ lib/worldfootball/mods.rb
|
|
|
18
22
|
lib/worldfootball/page.rb
|
|
19
23
|
lib/worldfootball/page_report.rb
|
|
20
24
|
lib/worldfootball/page_schedule.rb
|
|
25
|
+
lib/worldfootball/stages.rb
|
|
21
26
|
lib/worldfootball/vacuum.rb
|
|
22
27
|
lib/worldfootball/version.rb
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
key, slug
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
# todo/fix: adjust date/time by -6 or 7 hours!!!
|
|
5
|
+
# /can-canadian-championship-2020/
|
|
6
|
+
# - Qual. 1. Runde
|
|
7
|
+
# - Qual. 2. Runde
|
|
8
|
+
# - Qual. 3. Runde
|
|
9
|
+
# todo/fix: check for leagues - premier league? championship? soccer league?
|
|
10
|
+
ca.1, can-premier-league-2024
|
|
11
|
+
ca.cup, can-canadian-championship-2024
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
# todo/fix: adjust date/time by -7 hours!!!
|
|
15
|
+
## e.g. 25.07.2020 02:30 => 24.07.2020 19.30
|
|
16
|
+
# 11.01.2020 04:00 => 10.01.2020 21.00
|
|
17
|
+
#
|
|
18
|
+
# e.g. /mex-primera-division-2020-2021-apertura/
|
|
19
|
+
# /mex-primera-division-2019-2020-clausura/
|
|
20
|
+
# /mex-primera-division-2019-2020-apertura-playoffs/
|
|
21
|
+
# - Viertelfinale
|
|
22
|
+
# - Halbfinale
|
|
23
|
+
# - Finale
|
|
24
|
+
# /mex-primera-division-2018-2019-clausura-playoffs/
|
|
25
|
+
mx.1, mex-primera-division-2024-2025-apertura_2
|
|
26
|
+
mx.2, mex-liga-de-expansion-2024-2025-apertura
|
|
27
|
+
mx.cup, mex-copa-mx-2019-2020
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
## change to mls - why? why not?
|
|
32
|
+
us.1, usa-major-league-soccer-2024
|
|
33
|
+
us.2, usa-usl-championship-2024
|
|
34
|
+
us.cup, usa-u-s-open-cup-2024
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
br.1, bra-serie-a-2024
|
|
39
|
+
br.2, bra-serie-b-2024
|
|
40
|
+
br.cup, bra-copa-do-brasil-2024
|
|
41
|
+
|
|
42
|
+
|
|
43
|
+
co.1, col-primera-a-2024-clausura
|
|
44
|
+
co.2, col-primera-b-2024-clausura
|
|
45
|
+
co.cup, col-copa-colombia-2024
|
|
46
|
+
|
|
47
|
+
|
|
48
|
+
cl.1, chi-primera-division-2024
|
|
49
|
+
cl.cup, chi-copa-chile-2024
|
|
50
|
+
|
|
51
|
+
ec.1, ecu-serie-a-2024-segunda-etapa
|
|
52
|
+
ec.2, ecu-serie-b-2024_2
|
|
53
|
+
|
|
54
|
+
bo.1, bol-liga-profesional-2024-clausura
|
|
55
|
+
|
|
56
|
+
|
|
57
|
+
ar.1, arg-primera-division-2024
|
|
58
|
+
ar.2.nacional, arg-primera-b-nacional-2024
|
|
59
|
+
ar.2.metro, arg-primera-b-metropolitana-2024-clausura
|
|
60
|
+
ar.cup, arg-copa-argentina-2024
|
|
61
|
+
|
|
62
|
+
py.1, par-primera-division-2024-clausura
|
|
63
|
+
|
|
64
|
+
pe.1, per-primera-division-2024-clausura_2
|
|
65
|
+
|
|
66
|
+
uy.1, uru-primera-division-2024-clausura
|
|
67
|
+
uy.2, uru-segunda-division-2024-fase-regular
|
|
68
|
+
uy.cup, uru-copa-2024
|
|
69
|
+
|
|
70
|
+
ve.1, ven-primera-division-2024-clausura
|
data/config/leagues_asia.csv
CHANGED
data/config/leagues_europe.csv
CHANGED
|
@@ -4,6 +4,10 @@ de.1, bundesliga-2024-2025
|
|
|
4
4
|
de.2, 2-bundesliga-2024-2025
|
|
5
5
|
de.3, 3-liga-2024-2025
|
|
6
6
|
de.4.bayern, regionalliga-bayern-2024-2025
|
|
7
|
+
de.4.n, regionalliga-nord-2024-2025
|
|
8
|
+
de.4.no, regionalliga-nordost-2024-2025
|
|
9
|
+
de.4.w, regionalliga-west-2024-2025
|
|
10
|
+
de.4.sw, regionalliga-suedwest-2024-2025
|
|
7
11
|
de.cup, dfb-pokal-2024-2025
|
|
8
12
|
|
|
9
13
|
at.1, aut-bundesliga-2024-2025
|
|
@@ -20,6 +24,9 @@ ch.cup, sui-cup-2024-2025
|
|
|
20
24
|
hu.1, hun-nb-i-2024-2025
|
|
21
25
|
|
|
22
26
|
cz.1, cze-1-fotbalova-liga-2024-2025
|
|
27
|
+
cz.2, cze-2-fotbalova-liga-2024-2025
|
|
28
|
+
cz.3, cze-3-fotbalova-liga-2024-2025-cfl-a
|
|
29
|
+
|
|
23
30
|
sk.1, svk-super-liga-2024-2025
|
|
24
31
|
|
|
25
32
|
pl.1, pol-ekstraklasa-2024-2025
|
|
@@ -35,6 +42,7 @@ eng.cup, eng-fa-cup-2023-2024 ### update to 2024-2025 later!!!
|
|
|
35
42
|
eng.cup.l, eng-league-cup-2024-2025
|
|
36
43
|
|
|
37
44
|
|
|
45
|
+
|
|
38
46
|
sco.1, sco-premiership-2024-2025
|
|
39
47
|
|
|
40
48
|
ie.1, irl-premier-division-2024
|
|
@@ -46,6 +54,7 @@ fr.cup, fra-coupe-de-france-2023-2024 ### update to 2024-2025 later!!!
|
|
|
46
54
|
|
|
47
55
|
|
|
48
56
|
lu.1, lux-nationaldivision-2024-2025
|
|
57
|
+
|
|
49
58
|
nl.1, ned-eredivisie-2024-2025
|
|
50
59
|
nl.2, ned-eerste-divisie-2024-2025
|
|
51
60
|
nl.cup, ned-knvb-beker-2024-2025
|
|
@@ -67,9 +76,47 @@ es.2, esp-segunda-division-2024-2025
|
|
|
67
76
|
es.cup, esp-copa-del-rey-2023-2024 ## update to 2024-2025 later!!!
|
|
68
77
|
|
|
69
78
|
|
|
79
|
+
ro.1, rou-liga-1-2024-2025
|
|
80
|
+
ro.cup, rou-cupa-romaniei-2024-2025
|
|
81
|
+
|
|
82
|
+
ru.1, rus-premier-liga-2024-2025
|
|
83
|
+
ru.2, rus-premier-liga-2024-2025
|
|
84
|
+
|
|
85
|
+
ua.1, ukr-premyer-liga-2024-2025
|
|
86
|
+
|
|
87
|
+
|
|
88
|
+
|
|
70
89
|
tr.1, tur-sueperlig-2024-2025
|
|
71
90
|
tr.2, tur-1-lig-2024-2025
|
|
72
91
|
|
|
73
92
|
gr.1, gre-super-league-2024-2025
|
|
74
93
|
|
|
75
94
|
hr.1, cro-1-hnl-2024-2025
|
|
95
|
+
ba.1, bih-premier-liga-2024-2025
|
|
96
|
+
|
|
97
|
+
al.1, alb-kategoria-superiore-2024-2025
|
|
98
|
+
|
|
99
|
+
|
|
100
|
+
is.1, isl-urvalsdeild-2024
|
|
101
|
+
|
|
102
|
+
se.1, swe-allsvenskan-2024
|
|
103
|
+
se.2, swe-superettan-2024
|
|
104
|
+
|
|
105
|
+
no.1, nor-eliteserien-2024
|
|
106
|
+
fi.1, fin-veikkausliiga-2024-championship
|
|
107
|
+
dk.1, den-superliga-2024-2025
|
|
108
|
+
|
|
109
|
+
|
|
110
|
+
|
|
111
|
+
|
|
112
|
+
uefa.cl, champions-league-2024-2025
|
|
113
|
+
uefa.cl.q, champions-league-qual-2024-2025
|
|
114
|
+
uefa.el, europa-league-2024-2025
|
|
115
|
+
uefa.el.q, europa-league-qual-2024-2025
|
|
116
|
+
uefa.conf, conference-league-2024-2025
|
|
117
|
+
uefa.conf.q, europa-conference-league-qual-2024-2025
|
|
118
|
+
|
|
119
|
+
uefa.nl.a, nations-league-a-2024-2025
|
|
120
|
+
uefa.nl.b, nations-league-b-2024-2025
|
|
121
|
+
uefa.nl.c, nations-league-c-2024-2025
|
|
122
|
+
uefa.nl.d, nations-league-d-2024-2025
|
data/config/rounds.csv
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
key, name1, name2
|
|
2
|
+
|
|
3
|
+
*, 1. Runde, Round 1
|
|
4
|
+
*, 2. Runde, Round 2
|
|
5
|
+
*, 3. Runde, Round 3
|
|
6
|
+
*, 4. Runde, Round 4
|
|
7
|
+
*, 5. Runde, Round 5
|
|
8
|
+
*, 6. Runde, Round 6
|
|
9
|
+
*, 7. Runde, Round 7
|
|
10
|
+
*, 8. Runde, Round 8
|
|
11
|
+
*, 9. Runde, Round 9
|
|
12
|
+
*, Achtelfinale, Round of 16
|
|
13
|
+
*, Viertelfinale, Quarterfinals
|
|
14
|
+
*, Halbfinale, Semifinals
|
|
15
|
+
*, Finale, Final
|
|
16
|
+
|
data/config/stages.csv
ADDED
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
key, name1, name2,
|
|
2
|
+
|
|
3
|
+
*, Meisterschaft, Playoffs - Championship
|
|
4
|
+
*, Abstieg, Playoffs - Relegation
|
|
5
|
+
*, Relegation, Playoffs - Relegation
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
sco.1, Championship, Playoffs - Championship
|
|
9
|
+
sco.1, Relegation', Playoffs - Relegation
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
at.1, Meistergruppe, Playoffs - Championship
|
|
13
|
+
at.1, Qualifikationsgruppe, Playoffs - Relegation
|
|
14
|
+
at.1, Playoff, Europa League Finals
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
pl.1, Playoffs, Playoffs - Championship
|
|
18
|
+
pl.2, Abstieg, Playoffs - Relegation
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
sk.1, Meisterschaft, Playoffs - Championship
|
|
22
|
+
sk.1, Abstieg, Playoffs - Relegation
|
|
23
|
+
sk.1, Europa League, Europa League Finals
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
ro.1, Championship, Playoffs - Championship
|
|
27
|
+
ro.1, Relegation, Playoffs - Relegation
|
|
28
|
+
|
|
29
|
+
ru.1, Meisterschaft, Playoffs - Championship
|
|
30
|
+
ru.1, Relegation, Playoffs - Relegation
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
ua.1, Meisterschaft, Playoffs - Championship
|
|
34
|
+
ua.1, Abstieg, Playoffs - Relegation
|
|
35
|
+
ua.1, Playoffs EL, Europa League Finals
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
fi.1, Meisterschaft, Playoffs - Championship
|
|
39
|
+
fi.1, Abstieg, Playoffs - Challenger
|
|
40
|
+
fi.1, Playoff EL, Europa League Finals
|
|
41
|
+
|
|
42
|
+
dk.1, Meisterschaft, Playoffs - Championship
|
|
43
|
+
dk.1, Abstieg, Playoffs - Relegation
|
|
44
|
+
dk.1, Europa League, Europa League Finals
|
|
45
|
+
|
|
46
|
+
|
|
47
|
+
gr.1, Meisterschaft, Playoffs - Championship
|
|
48
|
+
gr.1, Abstieg, Playoffs - Relegation
|
|
49
|
+
gr.1, Playoffs, Playoffs
|
|
50
|
+
gr.1, Spiel um Platz 6, Match 6th Place
|
|
51
|
+
|
|
52
|
+
|
|
53
|
+
|
|
54
|
+
mx.1, Apertura Playoffs, Apertura - Liguilla
|
|
55
|
+
mx.1, Clausura Playoffs, Clausura - Liguilla
|
|
56
|
+
|
|
57
|
+
|
|
58
|
+
kr.1, Meisterschaft, Playoffs - Championship
|
|
59
|
+
kr.1, Abstieg, Playoffs - Relegation
|
|
60
|
+
|
|
61
|
+
|
|
62
|
+
nz.1, Playoffs, Playoff Finals
|
|
63
|
+
|
|
64
|
+
|
data/lib/worldfootball/build.rb
CHANGED
|
@@ -2,23 +2,6 @@
|
|
|
2
2
|
module Worldfootball
|
|
3
3
|
|
|
4
4
|
|
|
5
|
-
ROUND_TO_EN = {
|
|
6
|
-
'1. Runde' => 'Round 1',
|
|
7
|
-
'2. Runde' => 'Round 2',
|
|
8
|
-
'3. Runde' => 'Round 3',
|
|
9
|
-
'4. Runde' => 'Round 4',
|
|
10
|
-
'5. Runde' => 'Round 5',
|
|
11
|
-
'6. Runde' => 'Round 6',
|
|
12
|
-
'7. Runde' => 'Round 7',
|
|
13
|
-
'8. Runde' => 'Round 8',
|
|
14
|
-
'9. Runde' => 'Round 9',
|
|
15
|
-
'Achtelfinale' => 'Round of 16',
|
|
16
|
-
'Viertelfinale' => 'Quarterfinals',
|
|
17
|
-
'Halbfinale' => 'Semifinals',
|
|
18
|
-
'Finale' => 'Final',
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
|
|
22
5
|
## todo/check: english league cup/trophy has NO ET - also support - make more flexible!!!
|
|
23
6
|
|
|
24
7
|
## build "standard" match records from "raw" table rows
|
|
@@ -69,36 +52,22 @@ def self.build( rows, season:, league:, stage: '' ) ## rename to fixup or such
|
|
|
69
52
|
|
|
70
53
|
## note - must start line e.g.
|
|
71
54
|
## do NOT match => Qual. 1. Runde (1. Runde)!!!
|
|
72
|
-
|
|
73
|
-
[1-9]\.[ ]Runde|
|
|
74
|
-
Achtelfinale|
|
|
75
|
-
Viertelfinale|
|
|
76
|
-
Halbfinale|
|
|
77
|
-
Finale
|
|
78
|
-
)$
|
|
79
|
-
/x
|
|
55
|
+
else
|
|
80
56
|
puts
|
|
81
57
|
print '[%03d] ' % (i+1)
|
|
82
58
|
print row[:round]
|
|
83
59
|
|
|
84
|
-
|
|
85
|
-
print " => #{round}"
|
|
86
|
-
print "\n"
|
|
60
|
+
round_new = map_round( row[:round], league: league, season: season )
|
|
87
61
|
|
|
88
|
-
if
|
|
89
|
-
|
|
62
|
+
if round_new
|
|
63
|
+
round = round_new
|
|
64
|
+
print " => #{round}"
|
|
65
|
+
print "\n"
|
|
66
|
+
else
|
|
67
|
+
round = row[:round]
|
|
68
|
+
puts "!! WARN: unknown round >#{row[:round]}< for league >#{league} #{season}<:"
|
|
90
69
|
pp row
|
|
91
|
-
exit 1
|
|
92
70
|
end
|
|
93
|
-
else
|
|
94
|
-
puts
|
|
95
|
-
print '[%03d] ' % (i+1)
|
|
96
|
-
print row[:round]
|
|
97
|
-
print "\n"
|
|
98
|
-
|
|
99
|
-
puts "!! WARN: unknown round >#{row[:round]}< for league >#{league}<:"
|
|
100
|
-
pp row
|
|
101
|
-
round = row[:round]
|
|
102
71
|
end
|
|
103
72
|
|
|
104
73
|
|
|
@@ -168,7 +137,18 @@ def self.build( rows, season:, league:, stage: '' ) ## rename to fixup or such
|
|
|
168
137
|
## overwrite old with local
|
|
169
138
|
date_str = local.strftime( '%Y-%m-%d' )
|
|
170
139
|
time_str = local.strftime( '%H:%M' )
|
|
171
|
-
|
|
140
|
+
|
|
141
|
+
## pretty print timezone
|
|
142
|
+
### todo/fix - bundle into fmt_timezone method or such for reuse
|
|
143
|
+
tz_abbr = local.strftime( '%Z' ) ## e.g. EEST or if not available +03 or such
|
|
144
|
+
tz_offset = local.strftime( '%z' ) ## e.g. +0300
|
|
145
|
+
|
|
146
|
+
timezone = if tz_abbr =~ /^[+-][0-9]+$/ ## only digits (no abbrev.)
|
|
147
|
+
tz_offset
|
|
148
|
+
else
|
|
149
|
+
"#{tz_abbr}/#{tz_offset}"
|
|
150
|
+
end
|
|
151
|
+
|
|
172
152
|
utc = utc.strftime( '%Y-%m-%dT%H:%MZ' )
|
|
173
153
|
end
|
|
174
154
|
|
|
@@ -15,6 +15,14 @@ def self.convert( league:, season: )
|
|
|
15
15
|
## todo/fix: report error/check if stage is nil!!!
|
|
16
16
|
stage ||= ''
|
|
17
17
|
|
|
18
|
+
## try to map stage name if new name defined/found
|
|
19
|
+
unless stage.empty?
|
|
20
|
+
stage_new = map_stage( stage, league: league.key,
|
|
21
|
+
season: season )
|
|
22
|
+
stage = stage_new if stage_new
|
|
23
|
+
end
|
|
24
|
+
|
|
25
|
+
|
|
18
26
|
print " parsing #{slug}..."
|
|
19
27
|
|
|
20
28
|
# unless File.exist?( path )
|
|
@@ -51,12 +51,16 @@ class LeagueItem # nested inside LeagueConfig
|
|
|
51
51
|
## ["2019-2021 Playoffs", "regionalliga-bayern-2019-2021-playoffs"],
|
|
52
52
|
## ["2019-2021", "regionalliga-bayern-2019-2021"],
|
|
53
53
|
##
|
|
54
|
-
|
|
54
|
+
##
|
|
55
|
+
## ["1955/1958", "europa-league-1955-1958"]]
|
|
56
|
+
## ["1958/1960", "uefa-cup-1958-1960"],
|
|
55
57
|
|
|
56
58
|
season, stage = text.split( ' ', 2 )
|
|
57
59
|
|
|
58
60
|
## todo/fix: add a waring here and auto log to logs.txt!!!!
|
|
59
61
|
next if season == '2019-2021'
|
|
62
|
+
next if season == '1958/1960'
|
|
63
|
+
next if season == '1955/1958'
|
|
60
64
|
|
|
61
65
|
season = Season.parse( season )
|
|
62
66
|
|
|
@@ -116,8 +120,11 @@ end # class LeagueConfig
|
|
|
116
120
|
|
|
117
121
|
|
|
118
122
|
LEAGUES = LeagueConfig.new
|
|
119
|
-
['
|
|
120
|
-
'leagues_asia',
|
|
123
|
+
['leagues_america',
|
|
124
|
+
'leagues_asia',
|
|
125
|
+
'leagues_europe',
|
|
126
|
+
'leagues_middle_east',
|
|
127
|
+
'leagues_pacific'].each do |name|
|
|
121
128
|
recs = read_csv( "#{Worldfootball.root}/config/#{name}.csv" )
|
|
122
129
|
pp recs
|
|
123
130
|
puts " #{recs.size} league(s) in #{name}"
|
data/lib/worldfootball/mods.rb
CHANGED
|
@@ -11,6 +11,19 @@ def self.norm_team( team )
|
|
|
11
11
|
## clean team name and asciify (e.g. ’->' )
|
|
12
12
|
team = team.sub( '(old)', '' ).strip
|
|
13
13
|
team = team.gsub( '’', "'" ) ## e.g. Hawke’s Bay United FC
|
|
14
|
+
|
|
15
|
+
## Criciúma - SC => Criciúma - SC
|
|
16
|
+
## Bahia - BA => Bahia - BA
|
|
17
|
+
## remove inline dash ( - ) with single space
|
|
18
|
+
team = team.gsub( /[ ]+[-][ ]+/, ' ' )
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
## todo:
|
|
22
|
+
## replace (A) with II
|
|
23
|
+
## Austria Wien (A) => Austria Wien (A)
|
|
24
|
+
## others too? - move to mods instead of generic rule - why? why not?
|
|
25
|
+
team = team.sub( /[ ]+\(A\)/, ' II' )
|
|
26
|
+
|
|
14
27
|
team
|
|
15
28
|
end
|
|
16
29
|
|
|
@@ -71,8 +84,8 @@ SCORE_ERRORS = {
|
|
|
71
84
|
},
|
|
72
85
|
'at.cup' => {
|
|
73
86
|
## 2023/24
|
|
74
|
-
'2023-07-22' => [ 'SV Leobendorf', 'SV Horn', ['3-2 (2-0, 2-2, 3-2) n.V.', '3-2 (2-0, 2-2) n.V.']],
|
|
75
|
-
},
|
|
87
|
+
'2023-07-22' => [ 'SV Leobendorf', 'SV Horn', ['3-2 (2-0, 2-2, 3-2) n.V.', '3-2 (2-0, 2-2) n.V.']],
|
|
88
|
+
},
|
|
76
89
|
}
|
|
77
90
|
|
|
78
91
|
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
|
|
2
|
+
|
|
3
|
+
module Worldfootball
|
|
4
|
+
|
|
5
|
+
def self.map_stage( stage, league:, season: )
|
|
6
|
+
@stages ||= begin
|
|
7
|
+
stages = {}
|
|
8
|
+
recs = read_csv( "#{Worldfootball.root}/config/stages.csv" )
|
|
9
|
+
recs.each do |rec|
|
|
10
|
+
stages[ rec['key'] ] ||= Hash.new
|
|
11
|
+
stages[ rec['key'] ][ rec['name1'] ] = rec['name2']
|
|
12
|
+
end
|
|
13
|
+
stages
|
|
14
|
+
end
|
|
15
|
+
|
|
16
|
+
## pp @stages
|
|
17
|
+
|
|
18
|
+
league_code = league.to_s.downcase
|
|
19
|
+
|
|
20
|
+
name = nil
|
|
21
|
+
name = @stages[league_code][ stage ] if @stages.has_key?( league_code )
|
|
22
|
+
name = @stages['*'][stage] if name.nil? ## try generic (*) lookup
|
|
23
|
+
name
|
|
24
|
+
end
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
def self.map_round( round, league:, season: )
|
|
28
|
+
@rounds ||= begin
|
|
29
|
+
rounds = {}
|
|
30
|
+
recs = read_csv( "#{Worldfootball.root}/config/rounds.csv" )
|
|
31
|
+
recs.each do |rec|
|
|
32
|
+
rounds[ rec['key'] ] ||= Hash.new
|
|
33
|
+
rounds[ rec['key'] ][ rec['name1'] ] = rec['name2']
|
|
34
|
+
end
|
|
35
|
+
rounds
|
|
36
|
+
end
|
|
37
|
+
|
|
38
|
+
## pp @stages
|
|
39
|
+
|
|
40
|
+
league_code = league.to_s.downcase
|
|
41
|
+
|
|
42
|
+
name = nil
|
|
43
|
+
name = @rounds[league_code][ round ] if @rounds.has_key?( league_code )
|
|
44
|
+
name = @rounds['*'][round] if name.nil? ## try generic (*) lookup
|
|
45
|
+
name
|
|
46
|
+
end
|
|
47
|
+
end # module Worldfootball
|
data/lib/worldfootball.rb
CHANGED
|
@@ -8,8 +8,10 @@ require 'nokogiri'
|
|
|
8
8
|
# our own code
|
|
9
9
|
require_relative 'worldfootball/version'
|
|
10
10
|
require_relative 'worldfootball/leagues'
|
|
11
|
+
require_relative 'worldfootball/stages'
|
|
12
|
+
|
|
13
|
+
|
|
11
14
|
|
|
12
|
-
require_relative 'worldfootball/config' ## rename to setup/timezones/layouts or such?
|
|
13
15
|
require_relative 'worldfootball/download'
|
|
14
16
|
require_relative 'worldfootball/page'
|
|
15
17
|
require_relative 'worldfootball/page_schedule'
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: worldfootball
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.2.
|
|
4
|
+
version: 0.2.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-09-
|
|
11
|
+
date: 2024-09-13 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: football-timezones
|
|
@@ -102,13 +102,17 @@ files:
|
|
|
102
102
|
- README.md
|
|
103
103
|
- Rakefile
|
|
104
104
|
- bin/wfb
|
|
105
|
+
- config/leagues_america.csv
|
|
105
106
|
- config/leagues_asia.csv
|
|
106
107
|
- config/leagues_europe.csv
|
|
108
|
+
- config/leagues_middle_east.csv
|
|
109
|
+
- config/leagues_pacific.csv
|
|
110
|
+
- config/rounds.csv
|
|
111
|
+
- config/stages.csv
|
|
107
112
|
- lib/worldfootball.rb
|
|
108
113
|
- lib/worldfootball/build-parse_score.rb
|
|
109
114
|
- lib/worldfootball/build.rb
|
|
110
115
|
- lib/worldfootball/cache.rb
|
|
111
|
-
- lib/worldfootball/config.rb
|
|
112
116
|
- lib/worldfootball/convert.rb
|
|
113
117
|
- lib/worldfootball/convert_reports.rb
|
|
114
118
|
- lib/worldfootball/download.rb
|
|
@@ -117,6 +121,7 @@ files:
|
|
|
117
121
|
- lib/worldfootball/page.rb
|
|
118
122
|
- lib/worldfootball/page_report.rb
|
|
119
123
|
- lib/worldfootball/page_schedule.rb
|
|
124
|
+
- lib/worldfootball/stages.rb
|
|
120
125
|
- lib/worldfootball/vacuum.rb
|
|
121
126
|
- lib/worldfootball/version.rb
|
|
122
127
|
homepage: https://github.com/sportdb/sport.db
|
data/lib/worldfootball/config.rb
DELETED
|
@@ -1,85 +0,0 @@
|
|
|
1
|
-
module Worldfootball
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
####
|
|
5
|
-
# config for slug to local basename / directories
|
|
6
|
-
# e.g.
|
|
7
|
-
# aut-bundesliga-2023-2024 => austria/2023-24/1_bundesliga.txt
|
|
8
|
-
|
|
9
|
-
## add (timezone) offset here too - why? why not?
|
|
10
|
-
LEAGUE_SETUPS = {
|
|
11
|
-
## note - for now auto-generate path via name (downcased)
|
|
12
|
-
## e.g. Belgium => /belgium
|
|
13
|
-
|
|
14
|
-
## top five (europe)
|
|
15
|
-
'eng' => { code: 'eng', name: 'England' },
|
|
16
|
-
'es' => { code: 'esp', name: 'Spain' },
|
|
17
|
-
# 'fr' => { code: 'fra', name: 'France' },
|
|
18
|
-
# 'de' => { code: '???', name: 'Germany' },
|
|
19
|
-
'it' => { code: 'ita', name: 'Italy' },
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
'be' => { code: 'bel', name: 'Belgium' },
|
|
23
|
-
'at' => { code: 'aut', name: 'Austria' },
|
|
24
|
-
'hu' => { code: 'hun', name: 'Hungary' },
|
|
25
|
-
|
|
26
|
-
'tr' => { code: 'tur', name: 'Turkey' },
|
|
27
|
-
'nl' => { code: 'ned', name: 'Netherlands' },
|
|
28
|
-
'ch' => { code: 'sui', name: 'Switzerland' },
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
'cz' => { code: 'cze', name: 'Czech Republic' },
|
|
32
|
-
'dk' => { code: 'den', name: 'Denmark' },
|
|
33
|
-
'fi' => { code: 'fin', name: 'Finland' },
|
|
34
|
-
'gr' => { code: 'gre', name: 'Greece' },
|
|
35
|
-
|
|
36
|
-
'ie' => { code: 'irl', name: 'Ireland' },
|
|
37
|
-
'sco' => { code: 'sco', name: 'Scotland' },
|
|
38
|
-
|
|
39
|
-
'lu' => { code: 'lux', name: 'Luxembourg' },
|
|
40
|
-
'pl' => { code: 'pol', name: 'Poland' },
|
|
41
|
-
'pt' => { code: 'por', name: 'Portugal' },
|
|
42
|
-
'ro' => { code: 'rou', name: 'Romania' },
|
|
43
|
-
'ru' => { code: 'rus', name: 'Russia' },
|
|
44
|
-
'se' => { code: 'swe', name: 'Sweden' },
|
|
45
|
-
'ua' => { code: 'ukr', name: 'Ukraine' },
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
'eg' => { code: 'egy', name: 'Egypt' },
|
|
49
|
-
'jp' => { code: 'jpn', name: 'Japan' },
|
|
50
|
-
'cn' => { code: 'chn', name: 'China' },
|
|
51
|
-
|
|
52
|
-
## note - for now do NOT add United States to league name
|
|
53
|
-
## e.g. 1 - Major League Soccer
|
|
54
|
-
## 2 - USL Championship
|
|
55
|
-
## cup - U.S. Open Cup
|
|
56
|
-
'us' => { code: 'usa', name: nil, path: 'united-states' },
|
|
57
|
-
|
|
58
|
-
'mx' => { code: 'mex', name: 'Mexico' },
|
|
59
|
-
'ar' => { code: 'arg', name: 'Argentina' },
|
|
60
|
-
'br' => { code: 'bra', name: 'Brazil' },
|
|
61
|
-
|
|
62
|
-
'uy' => { code: 'uru', name: 'Uruguay' },
|
|
63
|
-
'pe' => { code: 'per', name: 'Peru' },
|
|
64
|
-
'ec' => { code: 'ecu', name: 'Ecuador' },
|
|
65
|
-
'bo' => { code: 'bol', name: 'Bolivia' },
|
|
66
|
-
'cl' => { code: 'chi', name: 'Chile' },
|
|
67
|
-
'co' => { code: 'col', name: 'Colombia' },
|
|
68
|
-
|
|
69
|
-
'cr' => { code: 'crc', name: 'Costa Rica' },
|
|
70
|
-
'gt' => { code: 'gua', name: 'Guatemala' },
|
|
71
|
-
'hn' => { code: 'hon', name: 'Honduras' },
|
|
72
|
-
'sv' => { code: 'slv', name: 'El Salvador' },
|
|
73
|
-
'ni' => { code: 'nca', name: 'Nicaragua' },
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
## int'l tournaments
|
|
77
|
-
'uefa.cl' => { code: nil, name: 'UEFA', path: 'europe' },
|
|
78
|
-
'uefa.el' => { code: nil, name: 'UEFA', path: 'europe' },
|
|
79
|
-
'concacaf.cl' => { code: nil, name: nil, path: 'north-america' },
|
|
80
|
-
'copa.l' => { code: nil, name: nil, path: 'south-america' },
|
|
81
|
-
}
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
end # module Worldfootball
|