football-sources 0.0.1 → 0.1.0

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.
Files changed (30) hide show
  1. checksums.yaml +4 -4
  2. data/Manifest.txt +6 -15
  3. data/README.md +142 -1
  4. data/Rakefile +1 -1
  5. data/lib/football-sources.rb +26 -15
  6. data/lib/football-sources/apis.rb +1 -77
  7. data/lib/football-sources/apis/mods.rb +20 -0
  8. data/lib/football-sources/fbref.rb +4 -0
  9. data/lib/football-sources/fbref/build.rb +96 -0
  10. data/lib/football-sources/fbref/config.rb +16 -0
  11. data/lib/football-sources/fbref/convert.rb +95 -0
  12. data/lib/football-sources/version.rb +2 -2
  13. data/lib/football-sources/worldfootball.rb +1 -6
  14. data/lib/football-sources/worldfootball/jobs.rb +76 -0
  15. metadata +10 -19
  16. data/lib/football-sources/apis/download.rb +0 -11
  17. data/lib/football-sources/worldfootball/download.rb +0 -61
  18. data/lib/football-sources/worldfootball/leagues.rb +0 -200
  19. data/lib/football-sources/worldfootball/leagues/asia.rb +0 -53
  20. data/lib/football-sources/worldfootball/leagues/europe--british_isles.rb +0 -59
  21. data/lib/football-sources/worldfootball/leagues/europe--central.rb +0 -127
  22. data/lib/football-sources/worldfootball/leagues/europe--eastern.rb +0 -82
  23. data/lib/football-sources/worldfootball/leagues/europe--northern.rb +0 -57
  24. data/lib/football-sources/worldfootball/leagues/europe--southern.rb +0 -86
  25. data/lib/football-sources/worldfootball/leagues/europe--western.rb +0 -38
  26. data/lib/football-sources/worldfootball/leagues/europe.rb +0 -13
  27. data/lib/football-sources/worldfootball/leagues/north_america.rb +0 -44
  28. data/lib/football-sources/worldfootball/leagues/pacific.rb +0 -21
  29. data/lib/football-sources/worldfootball/leagues/south_america.rb +0 -11
  30. data/lib/football-sources/worldfootball/tool.rb +0 -100
