Hello,
The plain text football fixtures for leagues, teams, match
schedules, stadiums, and more that you can read with the sportdb gem
into your SQL database of choice now includes the 2015/16 seasons for
the English Premier League [1], the Deutsche Bundesliga [2], and more.
Any league missing? Add your league.
Use Datafiles [3] to build youself a copy e.g.
$ sportdb new en2015-16 # just the 2015-16 season, please
$ sportdb new en # all seasons
All data, code and samples public domain. Enjoy the beautiful game. Cheers.
PS: A datafile is - of course just a mini-language in Ruby to list
the datasets. Example - en.rb:
···
##########################################
# Datafile for English Premier Leagues
#
# use
# $ sportdb new en
world 'world.db', setup: 'countries'
football 'eng-england'
[1] https://github.com/openfootball/eng-england/tree/master/2015-16
[2] https://github.com/openfootball/de-deutschland/tree/master/2015-16
[3] https://github.com/openfootball/datafile
Hello,
I've put together a new sport.db (football.db) quick starter sample
using the Mauritius Premier League [1] to get you started creating
your own leagues/cups/etc. from scratch.
You can test drive the quick starter sample with a single command e.g.
$ sportdb build
Will use the bundled datafile (e.g. build script in Ruby):
inline do
Country.parse 'mu', 'Mauritius', 'MUS', '2_040 km²', '1_261_200'
end
football 'mu-mauritius'
To start from scratch follow these six steps:
- Step 1: Add all leagues
- Step 2: Add all clubs
- Step 3: Add all match fixtures and results
- Step 4: Add the league season "front matter" settings
- Step 5: Add a setups file list (also known as manifest)
- Step 6: Add a datafile build script - That's it. Done.
Using a file structure like:
├── 2014-15 # 2014-15 season folder
> ├── league-i.txt # match fixtures / results - matchdays 1-18
> ├── league-ii.txt # - matchdays 19-36
> └── league.yml # "front matter" settings
├── setups
> └── all.txt # file list (manifest)
├── leagues.txt # all leagues
├── clubs.txt # all clubs
└── Datafile # build script
That's it. Now try:
$ sqlite3 sport.db
SQLite version 3.7.16
Enter ".help" for instructions
Enter SQL statements terminated with a ";"
> select * from countries;
1|Mauritius|mauritius|mu|1|MUS|||1261200|2040|||f|t|f|f|
> select * from teams;
1|joachim|Cercle de Joachim||CDJ|Cercle de Joachim SC|Joachim|1||t|||||f|
2|chamarel|Chamarel SC||CHA|Chamarel|Chamarel Sport Club|1||t|||||f|
and so on and so forth. Cheers.
[1] GitHub - openfootball/league-starter: football.db league quick starter sample - start your own leagues & cups
Hello,
FYI: All top league match schedules and clubs are now for your
convenience also available in (auto)-generated JSON files in the new
/football.json repo [1] - no API key required - e.g.
2015-16/en.1.json [2] includes the complete English Premier League
(EPL) match schedule with results (scores) as time flies by and
2015-16/en.1.clubs.json [3], includes all 20 football clubs.
Cheers.
PS: Generating JSON in Ruby is fun The code e.g.:
league.events.each do |event|
clubs = []
event.teams.each do |team|
clubs << { key: team.key, name: team.title, code: team.code }
end
h = { name: event.title, clubs: clubs }
JSON.pretty_generate( h )
rounds = []
event.rounds.each do |round|
matches = []
round.matches.each do |match|
matches << { date: match.play_at.strftime( '%Y-%m-%d'),
team1: {
key: match.team1.key,
name: match.team1.title,
code: match.team1.code
},
team2: {
key: match.team2.key,
name: match.team2.title,
code: match.team2.code
},
score1: match.score1,
score2: match.score2 }
end
rounds << { name: round.title, matches: matches }
end
h = { name: event.title, rounds: rounds }
JSON.pretty_generate( h )
[1] https://github.com/openfootball/football.json
[2] https://github.com/openfootball/football.json/blob/master/2015-16/en.1.json
[3] https://github.com/openfootball/football.json/blob/master/2015-16/en.1.clubs.json