rsssf 0.0.1 → 0.2.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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: 0e916c424ef3d9ebd62d5c2fb1e09122806c5765
4
- data.tar.gz: 232f06dea9fd3f878e554b1d4a2029531468f842
2
+ SHA256:
3
+ metadata.gz: 92c74803ad71cb9cac8376ef3e0e01890352fc0a0edb01208eab3a9c41f60767
4
+ data.tar.gz: 874bdc292143352c88e23b44ed23abb98312d4afd2fd2cc797d078bce1eef0ed
5
5
  SHA512:
6
- metadata.gz: 898399cdcedd7890145278b17d6d7ab5d8f305160513def86152b69a345de5c19ddb4e2e770753c091216c203bf31a3bd2bd70ca33b0087a8d003292cdd97acf
7
- data.tar.gz: 0b76813d36aee3c59a83c2dfce1d916ee4677da585d52464a531dc2563e5bf96d33b345afe766bb4af962c03f4abcfed0a5b8523e485c85c7e85e406fd9ab8c6
6
+ metadata.gz: 0cc04f3a78663d870ed8a4d5b77813a1601e49a67fe3ea9265972f8da5b43b88adde78d184bedc320edb29439d7abb6439e6b045181bedea48c6d6be037d1a86
7
+ data.tar.gz: e92c7acc956eacd756665e83baee9373cf2af422da5deddd51e91e1266d7498e005a8d0b2e88868a23b3929c7b1900ef5bf20c7bd02e260bd07152e3e53d850a
@@ -1,3 +1,5 @@
1
+ ### 0.2.0
2
+
1
3
  ### 0.0.1 / 2015-09-15
2
4
 
3
5
  * Everything is new. First release
data/Manifest.txt CHANGED
@@ -1,6 +1,14 @@
1
- HISTORY.md
1
+ CHANGELOG.md
2
2
  Manifest.txt
3
3
  README.md
4
4
  Rakefile
5
5
  lib/rsssf.rb
6
+ lib/rsssf/convert.rb
7
+ lib/rsssf/download.rb
8
+ lib/rsssf/page.rb
9
+ lib/rsssf/repo.rb
10
+ lib/rsssf/reports/page.rb
11
+ lib/rsssf/reports/schedule.rb
12
+ lib/rsssf/schedule.rb
13
+ lib/rsssf/utils.rb
6
14
  lib/rsssf/version.rb
data/README.md CHANGED
@@ -1,24 +1,210 @@
1
1
  # rsssf - tools 'n' scripts for RSSSF (Rec.Sport.Soccer Statistics Foundation) archive data
2
2
 
3
3
 
