worldfootball 0.2.1 → 0.2.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +1 -1
- data/bin/wfb +66 -55
- 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: 795b62b085497648e27f552f4122df1b984d77ceca2ab21e82b76929476d3994
|
4
|
+
data.tar.gz: f7d42b68d8914b9fbb57ebf12295b762d3cb05a6928e99701183b59051d597cc
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ecd1b91f7b9f4569d637b16a44844b9e2c46ef7b2c0b0b82bd1774d8962f847d525bf0aa1019a559e1b48faee271983eeb3d325d70b50cdb629cd1bc2aceb724
|
7
|
+
data.tar.gz: 3566a25fac9a4ce695b92b6e924baa3c1d6db2dff19de2d1af35d48b1223cd960802eab0ca6b72ed9ebff1eb09e315d0621fc4930e4004f66a87af5ccc6d365a
|
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
|
|
@@ -76,7 +83,7 @@ if ['cache'].include?( args[0] )
|
|
76
83
|
end
|
77
84
|
|
78
85
|
|
79
|
-
if ['league', 'leagues', 'ls'].include?( args[0]
|
86
|
+
if ['league', 'leagues', 'ls'].include?( args[0] )
|
80
87
|
keys = LEAGUES.keys
|
81
88
|
|
82
89
|
pp keys
|
@@ -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.3
|
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
|