fbup 0.0.1 → 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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: d55ede42bbe3e933365193d25054464d9226d1a5743dc9b4919ce47760faa68d
4
- data.tar.gz: 2c759f0719ceed561a02d25818141cb57625ef60ca99f1f294c5e80e0b185d05
3
+ metadata.gz: '07096715a38cb0bcd17cd41f5904203118e2d25c0cb3d55f9a693e7e5697ea4c'
4
+ data.tar.gz: dad822c19b93b47455443d4f46d08ba8a43fd0ea75e7562bab792ef412e89fd8
5
5
  SHA512:
6
- metadata.gz: ea4c01a1e01290360ebe48028225745c6b33d6ad2196af66846f6287a1a0bd2c6713c7026127a281caade87d8b2488c27c09e0c61d54a7992322d0b334b33d12
7
- data.tar.gz: 5b6afe253dcabb81e23918dbb257104dcb3c25446f3a5ffdcd3e12553fd5dcf69995018f4476903c3ae5844fc00e3969afb84c0634d390063b743011553d7419
6
+ metadata.gz: 17a84b2d10d04d66c98920cf522f650fd2821eb8655465383e22494903c34052ba7ed6559212b4561832f5afa653ac31012ebaeac943dd0739c61026755c8f22
7
+ data.tar.gz: 7ac5c17ac2f5f5471a0a311db84c404d9d3212937466085d9be4b6b1a4d6b89e73d872ae844818386552c10243d4c1f34d8f062bc0c3ae6c4fd1d0eb02173128
data/CHANGELOG.md CHANGED
@@ -1,3 +1,4 @@
1
+ ### 0.1.1
1
2
  ### 0.0.1 / 2024-12-29
2
3
 
3
4
  * Everything is new. First release.
data/Rakefile CHANGED
@@ -20,8 +20,9 @@ Hoe.spec 'fbup' do
20
20
  self.licenses = ['Public Domain']
21
21
 
22
22
  self.extra_deps = [
23
- ['sportdb-writers', '>= 0.4.0'],
24
- ['gitti', '>= 0.6.1'],
23
+ ['gitti', '>= 0.6.1'],
24
+ ['sportdb-writers', '>= 0.4.1'],
25
+ ['football-timezones', '>= 0.3.0'],
25
26
  ]
26
27
 
27
28
  self.spec_extras = {
data/bin/fbup CHANGED
@@ -6,7 +6,9 @@
6
6
  ## ruby -I fbup/lib fbup/bin/fbup
7
7
 
8
8
 
9
-
9
+ ## note - quick hack - auto-add local football timezones
10
+ $LOAD_PATH.unshift( '/sports/sportdb/sport.db/timezones/lib' )
11
+ $LOAD_PATH.unshift( '/sports/sportdb/sport.db/fifa/lib' )
10
12
  require 'fbup'
11
13
 
12
14
 
@@ -1,117 +1,153 @@
1
- key, path
1
+ key, path, flags
2
2
 
3
- at, austria
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
- fr, europe/france
15
+ at, austria, classic
11
16
 
12
- hu, europe/hungary
13
- gr, europe/greece
14
- pt, europe/portugal
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
- tr, europe/turkey
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
- fi, europe/finland
25
- se, europe/sweden
26
- no, europe/norway
27
- dk, europe/denmark
32
+ fr, europe/france,
28
33
 
29
- lu, europe/luxembourg
30
- be, europe/belgium
31
- nl, europe/netherlands
32
- cz, europe/czech-republic
34
+ hu, europe/hungary,
35
+ gr, europe/greece,
36
+ pt, europe/portugal,
33
37
 
34
- sk, europe/slovakia
35
- hr, europe/croatia
36
- pl, europe/poland
38
+ ch, europe/switzerland,
37
39
 
38
- ro, europe/romania
40
+ tr, europe/turkey,
39
41
 
40
- ua, europe/ukraine
42
+ is, europe/iceland,
43
+ sco, europe/scotland,
44
+ ie, europe/ireland,
41
45
 
42
- ru, europe/russia
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
- al, europe/albania
46
- ad, europe/andorra
47
- by, europe/belarus
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
- sm, europe/san-marino
61
- rs, europe/serbia
62
- si, europe/slovenia
60
+ ro, europe/romania,
63
61
 
64
- xk, europe/kosovo
65
- kos, europe/kosovo
62
+ ua, europe/ukraine,
66
63
 
67
- am, europe/armenia
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
- euro, euro
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
- ar, south-america/argentina
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
- cn, world/asia/china
109
- jp, world/asia/japan
107
+ ar, south-america/argentina,
108
+ br, south-america/brazil,
109
+ co, south-america/colombia,
110
110
 
111
- kz, world/asia/kazakhstan
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, worldcup
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,
@@ -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 = SportDb::TxtMatchWriter.build( matches )
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
- outpath = "#{root_dir}/#{repo_path}/#{season.to_path}/#{basename}.txt"
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
@@ -3,7 +3,7 @@ module SportDb
3
3
  module Module
4
4
  module Fbup
5
5
  MAJOR = 0 ## todo: namespace inside version or something - why? why not??
6
- MINOR = 0
6
+ MINOR = 1
7
7
  PATCH = 1
8
8
  VERSION = [MAJOR,MINOR,PATCH].join('.')
9
9
 
data/lib/fbup.rb CHANGED
@@ -1,5 +1,6 @@
1
1
 
2
2
  require 'sportdb/writers'
3
+ require 'football/timezones' ## pulls-in find_league_info, etc.
3
4
 
4
5
 
5
6
  require 'optparse' ## command-line processing; check if included updstream?
metadata CHANGED
@@ -1,43 +1,57 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fbup
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.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: 2024-12-29 00:00:00.000000000 Z
11
+ date: 2025-03-24 00:00:00.000000000 Z
12
12
  dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: gitti
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ">="
18
+ - !ruby/object:Gem::Version
19
+ version: 0.6.1
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ">="
25
+ - !ruby/object:Gem::Version
26
+ version: 0.6.1
13
27
  - !ruby/object:Gem::Dependency
14
28
  name: sportdb-writers
15
29
  requirement: !ruby/object:Gem::Requirement
16
30
  requirements:
17
31
  - - ">="
18
32
  - !ruby/object:Gem::Version
19
- version: 0.4.0
33
+ version: 0.4.1
20
34
  type: :runtime
21
35
  prerelease: false
22
36
  version_requirements: !ruby/object:Gem::Requirement
23
37
  requirements:
24
38
  - - ">="
25
39
  - !ruby/object:Gem::Version
26
- version: 0.4.0
40
+ version: 0.4.1
27
41
  - !ruby/object:Gem::Dependency
28
- name: gitti
42
+ name: football-timezones
29
43
  requirement: !ruby/object:Gem::Requirement
30
44
  requirements:
31
45
  - - ">="
32
46
  - !ruby/object:Gem::Version
33
- version: 0.6.1
47
+ version: 0.3.0
34
48
  type: :runtime
35
49
  prerelease: false
36
50
  version_requirements: !ruby/object:Gem::Requirement
37
51
  requirements:
38
52
  - - ">="
39
53
  - !ruby/object:Gem::Version
40
- version: 0.6.1
54
+ version: 0.3.0
41
55
  - !ruby/object:Gem::Dependency
42
56
  name: rdoc
43
57
  requirement: !ruby/object:Gem::Requirement