football-sources 0.0.1 → 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/CHANGELOG.md +6 -4
- data/Manifest.txt +0 -29
- data/README.md +30 -28
- data/Rakefile +32 -31
- data/lib/football/sources.rb +6 -6
- data/lib/football-sources/version.rb +19 -19
- data/lib/football-sources.rb +16 -46
- metadata +15 -58
- data/lib/football-sources/apis/config.rb +0 -17
- data/lib/football-sources/apis/convert.rb +0 -239
- data/lib/football-sources/apis/convert_cl.rb +0 -267
- data/lib/football-sources/apis/download.rb +0 -11
- data/lib/football-sources/apis/stat.rb +0 -59
- data/lib/football-sources/apis.rb +0 -86
- data/lib/football-sources/worldfootball/build.rb +0 -245
- data/lib/football-sources/worldfootball/config.rb +0 -16
- data/lib/football-sources/worldfootball/convert.rb +0 -100
- data/lib/football-sources/worldfootball/convert_reports.rb +0 -107
- data/lib/football-sources/worldfootball/download.rb +0 -61
- data/lib/football-sources/worldfootball/leagues/asia.rb +0 -53
- data/lib/football-sources/worldfootball/leagues/europe--british_isles.rb +0 -59
- data/lib/football-sources/worldfootball/leagues/europe--central.rb +0 -127
- data/lib/football-sources/worldfootball/leagues/europe--eastern.rb +0 -82
- data/lib/football-sources/worldfootball/leagues/europe--northern.rb +0 -57
- data/lib/football-sources/worldfootball/leagues/europe--southern.rb +0 -86
- data/lib/football-sources/worldfootball/leagues/europe--western.rb +0 -38
- data/lib/football-sources/worldfootball/leagues/europe.rb +0 -13
- data/lib/football-sources/worldfootball/leagues/north_america.rb +0 -44
- data/lib/football-sources/worldfootball/leagues/pacific.rb +0 -21
- data/lib/football-sources/worldfootball/leagues/south_america.rb +0 -11
- data/lib/football-sources/worldfootball/leagues.rb +0 -200
- data/lib/football-sources/worldfootball/mods.rb +0 -72
- data/lib/football-sources/worldfootball/tool.rb +0 -100
- data/lib/football-sources/worldfootball/vacuum.rb +0 -66
- data/lib/football-sources/worldfootball.rb +0 -24
- data/test/helper.rb +0 -8
- data/test/test_version.rb +0 -16
@@ -1,245 +0,0 @@
|
|
1
|
-
|
2
|
-
module Worldfootball
|
3
|
-
|
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
|
-
'Achtelfinale' => 'Round of 16',
|
11
|
-
'Viertelfinale' => 'Quarterfinals',
|
12
|
-
'Halbfinale' => 'Semifinals',
|
13
|
-
'Finale' => 'Final',
|
14
|
-
}
|
15
|
-
|
16
|
-
|
17
|
-
## todo/check: english league cup/trophy has NO ET - also support - make more flexible!!!
|
18
|
-
|
19
|
-
## build "standard" match records from "raw" table rows
|
20
|
-
def self.build( rows, season:, league:, stage: '' ) ## rename to fixup or such - why? why not?
|
21
|
-
season = Season( season ) ## cast (ensure) season class (NOT string, integer, etc.)
|
22
|
-
|
23
|
-
raise ArgumentError, "league key as string expected" unless league.is_a?(String) ## note: do NOT pass in league struct! pass in key (string)
|
24
|
-
|
25
|
-
print " #{rows.size} rows - build #{league} #{season}"
|
26
|
-
print " - #{stage}" unless stage.empty?
|
27
|
-
print "\n"
|
28
|
-
|
29
|
-
|
30
|
-
## note: use only first part from key for lookup
|
31
|
-
## e.g. at.1 => at
|
32
|
-
## eng.1 => eng
|
33
|
-
## and so on
|
34
|
-
mods = MODS[ league.split('.')[0] ] || {}
|
35
|
-
|
36
|
-
score_errors = SCORE_ERRORS[ league ] || {}
|
37
|
-
|
38
|
-
|
39
|
-
i = 0
|
40
|
-
recs = []
|
41
|
-
rows.each do |row|
|
42
|
-
i += 1
|
43
|
-
|
44
|
-
|
45
|
-
if row[:round] =~ /Spieltag/
|
46
|
-
puts
|
47
|
-
print '[%03d] ' % (i+1)
|
48
|
-
print row[:round]
|
49
|
-
|
50
|
-
if m = row[:round].match( /([0-9]+)\. Spieltag/ )
|
51
|
-
## todo/check: always use a string even if number (as a string eg. '1' etc.)
|
52
|
-
round = m[1] ## note: keep as string (NOT number)
|
53
|
-
print " => #{round}"
|
54
|
-
else
|
55
|
-
puts "!! ERROR: cannot find matchday number"
|
56
|
-
exit 1
|
57
|
-
end
|
58
|
-
print "\n"
|
59
|
-
elsif row[:round] =~ /[1-9]\.[ ]Runde|
|
60
|
-
Achtelfinale|
|
61
|
-
Viertelfinale|
|
62
|
-
Halbfinale|
|
63
|
-
Finale
|
64
|
-
/x
|
65
|
-
puts
|
66
|
-
print '[%03d] ' % (i+1)
|
67
|
-
print row[:round]
|
68
|
-
|
69
|
-
|
70
|
-
## do NOT translate rounds (to english) - keep in german / deutsch (de)
|
71
|
-
if ['at.cup', 'at.1', ## at.1 - incl. europa league playoff
|
72
|
-
'de.cup'].include?( league )
|
73
|
-
round = row[:round]
|
74
|
-
else
|
75
|
-
round = ROUND_TO_EN[ row[:round] ]
|
76
|
-
if round.nil?
|
77
|
-
puts "!! ERROR: no mapping for round to english (en) found >#{row[:round]}<:"
|
78
|
-
pp row
|
79
|
-
exit 1
|
80
|
-
end
|
81
|
-
print " => #{round}"
|
82
|
-
end
|
83
|
-
print "\n"
|
84
|
-
else
|
85
|
-
puts "!! ERROR: unknown round >#{row[:round]}< for league >#{league}<:"
|
86
|
-
pp row
|
87
|
-
exit 1
|
88
|
-
end
|
89
|
-
|
90
|
-
|
91
|
-
date_str = row[:date]
|
92
|
-
time_str = row[:time]
|
93
|
-
team1_str = row[:team1]
|
94
|
-
team2_str = row[:team2]
|
95
|
-
score_str = row[:score]
|
96
|
-
|
97
|
-
## convert date from string e.g. 2019-25-10
|
98
|
-
date = Date.strptime( date_str, '%Y-%m-%d' )
|
99
|
-
|
100
|
-
|
101
|
-
### check for score_error; first (step 1) lookup by date
|
102
|
-
score_error = score_errors[ date.strftime('%Y-%m-%d') ]
|
103
|
-
if score_error
|
104
|
-
if team1_str == score_error[0] &&
|
105
|
-
team2_str == score_error[1]
|
106
|
-
## check if team names match too; if yes, apply fix/patch!!
|
107
|
-
if score_str != score_error[2][0]
|
108
|
-
puts "!! WARN - score fix changed? - expected #{score_error[2][0]}, got #{score_str} - fixing to #{score_error[2][1]}"
|
109
|
-
pp row
|
110
|
-
end
|
111
|
-
puts "FIX - applying score error fix - from #{score_error[2][0]} to => #{score_error[2][1]}"
|
112
|
-
score_str = score_error[2][1]
|
113
|
-
end
|
114
|
-
end
|
115
|
-
|
116
|
-
|
117
|
-
print '[%03d] ' % (i+1)
|
118
|
-
print "%-10s | " % date_str
|
119
|
-
print "%-5s | " % time_str
|
120
|
-
print "%-22s | " % team1_str
|
121
|
-
print "%-22s | " % team2_str
|
122
|
-
print score_str
|
123
|
-
print "\n"
|
124
|
-
|
125
|
-
|
126
|
-
## check for 0:3 Wert. - change Wert. to awd. (awarded)
|
127
|
-
score_str = score_str.sub( /Wert\./i, 'awd.' )
|
128
|
-
|
129
|
-
## clean team name (e.g. remove (old))
|
130
|
-
## and asciify (e.g. ’ to ' )
|
131
|
-
team1_str = norm_team( team1_str )
|
132
|
-
team2_str = norm_team( team2_str )
|
133
|
-
|
134
|
-
team1_str = mods[ team1_str ] if mods[ team1_str ]
|
135
|
-
team2_str = mods[ team2_str ] if mods[ team2_str ]
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
|
140
|
-
ht, ft, et, pen, comments = parse_score( score_str )
|
141
|
-
|
142
|
-
|
143
|
-
|
144
|
-
recs << [stage,
|
145
|
-
round,
|
146
|
-
date.strftime( '%Y-%m-%d' ),
|
147
|
-
time_str,
|
148
|
-
team1_str,
|
149
|
-
ft,
|
150
|
-
ht,
|
151
|
-
team2_str,
|
152
|
-
et, # extra: incl. extra time
|
153
|
-
pen, # extra: incl. penalties
|
154
|
-
comments]
|
155
|
-
end # each row
|
156
|
-
recs
|
157
|
-
end # build
|
158
|
-
|
159
|
-
|
160
|
-
|
161
|
-
def self.parse_score( score_str )
|
162
|
-
comments = String.new( '' ) ## check - rename to/use status or such - why? why not?
|
163
|
-
|
164
|
-
## split score
|
165
|
-
ft = ''
|
166
|
-
ht = ''
|
167
|
-
et = ''
|
168
|
-
pen = ''
|
169
|
-
if score_str == '---' ## in the future (no score yet) - was -:-
|
170
|
-
ft = ''
|
171
|
-
ht = ''
|
172
|
-
elsif score_str == 'n.gesp.' || ## cancelled (british) / canceled (us)
|
173
|
-
score_str == 'ausg.' || ## todo/check: change to some other status ????
|
174
|
-
score_str == 'annull.' ## todo/check: change to some other status (see ie 2012) ????
|
175
|
-
ft = '(*)'
|
176
|
-
ht = ''
|
177
|
-
comments = 'cancelled'
|
178
|
-
elsif score_str == 'abgebr.' ## abandoned -- waiting for replay?
|
179
|
-
ft = '(*)'
|
180
|
-
ht = ''
|
181
|
-
comments = 'abandoned'
|
182
|
-
elsif score_str == 'verl.' ## postponed
|
183
|
-
ft = ''
|
184
|
-
ht = ''
|
185
|
-
comments = 'postponed'
|
186
|
-
# 5-4 (0-0, 1-1, 2-2) i.E.
|
187
|
-
elsif score_str =~ /([0-9]+) [ ]*-[ ]* ([0-9]+)
|
188
|
-
[ ]*
|
189
|
-
\(([0-9]+) [ ]*-[ ]* ([0-9]+)
|
190
|
-
[ ]*,[ ]*
|
191
|
-
([0-9]+) [ ]*-[ ]* ([0-9]+)
|
192
|
-
[ ]*,[ ]*
|
193
|
-
([0-9]+) [ ]*-[ ]* ([0-9]+)\)
|
194
|
-
[ ]*
|
195
|
-
i\.E\.
|
196
|
-
/x
|
197
|
-
pen = "#{$1}-#{$2}"
|
198
|
-
ht = "#{$3}-#{$4}"
|
199
|
-
ft = "#{$5}-#{$6}"
|
200
|
-
et = "#{$7}-#{$8}"
|
201
|
-
# 2-1 (1-0, 1-1) n.V
|
202
|
-
elsif score_str =~ /([0-9]+) [ ]*-[ ]* ([0-9]+)
|
203
|
-
[ ]*
|
204
|
-
\(([0-9]+) [ ]*-[ ]* ([0-9]+)
|
205
|
-
[ ]*,[ ]*
|
206
|
-
([0-9]+) [ ]*-[ ]* ([0-9]+)
|
207
|
-
\)
|
208
|
-
[ ]*
|
209
|
-
n\.V\.
|
210
|
-
/x
|
211
|
-
et = "#{$1}-#{$2}"
|
212
|
-
ht = "#{$3}-#{$4}"
|
213
|
-
ft = "#{$5}-#{$6}"
|
214
|
-
elsif score_str =~ /([0-9]+)
|
215
|
-
[ ]*-[ ]*
|
216
|
-
([0-9]+)
|
217
|
-
[ ]*
|
218
|
-
\(([0-9]+)
|
219
|
-
[ ]*-[ ]*
|
220
|
-
([0-9]+)
|
221
|
-
\)
|
222
|
-
/x
|
223
|
-
ft = "#{$1}-#{$2}"
|
224
|
-
ht = "#{$3}-#{$4}"
|
225
|
-
elsif score_str =~ /([0-9]+)
|
226
|
-
[ ]*-[ ]*
|
227
|
-
([0-9]+)
|
228
|
-
[ ]*
|
229
|
-
([a-z.]+)
|
230
|
-
/x
|
231
|
-
ft = "#{$1}-#{$2} (*)"
|
232
|
-
ht = ''
|
233
|
-
comments = $3
|
234
|
-
elsif score_str =~ /^([0-9]+)-([0-9]+)$/
|
235
|
-
ft = "#{$1}-#{$2}" ## e.g. see luxemburg and others
|
236
|
-
ht = ''
|
237
|
-
else
|
238
|
-
puts "!! ERROR - unsupported score format >#{score_str}< - sorry; maybe add a score error fix/patch"
|
239
|
-
exit 1
|
240
|
-
end
|
241
|
-
|
242
|
-
[ht, ft, et, pen, comments]
|
243
|
-
end
|
244
|
-
|
245
|
-
end # module Worldfootball
|
@@ -1,16 +0,0 @@
|
|
1
|
-
module Worldfootball
|
2
|
-
|
3
|
-
### add some more config options / settings
|
4
|
-
class Configuration
|
5
|
-
#########
|
6
|
-
## nested configuration classes - use - why? why not?
|
7
|
-
class Convert
|
8
|
-
def out_dir() @out_dir || './o'; end
|
9
|
-
def out_dir=(value) @out_dir = value; end
|
10
|
-
end
|
11
|
-
|
12
|
-
def convert() @convert ||= Convert.new; end
|
13
|
-
end # class Configuration
|
14
|
-
|
15
|
-
|
16
|
-
end # module Worldfootball
|
@@ -1,100 +0,0 @@
|
|
1
|
-
|
2
|
-
module Worldfootball
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
def self.convert( league:, season:, offset: nil ) ## check: rename (optional) offset to time_offset or such?
|
7
|
-
season = Season( season ) ## cast (ensure) season class (NOT string, integer, etc.)
|
8
|
-
|
9
|
-
league = find_league( league )
|
10
|
-
|
11
|
-
pages = league.pages( season: season )
|
12
|
-
|
13
|
-
# note: assume stages if pages is an array (of hash table/records)
|
14
|
-
# (and NOT a single hash table/record)
|
15
|
-
if pages.is_a?(Array)
|
16
|
-
recs = []
|
17
|
-
pages.each do |page_meta|
|
18
|
-
slug = page_meta[:slug]
|
19
|
-
stage_name = page_meta[:stage]
|
20
|
-
## todo/fix: report error/check if stage.name is nil!!!
|
21
|
-
|
22
|
-
print " parsing #{slug}..."
|
23
|
-
|
24
|
-
# unless File.exist?( path )
|
25
|
-
# puts "!! WARN - missing stage >#{stage_name}< source - >#{path}<"
|
26
|
-
# next
|
27
|
-
# end
|
28
|
-
|
29
|
-
page = Page::Schedule.from_cache( slug )
|
30
|
-
print " title=>#{page.title}<..."
|
31
|
-
print "\n"
|
32
|
-
|
33
|
-
rows = page.matches
|
34
|
-
stage_recs = build( rows, season: season, league: league.key, stage: stage_name )
|
35
|
-
|
36
|
-
pp stage_recs[0] ## check first record
|
37
|
-
recs += stage_recs
|
38
|
-
end
|
39
|
-
else
|
40
|
-
page_meta = pages
|
41
|
-
slug = page_meta[:slug]
|
42
|
-
|
43
|
-
print " parsing #{slug}..."
|
44
|
-
|
45
|
-
page = Page::Schedule.from_cache( slug )
|
46
|
-
print " title=>#{page.title}<..."
|
47
|
-
print "\n"
|
48
|
-
|
49
|
-
rows = page.matches
|
50
|
-
recs = build( rows, season: season, league: league.key )
|
51
|
-
|
52
|
-
pp recs[0] ## check first record
|
53
|
-
end
|
54
|
-
|
55
|
-
recs = recs.map { |rec| fix_date( rec, offset ) } if offset
|
56
|
-
|
57
|
-
## note: sort matches by date before saving/writing!!!!
|
58
|
-
## note: for now assume date in string in 1999-11-30 format (allows sort by "simple" a-z)
|
59
|
-
## note: assume date is third column!!! (stage/round/date/...)
|
60
|
-
recs = recs.sort { |l,r| l[2] <=> r[2] }
|
61
|
-
## reformat date / beautify e.g. Sat Aug 7 1993
|
62
|
-
recs.each { |rec| rec[2] = Date.strptime( rec[2], '%Y-%m-%d' ).strftime( '%a %b %-d %Y' ) }
|
63
|
-
|
64
|
-
## remove unused columns (e.g. stage, et, p, etc.)
|
65
|
-
recs, headers = vacuum( recs )
|
66
|
-
|
67
|
-
puts headers
|
68
|
-
pp recs[0] ## check first record
|
69
|
-
|
70
|
-
out_path = "#{config.convert.out_dir}/#{season.path}/#{league.key}.csv"
|
71
|
-
|
72
|
-
puts "write #{out_path}..."
|
73
|
-
Cache::CsvMatchWriter.write( out_path, recs, headers: headers )
|
74
|
-
end
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
## helper to fix dates to use local timezone (and not utc/london time)
|
79
|
-
def self.fix_date( row, offset )
|
80
|
-
return row if row[3].nil? || row[3].empty? ## note: time (column) required for fix
|
81
|
-
|
82
|
-
col = row[2]
|
83
|
-
if col =~ /^\d{4}-\d{2}-\d{2}$/
|
84
|
-
date_fmt = '%Y-%m-%d' # e.g. 2002-08-17
|
85
|
-
else
|
86
|
-
puts "!!! ERROR - wrong (unknown) date format >>#{col}<<; cannot continue; fix it; sorry"
|
87
|
-
## todo/fix: add to errors/warns list - why? why not?
|
88
|
-
exit 1
|
89
|
-
end
|
90
|
-
|
91
|
-
date = DateTime.strptime( "#{row[2]} #{row[3]}", "#{date_fmt} %H:%M" )
|
92
|
-
## NOTE - MUST be -7/24.0!!!! or such to work
|
93
|
-
date = date + (offset/24.0)
|
94
|
-
|
95
|
-
row[2] = date.strftime( date_fmt ) ## overwrite "old"
|
96
|
-
row[3] = date.strftime( '%H:%M' )
|
97
|
-
row ## return row for possible pipelining - why? why not?
|
98
|
-
end
|
99
|
-
|
100
|
-
end # module Worldfootball
|
@@ -1,107 +0,0 @@
|
|
1
|
-
module Worldfootball
|
2
|
-
|
3
|
-
|
4
|
-
def self.convert_reports( league:, season: )
|
5
|
-
season = Season( season ) ## cast (ensure) season class (NOT string, integer, etc.)
|
6
|
-
|
7
|
-
league = find_league( league )
|
8
|
-
|
9
|
-
## note: use only first part from key for lookup
|
10
|
-
## e.g. at.1 => at
|
11
|
-
## eng.1 => eng
|
12
|
-
## and so on
|
13
|
-
mods = MODS[ league.key.split('.')[0] ] || {}
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
pages = league.pages( season: season )
|
18
|
-
|
19
|
-
recs = []
|
20
|
-
|
21
|
-
## if single (simple) page setup - wrap in array
|
22
|
-
pages = pages.is_a?(Array) ? pages : [pages]
|
23
|
-
pages.each do |page_meta| # note: use page_info for now (or page_rec or page_meta or such)
|
24
|
-
|
25
|
-
page = Page::Schedule.from_cache( page_meta[:slug] )
|
26
|
-
print " page title=>#{page.title}<..."
|
27
|
-
print "\n"
|
28
|
-
|
29
|
-
matches = page.matches
|
30
|
-
|
31
|
-
puts "matches - #{matches.size} rows:"
|
32
|
-
pp matches[0]
|
33
|
-
|
34
|
-
puts "#{page.generated_in_days_ago} - #{page.generated}"
|
35
|
-
|
36
|
-
|
37
|
-
matches.each_with_index do |match,i|
|
38
|
-
|
39
|
-
report_ref = match[:report_ref]
|
40
|
-
if report_ref.nil?
|
41
|
-
puts "!! WARN: no match report ref found for match:"
|
42
|
-
pp match
|
43
|
-
next
|
44
|
-
end
|
45
|
-
|
46
|
-
puts "reading #{i+1}/#{matches.size} - #{report_ref}..."
|
47
|
-
report = Page::Report.from_cache( report_ref )
|
48
|
-
|
49
|
-
puts
|
50
|
-
puts report.title
|
51
|
-
puts report.generated
|
52
|
-
|
53
|
-
rows = report.goals
|
54
|
-
puts "goals - #{rows.size} records"
|
55
|
-
## pp rows
|
56
|
-
|
57
|
-
|
58
|
-
if rows.size > 0
|
59
|
-
## add goals
|
60
|
-
date = Date.strptime( match[:date], '%Y-%m-%d')
|
61
|
-
|
62
|
-
team1 = match[:team1]
|
63
|
-
team2 = match[:team2]
|
64
|
-
|
65
|
-
## clean team name (e.g. remove (old))
|
66
|
-
## and asciify (e.g. ’ to ' )
|
67
|
-
team1 = norm_team( team1 )
|
68
|
-
team2 = norm_team( team2 )
|
69
|
-
|
70
|
-
team1 = mods[ team1 ] if mods[ team1 ]
|
71
|
-
team2 = mods[ team2 ] if mods[ team2 ]
|
72
|
-
|
73
|
-
match_id = "#{team1} - #{team2} | #{date.strftime('%b %-d %Y')}"
|
74
|
-
|
75
|
-
|
76
|
-
rows.each do |row|
|
77
|
-
extra = if row[:owngoal]
|
78
|
-
'(og)' ## or use OG or O.G.- why? why not?
|
79
|
-
elsif row[:penalty]
|
80
|
-
'(pen)' ## or use P or PEN - why? why not?
|
81
|
-
else
|
82
|
-
''
|
83
|
-
end
|
84
|
-
|
85
|
-
rec = [match_id,
|
86
|
-
row[:score],
|
87
|
-
"#{row[:minute]}'",
|
88
|
-
extra,
|
89
|
-
row[:player],
|
90
|
-
row[:notes]]
|
91
|
-
recs << rec
|
92
|
-
end
|
93
|
-
end
|
94
|
-
end # each match
|
95
|
-
end # each page
|
96
|
-
|
97
|
-
## pp recs
|
98
|
-
|
99
|
-
out_path = "#{config.convert.out_dir}/#{season.path}/#{league.key}~goals.csv"
|
100
|
-
|
101
|
-
headers = ['Match', 'Score', 'Minute', 'Extra', 'Player', 'Notes']
|
102
|
-
|
103
|
-
puts "write #{out_path}..."
|
104
|
-
Cache::CsvMatchWriter.write( out_path, recs, headers: headers )
|
105
|
-
end
|
106
|
-
end # module Worldfootballl
|
107
|
-
|
@@ -1,61 +0,0 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
module Worldfootball
|
4
|
-
|
5
|
-
##
|
6
|
-
## note/fix!!!!
|
7
|
-
## do NOT allow redirects for now - report error!!!
|
8
|
-
## does NOT return 404 page not found errors; always redirects (301) to home page
|
9
|
-
## on missing pages:
|
10
|
-
## 301 Moved Permanently location=https://www.weltfussball.de/
|
11
|
-
## 301 Moved Permanently location=https://www.weltfussball.de/
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
# url = "https://www.weltfussball.de/alle_spiele/eng-league-one-#{season}/"
|
17
|
-
# url = "https://www.weltfussball.de/alle_spiele/eng-league-two-#{season}/"
|
18
|
-
# https://www.weltfussball.de/alle_spiele/eng-national-league-2019-2020/
|
19
|
-
# https://www.weltfussball.de/alle_spiele/eng-fa-cup-2018-2019/
|
20
|
-
# https://www.weltfussball.de/alle_spiele/eng-league-cup-2019-2020/
|
21
|
-
|
22
|
-
# https://www.weltfussball.de/alle_spiele/fra-ligue-2-2019-2020/
|
23
|
-
# https://www.weltfussball.de/alle_spiele/ita-serie-b-2019-2020/
|
24
|
-
# https://www.weltfussball.de/alle_spiele/rus-premier-liga-2019-2020/
|
25
|
-
# https://www.weltfussball.de/alle_spiele/rus-1-division-2019-2020/
|
26
|
-
# https://www.weltfussball.de/alle_spiele/tur-sueperlig-2019-2020/
|
27
|
-
# https://www.weltfussball.de/alle_spiele/tur-1-lig-2019-2020/
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
def self.schedule( league:, season: )
|
32
|
-
season = Season( season ) ## cast (ensure) season class (NOT string, integer, etc.)
|
33
|
-
|
34
|
-
league = find_league( league )
|
35
|
-
|
36
|
-
pages = league.pages( season: season )
|
37
|
-
|
38
|
-
## if single (simple) page setup - wrap in array
|
39
|
-
pages = pages.is_a?(Array) ? pages : [pages]
|
40
|
-
pages.each do |page_meta|
|
41
|
-
Metal.schedule( page_meta[:slug] )
|
42
|
-
end # each page
|
43
|
-
end
|
44
|
-
|
45
|
-
|
46
|
-
def self.schedule_reports( league:, season:, cache: true ) ## todo/check: rename to reports_for_schedule or such - why? why not?
|
47
|
-
season = Season( season ) ## cast (ensure) season class (NOT string, integer, etc.)
|
48
|
-
|
49
|
-
league = find_league( league )
|
50
|
-
|
51
|
-
pages = league.pages( season: season )
|
52
|
-
|
53
|
-
## if single (simple) page setup - wrap in array
|
54
|
-
pages = pages.is_a?(Array) ? pages : [pages]
|
55
|
-
pages.each do |page_meta|
|
56
|
-
Metal.schedule_reports( page_meta[:slug], cache: cache )
|
57
|
-
end # each page
|
58
|
-
end
|
59
|
-
|
60
|
-
|
61
|
-
end # module Worldfootball
|
@@ -1,53 +0,0 @@
|
|
1
|
-
module Worldfootball
|
2
|
-
|
3
|
-
LEAGUES_ASIA = {
|
4
|
-
|
5
|
-
# /chn-super-league-2020/
|
6
|
-
'cn.1' => { pages: 'chn-super-league' },
|
7
|
-
|
8
|
-
# /jpn-j1-league-2020/
|
9
|
-
'jp.1' => { pages: 'jpn-j1-league' },
|
10
|
-
|
11
|
-
|
12
|
-
=begin
|
13
|
-
2020 -- >/alle_spiele/kor-k-league-1-2020/<
|
14
|
-
2019 Meisterschaft -- >/alle_spiele/kor-k-league-1-2019-meisterschaft/<
|
15
|
-
2019 Abstieg -- >/alle_spiele/kor-k-league-1-2019-abstieg/<
|
16
|
-
2019 -- >/alle_spiele/kor-k-league-1-2019/<
|
17
|
-
2018 Meisterschaft -- >/alle_spiele/kor-k-league-1-2018-meisterschaft/<
|
18
|
-
2018 Abstieg -- >/alle_spiele/kor-k-league-1-2018-abstieg/<
|
19
|
-
2018 -- >/alle_spiele/kor-k-league-classic-2018/<
|
20
|
-
2017 Meisterschaft -- >/alle_spiele/kor-k-league-classic-2017-meisterschaft/<
|
21
|
-
2017 Abstieg -- >/alle_spiele/kor-k-league-classic-2017-abstieg/<
|
22
|
-
2017 -- >/alle_spiele/kor-k-league-classic-2017/<
|
23
|
-
2016 Meisterschaft -- >/alle_spiele/kor-k-league-classic-2016-meisterschaft/<
|
24
|
-
2016 Abstieg -- >/alle_spiele/kor-k-league-classic-2016-abstieg/<
|
25
|
-
2016 -- >/alle_spiele/kor-k-league-2016/<
|
26
|
-
2015 Meisterschaft -- >/alle_spiele/kor-k-league-2015-meisterschaft/<
|
27
|
-
2015 Abstieg -- >/alle_spiele/kor-k-league-2015-abstieg/<
|
28
|
-
2015 -- >/alle_spiele/kor-k-league-2015/<
|
29
|
-
=end
|
30
|
-
|
31
|
-
### todo/fix: time-zone offset!!!!!!!!
|
32
|
-
# /kor-k-league-1-2020/
|
33
|
-
# /kor-k-league-1-2019-meisterschaft/
|
34
|
-
# /kor-k-league-1-2019-abstieg/
|
35
|
-
'kr.1' => {
|
36
|
-
pages: {
|
37
|
-
'kor-k-league-1-{season}' => 'Regular Season', # 1
|
38
|
-
'kor-k-league-1-{season}-meisterschaft' => 'Playoffs - Championship', # 2
|
39
|
-
'kor-k-league-1-{season}-abstieg' => 'Playoffs - Relegation', # 3
|
40
|
-
},
|
41
|
-
season: ->( season ) {
|
42
|
-
case season
|
43
|
-
when Season('2020') then [1] # just getting started
|
44
|
-
when Season('2019') then [1,2,3]
|
45
|
-
end
|
46
|
-
}
|
47
|
-
},
|
48
|
-
|
49
|
-
}
|
50
|
-
|
51
|
-
end # module Worldfootball
|
52
|
-
|
53
|
-
|
@@ -1,59 +0,0 @@
|
|
1
|
-
|
2
|
-
module Worldfootball
|
3
|
-
|
4
|
-
|
5
|
-
LEAGUES_EUROPE.merge!({
|
6
|
-
|
7
|
-
|
8
|
-
# /eng-national-league-2020-2021/
|
9
|
-
'eng.1' => { pages: 'eng-premier-league' },
|
10
|
-
'eng.2' => { pages: 'eng-championship' },
|
11
|
-
'eng.3' => { pages: 'eng-league-one' },
|
12
|
-
'eng.4' => { pages: 'eng-league-two' },
|
13
|
-
'eng.5' => { pages: 'eng-national-league' },
|
14
|
-
'eng.cup' => { pages: 'eng-fa-cup' }, ## change key to eng.cup.fa or such??
|
15
|
-
'eng.cup.l' => { pages: 'eng-league-cup' }, ## change key to ??
|
16
|
-
|
17
|
-
'sco.1' => {
|
18
|
-
pages: {
|
19
|
-
'sco-premiership-{season}' => 'Regular Season',
|
20
|
-
'sco-premiership-{end_year}-playoff' => 'Playoffs - Championship', # note: only uses season.end_year!
|
21
|
-
'sco-premiership-{end_year}-abstieg' => 'Playoffs - Relegation', # note: only uses season.end_year!
|
22
|
-
},
|
23
|
-
season: ->( season ) {
|
24
|
-
case season
|
25
|
-
when Season('2020/21') then [1] # just getting started
|
26
|
-
when Season('2019/20') then [1] # covid-19 - no championship & relegation
|
27
|
-
when Season('2018/19') then [1,2,3]
|
28
|
-
end
|
29
|
-
}
|
30
|
-
},
|
31
|
-
|
32
|
-
# e.g. /irl-premier-division-2019/
|
33
|
-
# irl-premier-division-2020
|
34
|
-
# irl-premier-division-2019
|
35
|
-
# irl-premier-division-2018
|
36
|
-
# irl-premier-division-2017
|
37
|
-
# irl-premier-division-2016
|
38
|
-
# irl-premier-division-2015
|
39
|
-
# irl-premier-division-2014
|
40
|
-
# irl-premier-division-2013
|
41
|
-
# irl-airtricity-league-2012
|
42
|
-
# irl-airtricity-league-2011
|
43
|
-
# irl-airtricity-league-2010
|
44
|
-
|
45
|
-
'ie.1' => {
|
46
|
-
pages: [
|
47
|
-
'irl-premier-division',
|
48
|
-
'irl-airtricity-league'],
|
49
|
-
season: ->( season ) {
|
50
|
-
case season
|
51
|
-
when Season('2013')..Season('2020') then 1
|
52
|
-
when Season('2010')..Season('2012') then 2
|
53
|
-
end
|
54
|
-
}
|
55
|
-
},
|
56
|
-
})
|
57
|
-
|
58
|
-
end
|
59
|
-
|