football-sources 0.1.0 → 0.1.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: b068838936cfdba0eae277fe5f44c957f2281655
4
- data.tar.gz: da3b4be77ac9661aaaa469580d38d37e68f3ae08
2
+ SHA256:
3
+ metadata.gz: a9b9787aaaaad173642d6bf3ddd19bb573f8f997eb04dbe2e702dc830144eedb
4
+ data.tar.gz: e2f0e59b5949d9994a4eb01b2ae2ef0deaa959042cb1a98feccf9c009a01ffbd
5
5
  SHA512:
6
- metadata.gz: 9179c04e869df95a9b473aeabe1397f19c29108a1eac6e6d3fe149f2cb3b5f6967002d459e4ba013bfae26a22748724030805ebc591c333a389e53eb5d05576a
7
- data.tar.gz: 31c7a7a673ea694996ddcf4ae550aa0904c2ba5391f5af3bfe09c9bf1f27f2af2ba0d8ddee0389da0b11a739b7bedb9e35055486a834a338072049d5a0f758e8
6
+ metadata.gz: b95e6df43a8374cbc66d8e4774443a613de9a35ba8adc9041b496c1ae4f34ba03b55b887ed6f2573cafae37ecf3828490fa15bc0ea5c8b89d1723d6a45030db2
7
+ data.tar.gz: 6674c3799a962cc57405f4cab10cf273bbc856f3268c9f556c02fc5da7541703e205ace4e1b431b417195aeab33a9666d084e0cb3a5dc3e14c0cdac273698e1b
data/CHANGELOG.md CHANGED
@@ -1,4 +1,6 @@
1
- ### 0.0.1 / 2020-11-09
2
-
3
- * Everything is new. First release.
4
-
1
+ ### 0.1.1
2
+
3
+ ### 0.0.1 / 2020-11-09
4
+
5
+ * Everything is new. First release.
6
+
data/Manifest.txt CHANGED
@@ -3,25 +3,5 @@ Manifest.txt
3
3
  README.md
4
4
  Rakefile
5
5
  lib/football-sources.rb
6
- lib/football-sources/apis.rb
7
- lib/football-sources/apis/config.rb
8
- lib/football-sources/apis/convert.rb
9
- lib/football-sources/apis/convert_cl.rb
10
- lib/football-sources/apis/mods.rb
11
- lib/football-sources/apis/stat.rb
12
- lib/football-sources/fbref.rb
13
- lib/football-sources/fbref/build.rb
14
- lib/football-sources/fbref/config.rb
15
- lib/football-sources/fbref/convert.rb
16
6
  lib/football-sources/version.rb
17
- lib/football-sources/worldfootball.rb
18
- lib/football-sources/worldfootball/build.rb
19
- lib/football-sources/worldfootball/config.rb
20
- lib/football-sources/worldfootball/convert.rb
21
- lib/football-sources/worldfootball/convert_reports.rb
22
- lib/football-sources/worldfootball/jobs.rb
23
- lib/football-sources/worldfootball/mods.rb
24
- lib/football-sources/worldfootball/vacuum.rb
25
7
  lib/football/sources.rb
