worldfootball 0.1.2 → 0.2.0
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 -1
- data/Rakefile +1 -3
- data/bin/wfb +6 -2
- data/config/leagues_asia.csv +6 -0
- data/config/leagues_europe.csv +75 -0
- data/lib/worldfootball/build.rb +40 -10
- data/lib/worldfootball/config.rb +0 -135
- data/lib/worldfootball/convert.rb +1 -62
- data/lib/worldfootball/leagues.rb +9 -7
- data/lib/worldfootball/page.rb +1 -1
- data/lib/worldfootball/vacuum.rb +3 -1
- data/lib/worldfootball/version.rb +2 -2
- data/lib/worldfootball.rb +3 -7
- metadata +5 -18
- data/config/leagues.csv +0 -16
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 78c749dd421814981a58c87104761091471a4ffe26a8261df132d77bca5ffb8f
|
|
4
|
+
data.tar.gz: 23a146156f4e38f0e92ef9689ed6a965b044e6ae2e489cffb5da56883c7e6e7a
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 64e28d3ffdb1056f9db34459ca7d23ba2116a9aeb8130d3b81a310590fc0ad5079eff635664d153a2798b5e9765a10e7508311d0c899b82c1c59f98bedecc60c
|
|
7
|
+
data.tar.gz: 52ef6922b2b1e735a67b9aae8ecd409c3314aa3d2a48b056d2be2d272b85c4e48735e983dda88630c461a25354a5f6f9cb64eb0cb4d6f642cf873263da3af954
|
data/CHANGELOG.md
CHANGED
data/Manifest.txt
CHANGED
data/Rakefile
CHANGED
|
@@ -18,11 +18,9 @@ Hoe.spec 'worldfootball' do
|
|
|
18
18
|
self.history_file = 'CHANGELOG.md'
|
|
19
19
|
|
|
20
20
|
self.extra_deps = [
|
|
21
|
-
|
|
22
|
-
['season-formats'],
|
|
21
|
+
['football-timezones'],
|
|
23
22
|
['webget'],
|
|
24
23
|
['nokogiri'],
|
|
25
|
-
['cocos'], ## later pull in with sportsdb-writers
|
|
26
24
|
]
|
|
27
25
|
|
|
28
26
|
self.licenses = ['Public Domain']
|
data/bin/wfb
CHANGED
|
@@ -15,7 +15,7 @@ Webcache.root = if File.exist?( '/sports/cache' )
|
|
|
15
15
|
|
|
16
16
|
## convert (default) output directory
|
|
17
17
|
Worldfootball.config.convert.out_dir = if File.exist?( '/sports/cache.wfb')
|
|
18
|
-
puts "
|
|
18
|
+
puts " setting convert out_dir to >/sports/cache.wfb<"
|
|
19
19
|
'/sports/cache.wfb'
|
|
20
20
|
else
|
|
21
21
|
'.' ## use working dir
|
|
@@ -102,12 +102,16 @@ if opts[:dry]
|
|
|
102
102
|
end
|
|
103
103
|
|
|
104
104
|
|
|
105
|
-
|
|
105
|
+
## note - default to latest season of league
|
|
106
|
+
## might be 2024/25 or 2024 or
|
|
107
|
+
# for world cup 2022 or such
|
|
108
|
+
season = Season( args[1] || league.seasons.keys[0] )
|
|
106
109
|
|
|
107
110
|
pages = league.pages!( season: season )
|
|
108
111
|
|
|
109
112
|
|
|
110
113
|
puts
|
|
114
|
+
pp [league.key, season.key]
|
|
111
115
|
pp pages
|
|
112
116
|
puts " #{pages.size} page(s)"
|
|
113
117
|
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
key, slug
|
|
2
|
+
|
|
3
|
+
de.1, bundesliga-2024-2025
|
|
4
|
+
de.2, 2-bundesliga-2024-2025
|
|
5
|
+
de.3, 3-liga-2024-2025
|
|
6
|
+
de.4.bayern, regionalliga-bayern-2024-2025
|
|
7
|
+
de.cup, dfb-pokal-2024-2025
|
|
8
|
+
|
|
9
|
+
at.1, aut-bundesliga-2024-2025
|
|
10
|
+
at.2, aut-2-liga-2024-2025
|
|
11
|
+
at.3.o, aut-regionalliga-ost-2024-2025
|
|
12
|
+
at.cup, aut-oefb-cup-2024-2025
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
ch.1, sui-super-league-2024-2025
|
|
16
|
+
ch.2, sui-challenge-league-2024-2025
|
|
17
|
+
ch.cup, sui-cup-2024-2025
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
hu.1, hun-nb-i-2024-2025
|
|
21
|
+
|
|
22
|
+
cz.1, cze-1-fotbalova-liga-2024-2025
|
|
23
|
+
sk.1, svk-super-liga-2024-2025
|
|
24
|
+
|
|
25
|
+
pl.1, pol-ekstraklasa-2024-2025
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
eng.1, eng-premier-league-2024-2025
|
|
30
|
+
eng.2, eng-championship-2024-2025
|
|
31
|
+
eng.3, eng-league-one-2024-2025
|
|
32
|
+
eng.4, eng-league-two-2024-2025
|
|
33
|
+
eng.5, eng-national-league-2024-2025
|
|
34
|
+
eng.cup, eng-fa-cup-2023-2024 ### update to 2024-2025 later!!!
|
|
35
|
+
eng.cup.l, eng-league-cup-2024-2025
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
sco.1, sco-premiership-2024-2025
|
|
39
|
+
|
|
40
|
+
ie.1, irl-premier-division-2024
|
|
41
|
+
|
|
42
|
+
|
|
43
|
+
fr.1, fra-ligue-1-2024-2025
|
|
44
|
+
fr.2, fra-ligue-2-2024-2025
|
|
45
|
+
fr.cup, fra-coupe-de-france-2023-2024 ### update to 2024-2025 later!!!
|
|
46
|
+
|
|
47
|
+
|
|
48
|
+
lu.1, lux-nationaldivision-2024-2025
|
|
49
|
+
nl.1, ned-eredivisie-2024-2025
|
|
50
|
+
nl.2, ned-eerste-divisie-2024-2025
|
|
51
|
+
nl.cup, ned-knvb-beker-2024-2025
|
|
52
|
+
|
|
53
|
+
be.1, bel-eerste-klasse-a-2024-2025
|
|
54
|
+
be.2, bel-eerste-klasse-b-2024-2025
|
|
55
|
+
be.cup, bel-beker-van-belgie-2024-2025
|
|
56
|
+
|
|
57
|
+
|
|
58
|
+
it.1, ita-serie-a-2024-2025
|
|
59
|
+
it.2, ita-serie-b-2024-2025
|
|
60
|
+
it.cup, ita-coppa-italia-2024-2025
|
|
61
|
+
|
|
62
|
+
pt.1, por-primeira-liga-2024-2025
|
|
63
|
+
pt.2, por-segunda-liga-2024-2025
|
|
64
|
+
|
|
65
|
+
es.1, esp-primera-division-2024-2025
|
|
66
|
+
es.2, esp-segunda-division-2024-2025
|
|
67
|
+
es.cup, esp-copa-del-rey-2023-2024 ## update to 2024-2025 later!!!
|
|
68
|
+
|
|
69
|
+
|
|
70
|
+
tr.1, tur-sueperlig-2024-2025
|
|
71
|
+
tr.2, tur-1-lig-2024-2025
|
|
72
|
+
|
|
73
|
+
gr.1, gre-super-league-2024-2025
|
|
74
|
+
|
|
75
|
+
hr.1, cro-1-hnl-2024-2025
|
data/lib/worldfootball/build.rb
CHANGED
|
@@ -10,6 +10,8 @@ ROUND_TO_EN = {
|
|
|
10
10
|
'5. Runde' => 'Round 5',
|
|
11
11
|
'6. Runde' => 'Round 6',
|
|
12
12
|
'7. Runde' => 'Round 7',
|
|
13
|
+
'8. Runde' => 'Round 8',
|
|
14
|
+
'9. Runde' => 'Round 9',
|
|
13
15
|
'Achtelfinale' => 'Round of 16',
|
|
14
16
|
'Viertelfinale' => 'Quarterfinals',
|
|
15
17
|
'Halbfinale' => 'Semifinals',
|
|
@@ -24,13 +26,16 @@ def self.build( rows, season:, league:, stage: '' ) ## rename to fixup or such
|
|
|
24
26
|
season = Season( season ) ## cast (ensure) season class (NOT string, integer, etc.)
|
|
25
27
|
|
|
26
28
|
## note: do NOT pass in league struct! pass in key (string)
|
|
27
|
-
raise ArgumentError, "league key as string expected" unless league.is_a?(String)
|
|
29
|
+
raise ArgumentError, "league key as string expected" unless league.is_a?(String)
|
|
28
30
|
|
|
29
31
|
print " #{rows.size} row(s) - Worldfootball.build #{league} #{season}"
|
|
30
32
|
print " - #{stage}" unless stage.empty?
|
|
31
33
|
print "\n"
|
|
32
34
|
|
|
33
35
|
|
|
36
|
+
zone = find_zone!( league: league, season: season )
|
|
37
|
+
|
|
38
|
+
|
|
34
39
|
## note: use only first part from key for lookup
|
|
35
40
|
## e.g. at.1 => at
|
|
36
41
|
## eng.1 => eng
|
|
@@ -61,10 +66,10 @@ def self.build( rows, season:, league:, stage: '' ) ## rename to fixup or such
|
|
|
61
66
|
exit 1
|
|
62
67
|
end
|
|
63
68
|
print "\n"
|
|
64
|
-
|
|
65
|
-
## note - must start line e.g.
|
|
66
|
-
## do NOT match => Qual. 1. Runde (1. Runde)!!!
|
|
67
|
-
elsif row[:round] =~ /^(
|
|
69
|
+
|
|
70
|
+
## note - must start line e.g.
|
|
71
|
+
## do NOT match => Qual. 1. Runde (1. Runde)!!!
|
|
72
|
+
elsif row[:round] =~ /^(
|
|
68
73
|
[1-9]\.[ ]Runde|
|
|
69
74
|
Achtelfinale|
|
|
70
75
|
Viertelfinale|
|
|
@@ -103,12 +108,10 @@ def self.build( rows, season:, league:, stage: '' ) ## rename to fixup or such
|
|
|
103
108
|
team2_str = row[:team2]
|
|
104
109
|
score_str = row[:score]
|
|
105
110
|
|
|
106
|
-
## convert date from string e.g. 2019-25-10
|
|
107
|
-
date = Date.strptime( date_str, '%Y-%m-%d' )
|
|
108
111
|
|
|
109
112
|
|
|
110
113
|
### check for score_error; first (step 1) lookup by date
|
|
111
|
-
score_error = score_errors[
|
|
114
|
+
score_error = score_errors[ date_str ]
|
|
112
115
|
if score_error
|
|
113
116
|
if team1_str == score_error[0] &&
|
|
114
117
|
team2_str == score_error[1]
|
|
@@ -145,17 +148,44 @@ def self.build( rows, season:, league:, stage: '' ) ## rename to fixup or such
|
|
|
145
148
|
ht, ft, et, pen, comments = parse_score( score_str )
|
|
146
149
|
|
|
147
150
|
|
|
151
|
+
###################
|
|
152
|
+
### calculate date & times
|
|
153
|
+
## convert date from string e.g. 2019-25-10
|
|
154
|
+
## date = Date.strptime( date_str, '%Y-%m-%d' )
|
|
155
|
+
|
|
156
|
+
if time_str.nil? || time_str.empty?
|
|
157
|
+
## no time
|
|
158
|
+
## assume 00:00:00T
|
|
159
|
+
time_str = ''
|
|
160
|
+
timezone = ''
|
|
161
|
+
utc = ''
|
|
162
|
+
else
|
|
163
|
+
## note - assume central european (summer) time (cet/cest) - UTC+1 or UTC+2
|
|
164
|
+
cet = CET.strptime( "#{date_str} #{time_str}", '%Y-%m-%d %H:%M' )
|
|
165
|
+
|
|
166
|
+
utc = cet.getutc ## convert to utc
|
|
167
|
+
local = zone.to_local( utc ) # convert to local via utc
|
|
168
|
+
## overwrite old with local
|
|
169
|
+
date_str = local.strftime( '%Y-%m-%d' )
|
|
170
|
+
time_str = local.strftime( '%H:%M' )
|
|
171
|
+
timezone = local.strftime( '%Z/%z' )
|
|
172
|
+
utc = utc.strftime( '%Y-%m-%dT%H:%MZ' )
|
|
173
|
+
end
|
|
174
|
+
|
|
175
|
+
|
|
148
176
|
recs << [stage,
|
|
149
177
|
round,
|
|
150
|
-
|
|
178
|
+
date_str,
|
|
151
179
|
time_str,
|
|
180
|
+
timezone,
|
|
152
181
|
team1_str,
|
|
153
182
|
ft,
|
|
154
183
|
ht,
|
|
155
184
|
team2_str,
|
|
156
185
|
et, # extra: incl. extra time
|
|
157
186
|
pen, # extra: incl. penalties
|
|
158
|
-
comments
|
|
187
|
+
comments,
|
|
188
|
+
utc]
|
|
159
189
|
end # each row
|
|
160
190
|
recs
|
|
161
191
|
end # build
|
data/lib/worldfootball/config.rb
CHANGED
|
@@ -1,146 +1,11 @@
|
|
|
1
1
|
module Worldfootball
|
|
2
2
|
|
|
3
|
-
#################
|
|
4
|
-
# todo/fix - use timezone instead of offset !!!
|
|
5
|
-
# e.g
|
|
6
|
-
=begin
|
|
7
|
-
TIMEZONES = {
|
|
8
|
-
'eng.1' => 'Europe/London',
|
|
9
|
-
'eng.2' => 'Europe/London',
|
|
10
|
-
|
|
11
|
-
'es.1' => 'Europe/Madrid',
|
|
12
|
-
|
|
13
|
-
'de.1' => 'Europe/Berlin',
|
|
14
|
-
'fr.1' => 'Europe/Paris',
|
|
15
|
-
'it.1' => 'Europe/Rome',
|
|
16
|
-
'nl.1' => 'Europe/Amsterdam',
|
|
17
|
-
|
|
18
|
-
'pt.1' => 'Europe/Lisbon',
|
|
19
|
-
|
|
20
|
-
## todo/fix - pt.1
|
|
21
|
-
## one team in madeira!!! check for different timezone??
|
|
22
|
-
## CD Nacional da Madeira
|
|
23
|
-
|
|
24
|
-
'br.1' => 'America/Sao_Paulo',
|
|
25
|
-
## todo/fix - brazil has 4 timezones
|
|
26
|
-
## really only two in use for clubs
|
|
27
|
-
## west and east (amazonas et al)
|
|
28
|
-
## for now use west for all - why? why not?
|
|
29
|
-
}
|
|
30
|
-
=end
|
|
31
|
-
|
|
32
|
-
## todo - find "proper/classic" timezone ("winter time")
|
|
33
|
-
|
|
34
|
-
## Brasilia - Distrito Federal, Brasil (GMT-3) -- summer time?
|
|
35
|
-
## Ciudad de México, CDMX, México (GMT-5) -- summer time?
|
|
36
|
-
## Londres, Reino Unido (GMT+1)
|
|
37
|
-
## Madrid -- ?
|
|
38
|
-
## Lisboa -- ?
|
|
39
|
-
## Moskow -- ?
|
|
40
|
-
##
|
|
41
|
-
## todo/check - quick fix timezone offsets for leagues for now
|
|
42
|
-
## - find something better - why? why not?
|
|
43
|
-
## note: assume time is in GMT/UTC+1 - PLUS SUMMERTIME!!!
|
|
44
|
-
## todo/fix - consider summertime before conversion too!!!
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
OFFSETS = {
|
|
48
|
-
|
|
49
|
-
## fix - change to gmt/utc offset
|
|
50
|
-
## if offset == 1 (GMT/UTC+1)
|
|
51
|
-
## do NOTHING (default date/timezone of pages)
|
|
52
|
-
|
|
53
|
-
'eng' => 0,
|
|
54
|
-
# 'eng.1' => 0,
|
|
55
|
-
# 'eng.2' => 0,
|
|
56
|
-
# 'eng.3' => 0,
|
|
57
|
-
# 'eng.4' => 0,
|
|
58
|
-
# 'eng.5' => 0,
|
|
59
|
-
|
|
60
|
-
'ie' => 0,
|
|
61
|
-
'sco' => 0,
|
|
62
|
-
|
|
63
|
-
'pt' => 0,
|
|
64
|
-
# 'pt.1' => 0,
|
|
65
|
-
# 'pt.2' => 0,
|
|
66
|
-
|
|
67
|
-
'fi' => 2, # +2
|
|
68
|
-
'gr' => 2, # +2
|
|
69
|
-
'ro' => 2, # +2
|
|
70
|
-
'ua' => 2, # +2
|
|
71
|
-
|
|
72
|
-
'ru' => 3, # +3
|
|
73
|
-
'tr' => 3, # +3 turkey time/moscow time
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
'us' => -5, # (gmt-5) new york
|
|
77
|
-
|
|
78
|
-
'mx' => -6,
|
|
79
|
-
# 'mx.1' => -6,
|
|
80
|
-
# 'mx.2' => -6,
|
|
81
|
-
# 'mx.3' => -6,
|
|
82
|
-
# 'mx.cup' => -6,
|
|
83
|
-
|
|
84
|
-
'cr' => -6, # gmt-6
|
|
85
|
-
'gt' => -6, # gmt-6
|
|
86
|
-
'hn' => -6, # gmt-6
|
|
87
|
-
'sv' => -6, # gmt-6
|
|
88
|
-
'ni' => -6, # gmt-6
|
|
89
|
-
|
|
90
|
-
'uy' => -3, # gmt-3
|
|
91
|
-
'pe' => -5, # gmt-5
|
|
92
|
-
'ec' => -5, # gmt-5
|
|
93
|
-
'co' => -5, # gmt-5
|
|
94
|
-
'bo' => -4, # gmt-4
|
|
95
|
-
'cl' => -4, # gmt-4
|
|
96
|
-
|
|
97
|
-
'br' => -4, # gmt-3 - change to -3?
|
|
98
|
-
# 'br.1' => -4,
|
|
99
|
-
'ar' => -4, # gmt-3 - change to -3?
|
|
100
|
-
# 'ar.1' => -4,
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
'eg' => 3, # +3 (gmt+3)
|
|
104
|
-
'jp' => 9, # +9 (gmt+9)
|
|
105
|
-
'cn' => 7, # +7 (gmt+7)
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
## note - central european time (cet) - no need for date auto-fix
|
|
109
|
-
'at' => 1,
|
|
110
|
-
'de' => 1,
|
|
111
|
-
'ch' => 1,
|
|
112
|
-
'hu' => 1,
|
|
113
|
-
'cz' => 1,
|
|
114
|
-
'pl' => 1,
|
|
115
|
-
'nl' => 1,
|
|
116
|
-
'lu' => 1,
|
|
117
|
-
'be' => 1,
|
|
118
|
-
'dk' => 1,
|
|
119
|
-
'se' => 1,
|
|
120
|
-
'it' => 1,
|
|
121
|
-
'fr' => 1,
|
|
122
|
-
'es' => 1,
|
|
123
|
-
## see https://en.wikipedia.org/wiki/Time_in_Europe
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
################
|
|
127
|
-
## int'l tournaments
|
|
128
|
-
# 'uefa.cl'
|
|
129
|
-
# 'uefa.el'
|
|
130
|
-
'uefa.cl' => 1,
|
|
131
|
-
'uefa.el' => 1,
|
|
132
|
-
|
|
133
|
-
'concacaf.cl' => -6, ### use mx time
|
|
134
|
-
'copa.l' => -4, ### use brazil time
|
|
135
|
-
}
|
|
136
|
-
|
|
137
3
|
|
|
138
4
|
####
|
|
139
5
|
# config for slug to local basename / directories
|
|
140
6
|
# e.g.
|
|
141
7
|
# aut-bundesliga-2023-2024 => austria/2023-24/1_bundesliga.txt
|
|
142
8
|
|
|
143
|
-
|
|
144
9
|
## add (timezone) offset here too - why? why not?
|
|
145
10
|
LEAGUE_SETUPS = {
|
|
146
11
|
## note - for now auto-generate path via name (downcased)
|
|
@@ -37,9 +37,6 @@ def self.convert( league:, season: )
|
|
|
37
37
|
end
|
|
38
38
|
|
|
39
39
|
|
|
40
|
-
recs = fix_dates( recs, league: league.key )
|
|
41
|
-
|
|
42
|
-
|
|
43
40
|
## note: sort matches by date before saving/writing!!!!
|
|
44
41
|
## note: for now assume date in string in 1999-11-30 format (allows sort by "simple" a-z)
|
|
45
42
|
## note: assume date is third column!!! (stage/round/date/...)
|
|
@@ -60,63 +57,5 @@ recs.each do |rec|
|
|
|
60
57
|
puts "write #{out_path}..."
|
|
61
58
|
write_csv( out_path, recs, headers: headers )
|
|
62
59
|
end
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
## helper to fix dates to use local timezone (and not utc/london time)
|
|
66
|
-
def self.fix_dates( rows, league: )
|
|
67
|
-
|
|
68
|
-
## check: rename (optional) offset to time_offset or such?
|
|
69
|
-
## note - retry with league_country (e.g. eng.1 => eng etc.)
|
|
70
|
-
offset = OFFSETS[ league ] ||
|
|
71
|
-
OFFSETS[ league.split('.')[0] ]
|
|
72
|
-
|
|
73
|
-
if offset.nil?
|
|
74
|
-
puts "!! ERROR - no timezone/offset configured for league >#{league}<:"
|
|
75
|
-
pp rows[0] ## print first row too (for dates etc.)
|
|
76
|
-
exit 1
|
|
77
|
-
end
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
## todo/check - rename offset to timezone
|
|
81
|
-
## or utc_offset or such - why? why not
|
|
82
|
-
|
|
83
|
-
## note - assume central european time (cet) - GMT/UTC+1
|
|
84
|
-
## e.g. offset = 1 for cet (and 0 for gmt/london) etc.
|
|
85
|
-
diff_cet = offset-1
|
|
86
|
-
|
|
87
|
-
return rows if diff_cet == 0 ## no need to convert if in cet
|
|
88
|
-
|
|
89
|
-
rows.map { |row| _fix_date( row, offset ) }
|
|
90
|
-
end
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
def self._fix_date( row, offset )
|
|
94
|
-
## note: time (column) required for fix
|
|
95
|
-
return row if row[3].nil? || row[3].empty?
|
|
96
|
-
|
|
97
|
-
## note - assume central european time (cet) - GMT/UTC+1
|
|
98
|
-
diff_cet = offset-1
|
|
99
|
-
|
|
100
|
-
return row if diff_cet == 0
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
col = row[2]
|
|
105
|
-
if col =~ /^\d{4}-\d{2}-\d{2}$/
|
|
106
|
-
date_fmt = '%Y-%m-%d' # e.g. 2002-08-17
|
|
107
|
-
else
|
|
108
|
-
puts "!!! ERROR - wrong (unknown) date format >>#{col}<<; cannot continue; fix it; sorry"
|
|
109
|
-
## todo/fix: add to errors/warns list - why? why not?
|
|
110
|
-
exit 1
|
|
111
|
-
end
|
|
112
|
-
|
|
113
|
-
date = DateTime.strptime( "#{row[2]} #{row[3]}", "#{date_fmt} %H:%M" )
|
|
114
|
-
## NOTE - MUST be -7/24.0!!!! or such to work
|
|
115
|
-
date = date + (diff_cet/24.0)
|
|
116
|
-
|
|
117
|
-
row[2] = date.strftime( date_fmt ) ## overwrite "old"
|
|
118
|
-
row[3] = date.strftime( '%H:%M' )
|
|
119
|
-
row ## return row for possible pipelining - why? why not?
|
|
120
|
-
end
|
|
121
|
-
|
|
122
60
|
end # module Worldfootball
|
|
61
|
+
|
|
@@ -73,7 +73,7 @@ class LeagueItem # nested inside LeagueConfig
|
|
|
73
73
|
pages = pages( season: season )
|
|
74
74
|
if pages.nil?
|
|
75
75
|
puts "!! ERROR - no season #{season} found for #{key}; seasons incl:"
|
|
76
|
-
|
|
76
|
+
puts seasons.keys.join( ', ' )
|
|
77
77
|
puts " #{seasons.keys.size} season(s)"
|
|
78
78
|
exit 1
|
|
79
79
|
end
|
|
@@ -116,11 +116,13 @@ end # class LeagueConfig
|
|
|
116
116
|
|
|
117
117
|
|
|
118
118
|
LEAGUES = LeagueConfig.new
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
119
|
+
['leagues_europe',
|
|
120
|
+
'leagues_asia',].each do |name|
|
|
121
|
+
recs = read_csv( "#{Worldfootball.root}/config/#{name}.csv" )
|
|
122
|
+
pp recs
|
|
123
|
+
puts " #{recs.size} league(s) in #{name}"
|
|
124
|
+
LEAGUES.add( recs )
|
|
125
|
+
end
|
|
124
126
|
|
|
125
127
|
|
|
126
128
|
###########
|
|
@@ -130,7 +132,7 @@ def self.find_league!( league_code )
|
|
|
130
132
|
league = LEAGUES[ league_code ]
|
|
131
133
|
if league.nil?
|
|
132
134
|
puts "!! ERROR - no config found for #{league_code}; leagues incl:"
|
|
133
|
-
|
|
135
|
+
puts LEAGUES.keys.join( ', ' )
|
|
134
136
|
puts " #{LEAGUES.size} leagues(s)"
|
|
135
137
|
exit 1
|
|
136
138
|
end
|
data/lib/worldfootball/page.rb
CHANGED
data/lib/worldfootball/vacuum.rb
CHANGED
|
@@ -6,13 +6,15 @@ MAX_HEADERS = [
|
|
|
6
6
|
'Round',
|
|
7
7
|
'Date',
|
|
8
8
|
'Time',
|
|
9
|
+
'Timezone',
|
|
9
10
|
'Team 1',
|
|
10
11
|
'FT',
|
|
11
12
|
'HT',
|
|
12
13
|
'Team 2',
|
|
13
14
|
'ET',
|
|
14
15
|
'P',
|
|
15
|
-
'Comments'
|
|
16
|
+
'Comments', ## e.g. awarded, cancelled/canceled, etc.
|
|
17
|
+
'UTC']
|
|
16
18
|
|
|
17
19
|
MIN_HEADERS = [ ## always keep even if all empty
|
|
18
20
|
'Date',
|
data/lib/worldfootball.rb
CHANGED
|
@@ -1,18 +1,14 @@
|
|
|
1
1
|
## 3rd party (our own)
|
|
2
|
-
require '
|
|
3
|
-
require 'webget'
|
|
4
|
-
|
|
5
|
-
require 'cocos'
|
|
6
|
-
|
|
7
|
-
## 3rd party
|
|
2
|
+
require 'football/timezones' ## note - pulls in season/formats, cocos & tzinfo
|
|
3
|
+
require 'webget' ## incl. webget, webcache, webclient, etc.
|
|
8
4
|
require 'nokogiri'
|
|
9
5
|
|
|
10
6
|
|
|
11
|
-
|
|
12
7
|
###
|
|
13
8
|
# our own code
|
|
14
9
|
require_relative 'worldfootball/version'
|
|
15
10
|
require_relative 'worldfootball/leagues'
|
|
11
|
+
|
|
16
12
|
require_relative 'worldfootball/config' ## rename to setup/timezones/layouts or such?
|
|
17
13
|
require_relative 'worldfootball/download'
|
|
18
14
|
require_relative 'worldfootball/page'
|
metadata
CHANGED
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: worldfootball
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.
|
|
4
|
+
version: 0.2.0
|
|
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-11 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
|
-
name:
|
|
14
|
+
name: football-timezones
|
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
|
16
16
|
requirements:
|
|
17
17
|
- - ">="
|
|
@@ -52,20 +52,6 @@ dependencies:
|
|
|
52
52
|
- - ">="
|
|
53
53
|
- !ruby/object:Gem::Version
|
|
54
54
|
version: '0'
|
|
55
|
-
- !ruby/object:Gem::Dependency
|
|
56
|
-
name: cocos
|
|
57
|
-
requirement: !ruby/object:Gem::Requirement
|
|
58
|
-
requirements:
|
|
59
|
-
- - ">="
|
|
60
|
-
- !ruby/object:Gem::Version
|
|
61
|
-
version: '0'
|
|
62
|
-
type: :runtime
|
|
63
|
-
prerelease: false
|
|
64
|
-
version_requirements: !ruby/object:Gem::Requirement
|
|
65
|
-
requirements:
|
|
66
|
-
- - ">="
|
|
67
|
-
- !ruby/object:Gem::Version
|
|
68
|
-
version: '0'
|
|
69
55
|
- !ruby/object:Gem::Dependency
|
|
70
56
|
name: rdoc
|
|
71
57
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -116,7 +102,8 @@ files:
|
|
|
116
102
|
- README.md
|
|
117
103
|
- Rakefile
|
|
118
104
|
- bin/wfb
|
|
119
|
-
- config/
|
|
105
|
+
- config/leagues_asia.csv
|
|
106
|
+
- config/leagues_europe.csv
|
|
120
107
|
- lib/worldfootball.rb
|
|
121
108
|
- lib/worldfootball/build-parse_score.rb
|
|
122
109
|
- lib/worldfootball/build.rb
|
data/config/leagues.csv
DELETED
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
key, slug
|
|
2
|
-
|
|
3
|
-
de.1, bundesliga-2024-2025
|
|
4
|
-
de.2, 2-bundesliga-2024-2025
|
|
5
|
-
de.3, 3-liga-2024-2025
|
|
6
|
-
de.4.bayern, regionalliga-bayern-2024-2025
|
|
7
|
-
de.cup, dfb-pokal-2024-2025
|
|
8
|
-
|
|
9
|
-
at.1, aut-bundesliga-2024-2025
|
|
10
|
-
at.2, aut-2-liga-2024-2025
|
|
11
|
-
at.3.o, aut-regionalliga-ost-2024-2025
|
|
12
|
-
at.cup, aut-oefb-cup-2024-2025
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|