footty 2025.4.28 → 2025.5.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 620119829b1dbd891a01c374c8996a264e347f329e0211387e18fdc12add6fe6
4
- data.tar.gz: cc1f485cc3bbfc12ab5f3846823df6c63f7295912045996a08c2ccb4e50eb7a5
3
+ metadata.gz: 597423aa8445e6fd662c9a6541230726d1d97316e5f9a7ec7c8781dbf5f2f4e6
4
+ data.tar.gz: c5bf0acffaa91bd215253eef1b8271348e9596499ff202ef131fa8ef002abd5a
5
5
  SHA512:
6
- metadata.gz: a0394d72327b87ad90e207e48883bf90acace8e1183d85f9175b9a6484ab8c62e3e12759f77a3eac1e59cc526e0eeacdd70183418a29a920e47c10732f28e51e
7
- data.tar.gz: a0e274e21d9ca9620cbdda59ebdec84e92f5b8a99a4e747a177b076de6b830c94b66064c5b89c7ae6ae989b47803558aa7720fd51a321c089705987ad5196f52
6
+ metadata.gz: fe813055addd774484ca21f19f4200c4cd567f242121df493192fbb5ea1b96a50a893d157c12d255b17743b1014eed13020914859bd23984aa969836e9302b20
7
+ data.tar.gz: 140a848370b4d24ce43c9cc815fb2b28e2745eb68060dcae43415c1a54c770f9aaeb675d0b809ffbaf753b7b1353b9e98a7d021b1fb73fdc5d08d5adfe15b936
data/CHANGELOG.md CHANGED
@@ -1,4 +1,4 @@
1
- ### 2025.4.28
1
+ ### 2025.5.2
2
2
  ### 1.0.0 / 2018-06-09
3
3
 
4
4
  * Everything is new (again). First release.
@@ -42,7 +42,20 @@ module Footty
42
42
  def yesterdays_matches( date: Date.today ) matches_for( date-1 ); end
43
43
 
44
44
  def matches_for( date )
45
- matches = select_matches { |match| date == Date.parse( match['date'] ) }
45
+ matches = select_matches do |match|
46
+ date == Date.parse( match['date'] )
47
+ end
48
+ matches
49
+ end
50
+
51
+
52
+ def weeks_matches( week_start, week_end ) matches_within( week_start, week_end); end
53
+
54
+ def matches_within( start_date, end_date )
55
+ matches = select_matches do |match|
56
+ date = Date.parse( match['date'] )
57
+ date >= start_date && date <= end_date
58
+ end
46
59
  matches
47
60
  end
48
61
 
@@ -39,7 +39,11 @@ module Footty
39
39
  'nl'=> 'europe/netherlands/$season$_nl1.txt',
40
40
  'be'=> 'europe/belgium/$season$_be1.txt',
41
41
 
42
- 'champs'=> 'champions-league/$season$/cl.txt',
42
+ 'champs' => 'champions-league/$season$/cl.txt',
43
+ 'uefacl' => 'champions-league/$season$/cl.txt',
44
+ 'uefael' => 'champions-league/$season$/el.txt',
45
+ 'uefaconf' => 'champions-league/$season$/conf.txt',
46
+
43
47
 
44
48
  'br' => 'south-america/brazil/$year$_br1.txt',
45
49
  'ar' => 'south-america/argentina/$year$_ar1.txt',
@@ -51,6 +55,8 @@ module Footty
51
55
  'mx' => 'world/north-america/mexico/$season$_mx1.txt',
52
56
  'mls' => 'world/north-america/major-league-soccer/$year$_mls.txt',
53
57
 
58
+ 'concacafcl' => 'world/north-america/champions-league/$year$_concacafcl.txt',
59
+
54
60
  'eg' => 'world/africa/egypt/$season$_eg1.txt',
55
61
  'ma' => 'world/africa/morocco/$season$_ma1.txt',
56
62
 
@@ -1,6 +1,6 @@
1
1
 
2
2
  module Footty
3
- VERSION = '2025.4.28'
3
+ VERSION = '2025.5.2'
4
4
 
5
5
  def self.banner
6
6
  "footty/#{VERSION} on Ruby #{RUBY_VERSION} (#{RUBY_RELEASE_DATE}) [#{RUBY_PLATFORM}] in (#{root})"
data/lib/footty.rb CHANGED
@@ -22,6 +22,27 @@ Webget.config.sleep = 1 ## set delay in secs (to 1 sec - default is/maybe 3)
22
22
 
