football-timezones 0.2.2 → 0.3.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 +3 -1
- data/config/leagues.csv +423 -0
- data/lib/football-timezones/league_config.rb +83 -0
- data/lib/football-timezones/leagueset.rb +144 -0
- data/lib/football-timezones/timezones.rb +18 -1
- data/lib/football-timezones/version.rb +2 -2
- data/lib/football-timezones.rb +62 -10
- metadata +8 -6
- data/lib/football-timezones/datasets.rb +0 -62
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e1acaa59a47936cf0ac4c5eefb5787e443bc2fefde91676612da7c8ec4943c7c
|
4
|
+
data.tar.gz: 437779a99bfd460a95d824c5a31341a4e5d2e9c7b3326407dd23358696f077e7
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 532ae9d3e63cf763a73e775a3a41a06d7321e7c23726aba289d814b9aab3e082aca6b86592a1aff77d0b9cfb196d7e38a5466244e0baf798a72a89d155112af5
|
7
|
+
data.tar.gz: b10ac2a0864140fcd1f7bcc0cba321bea0cd960f63c450ee3891fa9d57e2227d4a2af5c2783a180d3d58e480d328ad130969133b3928c9bb601bca0190dfd235
|
data/CHANGELOG.md
CHANGED
data/Manifest.txt
CHANGED
@@ -2,6 +2,7 @@ CHANGELOG.md
|
|
2
2
|
Manifest.txt
|
3
3
|
README.md
|
4
4
|
Rakefile
|
5
|
+
config/leagues.csv
|
5
6
|
config/timezones_africa.csv
|
6
7
|
config/timezones_america.csv
|
7
8
|
config/timezones_asia.csv
|
@@ -10,7 +11,8 @@ config/timezones_middle_east.csv
|
|
10
11
|
config/timezones_pacific.csv
|
11
12
|
config/timezones_world.csv
|
12
13
|
lib/football-timezones.rb
|
13
|
-
lib/football-timezones/
|
14
|
+
lib/football-timezones/league_config.rb
|
15
|
+
lib/football-timezones/leagueset.rb
|
14
16
|
lib/football-timezones/timezones.rb
|
15
17
|
lib/football-timezones/version.rb
|
16
18
|
lib/football/timezones.rb
|
data/config/leagues.csv
ADDED
@@ -0,0 +1,423 @@
|
|
1
|
+
key,name,basename,start_season,end_season
|
2
|
+
caf.cl,CAF Champions League,cl,,
|
3
|
+
caf.conf,CAF Confederations Cup,cafconfederationscup,,
|
4
|
+
afl,African Football League,afl,,
|
5
|
+
eg.1,Egypt Premiership,1-premiership,,
|
6
|
+
eg.cup,Egypt Cup,cup,,
|
7
|
+
eg.super,Egypt Supercup,supercup,,
|
8
|
+
tn.1,Tunisia Ligue 1,ligue1,,
|
9
|
+
ma.1,Morocco Botola,1-botola,,
|
10
|
+
dz.1,Algeria Ligue 1,1-ligue1,,
|
11
|
+
za.1,South Africa Premier League,premierleague,,
|
12
|
+
za.2,South Africa National First Division,nationalfirstdivision,,
|
13
|
+
za.cup,South Africa Cup,cup,,
|
14
|
+
za.cup.l,South Africa Knockout,knockout,,
|
15
|
+
ng.1,Nigeria Professional League,professionalleague,,
|
16
|
+
ke.1,Kenya Premier League,premierleague,,
|
17
|
+
zm.1,Zambia Super League,superleague,,
|
18
|
+
gh.1,Ghana Premier League,premierleague,,
|
19
|
+
ug.1,Uganda Super League,superleague,,
|
20
|
+
zw.1,Zimbabwe Premier Soccer League,premiersoccerleague,,
|
21
|
+
bi.1,Burundi 1. Liga,1liga,,
|
22
|
+
ao.1,Angola Girabola,girabola,,
|
23
|
+
tz.1,Tanzania Premier League,premierleague,,
|
24
|
+
mu.1,Mauritius Premier League,premierleague,,
|
25
|
+
mu.cup,Mauritius Cup,cup,,
|
26
|
+
mu.cup.rep,Mauritius Republic Cup,republiccup,,
|
27
|
+
asia.cl,AFC Champions League,afcchampionsleague,,
|
28
|
+
asia.cup,AFC Cup,afccup,,
|
29
|
+
jp.1,Japan J. League,1-jleague,,
|
30
|
+
jp.2,Japan J. League 2,jleague2,,
|
31
|
+
jp.cup,Japan Emperor's Cup,emperorscup,,
|
32
|
+
jp.cup.l,Japan J. League Cup,jleaguecup,,
|
33
|
+
kr.1,South Korea K-League,kleague,,
|
34
|
+
kr.2,South Korea K-League 2,kleague2,,
|
35
|
+
kr.cup,South Korea Cup,cup,,
|
36
|
+
sg.1,Singapore Premier League,premierleague,,
|
37
|
+
th.1,Thailand Premier League,premierleague,,
|
38
|
+
my.1,Malaysia Super League,superleague,,
|
39
|
+
mm.1,Myanmar National League,nationalleague,,
|
40
|
+
id.1,Indonesia Super League,superleague,,
|
41
|
+
in.1.i,India I-League,ileague,,
|
42
|
+
in.1.ii,India Super League,superleague,,
|
43
|
+
tw.1,Taiwan Premier League,premierleague,,
|
44
|
+
cn.1,China Super League,1-superleague,,
|
45
|
+
kz.1,Kazakhstan Premier League A,1-premierleague,,
|
46
|
+
tm.1,Turkmenistan 1. Liga,1liga,,
|
47
|
+
uz.1,Uzbekistan Super League,superleague,,
|
48
|
+
tj.1,Tajikistan Higher League,higherleague,,
|
49
|
+
tj.super,Tajikistan Super Cup,supercup,,
|
50
|
+
vn.1,Vietnam V. League 1,vleague1,,
|
51
|
+
vn.cup,Vietnam Cup,cup,,
|
52
|
+
jm.1,Jamaica Premier League,premierleague,,
|
53
|
+
cr.1,Costa Rica Primera División,primeradivision,,
|
54
|
+
cr.2,Costa Rica Segunda División,segundadivision,,
|
55
|
+
hn.1,Honduras Primera División,primeradivision,,
|
56
|
+
sv.1,El Salvador Primera División,primeradivision,,
|
57
|
+
gt.1,Guatemala Liga Nacional,liganacional,,
|
58
|
+
ni.1,Nicaragua Primera División,primeradivision,,
|
59
|
+
at.1,Österr. Bundesliga,1-bundesliga,,
|
60
|
+
at.2,Österr. 2. Liga,2-liga2,2018/19,
|
61
|
+
at.2,Österr. Erste Liga,2-liga1,,2017/18
|
62
|
+
at.3.o,Österr. Regionalliga Ost,3-regionalliga-ost,,
|
63
|
+
at.3.m,Österr. Regionalliga Mitte,3-regionalliga-mitte,,
|
64
|
+
at.3.sbg,Österr. Regionalliga Salzburg,regionalligasalzburg,,
|
65
|
+
at.3.t,Österr. Regionalliga Tirol,regionalligatirol,,
|
66
|
+
at.3.v,Österr. Regionalliga Vorarlberg,regionalligavorarlberg,,
|
67
|
+
at.3.w,Österr. Regionalliga West,regionalligawest,,
|
68
|
+
at.cup,ÖFB Cup,cup,,
|
69
|
+
at.4.ost.w,Österr. Wiener Stadtliga,wienerstadtliga,,
|
70
|
+
at.4.ost.n,Österr. Landesliga Niederösterreich,landesliganiederosterreich,,
|
71
|
+
at.4.ost.b,Österr. Landesliga Burgenland,landesligaburgenland,,
|
72
|
+
at.4.mitte.st,Österr. Steirische Landesliga,steirischelandesliga,,
|
73
|
+
at.4.mitte.o,Österr. Landesliga Oberösterreich,landesligaoberosterreich,,
|
74
|
+
at.4.mitte.k,Österr. Kärtner Liga,kartnerliga,,
|
75
|
+
at.4.west.s,Österr. Salzburger Liga,salzburgerliga,,
|
76
|
+
at.4.west.t,Österr. Tiroler Liga,tirolerliga,,
|
77
|
+
at.4.west.v,Österr. Vorarlberg Liga,vorarlbergliga,,
|
78
|
+
at.5.n.ost,Österr. 2. Landesliga Ost (NÖ),2landesligaostno,,
|
79
|
+
at.5.n.west,Österr. 2. Landesliga West (NÖ),2landesligawestno,,
|
80
|
+
at.6.n.ost.sso,Österr. Gebietsliga Süd/Südost (NÖ),gebietsligasudsudostno,,
|
81
|
+
at.6.n.ost.nnw,Österr. Gebietsliga Nord/Nordwest (NÖ),gebietsliganordnordwestno,,
|
82
|
+
at.6.n.west.w,Österr. Gebietsliga West (NÖ),gebietsligawestno,,
|
83
|
+
at.6.n.west.nww,Österr. Gebietsliga Nordwest/Waldviertel (NÖ),gebietsliganordwestwaldviertelno,,
|
84
|
+
at.7.n.ost.sso.s,Österr. 1. Klasse Süd (NÖ),1klassesudno,,
|
85
|
+
at.7.n.ost.sso.o,Österr. 1. Klasse Ost (NÖ),1klasseostno,,
|
86
|
+
at.7.n.ost.nnw.n,Österr. 1. Klasse Nord (NÖ),1klassenordno,,
|
87
|
+
at.7.n.ost.nnw.nw,Österr. 1. Klasse Nordwest (NÖ),1klassenordwestno,,
|
88
|
+
at.7.n.west.w.w,Österr. 1. Klasse West (NÖ),1klassewestno,,
|
89
|
+
at.7.n.west.w.wm,Österr. 1. Klasse West-Mitte (NÖ),1klassewestmitteno,,
|
90
|
+
at.7.n.west.nww.nwm,Österr. 1. Klasse Nordwest-Mitte (NÖ),1klassenordwestmitteno,,
|
91
|
+
at.7.n.west.nww.w,Österr. 1. Klasse Waldviertel (NÖ),1klassewaldviertelno,,
|
92
|
+
at.8.n.steinfeld,Österr. 2. Klasse Steinfeld (NÖ),2klassesteinfeldno,,
|
93
|
+
at.8.n.wechsel,Österr. 2. Klasse Wechsel (NÖ),2klassewechselno,,
|
94
|
+
at.8.n.triestingtal,Österr. 2. Klasse Triestingtal (NÖ),2klassetriestingtalno,,
|
95
|
+
at.8.n.ostmitte,Österr. 2. Klasse Ost/Mitte (NÖ),2klasseostmitteno,,
|
96
|
+
at.8.n.ost,Österr. 2. Klasse Ost (NÖ),2klasseostno,,
|
97
|
+
at.8.n.weinviertel.n,Österr. 2. Klasse Weinviertel Nord (NÖ),2klasseweinviertelnordno,,
|
98
|
+
at.8.n.weinviertel.s,Österr. 2. Klasse Weinviertel Süd (NÖ),2klasseweinviertelsudno,,
|
99
|
+
at.8.n.marchfeld,Österr. 2. Klasse Marchfeld (NÖ),2klassemarchfeldno,,
|
100
|
+
at.8.n.donau,Österr. 2. Klasse Donau (NÖ),2klassedonauno,,
|
101
|
+
at.8.n.pulkautal,Österr. 2. Klasse Pulkautal (NÖ),2klassepulkautalno,,
|
102
|
+
at.8.n.ybbstal,Österr. 2. Klasse Ybbstal (NÖ),2klasseybbstalno,,
|
103
|
+
at.8.n.yspertal,Österr. 2. Klasse Yspertal (NÖ),2klasseyspertalno,,
|
104
|
+
at.8.n.alpenvorland,Österr. 2. Klasse Alpenvorland (NÖ),2klassealpenvorlandno,,
|
105
|
+
at.8.n.traisental,Österr. 2. Klasse Traisental (NÖ),2klassetraisentalno,,
|
106
|
+
at.8.n.wachau,Österr. 2. Klasse Wachau (NÖ),2klassewachauno,,
|
107
|
+
at.8.n.schmidatal,Österr. 2. Klasse Schmidatal (NÖ),2klasseschmidatalno,,
|
108
|
+
at.8.n.waldviertelthayatal,Österr. 2. Klasse Waldviertel Thayatal (NÖ),2klassewaldviertelthayatalno,,
|
109
|
+
at.8.n.waldviertel.s,Österr. 2. Klasse Waldviertel/Süd (NÖ),2klassewaldviertelsudno,,
|
110
|
+
at.9.n.hornerwald,Österr. 3. Klasse Hornerwald (NÖ),3klassehornerwaldno,,
|
111
|
+
at.9.n.mistelbach,Österr. 3. Klasse Mistelbach (NÖ),3klassemistelbachno,,
|
112
|
+
eng.2,English Championship,2-championship,2004/05,
|
113
|
+
eng.2,English Division One,2-division1,1992/93,2003/04
|
114
|
+
eng.1,English Division One,1-division1,1892/93,1991/92
|
115
|
+
eng.1,English Football League,1-footballleague,1888/89,1891/92
|
116
|
+
eng.3,English League One,3-league1,2004/05,
|
117
|
+
eng.3,English Division Two,3-division2,1992/93,2003/04
|
118
|
+
eng.2,English Division Two,2-division2,1892/93,1991/92
|
119
|
+
eng.4,English League Two,4-league2,2004/05,
|
120
|
+
eng.4,English Division Three,4-division3,1992/93,2003/04
|
121
|
+
eng.3,English Division Three,3-division3,,1991/92
|
122
|
+
eng.1,English Premier League,1-premierleague,1992/93,
|
123
|
+
eng.5,English National League,5-nationalleague,1992/93,
|
124
|
+
eng.3.a,English Division Three (North),3a-division3_north,,
|
125
|
+
eng.3.b,English Division Three (South),3b-division3_south,,
|
126
|
+
eng.cup,English FA Cup,facup,,
|
127
|
+
eng.super,English FA Community Shield,facommunityshield,,
|
128
|
+
eng.cup.l,English EFL Cup,eflcup,,
|
129
|
+
eng.cup.t,English EFL Trophy,efltrophy,,
|
130
|
+
eng.cup.t.ii,English FA Trophy,fatrophy,,
|
131
|
+
de.1,Deutsche Bundesliga,1-bundesliga,,
|
132
|
+
de.2,Deutsche 2. Bundesliga,2-bundesliga2,,
|
133
|
+
de.3,Deutsche 3. Liga,3-liga3,,
|
134
|
+
de.cup,DFB Pokal,cup,,
|
135
|
+
de.super,Deutsche Supercup,super,,
|
136
|
+
de.4.nord,Deutsche Regionalliga Nord,4-regionalliga-nord,,
|
137
|
+
de.4.nordost,Deutsche Regionalliga Nordost,4-regionalliga-nordost,,
|
138
|
+
de.4.west,Deutsche Regionalliga West,4-regionalliga-west,,
|
139
|
+
de.4.suedwest,Deutsche Regionalliga Südwest,4-regionalliga-suedwest,,
|
140
|
+
de.4.bayern,Deutsche Regionalliga Bayern,4-regionalliga-bayern,,
|
141
|
+
de.5.nord.sh,Deutsche Schleswig-Holstein-Liga,schleswigholsteinliga,,
|
142
|
+
de.5.nord.hh,Deutsche Oberliga Hamburg,oberligahamburg,,
|
143
|
+
de.5.nord.hb,Deutsche Bremen-Liga,bremenliga,,
|
144
|
+
de.5.nord.ni,Deutsche Oberliga Niedersachsen,oberliganiedersachsen,,
|
145
|
+
de.5.nordost.n,Deutsche Oberliga Nordost (Nord),oberliganordostnord,,
|
146
|
+
de.5.nordost.s,Deutsche Oberliga Nordost (Süd),oberliganordostsud,,
|
147
|
+
de.5.west.niederrhein,Deutsche Oberliga Niederrhein,oberliganiederrhein,,
|
148
|
+
de.5.west.mittelrhein,Deutsche Mittelrheinliga,mittelrheinliga,,
|
149
|
+
de.5.west.westfalen,Deutsche Oberliga Westfalen,oberligawestfalen,,
|
150
|
+
de.5.suedwest.rp.sl,Deutsche Oberliga Rheinland-Pfalz/Saar,oberligarheinlandpfalzsaar,,
|
151
|
+
de.5.suedwest.he,Deutsche Hessenliga,hessenliga,,
|
152
|
+
de.5.suedwest.bw,Deutsche Oberliga Baden-Württemberg,oberligabadenwurttemberg,,
|
153
|
+
de.5.by.n,Deutsche Bayernliga (Nord),bayernliganord,,
|
154
|
+
de.5.by.s,Deutsche Bayernliga (Süd),bayernligasud,,
|
155
|
+
uefa.cl,UEFA Champions League,cl,1992/93,
|
156
|
+
uefa.cl.quali,UEFA Champions League - Quali,uefachampionsleaguequali,1992/93,
|
157
|
+
euro.champs,European Champion Clubs' Cup,champs,1955/56,1991/92
|
158
|
+
euro.cup,European Cup Winners' Cup,cupwinners,1960/61,1998/99
|
159
|
+
uefa.el,UEFA Europa League,el,2009/10,
|
160
|
+
uefa.el.quali,UEFA Europa League - Quali,uefaeuropaleaguequali,2009/10,
|
161
|
+
uefa.cup,UEFA Cup,cup,1971/72,2008/09
|
162
|
+
uefa.conf,UEFA Conference League,conf,2021/22,
|
163
|
+
uefa.conf.quali,UEFA Conference League - Quali,uefaconferenceleaguequali,2021/22,
|
164
|
+
uefa.super,UEFA Super Cup,super,1972,
|
165
|
+
atl.cup,Atlantic Cup,atlanticcup,,
|
166
|
+
czsk.super,Czechoslovak Supercup,czechoslovaksupercup,,
|
167
|
+
sco.1,Scottish Premiership,1-premiership,,
|
168
|
+
sco.2,Scottish Championship,championship,,
|
169
|
+
sco.3,Scottish League One,leagueone,,
|
170
|
+
sco.4,Scottish League Two,leaguetwo,,
|
171
|
+
sco.cup.l,Scottish League Cup,leaguecup,,
|
172
|
+
sco.cup.fa,Scottish FA Cup,facup,,
|
173
|
+
sco.cup.cc,Scottish Challenge Cup,challengecup,,
|
174
|
+
wal.1,Welsh Premier League,1-premierleague,,
|
175
|
+
nir.1,Northern Irish Premiership,1-premiership,,
|
176
|
+
nir.2,Northern Irish Championship,championship,,
|
177
|
+
nir.cup.l,Northern Irish League Cup,leaguecup,,
|
178
|
+
nir.cup,Northern Irish Irish Cup,irishcup,,
|
179
|
+
nir.super,Northern Irish NIFL Charity Shield,niflcharityshield,,
|
180
|
+
ie.1,Irish Premier Division,1-premierdivision,,
|
181
|
+
ie.2,Irish First Division,firstdivision,,
|
182
|
+
ie.cup.l,Irish League Cup,leaguecup,,
|
183
|
+
ie.super,Irish Supercup,supercup,,
|
184
|
+
ie.cup,Irish FAI Cup,faicup,,
|
185
|
+
is.1,Iceland Urvalsdeild,1-urvalsdeild,,
|
186
|
+
is.2,Iceland 1. Deild,1deild,,
|
187
|
+
is.3,Iceland 2. Delid,2delid,,
|
188
|
+
is.cup,Iceland Cup,cup,,
|
189
|
+
is.cup.l,Iceland League Cup,leaguecup,,
|
190
|
+
is.super,Iceland Super Cup,supercup,,
|
191
|
+
fo.1,Faroe Islands Premier Division,1-premierdivision,,
|
192
|
+
es.1,Primera División de España,1-liga,,
|
193
|
+
es.2,Segunda División de España,2-liga2,,
|
194
|
+
es.3,Spain Segunda División B,segundadivisionb,,
|
195
|
+
es.cup,Copa del Rey de España,cup,,
|
196
|
+
es.super,Spain Supercopa,supercopa,,
|
197
|
+
pt.1,Portuguese Primeira Liga,1-primeiraliga,,
|
198
|
+
pt.2,Portuguese Segunda Liga,2-segundaliga,,
|
199
|
+
pt.cup,Portuguese Taça de Portugal,tacadeportugal,,
|
200
|
+
pt.cup.l,Portuguese Taça da Liga,tacadaliga,,
|
201
|
+
pt.super,Portuguese Supercup,supercup,,
|
202
|
+
gi.1,Gibraltar Premier League A,1-premierleague,,
|
203
|
+
ad.1,Andorra Premier Division,1-premierdisvision,,
|
204
|
+
fr.1,French Ligue 1,1-ligue1,,
|
205
|
+
fr.2,French Ligue 2,2-ligue2,,
|
206
|
+
fr.3,French National,national,,
|
207
|
+
fr.cup,French Coupe de France,cup,,
|
208
|
+
fr.cup.l,French Coupe de la Ligue,coupedelaligue,,
|
209
|
+
fr.super,French Trophée des Champions,tropheedeschampions,,
|
210
|
+
it.1,Italian Serie A,1-seriea,,
|
211
|
+
it.2,Italian Serie B,2-serieb,,
|
212
|
+
it.3.a,Italian Serie C (North & Central West),seriecnorthcentralwest,,
|
213
|
+
it.3.b,Italian Serie C (North & Central East),seriecnorthcentraleast,,
|
214
|
+
it.3.c,Italian Serie C (South),seriecsouth,,
|
215
|
+
it.cup,Coppa Italia,cup,,
|
216
|
+
it.cup.c,Italian Coppa Italia Serie C,coppaitaliaseriec,,
|
217
|
+
it.super,Italian Supercoppa Italiana,supercoppaitaliana,,
|
218
|
+
sm.1,San Marinese Championship,1-championship,,
|
219
|
+
tr.1,Turkish Süper Lig,1-superlig,,
|
220
|
+
tr.2,Turkish 1. Lig,2-lig1,,
|
221
|
+
tr.3.b,Turkish 2. Lig - Beya,2ligbeya,,
|
222
|
+
tr.3.ki,Turkish 2. Lig - Kirmizi,2ligkirmizi,,
|
223
|
+
tr.3.playoffs,Turkish 2. Lig - Play Offs,2ligplayoffs,,
|
224
|
+
tr.cup,Türkiye Kupasi,turkiyekupasi,,
|
225
|
+
tr.super,Turkish Süper Kupa,superkupa,,
|
226
|
+
gr.1,Greek Super League,1-superleague,,
|
227
|
+
gr.2,Greek Super League 2,superleague2,,
|
228
|
+
gr.cup,Greek Greek Cup,greekcup,,
|
229
|
+
cy.1,Cyprus First Division,1-firstdivision,,
|
230
|
+
cy.cup,Cyprus Cypriot Cup,cypriotcup,,
|
231
|
+
mt.1,Malta Premier League,1-premierleague,,
|
232
|
+
mt.cup,Malta Cup,cup,,
|
233
|
+
dk.1,Denmark Superligaen,1-superligaen,,
|
234
|
+
dk.2,Denmark 1. Division,1division,,
|
235
|
+
dk.cup,Denmark Landspokalturneringen,landspokalturneringen,,
|
236
|
+
no.1,Norway Eliteserien,1-eliteserien,,
|
237
|
+
no.2,Norway 1. Division,1division,,
|
238
|
+
no.3,Norway 2. Division,2division,,
|
239
|
+
no.cup,Norway Norwegian Football Cup,norwegianfootballcup,,
|
240
|
+
se.1,Sweden Allsvenskan,1-allsvenskan,,
|
241
|
+
se.2,Sweden Superettan,2-superettan,,
|
242
|
+
se.3.s,Sweden Div 1 Södra,div1sodra,,
|
243
|
+
se.3.n,Sweden Div 1 Norra,div1norra,,
|
244
|
+
se.cup,Sweden Cup,cup,,
|
245
|
+
fi.1,Finland Veikkausliiga,1-veikkausliiga,,
|
246
|
+
fi.2,Finland Ykkonen,ykkonen,,
|
247
|
+
fi.3,Finland Kakkonen,kakkonen,,
|
248
|
+
fi.4.a,Finland Kakkonen Group A,kakkonengroupa,,
|
249
|
+
fi.cup,Finland Cup,cup,,
|
250
|
+
nl.1,Netherlands Eredivisie,1-eredivisie,,
|
251
|
+
nl.1.comeback,Netherlands Eredivisie Comeback Tournament,eredivisiecomebacktournament,,
|
252
|
+
nl.2,Netherlands Eerste Divisie,eerstedivisie,,
|
253
|
+
nl.cup,Netherlands Cup,cup,,
|
254
|
+
nl.super,Netherlands Johan Cruijff Schaal,johancruijffschaal,,
|
255
|
+
nl.po,Netherlands Promotion/Relegation Playoffs,promotionrelegationplayoffs,,
|
256
|
+
be.1,Belgium First Division A,1-firstdivisiona,,
|
257
|
+
be.2,Belgium First Division B,firstdivisionb,,
|
258
|
+
be.cup,Beker van Belgie,bekervanbelgie,,
|
259
|
+
be.super,Belgium Supercup,supercup,,
|
260
|
+
lu.1,Luxembourg National Division,1-nationaldivision,,
|
261
|
+
pl.1,Poland Ekstraklasa,1-ekstraklasa,,
|
262
|
+
pl.2,Poland I Liga,iliga,,
|
263
|
+
pl.3,Poland II Liga,iiliga,,
|
264
|
+
pl.cup,Poland Cup,cup,,
|
265
|
+
pl.super,Poland Supercup,supercup,,
|
266
|
+
hu.1,Hungarian Nemzeti Bajnokság I,1-nbi,,
|
267
|
+
hu.2,Hungarian Nemzeti Bajnokság II,2-nbii,,
|
268
|
+
hu.cup,Hungarian Cup,cup,,
|
269
|
+
cz.1,Czech Republic First League,1-firstleague,,
|
270
|
+
cz.2,Czech Republic 1. Division,1division,,
|
271
|
+
cz.cup,Czech Republic Cup,cup,,
|
272
|
+
ch.1,Swiss Super League,1-superleague,,
|
273
|
+
ch.2,Swiss Challenge League,2-challengeleague,,
|
274
|
+
ch.3,Swiss Promotion League,promotionleague,,
|
275
|
+
ch.cup,Swiss Cup,cup,,
|
276
|
+
li.cup,Liechtensteiner Pokal,cup,,
|
277
|
+
sk.1,Slovakia First League,1-liga1,,
|
278
|
+
sk.2,Slovakia Second League,secondleague,,
|
279
|
+
sk.cup,Slovakia Cup,cup,,
|
280
|
+
si.1,Slovenia First League,1-firstleague,,
|
281
|
+
si.2,Slovenia Second League,secondleague,,
|
282
|
+
si.cup,Slovenia Cup,cup,,
|
283
|
+
hr.1,Croatia HNL,1-hnl,,
|
284
|
+
hr.2,Croatia Prva NL,prvanl,,
|
285
|
+
hr.3,Croatia Druga NL,druganl,,
|
286
|
+
hr.cup,Croatia Cup,cup,,
|
287
|
+
hr.super,Croatia Supercup,supercup,,
|
288
|
+
ba.1,Bosnia and Herzegovina Premier Liga,1-premierliga,,
|
289
|
+
ba.cup,Bosnia and Herzegovina Cup,cup,,
|
290
|
+
rs.1,Serbia Super League,1-superleague,,
|
291
|
+
rs.cup,Serbia Cup,cup,,
|
292
|
+
kos.1,Kosovo Superliga A,1-superliga,,
|
293
|
+
al.1,Albania Super League,1-superleague,,
|
294
|
+
md.1,Moldova First Division,1-firstdivision,,
|
295
|
+
me.1,Montenegro First League,1-firstleague,,
|
296
|
+
me.cup,Montenegro Cup,cup,,
|
297
|
+
mk.1,North Macedonia First League,1-firstleague,,
|
298
|
+
ro.1,Romania Liga 1,1-liga1,,
|
299
|
+
ro.2,Romania Liga 2,liga2,,
|
300
|
+
ro.3.a,Romania Liga 3 - Seria 1,liga3seria1,,
|
301
|
+
ro.cup,Romania Cup,cup,,
|
302
|
+
ro.super,Romania Supercup,supercup,,
|
303
|
+
bg.1,Bulgaria Premier League,1-premierleague,,
|
304
|
+
bg.cup,Bulgaria Cup,cup,,
|
305
|
+
bg.super,Bulgaria Supercup,supercup,,
|
306
|
+
lv.1,Latvia Higher League,1-higherleague,,
|
307
|
+
lt.1,Lithuania First Division,1-firstdivision,,
|
308
|
+
ee.1,Estonia Meistriliiga,1-meistriliiga,,
|
309
|
+
ee.cup,Estonia Cup,cup,,
|
310
|
+
ru.1,Russia Premier League,1-premierliga,,
|
311
|
+
ru.2,Russia 1. Division,2-division1,,
|
312
|
+
ru.cup,Russia Cup,cup,,
|
313
|
+
ru.super,Russia Supercup,supercup,,
|
314
|
+
ua.1,Ukraine Premier League,1-premierleague,,
|
315
|
+
ua.cup,Ukraine Cup,cup,,
|
316
|
+
ua.super,Ukraine Supercup,supercup,,
|
317
|
+
by.1,Belarus Premier League,1-premierleague,,
|
318
|
+
by.2,Belarus Pervaya Liga,pervayaliga,,
|
319
|
+
by.3,Belarus Vtoraya Liga,vtorayaliga,,
|
320
|
+
by.cup,Belarus Cup,cup,,
|
321
|
+
by.res,Belarus Reserve Liga,reserveliga,,
|
322
|
+
am.1,Armenia Premier League,1-premierleague,,
|
323
|
+
az.1,Azerbaijan Premier League A,1-premierleague,,
|
324
|
+
ge.1,Georgia Premier League A,1-premierleague,,
|
325
|
+
world,World Cup,cup,,
|
326
|
+
world.quali.europe,World Cup Quali Europe,worldcupqualieurope,,
|
327
|
+
world.quali.northamerica,World Cup Quali North/Central America and Caribbean,worldcupqualinorthcentralamericaandcaribbean,,
|
328
|
+
world.quali.southamerica,World Cup Quali South America,worldcupqualisouthamerica,,
|
329
|
+
world.quali.africa,World Cup Quali Africa,worldcupqualiafrica,,
|
330
|
+
world.quali.asia,World Cup Quali Asia (w/ Australia),worldcupqualiasiawaustralia,,
|
331
|
+
world.quali.pacific,World Cup Quali South Pacific,worldcupqualisouthpacific,,
|
332
|
+
world.quali.playoffs,World Cup Quali Intercontinental Playoffs,worldcupqualiintercontinentalplayoffs,,
|
333
|
+
world.confed,Confederations Cup,confederationscup,,
|
334
|
+
euro,Euro,euro,1960,
|
335
|
+
euro.quali,Euro Quali,euroquali,,
|
336
|
+
uefa.nl,UEFA Nations League,nl,2018/19,
|
337
|
+
uefa.nl.a,UEFA Nations League A,nla,2018/19,
|
338
|
+
uefa.nl.b,UEFA Nations League B,nlb,2018/19,
|
339
|
+
uefa.nl.c,UEFA Nations League C,nlc,2018/19,
|
340
|
+
southamerica,Copa América,copaamerica,,
|
341
|
+
northamerica,Gold Cup,goldcup,,
|
342
|
+
asia,Asian Cup,asiancup,,
|
343
|
+
africa,Africa Cup of Nations,africacupofnations,,
|
344
|
+
paficic,South Pacific Nations Cup,southpacificnationscup,,
|
345
|
+
world.club,Club World Cup,clubworldcup,,
|
346
|
+
il.1,Israel Premier League,1-premierleague,,
|
347
|
+
il.2,Israel National League,nationalleague,,
|
348
|
+
il.cup,Israel League Cup National,leaguecupnational,,
|
349
|
+
il.cup.lp,Israel League Cup Premier,leaguecuppremier,,
|
350
|
+
il.super,Israel Supercup,supercup,,
|
351
|
+
ps.1.i,Palestine West Bank Premier League,westbankpremierleague,,
|
352
|
+
ps.1.ii,Palestine Gaza Strip Premier League,gazastrippremierleague,,
|
353
|
+
ps.cup.gaza,Palestine Gaza Strip Cup,gazastripcup,,
|
354
|
+
sa.1,Saudi Arabia Saudi Professional League,saudiprofessionalleague,,
|
355
|
+
sa.cup,Saudi Arabia King Cup,kingcup,,
|
356
|
+
sa.super,Saudi Arabia Super Cup,supercup,,
|
357
|
+
qa.1,Qatar Stars League,starsleague,,
|
358
|
+
ir.1,Iran Pro League,proleague,,
|
359
|
+
bh.1,Bahrain Premier League,premierleague,,
|
360
|
+
om.cup,Oman Sultan Cup,sultancup,,
|
361
|
+
concacaf.cl,CONCACAF Champions League,concacafchampionsleague,,
|
362
|
+
concacaf.l,CONCACAF League,concacafleague,,
|
363
|
+
usmx.cup,US & Mexican Leagues Cup,usmexicanleaguescup,,
|
364
|
+
ca.1,Canada Premier League,premierleague,,
|
365
|
+
us.1,Major League Soccer,majorleaguesoccer,,
|
366
|
+
us.mls.back,MLS is Back Tournament,mlsisbacktournament,,
|
367
|
+
us.2,United Soccer League Championship,unitedsoccerleaguechampionship,,
|
368
|
+
us.3,United Soccer League One,unitedsoccerleagueone,,
|
369
|
+
us.4,United Soccer League Two,unitedsoccerleaguetwo,,
|
370
|
+
us.cup,US Open Cup,usopencup,,
|
371
|
+
us.ncaa,United States NCAA Men's Soccer,ncaamenssoccer,,
|
372
|
+
mx.1,Liga MX,1-ligamx,,
|
373
|
+
mx.2,Liga de Expansión MX,2-ligaexpansionmx,2020/21,
|
374
|
+
mx.2,Ascenso MX,2-ascensomx,,2019/20
|
375
|
+
mx.copa,Mexico Copa MX,copamx,,
|
376
|
+
au.1,Australia A-League,aleague,,
|
377
|
+
au.2.qpr,Australia Queensland Premier,queenslandpremier,,
|
378
|
+
au.cup,Australia FFA Cup,ffacup,,
|
379
|
+
ar.1,Argentina Primera Division,1-primeradivision,,
|
380
|
+
ar.2,Argentina Primera B Nacional,primerabnacional,,
|
381
|
+
ar.3.metro,Argentina Primera B Metropolitana,primerabmetropolitana,,
|
382
|
+
ar.3.fed,Argentina Torneo Federal A,torneofederala,,
|
383
|
+
ar.4.metro,Argentina Primera C Metropolitana,primeracmetropolitana,,
|
384
|
+
ar.4.fed,Argentina Torneo Federal B,torneofederalb,,
|
385
|
+
ar.5.metro,Argentina Primera D Metropolitana,primeradmetropolitana,,
|
386
|
+
ar.5.fed,Argentina Torneo Federal C,torneofederalc,,
|
387
|
+
ar.copa,Argentina Copa Argentina,copaargentina,,
|
388
|
+
ar.copa.l,Argentina Copa Superliga,copasuperliga,,
|
389
|
+
ar.super,Argentina Supercopa Argentina,supercopaargentina,,
|
390
|
+
br.1,Brasileiro Série A,1-seriea,,
|
391
|
+
br.2,Brasileiro Série B,2-serieb,,
|
392
|
+
br.3,Brasileiro Série C,3-seriec,,
|
393
|
+
br.4,Brasileiro Série D,4-seried,,
|
394
|
+
br.copa,Copa do Brasil,cup,,
|
395
|
+
br.league,Brazil Primeira Liga,primeiraliga,,
|
396
|
+
br.rs,Campeonato Gaúcho,gauchao,,
|
397
|
+
br.rs.2,Brazil Divisão de Acesso Gaúcha,divisaodeacessogaucha,,
|
398
|
+
br.rs.3,Brazil Terceirona,terceirona,,
|
399
|
+
br.sp,Campeonato Paulista,paulistao,,
|
400
|
+
br.rj,Campeonato Carioca,carioca,,
|
401
|
+
br.mg,Campeonato Mineiro,mineiro,,
|
402
|
+
br.paranaense,Campeonato Paranaense,paranaense,,
|
403
|
+
copa.l,Copa Libertadores,libertadores,,
|
404
|
+
copa.s,Copa Sudamericana,sudamericana,,
|
405
|
+
recopa,Recopa Sudamericana,recopasudamericana,,
|
406
|
+
py.1,Paraguay Primera Division,primeradivision,,
|
407
|
+
pe.1,Peru Primera Division,primeradivision,,
|
408
|
+
pe.2,Peru Segunda Division,segundadivision,,
|
409
|
+
pe.copa.bic,Peru Copa Bicentenario 2019,copabicentenario2019,,
|
410
|
+
bo.1,Bolivia Bolivian Primera División,bolivianprimeradivision,,
|
411
|
+
cl.1,Chile Primera Divison,primeradivison,,
|
412
|
+
cl.2,Chile Primera B,primerab,,
|
413
|
+
cl.copa,Copa Chile,copachile,,
|
414
|
+
co.1,Colombia Primera A,1-primeraa,,
|
415
|
+
co.2,Colombia Primera B,primerab,,
|
416
|
+
co.copa,Copa Colombia,copacolombia,,
|
417
|
+
co.super,Colombia Super Cup,supercup,,
|
418
|
+
uy.1,Uruguay Primera División,primeradivision,,
|
419
|
+
uy.copa,Uruguay Cup,cup,,
|
420
|
+
ec.1,Ecuador Serie A,seriea,,
|
421
|
+
ec.2,Ecuador Serie B,serieb,,
|
422
|
+
ve.1,Venezuela Primera División,primeradivision,,
|
423
|
+
ve.copa,Copa Venezuela,copavenezuela,,
|
@@ -0,0 +1,83 @@
|
|
1
|
+
|
2
|
+
module SportDb
|
3
|
+
class LeagueConfig
|
4
|
+
|
5
|
+
def self.read( path )
|
6
|
+
recs = read_csv( path )
|
7
|
+
new( recs )
|
8
|
+
end
|
9
|
+
|
10
|
+
def initialize( recs=nil )
|
11
|
+
@table = {}
|
12
|
+
add( recs ) if recs
|
13
|
+
end
|
14
|
+
|
15
|
+
|
16
|
+
class LeagueItem
|
17
|
+
def initialize
|
18
|
+
@recs = []
|
19
|
+
end
|
20
|
+
def add( rec ) @recs << rec; end
|
21
|
+
alias_method :<<, :add
|
22
|
+
|
23
|
+
def find_by_season( season )
|
24
|
+
@recs.each do |rec|
|
25
|
+
start_season = rec['start_season']
|
26
|
+
end_season = rec['end_season']
|
27
|
+
return rec if (start_season.nil? || start_season <= season) &&
|
28
|
+
(end_season.nil? || end_season >= season)
|
29
|
+
end
|
30
|
+
nil
|
31
|
+
end
|
32
|
+
|
33
|
+
|
34
|
+
def name_by_season( season )
|
35
|
+
rec = find_by_season( season )
|
36
|
+
rec ? rec['name'] : nil
|
37
|
+
end
|
38
|
+
|
39
|
+
def basename_by_season( season )
|
40
|
+
rec = find_by_season( season )
|
41
|
+
rec ? rec['basename'] : nil
|
42
|
+
end
|
43
|
+
|
44
|
+
|
45
|
+
def [](key)
|
46
|
+
## short cut - if only one or zero rec
|
47
|
+
## return directly
|
48
|
+
if @recs.empty?
|
49
|
+
nil
|
50
|
+
elsif @recs.size == 1 &&
|
51
|
+
@recs[0]['start_season'].nil? &&
|
52
|
+
@recs[0]['end_season'].nil?
|
53
|
+
@recs[0][key.to_s]
|
54
|
+
else ### return proc that requires season arg
|
55
|
+
case key.to_sym
|
56
|
+
when :name then method(:name_by_season).to_proc
|
57
|
+
when :basename then method(:basename_by_season).to_proc
|
58
|
+
else
|
59
|
+
nil ## return nil - why? why not?
|
60
|
+
## raise ArgumentError, "invalid key #{key}; use :name or :basename"
|
61
|
+
end
|
62
|
+
end
|
63
|
+
end
|
64
|
+
end
|
65
|
+
|
66
|
+
def add( recs )
|
67
|
+
recs.each do |rec|
|
68
|
+
@table[ rec['key'] ] ||= LeagueItem.new
|
69
|
+
|
70
|
+
## note: auto-change seasons to season object or nil
|
71
|
+
@table[ rec['key'] ] << { 'name' => rec['name'],
|
72
|
+
'basename' => rec['basename'],
|
73
|
+
'start_season' => rec['start_season'].empty? ? nil : Season.parse( rec['start_season'] ),
|
74
|
+
'end_season' => rec['end_season'].empty? ? nil : Season.parse( rec['end_season'] ),
|
75
|
+
}
|
76
|
+
end
|
77
|
+
end
|
78
|
+
|
79
|
+
|
80
|
+
def [](key) @table[ key.to_s.downcase ]; end
|
81
|
+
|
82
|
+
end # class LeagueConfig
|
83
|
+
end # module SportDb
|
@@ -0,0 +1,144 @@
|
|
1
|
+
|
2
|
+
|
3
|
+
##
|
4
|
+
# use/find a better name
|
5
|
+
# League Set, League Sheet,
|
6
|
+
# Leagueset/LeagueSet, LeagueSheet/Leaguesheet
|
7
|
+
# or Leagues (only)??
|
8
|
+
# or League Book, League Setup, ??
|
9
|
+
# or Workset, Worksheet, Workbook, ...
|
10
|
+
#
|
11
|
+
# move league config over here from sportdb-writers too!!!!!
|
12
|
+
|
13
|
+
|
14
|
+
#
|
15
|
+
# note - Leagueset is for now top-level
|
16
|
+
# NOT in a namespace (e.g. Sports/SportDB) - keep - why? why not?
|
17
|
+
|
18
|
+
|
19
|
+
class Leagueset
|
20
|
+
|
21
|
+
def self.parse_args( args )
|
22
|
+
### split args in datasets with leagues and seasons
|
23
|
+
datasets = []
|
24
|
+
args.each do |arg|
|
25
|
+
if arg =~ %r{^[0-9/-]+$} ## season
|
26
|
+
if datasets.empty?
|
27
|
+
puts "!! ERROR - league required before season arg; sorry"
|
28
|
+
exit 1
|
29
|
+
end
|
30
|
+
|
31
|
+
season = Season.parse( arg ) ## check season
|
32
|
+
datasets[-1][1] << season
|
33
|
+
else ## assume league key
|
34
|
+
key = arg.downcase
|
35
|
+
datasets << [key, []]
|
36
|
+
end
|
37
|
+
end
|
38
|
+
new(datasets)
|
39
|
+
end
|
40
|
+
|
41
|
+
|
42
|
+
def self.parse( txt )
|
43
|
+
### split args in datasets with leagues and seasons
|
44
|
+
datasets = []
|
45
|
+
recs = parse_csv( txt )
|
46
|
+
recs.each do |rec|
|
47
|
+
key = rec['league'].downcase
|
48
|
+
datasets << [key, []]
|
49
|
+
|
50
|
+
seasons_str = rec['seasons']
|
51
|
+
seasons = seasons_str.split( /[ ]+/ )
|
52
|
+
|
53
|
+
seasons.each do |season_str|
|
54
|
+
## note - add support for ranges e.g. 2001/02..2010/11
|
55
|
+
if season_str.index( '..' )
|
56
|
+
fst,snd = season_str.split( '..' )
|
57
|
+
# pp [fst,snd]
|
58
|
+
fst = Season.parse( fst )
|
59
|
+
snd = Season.parse( snd )
|
60
|
+
if fst < snd && fst.year? == snd.year?
|
61
|
+
datasets[-1][1] += (fst..snd).to_a
|
62
|
+
else
|
63
|
+
raise ArgumentError, "parse error - invalid season range >#{str}<, 1) two seasons required, 2) first < second, 3) same (year/academic) type"
|
64
|
+
end
|
65
|
+
else
|
66
|
+
season = Season.parse( season_str ) ## check season
|
67
|
+
datasets[-1][1] << season
|
68
|
+
end
|
69
|
+
end
|
70
|
+
end
|
71
|
+
new(datasets)
|
72
|
+
end
|
73
|
+
|
74
|
+
def self.read( path ) parse( read_text( path )); end
|
75
|
+
|
76
|
+
|
77
|
+
|
78
|
+
def initialize( recs )
|
79
|
+
@recs = recs
|
80
|
+
end
|
81
|
+
|
82
|
+
def size() @recs.size; end
|
83
|
+
|
84
|
+
def each( &blk )
|
85
|
+
@recs.each do |league_key, seasons|
|
86
|
+
blk.call( league_key, seasons )
|
87
|
+
end
|
88
|
+
end
|
89
|
+
|
90
|
+
|
91
|
+
### use a function for (re)use
|
92
|
+
### note - may add seasons in place!! (if seasons is empty)
|
93
|
+
def validate!( source_path: ['.'] )
|
94
|
+
each do |league_key, seasons|
|
95
|
+
|
96
|
+
league_info = find_league_info( league_key )
|
97
|
+
if league_info.nil?
|
98
|
+
puts "!! ERROR - no league (config) found for >#{league_key}<; sorry"
|
99
|
+
exit 1
|
100
|
+
end
|
101
|
+
|
102
|
+
|
103
|
+
if seasons.empty?
|
104
|
+
## simple heuristic to find current season
|
105
|
+
[ Season( '2024/25'), Season( '2024') ].each do |season|
|
106
|
+
filename = "#{season.to_path}/#{league_key}.csv"
|
107
|
+
path = find_file( filename, path: source_path )
|
108
|
+
if path
|
109
|
+
seasons << season
|
110
|
+
break
|
111
|
+
end
|
112
|
+
end
|
113
|
+
|
114
|
+
if seasons.empty?
|
115
|
+
puts "!! ERROR - no latest auto-season via source found for #{league_key}; sorry"
|
116
|
+
exit 1
|
117
|
+
end
|
118
|
+
end
|
119
|
+
|
120
|
+
## check source path too upfront - why? why not?
|
121
|
+
seasons.each do |season|
|
122
|
+
filename = "#{season.to_path}/#{league_key}.csv"
|
123
|
+
path = find_file( filename, path: source_path )
|
124
|
+
|
125
|
+
if path.nil?
|
126
|
+
puts "!! ERROR - no source found for #{filename}; sorry"
|
127
|
+
exit 1
|
128
|
+
end
|
129
|
+
end
|
130
|
+
end # each record
|
131
|
+
end
|
132
|
+
|
133
|
+
|
134
|
+
|
135
|
+
|
136
|
+
|
137
|
+
def pretty_print( printer )
|
138
|
+
printer.text( "<Leagueset: " )
|
139
|
+
printer.text( @recs )
|
140
|
+
printer.text( ">")
|
141
|
+
end
|
142
|
+
|
143
|
+
end # module Leagueset
|
144
|
+
|
@@ -19,7 +19,24 @@ module CET ## central european time helpers
|
|
19
19
|
pp d
|
20
20
|
exit 1
|
21
21
|
end
|
22
|
-
|
22
|
+
|
23
|
+
### 2006-03-26 02:00:00
|
24
|
+
## raise exception
|
25
|
+
## is an invalid local time. (TZInfo::PeriodNotFound)
|
26
|
+
## quick fix add +1
|
27
|
+
## 2012-03-25 02:00:00
|
28
|
+
## is an invalid local time. (TZInfo::PeriodNotFound)
|
29
|
+
|
30
|
+
if ['2018-03-25 02:00',
|
31
|
+
'2012-03-25 02:00',
|
32
|
+
'2006-03-26 02:00',
|
33
|
+
].include?( d.strftime( '%Y-%m-%d %H:%M' ))
|
34
|
+
puts "!! hack - fix CET date #{d} - add +1 hour"
|
35
|
+
pp d
|
36
|
+
zone.local_time( d.year, d.month, d.day, d.hour+1, d.min, d.sec )
|
37
|
+
else
|
38
|
+
zone.local_time( d.year, d.month, d.day, d.hour, d.min, d.sec )
|
39
|
+
end
|
23
40
|
end
|
24
41
|
def self.zone() @zone ||= UTC.find_zone( 'Europe/Vienna' ); end
|
25
42
|
end # class CET
|
data/lib/football-timezones.rb
CHANGED
@@ -9,21 +9,73 @@ require 'tzinfo'
|
|
9
9
|
require_relative 'football-timezones/version'
|
10
10
|
require_relative 'football-timezones/timezones'
|
11
11
|
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
12
|
+
|
13
|
+
|
14
|
+
###################
|
15
|
+
## setup (quick) leagues (info) table
|
16
|
+
require_relative 'football-timezones/league_config'
|
17
|
+
|
18
|
+
module LeagueInfoHelper
|
19
|
+
def _league_info ## load config on demand
|
20
|
+
@_leagues ||= begin
|
21
|
+
leagues = SportDb::LeagueConfig.new
|
22
|
+
['leagues',
|
23
|
+
].each do |name|
|
24
|
+
recs = read_csv( "#{SportDb::Module::Timezones.root}/config/#{name}.csv" )
|
25
|
+
leagues.add( recs )
|
26
|
+
end
|
27
|
+
leagues
|
28
|
+
end
|
29
|
+
end
|
30
|
+
|
31
|
+
def find_league_info( league )
|
32
|
+
raise ArgumentError, "league key as string|symbol expected" unless league.is_a?(String) || league.is_a?(Symbol)
|
33
|
+
_league_info[ league ]
|
34
|
+
end
|
35
|
+
end # module LeagueInfoHelper
|
36
|
+
|
37
|
+
|
38
|
+
|
39
|
+
|
40
|
+
|
41
|
+
require_relative 'football-timezones/leagueset'
|
42
|
+
|
43
|
+
#### add alias - why? why not?
|
44
|
+
LeagueSet = Leagueset
|
45
|
+
|
46
|
+
|
47
|
+
module LeaguesetHelper
|
48
|
+
###
|
49
|
+
### note - make read_leagueset & friends public/global by default - why? why not?
|
50
|
+
def read_leagueset( path ) Leagueset.read( path ); end
|
51
|
+
def parse_leagueset( txt ) Leagueset.parse( txt ); end
|
52
|
+
def parse_leagueset_args( args ) Leagueset.parse_args( args ); end
|
16
53
|
end
|
17
54
|
|
18
55
|
|
19
56
|
|
20
|
-
|
57
|
+
module FileHelper
|
58
|
+
def find_file( filename, path: )
|
59
|
+
path.each do |src_dir|
|
60
|
+
path = "#{src_dir}/#{filename}"
|
61
|
+
return path if File.exist?( path )
|
62
|
+
end
|
63
|
+
|
64
|
+
## fix - raise file not found error!!!
|
65
|
+
nil ## not found - raise filenot found error - why? why not?
|
66
|
+
end
|
67
|
+
end
|
68
|
+
|
69
|
+
|
21
70
|
|
22
|
-
|
23
|
-
### note - make
|
24
|
-
|
25
|
-
|
26
|
-
|
71
|
+
####
|
72
|
+
### note - make find_zone! public/global by default - why? why not?
|
73
|
+
module Kernel
|
74
|
+
include FileHelper
|
75
|
+
include TimezoneHelper
|
76
|
+
include LeagueInfoHelper
|
77
|
+
include LeaguesetHelper
|
78
|
+
end
|
27
79
|
|
28
80
|
|
29
81
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: football-timezones
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.3.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-
|
11
|
+
date: 2024-12-29 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: tzinfo
|
@@ -78,14 +78,14 @@ dependencies:
|
|
78
78
|
requirements:
|
79
79
|
- - "~>"
|
80
80
|
- !ruby/object:Gem::Version
|
81
|
-
version: '4.
|
81
|
+
version: '4.2'
|
82
82
|
type: :development
|
83
83
|
prerelease: false
|
84
84
|
version_requirements: !ruby/object:Gem::Requirement
|
85
85
|
requirements:
|
86
86
|
- - "~>"
|
87
87
|
- !ruby/object:Gem::Version
|
88
|
-
version: '4.
|
88
|
+
version: '4.2'
|
89
89
|
description: football-timezones - time & timezone helpers for football (league) data
|
90
90
|
email: gerald.bauer@gmail.com
|
91
91
|
executables: []
|
@@ -99,6 +99,7 @@ files:
|
|
99
99
|
- Manifest.txt
|
100
100
|
- README.md
|
101
101
|
- Rakefile
|
102
|
+
- config/leagues.csv
|
102
103
|
- config/timezones_africa.csv
|
103
104
|
- config/timezones_america.csv
|
104
105
|
- config/timezones_asia.csv
|
@@ -107,7 +108,8 @@ files:
|
|
107
108
|
- config/timezones_pacific.csv
|
108
109
|
- config/timezones_world.csv
|
109
110
|
- lib/football-timezones.rb
|
110
|
-
- lib/football-timezones/
|
111
|
+
- lib/football-timezones/league_config.rb
|
112
|
+
- lib/football-timezones/leagueset.rb
|
111
113
|
- lib/football-timezones/timezones.rb
|
112
114
|
- lib/football-timezones/version.rb
|
113
115
|
- lib/football/timezones.rb
|
@@ -132,7 +134,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
132
134
|
- !ruby/object:Gem::Version
|
133
135
|
version: '0'
|
134
136
|
requirements: []
|
135
|
-
rubygems_version: 3.
|
137
|
+
rubygems_version: 3.5.22
|
136
138
|
signing_key:
|
137
139
|
specification_version: 4
|
138
140
|
summary: football-timezones - time & timezone helpers for football (league) data
|
@@ -1,62 +0,0 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
module Datasets
|
4
|
-
def self.parse_args( args )
|
5
|
-
### split args in datasets with leagues and seasons
|
6
|
-
datasets = []
|
7
|
-
args.each do |arg|
|
8
|
-
if arg =~ %r{^[0-9/-]+$} ## season
|
9
|
-
if datasets.empty?
|
10
|
-
puts "!! ERROR - league required before season arg; sorry"
|
11
|
-
exit 1
|
12
|
-
end
|
13
|
-
|
14
|
-
season = Season.parse( arg ) ## check season
|
15
|
-
datasets[-1][1] << season
|
16
|
-
else ## assume league key
|
17
|
-
key = arg.downcase
|
18
|
-
datasets << [key, []]
|
19
|
-
end
|
20
|
-
end
|
21
|
-
datasets
|
22
|
-
end
|
23
|
-
|
24
|
-
|
25
|
-
def self.parse( txt )
|
26
|
-
### split args in datasets with leagues and seasons
|
27
|
-
datasets = []
|
28
|
-
recs = parse_csv( txt )
|
29
|
-
recs.each do |rec|
|
30
|
-
key = rec['league'].downcase
|
31
|
-
datasets << [key, []]
|
32
|
-
|
33
|
-
seasons_str = rec['seasons']
|
34
|
-
seasons = seasons_str.split( /[ ]+/ )
|
35
|
-
|
36
|
-
seasons.each do |season_str|
|
37
|
-
## note - add support for ranges e.g. 2001/02..2010/11
|
38
|
-
if season_str.index( '..' )
|
39
|
-
fst,snd = season_str.split( '..' )
|
40
|
-
# pp [fst,snd]
|
41
|
-
fst = Season.parse( fst )
|
42
|
-
snd = Season.parse( snd )
|
43
|
-
if fst < snd && fst.year? == snd.year?
|
44
|
-
datasets[-1][1] += (fst..snd).to_a
|
45
|
-
else
|
46
|
-
raise ArgumentError, "parse error - invalid season range >#{str}<, 1) two seasons required, 2) first < second, 3) same (year/academic) type"
|
47
|
-
end
|
48
|
-
else
|
49
|
-
season = Season.parse( season_str ) ## check season
|
50
|
-
datasets[-1][1] << season
|
51
|
-
end
|
52
|
-
end
|
53
|
-
end
|
54
|
-
datasets
|
55
|
-
end
|
56
|
-
|
57
|
-
|
58
|
-
def self.read( path )
|
59
|
-
parse( read_text( path ))
|
60
|
-
end
|
61
|
-
end # module Datasets
|
62
|
-
|