@@ -1,38 +0,0 @@
1
-
2
- module Worldfootball
3
-
4
- LEAGUES_EUROPE.merge!({
5
- 'fr.1' => { pages: 'fra-ligue-1' },
6
- 'fr.2' => { pages: 'fra-ligue-2' },
7
-
8
- # e.g. /lux-nationaldivision-2020-2021/
9
- 'lu.1' => { pages: 'lux-nationaldivision' },
10
-
11
- # e.g. /ned-eredivisie-2020-2021/
12
- 'nl.1' => { pages: 'ned-eredivisie' },
13
- # Championship play-offs
14
- # Europa League play-offs (Group A + Group B / Finals )
15
-
16
- # e.g. /bel-eerste-klasse-a-2020-2021/
17
- # /bel-europa-league-playoffs-2018-2019-playoff/
18
- # - Halbfinale
19
- # - Finale
20
- 'be.1' => {
21
- pages: {
22
- 'bel-eerste-klasse-a-{season}' => 'Regular Season',
23
- 'bel-eerste-klasse-a-{season}-playoff-i' => 'Playoffs - Championship',
24
- 'bel-europa-league-playoffs-{season}' => 'Playoffs - Europa League', ## note: missing groups (A & B)
25
- 'bel-europa-league-playoffs-{season}-playoff' => 'Playoffs - Europa League - Finals',
26
- },
27
- season: ->( season ) {
28
- case season
29
- when Season('2020/21') then [1] # just getting started
30
- when Season('2019/20') then [1] # covid-19 - no championship & europa
31
- when Season('2018/19') then [1,2,3,4]
32
- end
33
- }
34
- },
35
-
36
- })
37
-
38
- end
@@ -1,13 +0,0 @@
1
-
2
- module Worldfootball
3
- LEAGUES_EUROPE = {}
4
- end
5
-
6
-
7
- require_relative 'europe--western'
8
- require_relative 'europe--british_isles'
9
- require_relative 'europe--northern'
10
- require_relative 'europe--central'
11
- require_relative 'europe--eastern'
12
- require_relative 'europe--southern'
13
-
@@ -1,44 +0,0 @@
1
- module Worldfootball
2
-
3
- LEAGUES_NORTH_AMERICA = {
4
-
5
- # todo/fix: adjust date/time by -6 or 7 hours!!!
6
- # /can-canadian-championship-2020/
7
- # - Qual. 1. Runde
8
- # - Qual. 2. Runde
9
- # - Qual. 3. Runde
10
- # todo/fix: check for leagues - premier league? championship? soccer league?
11
- # 'ca.1' => { slug: 'can-canadian-championship' },
12
-
13
-
14
-
15
- # todo/fix: adjust date/time by -7 hours!!!
16
- ## e.g. 25.07.2020 02:30 => 24.07.2020 19.30
17
- # 11.01.2020 04:00 => 10.01.2020 21.00
18
- #
19
- # e.g. /mex-primera-division-2020-2021-apertura/
20
- # /mex-primera-division-2019-2020-clausura/
21
- # /mex-primera-division-2019-2020-apertura-playoffs/
22
- # - Viertelfinale
23
- # - Halbfinale
24
- # - Finale
25
- # /mex-primera-division-2018-2019-clausura-playoffs/
26
- 'mx.1' => {
27
- pages: {
28
- 'mex-primera-division-{season}-apertura' => 'Apertura', # 1
29
- 'mex-primera-division-{season}-apertura-playoffs' => 'Apertura - Liguilla', # 2
30
- 'mex-primera-division-{season}-clausura' => 'Clausura', # 3
31
- 'mex-primera-division-{season}-clausura-playoffs' => 'Clausura - Liguilla', # 4
32
- },
33
- season: ->( season ) {
34
- case season
35
- when Season('2020/21') then [1] # just getting started
36
- when Season('2019/20') then [1,2,3] # covid-19 - no liguilla
37
- when Season('2010/11')..Season('2018/19') then [1,2,3,4]
38
- end
39
- }
40
- },
41
- }
42
-
43
- end # module Worldfootball
44
-
@@ -1,21 +0,0 @@
1
- module Worldfootball
2
-
3
- LEAGUES_PACIFIC = {
4
-
5
- # /nzl-nz-football-championship-2019-2020/
6
- # /nzl-nz-football-championship-2018-2019-playoffs/
7
- 'nz.1' => {
8
- pages: {
9
- 'nzl-nz-football-championship-{season}' => 'Regular Season', # 1
10
- 'nzl-nz-football-championship-{season}-playoffs' => 'Playoff Finals', # 2
11
- },
12
- season: ->( season ) {
13
- case season
14
- when Season('2019/20') then [1] ## covid-19 - no playoffs/finals
15
- when Season('2018/19') then [1,2]
16
- end
17
- }
18
- },
19
- }
20
-
21
- end # module Worldfootball
@@ -1,11 +0,0 @@
1
- module Worldfootball
2
-
3
- LEAGUES_SOUTH_AMERICA = {
4
-
5
- # todo/fix: adjust date/time by -6 or 7 hours!!!
6
- # /bra-serie-a-2020/
7
- 'br.1' => { pages: 'bra-serie-a' },
8
- }
9
-
10
- end # module Worldfootball
11
-
@@ -1,100 +0,0 @@
1
-
2
-
3
- module Worldfootball
4
- ################################
5
- # add more helpers
6
- # move upstream for (re)use - why? why not?
7
-
8
- ## todo/check: what to do: if league is both included and excluded?
9
- ## include forces include? or exclude has the last word? - why? why not?
10
- ## Excludes match before includes,
11
- ## meaning that something that has been excluded cannot be included again
12
-
13
- ## todo - find "proper/classic" timezone ("winter time")
14
-
15
- ## Brasilia - Distrito Federal, Brasil (GMT-3) -- summer time?
16
- ## Ciudad de México, CDMX, México (GMT-5) -- summer time?
17
- ## Londres, Reino Unido (GMT+1)
18
- ## Madrid -- ?
19
- ## Lisboa -- ?
20
- ## Moskow -- ?
21
- ##
22
- ## todo/check - quick fix timezone offsets for leagues for now
23
- ## - find something better - why? why not?
24
- ## note: assume time is in GMT+1
25
- OFFSETS = {
26
- 'eng.1' => -1,
27
- 'eng.2' => -1,
28
- 'eng.3' => -1,
29
- 'eng.4' => -1,
30
- 'eng.5' => -1,
31
-
32
- 'es.1' => -1,
33
- 'es.2' => -1,
34
-
35
- 'pt.1' => -1,
36
- 'pt.2' => -1,
37
-
38
- 'br.1' => -5,
39
- 'mx.1' => -7,
40
- }
41
-
42
-
43
-
44
-
45
- class Tool
46
- def initialize( includes: nil,
47
- excludes: nil )
48
- ## quick fix: move/handle empty array upstream!!!!
49
- includes = nil if includes.is_a?(Array) && includes.empty?
50
-
51
- @includes = includes
52
- @excludes = excludes
53
- end
54
-
55
-
56
-
57
- def download( datasets )
58
- datasets.each do |dataset|
59
- league = dataset[0]
60
- seasons = dataset[1]
61
-
62
- with_filter( league ) do
63
- seasons.each do |season|
64
- puts "downloading #{league} #{season}..."
65
-
66
- Worldfootball.schedule( league: league,
67
- season: season )
68
- end
69
- end
70
- end
71
- end
72
-
73
- def convert( datasets )
74
- datasets.each do |dataset|
75
- league = dataset[0]
76
- seasons = dataset[1]
77
-
78
- with_filter( league ) do
79
- seasons.each do |season|
80
- Worldfootball.convert( league: league,
81
- season: season,
82
- offset: OFFSETS[ league ] )
83
- end
84
- end
85
- end
86
- end
87
-
88
-
89
- #########################################
90
- # more helpers
91
- def with_filter( league, &blk )
92
- return if @excludes && @excludes.find { |q| league.start_with?( q.downcase ) }
93
- return if @includes && @includes.find { |q| league.start_with?( q.downcase ) }.nil?
94
- blk.call()
95
- end
96
-
97
- end # class Tool
98
- end # module Worldfootball
99
-
100
-