fbup 0.1.0 → 0.1.1
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/fbup +3 -1
- data/config/openfootball.csv +115 -79
- data/lib/fbup/github_config.rb +9 -0
- data/lib/fbup/main.rb +76 -5
- data/lib/fbup/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: '07096715a38cb0bcd17cd41f5904203118e2d25c0cb3d55f9a693e7e5697ea4c'
|
4
|
+
data.tar.gz: dad822c19b93b47455443d4f46d08ba8a43fd0ea75e7562bab792ef412e89fd8
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 17a84b2d10d04d66c98920cf522f650fd2821eb8655465383e22494903c34052ba7ed6559212b4561832f5afa653ac31012ebaeac943dd0739c61026755c8f22
|
7
|
+
data.tar.gz: 7ac5c17ac2f5f5471a0a311db84c404d9d3212937466085d9be4b6b1a4d6b89e73d872ae844818386552c10243d4c1f34d8f062bc0c3ae6c4fd1d0eb02173128
|
data/CHANGELOG.md
CHANGED
data/bin/fbup
CHANGED
data/config/openfootball.csv
CHANGED
@@ -1,117 +1,153 @@
|
|
1
|
-
key, path
|
1
|
+
key, path, flags
|
2
2
|
|
3
|
-
|
3
|
+
## note - flags - defaults for now are v2 | flat
|
4
|
+
##
|
5
|
+
## v2 - v2 format (football.txt)
|
6
|
+
## flat - add season to basename (no season directory)
|
7
|
+
## e.g. 2023-24_at1.txt
|
8
|
+
## classic - use season directory AND league slug for basename
|
9
|
+
## e.g. 2023-24/1-bundesliga.txt
|
10
|
+
##
|
11
|
+
##
|
12
|
+
## add archive flag for using archive style names before 2000 or such - why? why not?
|
4
13
|
|
5
|
-
de, deutschland
|
6
|
-
eng, england
|
7
|
-
es, espana
|
8
|
-
it, italy
|
9
14
|
|
10
|
-
|
15
|
+
at, austria, classic
|
11
16
|
|
12
|
-
|
13
|
-
|
14
|
-
|
17
|
+
de, deutschland, classic
|
18
|
+
eng, england, classic
|
19
|
+
es, espana, classic
|
20
|
+
it, italy, classic
|
15
21
|
|
16
|
-
ch, europe/switzerland
|
17
22
|
|
18
|
-
|
23
|
+
## todo/fix - add aliases WITHOUT repeating conifg - why? why not?
|
24
|
+
uefa.cl, champions-league, classic
|
25
|
+
uefa.champs, champions-league, classic
|
26
|
+
uefa.el, champions-league, classic
|
27
|
+
uefa.europa, champions-league, classic
|
28
|
+
uefa.conf, champions-league, classic
|
29
|
+
uefa.con, champions-league, classic
|
19
30
|
|
20
|
-
is, europe/iceland
|
21
|
-
sco, europe/scotland
|
22
|
-
ie, europe/ireland
|
23
31
|
|
24
|
-
|
25
|
-
se, europe/sweden
|
26
|
-
no, europe/norway
|
27
|
-
dk, europe/denmark
|
32
|
+
fr, europe/france,
|
28
33
|
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
cz, europe/czech-republic
|
34
|
+
hu, europe/hungary,
|
35
|
+
gr, europe/greece,
|
36
|
+
pt, europe/portugal,
|
33
37
|
|
34
|
-
|
35
|
-
hr, europe/croatia
|
36
|
-
pl, europe/poland
|
38
|
+
ch, europe/switzerland,
|
37
39
|
|
38
|
-
|
40
|
+
tr, europe/turkey,
|
39
41
|
|
40
|
-
|
42
|
+
is, europe/iceland,
|
43
|
+
sco, europe/scotland,
|
44
|
+
ie, europe/ireland,
|
41
45
|
|
42
|
-
|
46
|
+
fi, europe/finland,
|
47
|
+
se, europe/sweden,
|
48
|
+
no, europe/norway,
|
49
|
+
dk, europe/denmark,
|
43
50
|
|
51
|
+
lu, europe/luxembourg,
|
52
|
+
be, europe/belgium,
|
53
|
+
nl, europe/netherlands,
|
54
|
+
cz, europe/czech-republic,
|
44
55
|
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
ba, europe/bosnia-herzegovina ## use bosnia-n-herzegovina ??
|
49
|
-
bg, europe/bulgaria
|
50
|
-
cy, europe/cyprus
|
51
|
-
ee, europe/estonia
|
52
|
-
lv, europe/latvia
|
53
|
-
li, europe/liechtenstein
|
54
|
-
lt, europe/lithuania
|
55
|
-
mk, europe/north-macedonia
|
56
|
-
mt, europe/malta
|
57
|
-
md, europe/moldova
|
58
|
-
me, europe/montenegro
|
56
|
+
sk, europe/slovakia,
|
57
|
+
hr, europe/croatia,
|
58
|
+
pl, europe/poland,
|
59
59
|
|
60
|
-
|
61
|
-
rs, europe/serbia
|
62
|
-
si, europe/slovenia
|
60
|
+
ro, europe/romania,
|
63
61
|
|
64
|
-
|
65
|
-
kos, europe/kosovo
|
62
|
+
ua, europe/ukraine,
|
66
63
|
|
67
|
-
|
68
|
-
az, europe/azerbaijan
|
69
|
-
ge, europe/georgia
|
70
|
-
fo, europe/faroe-islands
|
71
|
-
gi, europe/gibraltar
|
64
|
+
ru, europe/russia,
|
72
65
|
|
73
|
-
wal, europe/wales
|
74
|
-
nir, europe/northern-ireland
|
75
66
|
|
67
|
+
al, europe/albania,
|
68
|
+
ad, europe/andorra,
|
69
|
+
by, europe/belarus,
|
70
|
+
ba, europe/bosnia-herzegovina, ## use bosnia-n-herzegovina ??
|
71
|
+
bg, europe/bulgaria,
|
72
|
+
cy, europe/cyprus,
|
73
|
+
ee, europe/estonia,
|
74
|
+
lv, europe/latvia,
|
75
|
+
li, europe/liechtenstein,
|
76
|
+
lt, europe/lithuania,
|
77
|
+
mk, europe/north-macedonia,
|
78
|
+
mt, europe/malta,
|
79
|
+
md, europe/moldova,
|
80
|
+
me, europe/montenegro,
|
76
81
|
|
82
|
+
sm, europe/san-marino,
|
83
|
+
rs, europe/serbia,
|
84
|
+
si, europe/slovenia,
|
77
85
|
|
78
|
-
uefa.cl, champions-league
|
79
|
-
uefa.champs, champions-league
|
80
|
-
uefa.el, champions-league
|
81
|
-
uefa.europa, champions-league
|
82
|
-
uefa.conf, champions-league
|
83
|
-
uefa.con, champions-league
|
84
86
|
|
85
|
-
|
87
|
+
xk, europe/kosovo,
|
88
|
+
kos, europe/kosovo,
|
86
89
|
|
90
|
+
am, europe/armenia,
|
91
|
+
az, europe/azerbaijan,
|
92
|
+
ge, europe/georgia,
|
93
|
+
fo, europe/faroe-islands,
|
94
|
+
gi, europe/gibraltar,
|
87
95
|
|
96
|
+
wal, europe/wales,
|
97
|
+
nir, europe/northern-ireland,
|
88
98
|
|
89
|
-
mx, mexico
|
90
99
|
|
91
100
|
|
92
|
-
|
93
|
-
br, south-america/brazil
|
94
|
-
co, south-america/colombia
|
101
|
+
euro, euro,
|
95
102
|
|
96
|
-
copa.l, south-america/copa-libertadores
|
97
|
-
copa.s, south-america/copa-libertadores
|
98
103
|
|
99
104
|
|
100
|
-
eg, africa/egypt
|
101
|
-
ma, africa/morocco
|
102
|
-
dz, africa/algeria
|
103
|
-
afl, africa/african-football-league
|
104
|
-
caf.cl, africa/champions-league
|
105
|
-
caf.champs, africa/champions-league
|
106
105
|
|
107
106
|
|
108
|
-
|
109
|
-
|
107
|
+
ar, south-america/argentina,
|
108
|
+
br, south-america/brazil,
|
109
|
+
co, south-america/colombia,
|
110
110
|
|
111
|
-
|
111
|
+
copa.l, south-america/copa-libertadores,
|
112
|
+
copa.s, south-america/copa-libertadores,
|
112
113
|
|
113
|
-
il, world/middle-east/israel
|
114
114
|
|
115
115
|
|
116
|
+
###
|
117
|
+
# world repo
|
116
118
|
|
117
|
-
world,
|
119
|
+
eg, world/africa/egypt,
|
120
|
+
ma, world/africa/morocco,
|
121
|
+
dz, world/africa/algeria,
|
122
|
+
|
123
|
+
afl, world/africa/african-football-league,
|
124
|
+
caf.cl, world/africa/champions-league,
|
125
|
+
caf.champs, world/africa/champions-league,
|
126
|
+
|
127
|
+
|
128
|
+
cn, world/asia/china,
|
129
|
+
jp, world/asia/japan,
|
130
|
+
|
131
|
+
kz, world/asia/kazakhstan,
|
132
|
+
|
133
|
+
il, world/middle-east/israel,
|
134
|
+
|
135
|
+
|
136
|
+
mls, world/north-america/major-league-soccer,
|
137
|
+
|
138
|
+
|
139
|
+
mx, world/north-america/mexico,
|
140
|
+
## todo/check - why mx config is not enough?
|
141
|
+
## mx.2.expansion, world/north-america/mexico
|
142
|
+
|
143
|
+
|
144
|
+
## fix/change concacaf.cl to concacaf.champs !!!
|
145
|
+
concacaf.cl, world/north-america/champions-league,
|
146
|
+
concacaf.champs, world/north-america/champions-league,
|
147
|
+
|
148
|
+
|
149
|
+
|
150
|
+
au, world/pacific/australia,
|
151
|
+
|
152
|
+
|
153
|
+
world, worldcup,
|
data/lib/fbup/github_config.rb
CHANGED
@@ -55,7 +55,16 @@ def add( recs )
|
|
55
55
|
'name' => name, ## (required)
|
56
56
|
'path' => path ## extra/inner/inside/local path (optional)
|
57
57
|
}
|
58
|
+
|
59
|
+
## check for/add flags
|
60
|
+
flags = rec['flags'].split( /[ ]*[|][ ]*/ )
|
61
|
+
## generte hash
|
62
|
+
## e.g. v2 | flat => { 'v2' => true, 'flat' => true } etc.
|
63
|
+
flags = flags.map { |flag| [flag, true] }.to_h
|
64
|
+
@table[ rec['key'] ]['flags'] = flags if flags.size > 0
|
58
65
|
end
|
66
|
+
|
67
|
+
|
59
68
|
end
|
60
69
|
|
61
70
|
|
data/lib/fbup/main.rb
CHANGED
@@ -1,5 +1,23 @@
|
|
1
1
|
|
2
2
|
module Fbup
|
3
|
+
|
4
|
+
LEAGUE_NAMES_V2 = {
|
5
|
+
'jp.1' => 'Japan | J1 League',
|
6
|
+
'cn.1' => 'China | Super League',
|
7
|
+
'kz.1' => 'Kazakhstan | Premier League',
|
8
|
+
'eg.1' => 'Egypt | Premiership',
|
9
|
+
'ma.1' => 'Morocco | Botola Pro 1',
|
10
|
+
'dz.1' => 'Algeria | Ligue 1',
|
11
|
+
'il.1' => 'Israel | Premier League',
|
12
|
+
'au.1' => 'Australia | A-League',
|
13
|
+
############
|
14
|
+
## international
|
15
|
+
## note - will fetch team pages one-by-one too to get country (codes)
|
16
|
+
'afl' => 'African Football League',
|
17
|
+
'caf.cl' => 'CAF Champions League',
|
18
|
+
}
|
19
|
+
|
20
|
+
|
3
21
|
def self.main( args=ARGV )
|
4
22
|
|
5
23
|
opts = {
|
@@ -11,9 +29,15 @@ opts = {
|
|
11
29
|
debug: true,
|
12
30
|
file: nil,
|
13
31
|
test_dir: './o',
|
32
|
+
|
33
|
+
v1: false,
|
34
|
+
classic: false,
|
35
|
+
## v2: false, ## v2 Football.TXT generation fromat
|
36
|
+
## flat: false, ## use "flat" naming convention for datafile
|
14
37
|
}
|
15
38
|
|
16
39
|
|
40
|
+
|
17
41
|
parser = OptionParser.new do |parser|
|
18
42
|
parser.banner = "Usage: #{$PROGRAM_NAME} [options] [args]"
|
19
43
|
|
@@ -47,6 +71,18 @@ parser = OptionParser.new do |parser|
|
|
47
71
|
opts[:debug] = false
|
48
72
|
end
|
49
73
|
|
74
|
+
parser.on( "--v1",
|
75
|
+
"v1 text format - default is (#{opts[:v1]})" ) do |v1|
|
76
|
+
opts[:v1] = true
|
77
|
+
end
|
78
|
+
|
79
|
+
parser.on( "--classic",
|
80
|
+
"classic names; use season in directory NOT basename - default is (#{opts[:classic]})" ) do |classic|
|
81
|
+
opts[:classic] = true
|
82
|
+
end
|
83
|
+
|
84
|
+
|
85
|
+
|
50
86
|
parser.on( "-I DIR", "--include DIR",
|
51
87
|
"add directory to (source) search path - default is (#{opts[:source_path].join(',')})") do |dir|
|
52
88
|
opts[:source_path] += path
|
@@ -115,7 +151,6 @@ sync.git_fast_forward_if_clean if opts[:ffwd]
|
|
115
151
|
datasets.validate!( source_path: source_path )
|
116
152
|
|
117
153
|
|
118
|
-
|
119
154
|
datasets.each do |league_key, seasons|
|
120
155
|
puts "==> gen #{league_key} - #{seasons.size} seasons(s)..."
|
121
156
|
|
@@ -131,25 +166,61 @@ datasets.each do |league_key, seasons|
|
|
131
166
|
matches = SportDb::CsvMatchParser.read( path )
|
132
167
|
puts " #{matches.size} matches"
|
133
168
|
|
169
|
+
|
170
|
+
## get repo config for flags and more
|
171
|
+
repo = GitHubSync::REPOS[ league_key ]
|
172
|
+
flags = repo['flags'] || {}
|
173
|
+
classic_flag = flags['classic'] || false
|
174
|
+
|
175
|
+
|
134
176
|
## build
|
135
|
-
txt =
|
177
|
+
txt = if classic_flag || opts[:v1]
|
178
|
+
SportDb::TxtMatchWriter.build( matches )
|
179
|
+
else
|
180
|
+
SportDb::TxtMatchWriter.build_v2( matches )
|
181
|
+
end
|
182
|
+
|
136
183
|
puts txt if opts[:debug]
|
137
184
|
|
185
|
+
|
138
186
|
league_name = league_info[ :name ] # e.g. Brasileiro Série A
|
139
187
|
basename = league_info[ :basename] #.e.g 1-seriea
|
140
188
|
|
141
189
|
league_name = league_name.call( season ) if league_name.is_a?( Proc ) ## is proc/func - name depends on season
|
142
190
|
basename = basename.call( season ) if basename.is_a?( Proc ) ## is proc/func - name depends on season
|
143
191
|
|
192
|
+
|
193
|
+
if classic_flag || opts[:classic]
|
194
|
+
## do nothing
|
195
|
+
else
|
196
|
+
## add quick fix for new league name overwrites
|
197
|
+
league_name = LEAGUE_NAMES_V2[league_key] || league_name
|
198
|
+
end
|
199
|
+
|
200
|
+
|
201
|
+
|
144
202
|
buf = String.new
|
145
203
|
buf << "= #{league_name} #{season}\n\n"
|
146
204
|
buf << txt
|
147
|
-
|
148
|
-
repo = GitHubSync::REPOS[ league_key ]
|
205
|
+
|
149
206
|
repo_path = "#{repo['owner']}/#{repo['name']}"
|
150
207
|
repo_path << "/#{repo['path']}" if repo['path'] ## note: do NOT forget to add optional extra path!!!
|
151
208
|
|
152
|
-
|
209
|
+
|
210
|
+
outpath = "#{root_dir}/#{repo_path}"
|
211
|
+
|
212
|
+
|
213
|
+
outpath += if classic_flag || opts[:classic]
|
214
|
+
"/#{season.to_path}/#{basename}.txt"
|
215
|
+
else
|
216
|
+
## add season "inline" (to basename) or use dir
|
217
|
+
## change base name to league key
|
218
|
+
## todo - fix - make gsub smarter
|
219
|
+
## change at.cup to at_cup - why? why not?
|
220
|
+
basename = league_key.gsub( '.', '' )
|
221
|
+
"/#{season.to_path}_#{basename}.txt"
|
222
|
+
end
|
223
|
+
|
153
224
|
|
154
225
|
if opts[:dry]
|
155
226
|
puts " (dry) writing to >#{outpath}<..."
|
data/lib/fbup/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: fbup
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Gerald Bauer
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2025-03-24 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: gitti
|