23
23
 
24
24
  module Footty
25
+
26
+
27
+ def self.week_tue_to_mon( today=Date.today )
28
+ ## Calculate the start of the (sport) week (tuesday)
29
+ ## note - wday starts counting sunday (0), monday (1), etc.
30
+ week_tue = today - (today.wday - 2) % 7
31
+ week_mon = week_tue + 6
32
+
33
+ [week_tue,week_mon]
34
+ end
35
+
36
+ def self.fmt_week( week_start, week_end )
37
+ buf = String.new
38
+ buf << "Week %02d" % week_start.cweek
39
+ buf << " - #{week_start.strftime( "%a %b/%-d")}"
40
+ buf << " to #{week_end.strftime( "%a %b/%-d %Y")}"
41
+ buf
42
+ end
43
+
44
+
45
+
25
46
  def self.main( args=ARGV )
26
47
  puts banner # say hello
27
48
 
@@ -38,7 +59,7 @@ module Footty
38
59
  upcoming: nil,
39
60
  past: nil,
40
61
 
41
- # week: nil,
62
+ week: false,
42
63
  # window: nil, ## 2 day plus/minus +2/-2
43
64
  }
44
65
 
@@ -69,6 +90,11 @@ module Footty
69
90
  parser.on( "-u", "--up", "--upcoming" ) do |upcoming|
70
91
  opts[:upcoming] = true
71
92
  end
93
+
94
+ parser.on( "-w", "--week",
95
+ "show matches of the (sport) week from tue to mon (default: #{opts[:week]})" ) do |week|
96
+ opts[:week] = true
97
+ end
72
98
  end
73
99
  parser.parse!( args )
74
100
 
@@ -110,6 +136,8 @@ module Footty
110
136
 
111
137
  top = [['world', '2022'],
112
138
  ['euro', '2024'],
139
+ ['mls', '2025'],
140
+ ['concacafcl', '2025'],
113
141
  ['mx', '2024/25'],
114
142
  ['copa', '2025'], ## copa libertadores
115
143
  ['en', '2024/25'],
@@ -117,8 +145,12 @@ module Footty
117
145
  ['it', '2024/25'],
118
146
  ['fr', '2024/25'],
119
147
  ['de', '2024/25'],
148
+ ['decup', '2024/25'],
120
149
  ['at', '2024/25'],
121
- ['champs', '2024/25'],
150
+ ['atcup', '2024/25'],
151
+ ['uefacl', '2024/25'],
152
+ ['uefael', '2024/25'],
153
+ ['uefaconf', '2024/25'],
122
154
  ]
123
155
 
124
156
 
@@ -181,21 +213,36 @@ module Footty
181
213
  'past'
182
214
  elsif opts[:upcoming]
183
215
  'upcoming'
216
+ elsif opts[:week]
217
+ 'week'
184
218
  else
185
219
  'today'
186
220
  end
187
221
 
188
222
 
189
- ## start with two empty lines - assume (massive) debug output before ;-)
190
- puts
191
- puts
223
+ ## if week get week number and start and end date (tuesday to mondey)
224
+ if what == 'week'
225
+ week_start, week_end = Footty.week_tue_to_mon( today)
226
+ puts
227
+ puts "=== " + Footty.fmt_week( week_start, week_end ) + " ==="
228
+ else
229
+ ## start with two empty lines - assume (massive) debug output before ;-)
230
+ puts
231
+ puts
232
+ end
233
+
192
234
  datasets.each do |dataset|
193
235
  print "==> #{dataset.league_name}"
194
236
  print " #{dataset.start_date} - #{dataset.end_date}"
195
237
  print " -- #{dataset.matches.size} match(es)"
196
238
  print "\n"
197
239
 
198
- if what == 'yesterday'
240
+ if what == 'week'
241
+ matches = dataset.weeks_matches( week_start, week_end )
242
+ if matches.empty?
243
+ puts (' '*4) + "** No matches scheduled or played in week #{week_start.cweek}.\n"
244
+ end
245
+ elsif what == 'yesterday'
199
246
  matches = dataset.yesterdays_matches
200
247
  if matches.empty?
201
248
  puts (' '*4) + "** No matches played yesterday.\n"
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: footty
3
3
  version: !ruby/object:Gem::Version
4
- version: 2025.4.28
4
+ version: 2025.5.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: 2025-04-28 00:00:00.000000000 Z
11
+ date: 2025-05-02 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: sportdb-quick