4
- * home :: [github.com/sportdb/rsssf](https://github.com/sportdb/mrhyde)
5
- * bugs :: [github.com/sportdb/rsssf/issues](https://github.com/sportdb/rsssf/issues)
4
+ * home :: [github.com/sportdb/sport.db.sources](https://github.com/sportdb/sport.db.sources)
5
+ * bugs :: [github.com/sportdb/sport.db.sources/issues](https://github.com/sportdb/sport.db.sources/issues)
6
6
  * gem :: [rubygems.org/gems/rsssf](https://rubygems.org/gems/rsssf)
7
7
  * rdoc :: [rubydoc.info/gems/rsssf](http://rubydoc.info/gems/rsssf)
8
- * forum :: [opensport](http://groups.google.com/group/opensport)
8
+
9
+
10
+
11
+
12
+ ## What's the Rec.Sport.Soccer Statistics Foundation (RSSSF)?
13
+
14
+ The RSSSF collects and offers football (soccer) league tables, match results and more
15
+ from all over the world online in plain text. Example:
16
+
17
+ ```
18
+ Round 1
19
+ [May 25]
20
+ Vasco da Gama 1-0 Portuguesa
21
+ [Carlos Tenório 47']
22
+ Vitória 2-2 Internacional
23
+ [Maxi Biancucchi 2', Gabriel Paulista 11'; Diego Forlán 29', Fred 63']
24
+ Corinthians 1-1 Botafogo
25
+ [Paulinho 73'; Rafael Marques 24']
26
+ [May 26]
27
+ Grêmio 2-0 Náutico [played in Caxias do Sul-RS]
28
+ [Zé Roberto 15', Elano 70']
29
+ Ponte Preta 0-2 São Paulo
30
+ [Lúcio 9', Jádson 44'p]
31
+ Criciúma 3-1 Bahia
32
+ [Matheus Ferraz 45'+1', Lins 46', João Vítor 82'; Diones 72']
33
+ Santos 0-0 Flamengo [played in Brasília-DF]
34
+ Fluminense 2-1 Atlético/PR [played in Macaé-RJ]
35
+ [Rafael Sóbis 15'p, Samuel 53'; Manoel 28']
36
+ Cruzeiro 5-0 Goiás
37
+ [Diego Souza 5', Bruno Rodrigo 30', Nílton 40',79', Borges 42']
38
+ Coritiba 2-1 Atlético/MG
39
+ [Deivid 53', Arthur 90'+1'; Diego Tardelli 51']
40
+ ```
41
+
42
+ [Find out more about the Rec.Sport.Soccer Statistics Foundation (RSSSF) »](http://www.rsssf.com)
43
+
9
44
 
10
45
 
11
46
  ## Usage
12
47
 
13
- To be done
48
+
49
+ ### Download (and Cache ) Pages
50
+
51
+ To download (and cache) pages from the world wide web use:
52
+
53
+ ``` ruby
54
+ Rsssf.download_page( 'https://rsssf.org/tablese/eng2024.html',
55
+ encoding: 'Windows-1252' )
56
+
57
+ Rsssf.download_page( 'https://rsssf.org/tablesb/braz2024.html',
58
+ encoding: 'Windows-1252' )
59
+ ```
60
+
61
+ Note: Most pages on rsssf.org use the Windows-1252 (character) encoding.
62
+ To "auto-magically" convert to unicode (utf-8)
63
+ add the encoding option (default is `UTF-8`).
64
+
65
+ Or as a convenience shortcut download (pre-configured table) pages by country code (e.g `eng` - England, `es` - Spain (España), `de` - Germany (Deutschland), `br` - Brazil (Brasil) etc.)
66
+ and season (e.g. `2023/24` or `2024` etc.)
67
+
68
+ ``` ruby
69
+ Rsssf.download_table( 'eng', season: '2023/24' )
70
+
71
+ Rsssf.download_table( 'br', season: '2024' )
72
+ ```
73
+
74
+
75
+ Note: The rsssf machinery uses a built-in web cache. All downloads get "auto-magically" cached (in `./cache/rsssf.org`).
76
+
77
+
78
+
79
+ ### Working with Pages
80
+
81
+
82
+ Note: The `RsssfPage` machinery will convert the rsssf archive page
83
+ from hypertext (HTML) to plain text e.g.
84
+
85
+ ```
86
+ <hr>
87
+ <a href="#premier">Premier League</A><br>
88
+ <a href="#cups">Cup Tournaments</A><br>
89
+ <a href="#champ">Championship</A><br>
90
+ <a href="#first">Division 1</A><br>
91
+ <a href="#second">Division 2</A><br>
92
+ <a href="#conf">Conference</A>
93
+ <hr>
94
+ <h4><a name="premier">Premier League</A></h4>
95
+ <pre>
96
+ Final Table:
97
+
98
+ 1.Chelsea 38 26 9 3 73-32 87 Champions
99
+ 2.Manchester City 38 24 7 7 83-38 79
100
+ 3.Arsenal 38 22 9 7 71-36 75
101
+ ...
102
+ ```
103
+
104
+ will become
105
+
106
+ ```
107
+ =-=-=-=-=-=-=-=-=-=-=-=-=-=-=
108
+ ‹Premier League›
109
+ ‹Cup Tournaments›
110
+ ‹Championship›
111
+ ‹Division 1›
112
+ ‹Division 2›
113
+ ‹Conference›
114
+ =-=-=-=-=-=-=-=-=-=-=-=-=-=-=
115
+
116
+ #### Premier League
117
+
118
+
119
+ Final Table:
120
+
121
+ 1.Chelsea 38 26 9 3 73-32 87 Champions
122
+ 2.Manchester City 38 24 7 7 83-38 79
123
+ 3.Arsenal 38 22 9 7 71-36 75
124
+ ...
125
+ ```
126
+
127
+
128
+ ### Working with Repos
129
+
130
+ To fetch pages from the world wide web for many seasons in batch setup and use a repo.
131
+
132
+ Step 1: List all archive pages
133
+
134
+ In the `tables/config.yml` list all archive pages to fetch. Example:
135
+
136
+ ``` yaml
137
+ 2010-11: tablese/eng2011.html
138
+ 2011-12: tablese/eng2012.html
139
+ 2012-13: tablese/eng2013.html
140
+ 2013-14: tablese/eng2014.html
141
+ 2014-15: tablese/eng2015.html
142
+ ```
143
+
144
+ Step 2: Fetch all archive pages
145
+
146
+ Use:
147
+
148
+ ``` ruby
149
+ repo = RsssfRepo.new( './england', title: 'England (and Wales)' )
150
+ repo.fetch_pages
151
+ ```
152
+
153
+ Bonus: To create a summary of all pages fetched (e.g. authors, last_updated, sections, etc.).
154
+ Use:
155
+
156
+ ``` ruby
157
+ repo.make_pages_report
158
+ ```
159
+
160
+ Example - `tables/README.md`:
161
+
162
+
163
+ football.db RSSSF Archive Data Summary for England (and Wales)
164
+
165
+ _Last Update: 2015-11-26 18:22:22 +0200_
166
+
167
+ | Season | File | Authors | Last Updated | Lines (Chars) | Sections |
168
+ | :------ | :------ | :------- | :----------- | ------------: | :------- |
169
+ | 2014-15 | [eng2015.txt](https://github.com/rsssf/eng-england/blob/master/tables/eng2015.txt) | Ian King and Karel Stokkermans | 4 Jun 2015 | 1249 (34138) | Premier League, Cup Tournaments, Championship, Division 1, Division 2, Conference |
170
+ | 2013-14 | [eng2014.txt](https://github.com/rsssf/eng-england/blob/master/tables/eng2014.txt) | Ian King and Karel Stokkermans | 5 Feb 2015 | 1254 (34294) | Premier League, Cup Tournaments, Championship, Division 1, Division 2, Conference |
171
+ | 2012-13 | [eng2013.txt](https://github.com/rsssf/eng-england/blob/master/tables/eng2013.txt) | Karel Stokkermans | 5 Feb 2015 | 1269 (34531) | Premiership, Cup Tournaments, Championship, Division 1, Division 2, Conference |
172
+ | 2011-12 | [eng2012.txt](https://github.com/rsssf/eng-england/blob/master/tables/eng2012.txt) | Karel Stokkermans | 5 Feb 2015 | 691 (21925) | Premiership, Cup Tournaments, Championship, Division 1, Division 2, Conference |
173
+ | 2010-11 | [eng2011.txt](https://github.com/rsssf/eng-england/blob/master/tables/eng2011.txt) | Ian King, Karel Stokkermans and Jan Schoenmakers | 5 Feb 2015 | 959 (37393) | Premiership, Cup Tournaments, Championship, Division 1, Division 2, Conference |
174
+
175
+
176
+ That's it.
177
+
178
+
179
+ ### Preparing Archive Pages for SQL Database Imports (e.g. football.db)
180
+
181
+ To import match schedules (fixtures and results) and more using the football.db machinery
182
+ prepare "simple" single league (or cup) pages with standings tables etc. stripped out.
183
+ For example, to break-out the Premier League and FA Cup from the `eng2015.txt`
184
+ archive page use:
185
+
186
+ ``` ruby
187
+ page = RsssfPage.from_url( 'http://www.rsssf.com/tablese/eng2015.html')
188
+
189
+ schedule = page.find_schedule( header: 'Premier League') ## returns RsssfSchedule obj
190
+ schedule.save( './1-premierleague.txt' )
191
+
192
+ schedule = page.find_schedule( header: 'FA Cup', cup: true )
193
+ schedule.save( './facup.txt' )
194
+ ```
14
195
 
15
196
 
16
197
 
17
- ## Install
198
+ ## RSSSF Datasets
18
199
 
19
- Just install the gem:
200
+ See the rsssf github org for pre-processed ready-to-import datasets. Prepared repos include:
20
201
 
21
- $ gem install rsssf
202
+ - [`england`](https://github.com/rsssf/england) - rsssf archive data for England - Premier League, Championship, FA Cup etc.
203
+ - [`deutschland`](https://github.com/rsssf/deutschland) - rsssf archive data for Germany (Deutschland) - Deutsche Bundesliga, 2. Bundesliga, 3. Liga, DFB Pokal etc.
204
+ - [`espana`](https://github.com/rsssf/espana) - rsssf archive data for España (Spain) - Primera División / La Liga, Copa de Rey, etc.
205
+ - [`austria`](https://github.com/rsssf/austria) - rsssf archive data for Austria (Österreich) - Österr. Bundesliga, Erste Liga, ÖFB Pokal etc.
206
+ - [`brazil`](https://github.com/rsssf/brazil) - rsssf archive data for Brazil (Brasil) - Campeonato Brasileiro Série A / Brasileirão etc.
207
+ - and more
22
208
 
23
209
 
24
210
  ## License
data/Rakefile CHANGED
@@ -8,25 +8,26 @@ Hoe.spec 'rsssf' do
8
8
  self.summary = "rsssf - tools 'n' scripts for RSSSF (Rec.Sport.Soccer Statistics Foundation) archive data"
9
9
  self.description = summary
10
10
 
11
- self.urls = ['https://github.com/sportdb/rsssf']
11
+ self.urls = { home: 'https://github.com/sportdb/sport.db.sources' }
12
12
 
13
13
  self.author = 'Gerald Bauer'
14
- self.email = 'opensport@googlegroups.com'
14
+ self.email = 'gerald.bauer@gmail.com'
15
15
 
16
16
  # switch extension to .markdown for gihub formatting
17
17
  self.readme_file = 'README.md'
18
- self.history_file = 'HISTORY.md'
18
+ self.history_file = 'CHANGELOG.md'
19
19
 
20
20
  self.extra_deps = [
21
- ['logutils'],
22
- ['textutils'],
23
- ['fetcher'],
21
+ ['cocos'],
22
+ ['season-formats'],
23
+ ['rsssf-parser'], ## add rsssf parser machinery & tool
24
24
  ]
25
25
 
26
+
26
27
  self.licenses = ['Public Domain']
27
28
 
28
29
  self.spec_extras = {
29
- required_ruby_version: '>= 1.9.2'
30
+ required_ruby_version: '>= 2.2.2'
30
31
  }
31
32
 
32
33
  end