worldfootball 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/CHANGELOG.md +6 -0
- data/Manifest.txt +29 -0
- data/README.md +27 -0
- data/Rakefile +34 -0
- data/bin/wfb +104 -0
- data/lib/worldfootball/build.rb +245 -0
- data/lib/worldfootball/convert.rb +162 -0
- data/lib/worldfootball/convert_reports.rb +107 -0
- data/lib/worldfootball/download.rb +131 -0
- data/lib/worldfootball/generator.rb +33 -0
- data/lib/worldfootball/leagues/asia.rb +53 -0
- data/lib/worldfootball/leagues/europe--british_isles.rb +64 -0
- data/lib/worldfootball/leagues/europe--central.rb +127 -0
- data/lib/worldfootball/leagues/europe--eastern.rb +82 -0
- data/lib/worldfootball/leagues/europe--northern.rb +57 -0
- data/lib/worldfootball/leagues/europe--southern.rb +86 -0
- data/lib/worldfootball/leagues/europe--western.rb +38 -0
- data/lib/worldfootball/leagues/europe.rb +13 -0
- data/lib/worldfootball/leagues/north_america.rb +44 -0
- data/lib/worldfootball/leagues/pacific.rb +21 -0
- data/lib/worldfootball/leagues/south_america.rb +11 -0
- data/lib/worldfootball/leagues.rb +200 -0
- data/lib/worldfootball/mods.rb +72 -0
- data/lib/worldfootball/page.rb +106 -0
- data/lib/worldfootball/page_report.rb +186 -0
- data/lib/worldfootball/page_schedule.rb +292 -0
- data/lib/worldfootball/vacuum.rb +66 -0
- data/lib/worldfootball/version.rb +20 -0
- data/lib/worldfootball.rb +66 -0
- metadata +169 -0
@@ -0,0 +1,107 @@
|
|
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
|
+
|
@@ -0,0 +1,131 @@
|
|
1
|
+
|
2
|
+
|
3
|
+
module Worldfootball
|
4
|
+
|
5
|
+
#################
|
6
|
+
## porcelain "api"
|
7
|
+
def self.schedule( league:, season: )
|
8
|
+
season = Season( season ) ## cast (ensure) season class (NOT string, integer, etc.)
|
9
|
+
|
10
|
+
league = find_league( league )
|
11
|
+
|
12
|
+
pages = league.pages( season: season )
|
13
|
+
|
14
|
+
## if single (simple) page setup - wrap in array
|
15
|
+
pages = pages.is_a?(Array) ? pages : [pages]
|
16
|
+
pages.each do |page_meta|
|
17
|
+
Metal.download_schedule( page_meta[:slug] )
|
18
|
+
end # each page
|
19
|
+
end
|
20
|
+
|
21
|
+
|
22
|
+
def self.reports( league:, season:, cache: true ) ## todo/check: rename to reports_for_schedule or such - why? why not?
|
23
|
+
season = Season( season ) ## cast (ensure) season class (NOT string, integer, etc.)
|
24
|
+
|
25
|
+
league = find_league( league )
|
26
|
+
|
27
|
+
pages = league.pages( season: season )
|
28
|
+
|
29
|
+
## if single (simple) page setup - wrap in array
|
30
|
+
pages = pages.is_a?(Array) ? pages : [pages]
|
31
|
+
pages.each do |page_meta|
|
32
|
+
Metal.download_reports_for_schedule( page_meta[:slug], cache: cache )
|
33
|
+
end # each page
|
34
|
+
end
|
35
|
+
|
36
|
+
|
37
|
+
|
38
|
+
|
39
|
+
##################
|
40
|
+
## plumbing metal "helpers"
|
41
|
+
|
42
|
+
## todo/check: put in Downloader namespace/class - why? why not?
|
43
|
+
## or use Metal - no "porcelain" downloaders / machinery
|
44
|
+
class Metal
|
45
|
+
|
46
|
+
BASE_URL = 'https://www.weltfussball.de'
|
47
|
+
|
48
|
+
|
49
|
+
def self.schedule_url( slug ) "#{BASE_URL}/alle_spiele/#{slug}/"; end
|
50
|
+
def self.report_url( slug ) "#{BASE_URL}/spielbericht/#{slug}/"; end
|
51
|
+
|
52
|
+
|
53
|
+
##
|
54
|
+
## note:
|
55
|
+
## do NOT allow redirects for now - report error!!!
|
56
|
+
## does NOT return 404 page not found errors; always redirects (301) to home page
|
57
|
+
## on missing pages:
|
58
|
+
## 301 Moved Permanently location=https://www.weltfussball.de/
|
59
|
+
## 301 Moved Permanently location=https://www.weltfussball.de/
|
60
|
+
|
61
|
+
|
62
|
+
# url = "https://www.weltfussball.de/alle_spiele/eng-league-one-#{season}/"
|
63
|
+
# url = "https://www.weltfussball.de/alle_spiele/eng-league-two-#{season}/"
|
64
|
+
# https://www.weltfussball.de/alle_spiele/eng-national-league-2019-2020/
|
65
|
+
# https://www.weltfussball.de/alle_spiele/eng-fa-cup-2018-2019/
|
66
|
+
# https://www.weltfussball.de/alle_spiele/eng-league-cup-2019-2020/
|
67
|
+
|
68
|
+
# https://www.weltfussball.de/alle_spiele/fra-ligue-2-2019-2020/
|
69
|
+
# https://www.weltfussball.de/alle_spiele/ita-serie-b-2019-2020/
|
70
|
+
# https://www.weltfussball.de/alle_spiele/rus-premier-liga-2019-2020/
|
71
|
+
# https://www.weltfussball.de/alle_spiele/rus-1-division-2019-2020/
|
72
|
+
# https://www.weltfussball.de/alle_spiele/tur-sueperlig-2019-2020/
|
73
|
+
# https://www.weltfussball.de/alle_spiele/tur-1-lig-2019-2020/
|
74
|
+
|
75
|
+
|
76
|
+
def self.download_schedule( slug )
|
77
|
+
url = schedule_url( slug )
|
78
|
+
download_page( url )
|
79
|
+
end
|
80
|
+
|
81
|
+
def self.download_report( slug, cache: true )
|
82
|
+
url = report_url( slug )
|
83
|
+
|
84
|
+
## check check first
|
85
|
+
if cache && Webcache.cached?( url )
|
86
|
+
puts " reuse local (cached) copy >#{Webcache.url_to_id( url )}<"
|
87
|
+
else
|
88
|
+
download_page( url )
|
89
|
+
end
|
90
|
+
end
|
91
|
+
|
92
|
+
|
93
|
+
def self.download_reports_for_schedule( slug, cache: true ) ## todo/check: rename to reports_for_schedule or such - why? why not?
|
94
|
+
|
95
|
+
page = Page::Schedule.from_cache( slug )
|
96
|
+
matches = page.matches
|
97
|
+
|
98
|
+
puts "matches - #{matches.size} rows:"
|
99
|
+
pp matches[0]
|
100
|
+
|
101
|
+
puts "#{page.generated_in_days_ago} - #{page.generated}"
|
102
|
+
|
103
|
+
## todo/fix: restore sleep to old value at the end!!!!
|
104
|
+
## Webget.config.sleep = 8 ## fetch 7-8 pages/min
|
105
|
+
|
106
|
+
matches.each_with_index do |match,i|
|
107
|
+
est = (Webget.config.sleep * (matches.size-(i+1)))/60.0 # estimated time left
|
108
|
+
|
109
|
+
puts "fetching #{i+1}/#{matches.size} (#{est} min(s)) - #{match[:round]} | #{match[:team1]} v #{match[:team2]}..."
|
110
|
+
report_ref = match[:report_ref ]
|
111
|
+
if report_ref
|
112
|
+
download_report( report_ref, cache: cache )
|
113
|
+
else
|
114
|
+
puts "!! WARN: report ref missing for match:"
|
115
|
+
pp match
|
116
|
+
end
|
117
|
+
end
|
118
|
+
end
|
119
|
+
|
120
|
+
|
121
|
+
def self.download_page( url ) ## get & record/save to cache
|
122
|
+
response = Webget.page( url ) ## fetch (and cache) html page (via HTTP GET)
|
123
|
+
|
124
|
+
## note: exit on get / fetch error - do NOT continue for now - why? why not?
|
125
|
+
exit 1 if response.status.nok? ## e.g. HTTP status code != 200
|
126
|
+
end
|
127
|
+
|
128
|
+
end # class Metal
|
129
|
+
end # module Worldfootball
|
130
|
+
|
131
|
+
|
@@ -0,0 +1,33 @@
|
|
1
|
+
|
2
|
+
##
|
3
|
+
### check - change Generator to Writer
|
4
|
+
## and write( league:, season: ) - why? why not?
|
5
|
+
|
6
|
+
module Worldfootball
|
7
|
+
class Generator
|
8
|
+
|
9
|
+
|
10
|
+
|
11
|
+
###########
|
12
|
+
## always download for now - why? why not?
|
13
|
+
## support cache - why? why not?
|
14
|
+
def generate( league:, season: )
|
15
|
+
|
16
|
+
## for testing use cached version always - why? why not?
|
17
|
+
## step 1 - download
|
18
|
+
Worldfootball.schedule( league: league, season: season )
|
19
|
+
|
20
|
+
## step 2 - convert (to .csv)
|
21
|
+
|
22
|
+
## todo/fix - convert in-memory and return matches
|
23
|
+
Worldfootball.convert( league: league, season: season )
|
24
|
+
|
25
|
+
source_dir = Worldfootball.config.convert.out_dir
|
26
|
+
|
27
|
+
Writer.write( league: league,
|
28
|
+
season: season,
|
29
|
+
source: source_dir )
|
30
|
+
end # def generate
|
31
|
+
|
32
|
+
end # class Generator
|
33
|
+
end # module Worldfootball
|
@@ -0,0 +1,53 @@
|
|
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
|
+
|
@@ -0,0 +1,64 @@
|
|
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
|
+
|
18
|
+
# 2021 Relegation,sco-premiership-2021-relegation
|
19
|
+
# 2021 Championship,sco-premiership-2021-championship
|
20
|
+
# 2020/2021,sco-premiership-2020-2021
|
21
|
+
|
22
|
+
'sco.1' => {
|
23
|
+
pages: {
|
24
|
+
'sco-premiership-{season}' => 'Regular Season',
|
25
|
+
'sco-premiership-{end_year}-championship' => 'Playoffs - Championship', # note: only uses season.end_year!
|
26
|
+
'sco-premiership-{end_year}-relegation' => 'Playoffs - Relegation', # note: only uses season.end_year!
|
27
|
+
},
|
28
|
+
season: ->( season ) {
|
29
|
+
case season
|
30
|
+
when Season('2020/21') then [1,2,3] # just getting started
|
31
|
+
when Season('2019/20') then [1] # covid-19 - no championship & relegation
|
32
|
+
when Season('2018/19') then [1,2,3]
|
33
|
+
end
|
34
|
+
}
|
35
|
+
},
|
36
|
+
|
37
|
+
# e.g. /irl-premier-division-2019/
|
38
|
+
# irl-premier-division-2020
|
39
|
+
# irl-premier-division-2019
|
40
|
+
# irl-premier-division-2018
|
41
|
+
# irl-premier-division-2017
|
42
|
+
# irl-premier-division-2016
|
43
|
+
# irl-premier-division-2015
|
44
|
+
# irl-premier-division-2014
|
45
|
+
# irl-premier-division-2013
|
46
|
+
# irl-airtricity-league-2012
|
47
|
+
# irl-airtricity-league-2011
|
48
|
+
# irl-airtricity-league-2010
|
49
|
+
|
50
|
+
'ie.1' => {
|
51
|
+
pages: [
|
52
|
+
'irl-premier-division',
|
53
|
+
'irl-airtricity-league'],
|
54
|
+
season: ->( season ) {
|
55
|
+
case season
|
56
|
+
when Season('2013')..Season('2020') then 1
|
57
|
+
when Season('2010')..Season('2012') then 2
|
58
|
+
end
|
59
|
+
}
|
60
|
+
},
|
61
|
+
})
|
62
|
+
|
63
|
+
end
|
64
|
+
|
@@ -0,0 +1,127 @@
|
|
1
|
+
|
2
|
+
module Worldfootball
|
3
|
+
|
4
|
+
|
5
|
+
LEAGUES_EUROPE.merge!({
|
6
|
+
|
7
|
+
# /2-bundesliga-{season}/
|
8
|
+
# /2-bundesliga-2013-2014/
|
9
|
+
# /dfb-pokal-2019-2020/
|
10
|
+
|
11
|
+
'de.1' => { pages: 'bundesliga' },
|
12
|
+
'de.2' => { pages: '2-bundesliga' },
|
13
|
+
'de.3' => { pages: '3-liga' },
|
14
|
+
'de.cup' => { pages: 'dfb-pokal' },
|
15
|
+
|
16
|
+
|
17
|
+
|
18
|
+
## note: use aut-2-liga !!! starting 2019-2018 !!!
|
19
|
+
## use aut-erste-liga !!! before e.g. 2010-2011 etc.
|
20
|
+
#
|
21
|
+
# /aut-erste-liga-{season}/
|
22
|
+
# /aut-bundesliga-2010-2011/
|
23
|
+
# /aut-erste-liga-2010-2011/
|
24
|
+
# /aut-oefb-cup-2019-2020/
|
25
|
+
|
26
|
+
=begin
|
27
|
+
2019/2020 Qualifikationsgruppe -- >/alle_spiele/aut-bundesliga-2019-2020-qualifikationsgruppe/<
|
28
|
+
2019/2020 Playoff -- >/alle_spiele/aut-bundesliga-2019-2020-playoff/<
|
29
|
+
2019/2020 Meistergruppe -- >/alle_spiele/aut-bundesliga-2019-2020-meistergruppe/<
|
30
|
+
2019/2020 -- >/alle_spiele/aut-bundesliga-2019-2020/<
|
31
|
+
2018/2019 Qualifikationsgruppe -- >/alle_spiele/aut-bundesliga-2018-2019-qualifikationsgruppe/<
|
32
|
+
2018/2019 Playoff -- >/alle_spiele/aut-bundesliga-2018-2019-playoff/<
|
33
|
+
2018/2019 Meistergruppe -- >/alle_spiele/aut-bundesliga-2018-2019-meistergruppe/<
|
34
|
+
=end
|
35
|
+
|
36
|
+
'at.1' => {
|
37
|
+
pages: {
|
38
|
+
'aut-bundesliga-{season}' => 'Grunddurchgang', # 1
|
39
|
+
'aut-bundesliga-{season}-meistergruppe' => 'Finaldurchgang - Meister', # 2
|
40
|
+
'aut-bundesliga-{season}-qualifikationsgruppe' => 'Finaldurchgang - Qualifikation', # 3
|
41
|
+
'aut-bundesliga-{season}-playoff' => 'Europa League Play-off', # 4
|
42
|
+
},
|
43
|
+
season: ->( season ) {
|
44
|
+
case season
|
45
|
+
when Season('2024/25') then [1]
|
46
|
+
when Season('2018/19')..Season('2023/24') then [1,2,3,4]
|
47
|
+
else 1 ## use simple format for the rest; note: index NOT wrapped in array
|
48
|
+
end
|
49
|
+
},
|
50
|
+
},
|
51
|
+
'at.2' => {
|
52
|
+
pages: ['aut-2-liga',
|
53
|
+
'aut-erste-liga'],
|
54
|
+
season: ->(season) { season.start_year >= 2019 ? 1 : 2 }
|
55
|
+
},
|
56
|
+
# /aut-regionalliga-ost-2020-2021/
|
57
|
+
'at.3.o' => { pages: 'aut-regionalliga-ost' },
|
58
|
+
'at.cup' => { pages: 'aut-oefb-cup' },
|
59
|
+
|
60
|
+
|
61
|
+
# /sui-super-league-2019-2020/
|
62
|
+
# /sui-challenge-league-2019-2020/
|
63
|
+
|
64
|
+
'ch.1' => { pages: 'sui-super-league' },
|
65
|
+
'ch.2' => { pages: 'sui-challenge-league' },
|
66
|
+
|
67
|
+
# /hun-nb-i-2020-2021/
|
68
|
+
'hu.1' => { pages: 'hun-nb-i' },
|
69
|
+
|
70
|
+
# /cze-1-fotbalova-liga-2020-2021/
|
71
|
+
'cz.1' => {
|
72
|
+
pages: {
|
73
|
+
'cze-1-fotbalova-liga-{season}' => 'Regular Season', # 1
|
74
|
+
},
|
75
|
+
season: ->( season ) {
|
76
|
+
case season
|
77
|
+
when Season('2020/21') then [1] # just getting started
|
78
|
+
end
|
79
|
+
}
|
80
|
+
},
|
81
|
+
|
82
|
+
|
83
|
+
# /pol-ekstraklasa-2020-2021/
|
84
|
+
# /pol-ekstraklasa-2019-2020-playoffs/
|
85
|
+
# /pol-ekstraklasa-2019-2020-abstieg/
|
86
|
+
#
|
87
|
+
# championship round (top eight teams) and
|
88
|
+
# relegation round (bottom eight teams)
|
89
|
+
'pl.1' => {
|
90
|
+
pages: {
|
91
|
+
'pol-ekstraklasa-{season}' => 'Regular Season', # 1
|
92
|
+
'pol-ekstraklasa-{season}-playoffs' => 'Playoffs - Championship', # 2
|
93
|
+
'pol-ekstraklasa-{season}-abstieg' => 'Playoffs - Relegation', # 3
|
94
|
+
},
|
95
|
+
season: ->( season ) {
|
96
|
+
case season
|
97
|
+
when Season('2020/21') then [1] # just getting started
|
98
|
+
when Season('2019/20') then [1,2,3]
|
99
|
+
when Season('2018/19') then [1,2,3]
|
100
|
+
end
|
101
|
+
}
|
102
|
+
},
|
103
|
+
|
104
|
+
# /svk-super-liga-2020-2021/
|
105
|
+
# /svk-super-liga-2019-2020-meisterschaft/
|
106
|
+
# /svk-super-liga-2019-2020-abstieg/
|
107
|
+
# /svk-super-liga-2019-2020-europa-league/
|
108
|
+
'sk.1' => {
|
109
|
+
pages: {
|
110
|
+
'svk-super-liga-{season}' => 'Regular Season', # 1
|
111
|
+
'svk-super-liga-{season}-meisterschaft' => 'Playoffs - Championship', # 2
|
112
|
+
'svk-super-liga-{season}-abstieg' => 'Playoffs - Relegation', # 3
|
113
|
+
'svk-super-liga-{season}-europa-league' => 'Europa League Finals', # 4
|
114
|
+
},
|
115
|
+
season: ->( season ) {
|
116
|
+
case season
|
117
|
+
when Season('2020/21') then [1] # getting started
|
118
|
+
when Season('2019/20') then [1,2,3,4]
|
119
|
+
when Season('2018/19') then [1,2,3] # note: no europa league finals / playoffs
|
120
|
+
end
|
121
|
+
}
|
122
|
+
},
|
123
|
+
|
124
|
+
|
125
|
+
})
|
126
|
+
|
127
|
+
end
|
@@ -0,0 +1,82 @@
|
|
1
|
+
|
2
|
+
module Worldfootball
|
3
|
+
|
4
|
+
LEAGUES_EUROPE.merge!({
|
5
|
+
|
6
|
+
# /rou-liga-1-2019-2020
|
7
|
+
# /rou-liga-1-2019-2020-championship
|
8
|
+
# /rou-liga-1-2019-2020-relegation
|
9
|
+
# ..
|
10
|
+
# /rom-liga-1-2015-2016
|
11
|
+
# /rom-liga-1-2015-2016-championship
|
12
|
+
# /rou-liga-1-2015-2016-relegation
|
13
|
+
|
14
|
+
|
15
|
+
'ro.1' => {
|
16
|
+
pages: {
|
17
|
+
'rou-liga-1-{season}' => 'Regular Season',
|
18
|
+
'rou-liga-1-{season}-championship' => 'Playoffs - Championship',
|
19
|
+
'rou-liga-1-{season}-relegation' => 'Playoffs - Relegation',
|
20
|
+
## note: change of country code from rou to rom in slug in 2015/16!!!
|
21
|
+
'rom-liga-1-{season}' => 'Regular Season',
|
22
|
+
'rom-liga-1-{season}-championship' => 'Playoffs - Championship',
|
23
|
+
'rom-liga-1-{season}-relegation' => 'Playoffs - Relegation',
|
24
|
+
},
|
25
|
+
season: ->( season ) {
|
26
|
+
case season
|
27
|
+
when Season('2020/21') then [1] # just getting started
|
28
|
+
when Season('2016/17')..Season('2019/20') then [1,2,3]
|
29
|
+
when Season('2015/16') then [4,5,3] # handle special case with weird mixed slugs
|
30
|
+
when Season('2010/11')..Season('2014/15') then 4 ## use simple format for the rest; note: index NOT wrapped in array
|
31
|
+
end
|
32
|
+
}
|
33
|
+
},
|
34
|
+
|
35
|
+
# rus-premier-liga-2020-2021
|
36
|
+
# ..
|
37
|
+
# rus-premier-liga-2012-2013
|
38
|
+
#
|
39
|
+
# rus-premier-liga-2011-2012
|
40
|
+
# rus-premier-liga-2011-2012-meisterschaft
|
41
|
+
# rus-premier-liga-2011-2012-relegation
|
42
|
+
#
|
43
|
+
# rus-premier-liga-2010
|
44
|
+
'ru.1' => {
|
45
|
+
pages: {
|
46
|
+
'rus-premier-liga-{season}' => 'Regular Season',
|
47
|
+
'rus-premier-liga-{season}-meisterschaft' => 'Playoffs - Championship',
|
48
|
+
'rus-premier-liga-{season}-relegation' => 'Playoffs - Relegation',
|
49
|
+
},
|
50
|
+
season: ->( season ) {
|
51
|
+
case season
|
52
|
+
when Season('2012/13')..Season('2020/21') then 1 ## use simple format for the rest; note: index NOT wrapped in array
|
53
|
+
when Season('2011/12') then [1,2,3]
|
54
|
+
when Season('2004')..Season('2010') then 1 ## use simple format for the rest; note: index NOT wrapped in array
|
55
|
+
end
|
56
|
+
}
|
57
|
+
},
|
58
|
+
'ru.2' => { pages: 'rus-1-division' },
|
59
|
+
|
60
|
+
# /ukr-premyer-liga-2019-2020/
|
61
|
+
# /ukr-premyer-liga-2019-2020-meisterschaft/
|
62
|
+
# /ukr-premyer-liga-2019-2020-abstieg/
|
63
|
+
# /ukr-premyer-liga-2019-2020-playoffs-el/
|
64
|
+
'ua.1' => {
|
65
|
+
pages: {
|
66
|
+
'ukr-premyer-liga-{season}' => 'Regular Season',
|
67
|
+
'ukr-premyer-liga-{season}-meisterschaft' => 'Playoffs - Championship',
|
68
|
+
'ukr-premyer-liga-{season}-abstieg' => 'Playoffs - Relegation',
|
69
|
+
'ukr-premyer-liga-{season}-playoffs-el' => 'Europa League Finals',
|
70
|
+
},
|
71
|
+
season: ->( season ) {
|
72
|
+
case season
|
73
|
+
when Season('2019/20') then [1,2,3,4]
|
74
|
+
when Season('2018/19') then [1,2,3] # note: no europa league finals / playoffs
|
75
|
+
end
|
76
|
+
}
|
77
|
+
},
|
78
|
+
|
79
|
+
})
|
80
|
+
|
81
|
+
end
|
82
|
+
|
@@ -0,0 +1,57 @@
|
|
1
|
+
|
2
|
+
module Worldfootball
|
3
|
+
|
4
|
+
LEAGUES_EUROPE.merge!({
|
5
|
+
# e.g. /isl-urvalsdeild-2020/
|
6
|
+
'is.1' => { pages: 'isl-urvalsdeild' },
|
7
|
+
|
8
|
+
# e.g. /swe-allsvenskan-2020/
|
9
|
+
# /swe-superettan-2020/
|
10
|
+
'se.1' => { pages: 'swe-allsvenskan' },
|
11
|
+
'se.2' => { pages: 'swe-superettan' },
|
12
|
+
|
13
|
+
# e.g. /nor-eliteserien-2020/
|
14
|
+
'no.1' => { pages: 'nor-eliteserien' },
|
15
|
+
|
16
|
+
# e.g. /fin-veikkausliiga-2019/
|
17
|
+
# /fin-veikkausliiga-2019-meisterschaft/
|
18
|
+
# /fin-veikkausliiga-2019-abstieg/
|
19
|
+
# /fin-veikkausliiga-2019-playoff-el/
|
20
|
+
'fi.1' => {
|
21
|
+
pages: {
|
22
|
+
'fin-veikkausliiga-{season}' => 'Regular Season',
|
23
|
+
'fin-veikkausliiga-{season}-meisterschaft' => 'Playoffs - Championship',
|
24
|
+
'fin-veikkausliiga-{season}-abstieg' => 'Playoffs - Challenger',
|
25
|
+
'fin-veikkausliiga-{season}-playoff-el' => 'Europa League Finals',
|
26
|
+
},
|
27
|
+
season: ->( season ) {
|
28
|
+
case season
|
29
|
+
when Season('2020') then [1] # just getting started
|
30
|
+
when Season('2019') then [1,2,3,4]
|
31
|
+
end
|
32
|
+
}
|
33
|
+
},
|
34
|
+
|
35
|
+
# /den-superliga-2020-2021/
|
36
|
+
# /den-superliga-2019-2020-meisterschaft/
|
37
|
+
# /den-superliga-2019-2020-abstieg/
|
38
|
+
# /den-superliga-2019-2020-europa-league/
|
39
|
+
'dk.1' => {
|
40
|
+
pages: {
|
41
|
+
'den-superliga-{season}' => 'Regular Season',
|
42
|
+
'den-superliga-{season}-meisterschaft' => 'Playoffs - Championship',
|
43
|
+
'den-superliga-{season}-abstieg' => 'Playoffs - Relegation',
|
44
|
+
'den-superliga-{season}-europa-league' => 'Europa League Finals',
|
45
|
+
},
|
46
|
+
season: ->( season ) {
|
47
|
+
case season
|
48
|
+
when Season('2020/21') then [1] # just getting started
|
49
|
+
when Season('2019/20') then [1,2,3,4]
|
50
|
+
when Season('2018/19') then [1,2,3,4]
|
51
|
+
end
|
52
|
+
}
|
53
|
+
},
|
54
|
+
|
55
|
+
})
|
56
|
+
|
57
|
+
end
|