26
- test/helper.rb
27
- test/test_version.rb
data/README.md CHANGED
@@ -1,169 +1,30 @@
1
- # football-sources - get football data via web pages or web api (json) calls
2
-
3
-
4
- * home :: [github.com/sportdb/sport.db](https://github.com/sportdb/sport.db)
5
- * bugs :: [github.com/sportdb/sport.db/issues](https://github.com/sportdb/sport.db/issues)
6
- * gem :: [rubygems.org/gems/football-sources](https://rubygems.org/gems/football-sources)
7
- * rdoc :: [rubydoc.info/gems/football-sources](http://rubydoc.info/gems/football-sources)
8
- * forum :: [groups.google.com/group/opensport](https://groups.google.com/group/opensport)
9
-
10
-
11
-
12
- ## Usage
13
-
14
-
15
- ### Source #1 - `football-data.org` - ur src for machine readable football data
16
-
17
- [Daniel Freitag](https://www.football-data.org/about)'s dev-friendly football API
18
- offers a free to use plan
19
- for 12 leagues (API key sign-up and use required).
20
- See [`football-data.org` »](https://www.football-data.org)
21
-
22
-
23
- **Step 0 - Setup Secrets**
24
-
25
- Set the API key / token in the env(ironement).
26
- Example:
27
-
28
- ```
29
- set FOOTBALLDATA=1234567890abcdef1234567890abcdef
30
- ```
31
-
32
-
33
- **Step 1 - Download Match Schedules**
34
-
35
- Download the match schedules (in json) via api calls
36
- to your (local) web cache (in `~/.cache`).
37
- Note: The free trier has a 10 request/minute limit,
38
- thus, sleep/wait 10 secs after every request
39
- (should result in ~6 requests/minute).
40
-
41
-
42
- ``` ruby
43
- require 'football/sources'
44
-
45
-
46
- # download up (ongoing) 2020 or 2020/21 seasons
47
- Webget.config.sleep = 10
48
-
49
- Footballdata.schedule( league: 'eng.1', season: '2020/21' )
50
- Footballdata.schedule( league: 'eng.2', season: '2020/21' )
51
-
52
- Footballdata.schedule( league: 'de.1', season: '2020/21' )
53
- Footballdata.schedule( league: 'es.1', season: '2020/21' )
54
-
55
- Footballdata.schedule( league: 'fr.1', season: '2020/21' )
56
- Footballdata.schedule( league: 'it.1', season: '2020/21' )
57
-
58
- Footballdata.schedule( league: 'nl.1', season: '2020/21' )
59
- Footballdata.schedule( league: 'pt.1', season: '2020/21' )
60
-
61
- Footballdata.schedule( league: 'cl', season: '2020/21' )
62
-
63
- # note: Brasileirão - season is a calendar year (NOT an academic year)
64
- Footballdata.schedule( league: 'br.1', season: '2020' )
65
- ```
66
-
67
- Note: You can find all downloaded match schedules
68
- in your (local) web cache (in `~/.cache/api.football-data.org`) as pretty printed json documents.
69
-
70
-
71
-
72
-
73
- **Step 2 - Convert (Cached) Match Schedules to Records**
74
-
75
- Convert the (cached) match schedules
76
- in JSON to the one-line, one-match & one-file, one-season
77
- "standard" [Football.CSV format](https://github.com/footballcsv). Example:
78
-
79
- ``` ruby
80
- require 'football/sources'
81
-
82
- ['eng.1', 'eng.2',
83
- 'de.1',
84
- 'es.1',
85
- 'fr.1',
86
- 'it.1',
87
- 'nl.1',
88
- 'pt.1',
89
- 'cl',
90
- ].each do |league|
91
- Footballdata.convert( league: league, season: '2020/21' )
92
- end
93
-
94
- Footballdata.convert( league: 'br.1', season: '2020' )
95
- ```
96
-
97
- Note: By default all datasets get written into the `./o`
98
- directory. Use `Footballdata.config.convert.out_dir`
99
- to change the output directory.
100
-
101
- The English Premier League (`eng.1`) results in `./o/2020-21/eng.1.csv`:
102
-
103
- ```
104
- Matchday,Date,Team 1,FT,HT,Team 2,Comments
105
- 1,Sun Sep 13 2020,Manchester City FC,(*),,Aston Villa FC,postponed
106
- 1,Sun Sep 13 2020,Burnley FC,(*),,Manchester United FC,postponed
107
- 1,Sat Sep 12 2020,Fulham FC,0-3,0-1,Arsenal FC,
108
- 1,Sat Sep 12 2020,Crystal Palace FC,1-0,1-0,Southampton FC,
109
- 1,Sat Sep 12 2020,Liverpool FC,4-3,3-2,Leeds United FC,
110
- 1,Sat Sep 12 2020,West Ham United FC,0-2,0-0,Newcastle United FC,
111
- 1,Sun Sep 13 2020,West Bromwich Albion FC,0-3,0-0,Leicester City FC,
112
- 1,Sun Sep 13 2020,Tottenham Hotspur FC,0-1,0-0,Everton FC,
113
- 1,Mon Sep 14 2020,Sheffield United FC,0-2,0-2,Wolverhampton Wanderers FC,
114
- 1,Mon Sep 14 2020,Brighton & Hove Albion FC,1-3,0-1,Chelsea FC,
115
- 2,Sat Sep 19 2020,Everton FC,5-2,2-1,West Bromwich Albion FC,
116
- 2,Sat Sep 19 2020,Leeds United FC,4-3,2-1,Fulham FC,
117
- 2,Sat Sep 19 2020,Manchester United FC,1-3,0-1,Crystal Palace FC,
118
- 2,Sat Sep 19 2020,Arsenal FC,2-1,1-1,West Ham United FC,
119
- 2,Sun Sep 20 2020,Southampton FC,2-5,1-1,Tottenham Hotspur FC,
120
- 2,Sun Sep 20 2020,Newcastle United FC,0-3,0-2,Brighton & Hove Albion FC,
121
- 2,Sun Sep 20 2020,Chelsea FC,0-2,0-0,Liverpool FC,
122
- 2,Sun Sep 20 2020,Leicester City FC,4-2,1-1,Burnley FC,
123
- 2,Mon Sep 21 2020,Aston Villa FC,1-0,0-0,Sheffield United FC,
124
- 2,Mon Sep 21 2020,Wolverhampton Wanderers FC,1-3,0-2,Manchester City FC,
125
- ...
126
- ```
127
-
128
- Or the Brasileirão (`br.1`) in `./o/2020/br.1.csv`:
129
-
130
- ```
131
- Matchday,Date,Team 1,FT,HT,Team 2,Comments
132
- 1,Sat Aug 8 2020,Fortaleza EC,0-2,0-2,CA Paranaense,
133
- 1,Sat Aug 8 2020,Coritiba FBC,0-1,0-0,SC Internacional,
134
- 1,Sun Aug 9 2020,SC Recife,3-2,3-1,Ceará SC,
135
- 1,Sun Aug 9 2020,Santos FC,1-1,0-0,RB Bragantino,
136
- 1,Sun Aug 9 2020,CR Flamengo,0-1,0-1,CA Mineiro,
137
- 1,Sun Aug 9 2020,Goiás EC,(*),,São Paulo FC,postponed
138
- 1,Sun Aug 9 2020,Grêmio FBPA,1-0,1-0,Fluminense FC,
139
- 1,Sun Aug 9 2020,SE Palmeiras,(*),,CR Vasco da Gama,postponed
140
- 2,Wed Aug 12 2020,CA Mineiro,3-2,0-2,SC Corinthians Paulista,
141
- 2,Wed Aug 12 2020,CA Paranaense,2-1,1-1,Goiás EC,
142
- 2,Wed Aug 12 2020,RB Bragantino,1-1,1-0,Botafogo FR,
143
- 2,Wed Aug 12 2020,AC Goianiense,3-0,2-0,CR Flamengo,
144
- 2,Wed Aug 12 2020,EC Bahia,1-0,1-0,Coritiba FBC,
145
- 2,Thu Aug 13 2020,Fluminense FC,1-1,1-1,SE Palmeiras,
146
- 2,Thu Aug 13 2020,Ceará SC,1-1,1-0,Grêmio FBPA,
147
- 2,Thu Aug 13 2020,São Paulo FC,1-0,1-0,Fortaleza EC,
148
- 2,Thu Aug 13 2020,SC Internacional,2-0,0-0,Santos FC,
149
- 2,Thu Aug 13 2020,CR Vasco da Gama,2-0,2-0,SC Recife,
150
- ...
151
- ```
152
-
153
-
154
-
155
- That's it for now. More sources upcoming.
156
-
157
- ## License
158
-
159
- ![](https://publicdomainworks.github.io/buttons/zero88x31.png)
160
-
161
- The `football-sources` scripts are dedicated to the public domain.
162
- Use it as you please with no restrictions whatsoever.
163
-
164
-
165
- ## Questions? Comments?
166
-
167
- Send them along to the
168
- [Open Sports & Friends Forum/Mailing List](http://groups.google.com/group/opensport).
169
- Thanks!
1
+ # football-sources - get football match data (leagues, cups & more) via web pages or web api (json) calls
2
+
3
+
4
+ * home :: [github.com/sportdb/sport.db](https://github.com/sportdb/sport.db)
5
+ * bugs :: [github.com/sportdb/sport.db/issues](https://github.com/sportdb/sport.db/issues)
6
+ * gem :: [rubygems.org/gems/football-sources](https://rubygems.org/gems/football-sources)
7
+ * rdoc :: [rubydoc.info/gems/football-sources](http://rubydoc.info/gems/football-sources)
8
+ * forum :: [groups.google.com/group/opensport](https://groups.google.com/group/opensport)
9
+
10
+
11
+
12
+ ## Usage
13
+
14
+
15
+ To be done.
16
+
17
+
18
+
19
+ ## License
20
+
21
+
22
+ The `football-sources` scripts are dedicated to the public domain.
23
+ Use it as you please with no restrictions whatsoever.
24
+
25
+
26
+
27
+ ## Questions? Comments?
28
+
29
+ Yes, you can. More than welcome.
30
+ See [Help & Support »](https://github.com/openfootball/help)
data/Rakefile CHANGED
@@ -1,31 +1,32 @@
1
- require 'hoe'
2
- require './lib/football-sources/version.rb'
3
-
4
- Hoe.spec 'football-sources' do
5
-
6
- self.version = FootballSources::VERSION
7
-
8
- self.summary = 'football-sources - get football data via web pages or web api (json) calls'
9
- self.description = summary
10
-
11
- self.urls = { home: 'https://github.com/sportdb/sport.db' }
12
-
13
- self.author = 'Gerald Bauer'
14
- self.email = 'opensport@googlegroups.com'
15
-
16
- # switch extension to .markdown for gihub formatting
17
- self.readme_file = 'README.md'
18
- self.history_file = 'CHANGELOG.md'
19
-
20
- self.extra_deps = [
21
- ['webget-football', '>= 0.1.1'],
22
- ['sportdb-catalogs', '>= 1.0.0'],
23
- ]
24
-
25
- self.licenses = ['Public Domain']
26
-
27
- self.spec_extras = {
28
- required_ruby_version: '>= 2.2.2'
29
- }
30
-
31
- end
1
+ require 'hoe'
2
+ require './lib/football-sources/version.rb'
3
+
4
+ Hoe.spec 'football-sources' do
5
+
6
+ self.version = FootballSources::VERSION
7
+
8
+ self.summary = 'football-sources - get football match data (leagues, cups & more) via web pages or web api (json) calls'
9
+ self.description = summary
10
+
11
+
12
+
13
+ self.urls = { home: 'https://github.com/sportdb/sport.db' }
14
+
15
+ self.author = 'Gerald Bauer'
16
+ self.email = 'gerald.bauer@gmail.com'
17
+
18
+ # switch extension to .markdown for gihub formatting
19
+ self.readme_file = 'README.md'
20
+ self.history_file = 'CHANGELOG.md'
21
+
22
+ self.extra_deps = [
23
+ ['sportdb-catalogs'], #, '>= 1.0.0'],
24
+ ]
25
+
26
+ self.licenses = ['Public Domain']
27
+
28
+ self.spec_extras = {
29
+ required_ruby_version: '>= 2.2.2'
30
+ }
31
+
32
+ end
@@ -1,6 +1,6 @@
1
- # note: allow require 'football/sources' too
2
- # (in addition to require 'football-sources')
3
-
4
- require_relative '../football-sources'
5
-
6
-
1
+ # note: allow require 'football/sources' too
2
+ # (in addition to require 'football-sources')
3
+
4
+ require_relative '../football-sources'
5
+
6
+
@@ -1,19 +1,19 @@
1
-
2
- module FootballSources
3
- MAJOR = 0 ## todo: namespace inside version or something - why? why not??
4
- MINOR = 1
5
- PATCH = 0
6
- VERSION = [MAJOR,MINOR,PATCH].join('.')
7
-
8
- def self.version
9
- VERSION
10
- end
11
-
12
- def self.banner
13
- "football-sources/#{VERSION} on Ruby #{RUBY_VERSION} (#{RUBY_RELEASE_DATE}) [#{RUBY_PLATFORM}]"
14
- end
15
-
16
- def self.root
17
- File.expand_path( File.dirname(File.dirname(File.dirname(__FILE__))) )
18
- end
19
- end # module FootballSources
1
+
2
+ module FootballSources
3
+ MAJOR = 0 ## todo: namespace inside version or something - why? why not??
4
+ MINOR = 1
5
+ PATCH = 1
6
+ VERSION = [MAJOR,MINOR,PATCH].join('.')
7
+
8
+ def self.version
9
+ VERSION
10
+ end
11
+
12
+ def self.banner
13
+ "football-sources/#{VERSION} on Ruby #{RUBY_VERSION} (#{RUBY_RELEASE_DATE}) [#{RUBY_PLATFORM}]"
14
+ end
15
+
16
+ def self.root
17
+ File.expand_path( File.dirname(File.dirname(File.dirname(__FILE__))) )
18
+ end
19
+ end # module FootballSources
@@ -1,57 +1,16 @@
1
- require 'webget/football'
2
-
3
-
4
- # require 'sportdb/formats' ## for Season etc.
5
- require 'sportdb/catalogs' ## note: incl. deps csvreader etc.
6
-
7
-
8
-
9
- #############
10
- ## todo/fix: reuse a "original" CsvMatchWriter
11
- ## how? why? why not?
12
- ###############
13
- module Cache
14
- class CsvMatchWriter
15
-
16
- def self.csv_encode( values )
17
- ## quote values that incl. a comma
18
- values.map do |value|
19
- if value.index(',')
20
- puts "** rec with field with comma >#{value}< in:"
21
- pp values
22
- %Q{"#{value}"}
23
- else
24
- value
25
- end
26
- end.join( ',' )
27
- end
28
-
29
- def self.write( path, recs, headers: )
30
- ## for convenience - make sure parent folders/directories exist
31
- FileUtils.mkdir_p( File.dirname( path )) unless Dir.exist?( File.dirname( path ))
32
-
33
- File.open( path, 'w:utf-8' ) do |f|
34
- f.write( headers.join(',')) ## e.g. Date,Team 1,FT,HT,Team 2
35
- f.write( "\n" )
36
- recs.each do |values|
37
- f.write( csv_encode( values ))
38
- f.write( "\n" )
39
- end
40
- end
41
- end
42
- end # class CsvMatchWriter
43
- end # module Cache
44
-
45
-
46
-
47
-
48
- ###
49
- # our own code
50
- require 'football-sources/version' # let version always go first
51
-
52
- require 'football-sources/apis'
53
- require 'football-sources/worldfootball'
54
- require 'football-sources/fbref'
55
-
56
-
57
- puts FootballSources.banner # say hello
1
+
2
+
3
+ # require 'sportdb/formats' ## for Season etc.
4
+ require 'sportdb/catalogs' ## note: incl. deps csvreader etc.
5
+
6
+
7
+
8
+
9
+
10
+
11
+ ###
12
+ # our own code
13
+ require_relative 'football-sources/version' # let version always go first
14
+
15
+
16
+ puts FootballSources.banner # say hello
metadata CHANGED
@@ -1,43 +1,29 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: football-sources
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Gerald Bauer
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-11-21 00:00:00.000000000 Z
11
+ date: 2024-07-04 00:00:00.000000000 Z
12
12
  dependencies:
13
- - !ruby/object:Gem::Dependency
14
- name: webget-football
15
- requirement: !ruby/object:Gem::Requirement
16
- requirements:
17
- - - ">="
18
- - !ruby/object:Gem::Version
19
- version: 0.1.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.1.1
27
13
  - !ruby/object:Gem::Dependency
28
14
  name: sportdb-catalogs
29
15
  requirement: !ruby/object:Gem::Requirement
30
16
  requirements:
31
17
  - - ">="
32
18
  - !ruby/object:Gem::Version
33
- version: 1.0.0
19
+ version: '0'
34
20
  type: :runtime
35
21
  prerelease: false
36
22
  version_requirements: !ruby/object:Gem::Requirement
37
23
  requirements:
38
24
  - - ">="
39
25
  - !ruby/object:Gem::Version
40
- version: 1.0.0
26
+ version: '0'
41
27
  - !ruby/object:Gem::Dependency
42
28
  name: rdoc
43
29
  requirement: !ruby/object:Gem::Requirement
@@ -64,17 +50,17 @@ dependencies:
64
50
  requirements:
65
51
  - - "~>"
66
52
  - !ruby/object:Gem::Version
67
- version: '3.22'
53
+ version: '4.1'
68
54
  type: :development
69
55
  prerelease: false
70
56
  version_requirements: !ruby/object:Gem::Requirement
71
57
  requirements:
72
58
  - - "~>"
73
59
  - !ruby/object:Gem::Version
74
- version: '3.22'
75
- description: football-sources - get football data via web pages or web api (json)
76
- calls
77
- email: opensport@googlegroups.com
60
+ version: '4.1'
61
+ description: football-sources - get football match data (leagues, cups & more) via
62
+ web pages or web api (json) calls
63
+ email: gerald.bauer@gmail.com
78
64
  executables: []
79
65
  extensions: []
80
66
  extra_rdoc_files:
@@ -87,33 +73,13 @@ files:
87
73
  - README.md
88
74
  - Rakefile
89
75
  - lib/football-sources.rb
90
- - lib/football-sources/apis.rb
91
- - lib/football-sources/apis/config.rb
92
- - lib/football-sources/apis/convert.rb
93
- - lib/football-sources/apis/convert_cl.rb
94
- - lib/football-sources/apis/mods.rb
95
- - lib/football-sources/apis/stat.rb
96
- - lib/football-sources/fbref.rb
97
- - lib/football-sources/fbref/build.rb
98
- - lib/football-sources/fbref/config.rb
99
- - lib/football-sources/fbref/convert.rb
100
76
  - lib/football-sources/version.rb
101
- - lib/football-sources/worldfootball.rb
102
- - lib/football-sources/worldfootball/build.rb
103
- - lib/football-sources/worldfootball/config.rb
104
- - lib/football-sources/worldfootball/convert.rb
105
- - lib/football-sources/worldfootball/convert_reports.rb
106
- - lib/football-sources/worldfootball/jobs.rb
107
- - lib/football-sources/worldfootball/mods.rb
108
- - lib/football-sources/worldfootball/vacuum.rb
109
77
  - lib/football/sources.rb
110
- - test/helper.rb
111
- - test/test_version.rb
112
78
  homepage: https://github.com/sportdb/sport.db
113
79
  licenses:
114
80
  - Public Domain
115
81
  metadata: {}
116
- post_install_message:
82
+ post_install_message:
117
83
  rdoc_options:
118
84
  - "--main"
119
85
  - README.md
@@ -130,9 +96,9 @@ required_rubygems_version: !ruby/object:Gem::Requirement
130
96
  - !ruby/object:Gem::Version
131
97
  version: '0'
132
98
  requirements: []
133
- rubyforge_project:
134
- rubygems_version: 2.5.2
135
- signing_key:
99
+ rubygems_version: 3.4.10
100
+ signing_key:
136
101
  specification_version: 4
137
- summary: football-sources - get football data via web pages or web api (json) calls
102
+ summary: football-sources - get football match data (leagues, cups & more) via web
103
+ pages or web api (json) calls
138
104
  test_files: []
@@ -1,17 +0,0 @@
1
-
2
- module Footballdata
3
-
4
- ### add some more config options / settings
5
- class Configuration
6
- #########
7
- ## nested configuration classes - use - why? why not?
8
- class Convert
9
- def out_dir() @out_dir || './o'; end
10
- def out_dir=(value) @out_dir = value; end
11
- end
12
-
13
- def convert() @convert ||= Convert.new; end
14
- end # class Configuration
15
-
16
-
17
- end # module Footballdata