This is the code repository that powers the radiodns.uk website. The website is a directory listing of all the radio stations in the United Kingdom which have RadioDNS Hybrid Radio services available. Transmitter and DAB multiple information comes from Ofcom.
The steps to build the site are:
- Load the list of TV Anytime genre files into the database
- Load the Transmitter Parameters spreadsheet from Ofcom into the database
- For each service on FM and DAB, lookup the Authoritative FQDN using radiodns.org
- For each Authoritative FQDN, attempt to load the Service Information (SI.xml) file
These are the key files and directories that make up the project:
GemfileUsed by Bundler to list all the dependencies for this project
Rakefileparent rake file, describing build tasks. Run
rake -Tto list all the tasks
ansiblecontains an Ansible playbook, used to deploy the application to the live server
app.rbthe main web server application and top level router
binvarious ruby scripts, used to generate the site
db.rbthis is used to initialise Sequel and sets the
genrescollection of JSON files, mapping TV Anytime genre IDs to genre names
helpers.rbview helpers - methods to generate HTML to make the view code simpler
migrateSequel database migration files that create/update the database schema
modelsdirectory containing the Sequel database models
models.rbrequire this file to setup Sequel and load all the database models
publicstatic files served directly by the HTTP server
SI.xmlfiles are downloaded to this directory
routesdirectory containing route files (controllers) for main part of application
specRspec files to run tests against the application and model code
tasksdirectory containing Rake task files
viewsErubi templates for the the HTML and XML pages
You may need to install a recent version of Ruby on your computer before you can run the scripts.
To perform the geographic calculations on the transmitter locations, you also need Python 2.7 and the GDAL library.
To install GDAL on a Mac run:
$ brew install gdal
To install GDAL on Debian/Ubuntu run:
$ apt-get install python-gdal
Then make sure you have ruby Bundler installed:
$ gem install bundler
And install all the dependencies:
$ bundle install
To initialise the database run:
$ bundle exec rake db:migrate
Then fill it up with data using:
$ bundle exec rake load:all
rake -T to see a list of the individual tasks:
$ bundle exec rake -T rake clean # Deleted all the generated files (based on .gitignore) rake db:annotate # Annotate Sequel models rake db:migrate # Migrate database to latest version rake load:all # Load all data into the database rake load:authorities # Load authority information for each bearer from ra... rake load:genres # Load TVA genre data into the database rake load:ofcom # Load Ofcom data into the database rake load:si # Load SI files into the database rake publish # Publish the local SQLite database to the web server rake spec # Run RSpec code examples
You can then run a local webserver using:
$ bundle exec shotgun
Shotgun will reload the application after every request, which makes development much easier.
And then open the following URL in your browser: http://localhost:9393/
Bug reports and pull requests are welcome on GitHub at https://github.com/njh/radiodns-uk. This project is intended to be a safe and welcoming space for collaboration. Contributors are expected to adhere to the Contributor Covenant code of conduct.
The gem is available as open source under the terms of the MIT License.