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 website written in Ruby and uses the Sequel and Roda gems.
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 projectRakefileparent rake file, describing build tasks. Runrake -Tto list all the tasksansiblecontains an Ansible playbook, used to deploy the application to the live serverapp.rbthe main web server application and top level routerbinvarious ruby scripts, used to generate the sitedb.rbthis is used to initialise Sequel and sets theDBconstantgenrescollection of JSON files, mapping TV Anytime genre IDs to genre nameshelpers.rbview helpers - methods to generate HTML to make the view code simplermigrateSequel database migration files that create/update the database schemamodelsdirectory containing the Sequel database modelsmodels.rbrequire this file to setup Sequel and load all the database modelspublicstatic files served directly by the HTTP serversi_filesthe variousSI.xmlfiles are downloaded to this directoryroutesdirectory containing route files (controllers) for main part of applicationspecRspec files to run tests against the application and model codetasksdirectory containing Rake task filesviewsErubi 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
Run 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.