worldfootball 0.2.1 → 0.2.2
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 +65 -54
- data/lib/worldfootball/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 2e871cd1caa08e419ec61ec216e95becce7c4d7523f189d72819c8caeac3d064
|
|
4
|
+
data.tar.gz: e02aeb59551d0b67a3719fb770a4cbd66f0f0a8cefd707030e9c694c64e09920
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 2a87baa018202326f680a82a964a215e77d776dea8d49cd7d30909840b2309fc3b9f562c2ded0f27513e21df24b83c6c6aa4b2ccf8ecda3619594dedd4f6ca53
|
|
7
|
+
data.tar.gz: 8c52cf35ac656cee3281921ce83fb0f947385bcf11d719c98ec8506f5b8b172fc574dacbce5dbc35864056cc313e7177f4118651e28cec303e5e0e53d0fe6e2a
|
data/CHANGELOG.md
CHANGED
data/bin/wfb
CHANGED
|
@@ -30,6 +30,8 @@ def self.main( args=ARGV )
|
|
|
30
30
|
opts = {
|
|
31
31
|
cached: false,
|
|
32
32
|
convert: true,
|
|
33
|
+
file: nil,
|
|
34
|
+
dry: false,
|
|
33
35
|
}
|
|
34
36
|
|
|
35
37
|
|
|
@@ -43,19 +45,24 @@ parser = OptionParser.new do |parser|
|
|
|
43
45
|
## todo - add a single letter option for offline/cached
|
|
44
46
|
|
|
45
47
|
parser.on( "--cache", "--cached", "--offline",
|
|
46
|
-
"use cached data in
|
|
48
|
+
"use cached data in #{Webcache.root}" ) do |cached|
|
|
47
49
|
opts[:cached] = cached
|
|
48
50
|
end
|
|
49
51
|
|
|
50
|
-
parser.on( "--no-convert",
|
|
51
|
-
"turn off conversion to .csv in #{Worldfootball.config.convert.out_dir} - default is (#{
|
|
52
|
-
opts[:convert] =
|
|
52
|
+
parser.on( "--[no-]convert",
|
|
53
|
+
"turn on/off conversion to .csv in #{Worldfootball.config.convert.out_dir} - default is (#{opts[:convert]})" ) do |convert|
|
|
54
|
+
opts[:convert] = convert
|
|
53
55
|
end
|
|
54
56
|
|
|
55
57
|
parser.on( "--dry",
|
|
56
|
-
|
|
58
|
+
"dry run; do NOT write - default is (#{opts[:dry]})" ) do |dry|
|
|
57
59
|
opts[:dry] = dry
|
|
58
60
|
end
|
|
61
|
+
|
|
62
|
+
parser.on( "-f FILE", "--file FILE",
|
|
63
|
+
"read leagues (and seasons) via .csv file") do |file|
|
|
64
|
+
opts[:file] = file
|
|
65
|
+
end
|
|
59
66
|
end
|
|
60
67
|
|
|
61
68
|
|
|
@@ -90,62 +97,66 @@ if ['league', 'leagues', 'ls'].include?( args[0] || 'leagues' )
|
|
|
90
97
|
end
|
|
91
98
|
|
|
92
99
|
|
|
100
|
+
####
|
|
101
|
+
# assume leagues
|
|
93
102
|
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
## output more page meta info
|
|
100
|
-
puts "league meta:"
|
|
101
|
-
pp league
|
|
102
|
-
end
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
## note - default to latest season of league
|
|
106
|
-
## might be 2024/25 or 2024 or
|
|
107
|
-
# for world cup 2022 or such
|
|
108
|
-
season = Season( args[1] || league.seasons.keys[0] )
|
|
109
|
-
|
|
110
|
-
pages = league.pages!( season: season )
|
|
103
|
+
datasets = if opts[:file]
|
|
104
|
+
read_datasets( opts[:file] )
|
|
105
|
+
else
|
|
106
|
+
parse_datasets_args( args )
|
|
107
|
+
end
|
|
111
108
|
|
|
112
109
|
|
|
113
|
-
|
|
114
|
-
pp [league.key, season.key]
|
|
115
|
-
pp pages
|
|
116
|
-
puts " #{pages.size} page(s)"
|
|
110
|
+
datasets.each do |league_key, seasons|
|
|
117
111
|
|
|
112
|
+
league = find_league!( league_key ) ## league info lookup
|
|
118
113
|
|
|
119
|
-
if opts[:dry]
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
if opts[:cached]
|
|
126
|
-
# do nothing
|
|
127
|
-
else ## download to cache
|
|
128
|
-
pages.each_with_index do |(slug,_),i|
|
|
129
|
-
puts "==> #{i+1}/#{pages.size} - #{league_code} @ #{slug}..."
|
|
130
|
-
page = Metal.download_schedule( slug )
|
|
131
|
-
end
|
|
132
|
-
end
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
pages.each_with_index do |(slug,_),i|
|
|
136
|
-
puts "==> #{i+1}/#{pages.size} - #{league_code} @ #{slug}..."
|
|
137
|
-
page = Page::Schedule.from_cache( slug )
|
|
138
|
-
matches = page.matches
|
|
139
|
-
|
|
140
|
-
puts " #{matches.size} match(es)"
|
|
141
|
-
end
|
|
114
|
+
if opts[:dry]
|
|
115
|
+
## output more page meta info
|
|
116
|
+
puts "league meta:"
|
|
117
|
+
pp league
|
|
118
|
+
end
|
|
142
119
|
|
|
120
|
+
## note - default to latest season of league
|
|
121
|
+
## might be 2024/25 or 2024 or
|
|
122
|
+
# for world cup 2022 or such
|
|
123
|
+
seasons = [Season(league.seasons.keys[0])] if seasons.empty?
|
|
124
|
+
|
|
125
|
+
seasons.each do |season|
|
|
126
|
+
pages = league.pages!( season: season )
|
|
127
|
+
puts
|
|
128
|
+
pp [league.key, season.key]
|
|
129
|
+
pp pages
|
|
130
|
+
puts " #{pages.size} page(s)"
|
|
131
|
+
|
|
132
|
+
|
|
133
|
+
next if opts[:dry] ## stop here if dry run
|
|
134
|
+
|
|
135
|
+
if opts[:cached]
|
|
136
|
+
# do nothing
|
|
137
|
+
else ## download to cache
|
|
138
|
+
pages.each_with_index do |(slug,_),i|
|
|
139
|
+
puts "==> #{i+1}/#{pages.size} - #{league_key} @ #{slug}..."
|
|
140
|
+
page = Metal.download_schedule( slug )
|
|
141
|
+
end
|
|
142
|
+
end
|
|
143
|
+
|
|
144
|
+
pages.each_with_index do |(slug,_),i|
|
|
145
|
+
puts "==> #{i+1}/#{pages.size} - #{league_key} @ #{slug}..."
|
|
146
|
+
page = Page::Schedule.from_cache( slug )
|
|
147
|
+
matches = page.matches
|
|
148
|
+
|
|
149
|
+
puts " #{matches.size} match(es)"
|
|
150
|
+
end
|
|
151
|
+
|
|
152
|
+
if opts[:convert]
|
|
153
|
+
## write out (export to) comma-separated values (.csv) datafile
|
|
154
|
+
convert( league: league_key,
|
|
155
|
+
season: season )
|
|
156
|
+
end
|
|
157
|
+
end # each seasons
|
|
158
|
+
end # each league
|
|
143
159
|
|
|
144
|
-
if opts[:convert]
|
|
145
|
-
## write out (export to) comma-separated values (.csv) datafile
|
|
146
|
-
convert( league: league_code,
|
|
147
|
-
season: season )
|
|
148
|
-
end
|
|
149
160
|
end # def self.main
|
|
150
161
|
end # module Worldfootball
|
|
151
162
|
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: worldfootball
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.2.
|
|
4
|
+
version: 0.2.2
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Gerald Bauer
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2024-09-
|
|
11
|
+
date: 2024-09-15 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: football-timezones
|