worldfootball 0.2.3 → 0.2.4
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/bin/wfb +30 -18
- data/lib/worldfootball/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 0dfb778159b88ccab0c79abd75512a5751e148c96f5f2c1ecec6a1ea95b4eaa7
|
|
4
|
+
data.tar.gz: 907c8f61a222068bc591260c6928f08c5ab76fc3fa0f826b8a83e4aba673f6a3
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 3d008e4768814d2d290d71a73a82f7d8b83812e75dffc6a34fa3a32778634b7160b1642d1741ba84546e89f127965f9822db7c77c47ba2b3c01adb679523256a
|
|
7
|
+
data.tar.gz: '09605deda7a4431e396747d2b8cca60f1aaae662249999e0b585427d53721328cf2d74beb063f4423034c0bee3e6caf1c3037e87a5ad948836a6f8371c0bfaf6'
|
data/CHANGELOG.md
CHANGED
data/bin/wfb
CHANGED
|
@@ -31,7 +31,6 @@ opts = {
|
|
|
31
31
|
cached: false,
|
|
32
32
|
convert: true,
|
|
33
33
|
file: nil,
|
|
34
|
-
dry: false,
|
|
35
34
|
}
|
|
36
35
|
|
|
37
36
|
|
|
@@ -54,9 +53,10 @@ parser = OptionParser.new do |parser|
|
|
|
54
53
|
opts[:convert] = convert
|
|
55
54
|
end
|
|
56
55
|
|
|
57
|
-
parser.on( "--
|
|
58
|
-
|
|
59
|
-
opts[:
|
|
56
|
+
parser.on( "--print", "--pp",
|
|
57
|
+
"pretty print cached data in #{Webcache.root}; no download & conversion") do |print|
|
|
58
|
+
opts[:cached] = true
|
|
59
|
+
opts[:convert] = false
|
|
60
60
|
end
|
|
61
61
|
|
|
62
62
|
parser.on( "-f FILE", "--file FILE",
|
|
@@ -107,21 +107,29 @@ datasets = if opts[:file]
|
|
|
107
107
|
end
|
|
108
108
|
|
|
109
109
|
|
|
110
|
-
|
|
110
|
+
## step 0 - validate and fill-up seasons etc.
|
|
111
|
+
datasets.each do |dataset|
|
|
112
|
+
league_key, seasons = dataset
|
|
111
113
|
|
|
112
114
|
league = find_league!( league_key ) ## league info lookup
|
|
113
115
|
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
pp league
|
|
118
|
-
end
|
|
116
|
+
## output more page meta info
|
|
117
|
+
puts "league meta:"
|
|
118
|
+
pp league
|
|
119
119
|
|
|
120
120
|
## note - default to latest season of league
|
|
121
121
|
## might be 2024/25 or 2024 or
|
|
122
122
|
# for world cup 2022 or such
|
|
123
|
-
|
|
123
|
+
if seasons.empty?
|
|
124
|
+
seasons = [Season(league.seasons.keys[0])]
|
|
125
|
+
dataset[1] = seasons
|
|
126
|
+
end
|
|
127
|
+
end
|
|
124
128
|
|
|
129
|
+
|
|
130
|
+
## step 1 - download
|
|
131
|
+
datasets.each do |league_key, seasons|
|
|
132
|
+
league = find_league!( league_key ) ## league info lookup
|
|
125
133
|
seasons.each do |season|
|
|
126
134
|
pages = league.pages!( season: season )
|
|
127
135
|
puts
|
|
@@ -129,9 +137,6 @@ datasets.each do |league_key, seasons|
|
|
|
129
137
|
pp pages
|
|
130
138
|
puts " #{pages.size} page(s)"
|
|
131
139
|
|
|
132
|
-
|
|
133
|
-
next if opts[:dry] ## stop here if dry run
|
|
134
|
-
|
|
135
140
|
if opts[:cached]
|
|
136
141
|
# do nothing
|
|
137
142
|
else ## download to cache
|
|
@@ -148,14 +153,21 @@ datasets.each do |league_key, seasons|
|
|
|
148
153
|
|
|
149
154
|
puts " #{matches.size} match(es)"
|
|
150
155
|
end
|
|
156
|
+
end # each seasons
|
|
157
|
+
end # each league
|
|
151
158
|
|
|
152
|
-
|
|
159
|
+
|
|
160
|
+
if opts[:convert]
|
|
161
|
+
## step 2 - convert
|
|
162
|
+
datasets.each do |league_key, seasons|
|
|
163
|
+
seasons.each do |season|
|
|
153
164
|
## write out (export to) comma-separated values (.csv) datafile
|
|
154
165
|
convert( league: league_key,
|
|
155
166
|
season: season )
|
|
156
|
-
|
|
157
|
-
end
|
|
158
|
-
end
|
|
167
|
+
end
|
|
168
|
+
end
|
|
169
|
+
end
|
|
170
|
+
|
|
159
171
|
|
|
160
172
|
end # def self.main
|
|
161
173
|
end # module Worldfootball
|