MagicMirror module for Realtime Irish Rail API
JavaScript Python
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
DWD-RealtimeIrishRail.js
LICENSE
README.md
trains.py

README.md

DWD-RealtimeIrishRail

This an extension for the MagicMirror. It is specifically for Irish rail customers, It accesses the Realtime Irish Rail API via a Python SimpleHTTPServer, which makes the request, then parses the response and returns json formatted data to the module for use in the MagicMirror.

This is version 1.0 and therefore not at a stage for widespread use.

Installation

  1. Navigate into your MagicMirror's modules folder and execute git clone https://github.com/archerydwd/DWD-RealtimeIrishRail.git. A new folder will appear.
  2. Change directory into the new folder: cd DWD-RealtimeIrishRail/
  3. Install python: brew install python or yum install python
  4. Install pip: easy_install install pip
  5. Install requests: pip install requests
  6. Install beautiful soup 4: pip install beautifulsoup4
  7. Install xmltodict: pip install xmltodict
  8. Run the SimpleHTTPServer on the pi: python trains.py > /dev/null Or you can set up a cron to do this on reboot: sudo crontab -e append a new line at the bottom of this file with the following line of text: @reboot python /path/to/MagicMirror/DWD-RealtimeIrishRail/trains.py > /dev/null then do a reboot: sudo reboot (to check if the server is running: ps -ef | grep python this should show all running python processes with the trains.py listed, if not then make sure to execute the prior steps)
  9. Add DWD-RealtimeIrishRail to the modules array in the config/config.js (see next step below)

Using the module

To use this module, add it to the modules array in the config/config.js file:

modules: [
	{
		module: 'DWD-RealtimeIrishRail',
		position: 'bottom_bar',	// This can be any of the regions. Best results in bottom_bar or top_bar (if clear of other modules) regions.
		header: 'DWD-RealtimeIrishRail', // This is optional
		config: {
			// See 'Configuration options' for more information.
		}
	}
]

Configuration options

The following properties can be configured:

Option Description
updateInterval The rate (in ms) in which the module will refresh the train data.

Possible values: int
Default value: 60000
httpRequestURL http://127.0.0.1:5554/ (this is the url for the python trains server we just started above)
TrainUrl The api request url for the specific train station that you want to target. API URLs can be found here: http://api.irishrail.ie/realtime/realtime.asmx

Possible values:
  • Dublin Heuston: http://api.irishrail.ie/realtime/realtime.asmx/getStationDataByCodeXML_WithNumMins?StationCode=HSTON&NumMins=60
  • Dublin Connolly: http://api.irishrail.ie/realtime/realtime.asmx/getStationDataByCodeXML_WithNumMins?StationCode=CNLLY&NumMins=60
  • Park West and Cherry Orchard: http://api.irishrail.ie/realtime/realtime.asmx/getStationDataByCodeXML_WithNumMins?StationCode=CHORC&NumMins=60
  • Clondalkin Fonthill: http://api.irishrail.ie/realtime/realtime.asmx/getStationDataByCodeXML_WithNumMins?StationCode=CLDKN&NumMins=60
  • Adamstown: http://api.irishrail.ie/realtime/realtime.asmx/getStationDataByCodeXML_WithNumMins?StationCode=ADMTN&NumMins=60
  • Hazelhatch and Celbridge: http://api.irishrail.ie/realtime/realtime.asmx/getStationDataByCodeXML_WithNumMins?StationCode=HZLCH&NumMins=60
  • Sallins and Naas: http://api.irishrail.ie/realtime/realtime.asmx/getStationDataByCodeXML_WithNumMins?StationCode=SALNS&NumMins=60
  • Newbridge: http://api.irishrail.ie/realtime/realtime.asmx/getStationDataByCodeXML_WithNumMins?StationCode=NBRGE&NumMins=60
  • Kildare: http://api.irishrail.ie/realtime/realtime.asmx/getStationDataByCodeXML_WithNumMins?StationCode=KDARE&NumMins=60
  • Athy: http://api.irishrail.ie/realtime/realtime.asmx/getStationDataByCodeXML_WithNumMins?StationCode=ATHY&NumMins=90
  • Carlow: http://api.irishrail.ie/realtime/realtime.asmx/getStationDataByCodeXML_WithNumMins?StationCode=crlow&NumMins=90
  • Muine Bheag: http://api.irishrail.ie/realtime/realtime.asmx/getStationDataByCodeXML_WithNumMins?StationCode=MNEBG&NumMins=90
  • Kilkenny: http://api.irishrail.ie/realtime/realtime.asmx/getStationDataByCodeXML_WithNumMins?StationCode=KKNNY&NumMins=90
  • Thomastown: http://api.irishrail.ie/realtime/realtime.asmx/getStationDataByCodeXML_WithNumMins?StationCode=THTWN&NumMins=90
  • Waterford: http://api.irishrail.ie/realtime/realtime.asmx/getStationDataByCodeXML_WithNumMins?StationCode=WFORD&NumMins=90
  • Monasterevin: http://api.irishrail.ie/realtime/realtime.asmx/getStationDataByCodeXML_WithNumMins?StationCode=MONVN&NumMins=90
  • Portarlington: http://api.irishrail.ie/realtime/realtime.asmx/getStationDataByCodeXML_WithNumMins?StationCode=PTRTN&NumMins=90
  • Portlaoise: http://api.irishrail.ie/realtime/realtime.asmx/getStationDataByCodeXML_WithNumMins?StationCode=PTLSE&NumMins=90
  • Ballybrophy: http://api.irishrail.ie/realtime/realtime.asmx/getStationDataByCodeXML_WithNumMins?StationCode=BBRHY&NumMins=90
  • Templemore: http://api.irishrail.ie/realtime/realtime.asmx/getStationDataByCodeXML_WithNumMins?StationCode=TPMOR&NumMins=90
  • Thurles: http://api.irishrail.ie/realtime/realtime.asmx/getStationDataByCodeXML_WithNumMins?StationCode=THRLS&NumMins=90
  • Limerick Junction: http://api.irishrail.ie/realtime/realtime.asmx/getStationDataByCodeXML_WithNumMins?StationCode=LMRKJ&NumMins=90
  • Tipperary: http://api.irishrail.ie/realtime/realtime.asmx/getStationDataByCodeXML_WithNumMins?StationCode=TIPRY&NumMins=90
  • Cahir: http://api.irishrail.ie/realtime/realtime.asmx/getStationDataByCodeXML_WithNumMins?StationCode=CAHIR&NumMins=90
  • Clonmel: http://api.irishrail.ie/realtime/realtime.asmx/getStationDataByCodeXML_WithNumMins?StationCode=CLMEL&NumMins=90
  • Carrick-on-Suir: http://api.irishrail.ie/realtime/realtime.asmx/getStationDataByCodeXML_WithNumMins?StationCode=CKOSR&NumMins=90
  • Charleville: http://api.irishrail.ie/realtime/realtime.asmx/getStationDataByCodeXML_WithNumMins?StationCode=CVILL&NumMins=90
  • Mallow: http://api.irishrail.ie/realtime/realtime.asmx/getStationDataByCodeXML_WithNumMins?StationCode=MLLOW&NumMins=90
  • Cork: http://api.irishrail.ie/realtime/realtime.asmx/getStationDataByCodeXML_WithNumMins?StationCode=CORK&NumMins=90
  • Little Island: http://api.irishrail.ie/realtime/realtime.asmx/getStationDataByCodeXML_WithNumMins?StationCode=LSLND&NumMins=90
  • Glounthaune: http://api.irishrail.ie/realtime/realtime.asmx/getStationDataByCodeXML_WithNumMins?StationCode=GHANE&NumMins=90
  • Midleton: http://api.irishrail.ie/realtime/realtime.asmx/getStationDataByCodeXML_WithNumMins?StationCode=MDLTN&NumMins=90
  • Fota: http://api.irishrail.ie/realtime/realtime.asmx/getStationDataByCodeXML_WithNumMins?StationCode=FOTA&NumMins=90
  • Carrigaloe: http://api.irishrail.ie/realtime/realtime.asmx/getStationDataByCodeXML_WithNumMins?StationCode=CGLOE&NumMins=90
  • Rushbrooke: http://api.irishrail.ie/realtime/realtime.asmx/getStationDataByCodeXML_WithNumMins?StationCode=RBROK&NumMins=90
  • Cobh: http://api.irishrail.ie/realtime/realtime.asmx/getStationDataByCodeXML_WithNumMins?StationCode=COBH&NumMins=90
  • Banteer: http://api.irishrail.ie/realtime/realtime.asmx/getStationDataByCodeXML_WithNumMins?StationCode=BTEER&NumMins=90
  • Millstreet: http://api.irishrail.ie/realtime/realtime.asmx/getStationDataByCodeXML_WithNumMins?StationCode=MLSRT&NumMins=90
  • Rathmore: http://api.irishrail.ie/realtime/realtime.asmx/getStationDataByCodeXML_WithNumMins?StationCode=RMORE&NumMins=90
  • Killarney: http://api.irishrail.ie/realtime/realtime.asmx/getStationDataByCodeXML_WithNumMins?StationCode=KLRNY&NumMins=90
  • Farranfore: http://api.irishrail.ie/realtime/realtime.asmx/getStationDataByCodeXML_WithNumMins?StationCode=FFORE&NumMins=90
  • Tralee: http://api.irishrail.ie/realtime/realtime.asmx/getStationDataByCodeXML_WithNumMins?StationCode=TRLEE&NumMins=90
  • Limerick (Colbert): http://api.irishrail.ie/realtime/realtime.asmx/getStationDataByCodeXML_WithNumMins?StationCode=LMRCK&NumMins=90
  • Ennis: http://api.irishrail.ie/realtime/realtime.asmx/getStationDataByCodeXML_WithNumMins?StationCode=ENNIS&NumMins=90
  • Gort: http://api.irishrail.ie/realtime/realtime.asmx/getStationDataByCodeXML_WithNumMins?StationCode=GORT&NumMins=90
  • Athenry: http://api.irishrail.ie/realtime/realtime.asmx/getStationDataByCodeXML_WithNumMins?StationCode=ATHRY&NumMins=90
  • Oranmore: http://api.irishrail.ie/realtime/realtime.asmx/getStationDataByCodeXML_WithNumMins?StationCode=ORNMR&NumMins=90
  • Galway: http://api.irishrail.ie/realtime/realtime.asmx/getStationDataByCodeXML_WithNumMins?StationCode=GALWY&NumMins=90
  • Roscrea: http://api.irishrail.ie/realtime/realtime.asmx/getStationDataByCodeXML_WithNumMins?StationCode=RCREA&NumMins=90
  • Cloughjordan: http://api.irishrail.ie/realtime/realtime.asmx/getStationDataByCodeXML_WithNumMins?StationCode=CJRDN&NumMins=90
  • Nenagh: http://api.irishrail.ie/realtime/realtime.asmx/getStationDataByCodeXML_WithNumMins?StationCode=NNAGH&NumMins=90
  • Birdhill: http://api.irishrail.ie/realtime/realtime.asmx/getStationDataByCodeXML_WithNumMins?StationCode=BHILL&NumMins=90
  • Tullamore: http://api.irishrail.ie/realtime/realtime.asmx/getStationDataByCodeXML_WithNumMins?StationCode=TMORE&NumMins=90
  • Clara: http://api.irishrail.ie/realtime/realtime.asmx/getStationDataByCodeXML_WithNumMins?StationCode=CLARA&NumMins=90
  • Athlone: http://api.irishrail.ie/realtime/realtime.asmx/getStationDataByCodeXML_WithNumMins?StationCode=ATLNE&NumMins=90
  • Ballinasloe: http://api.irishrail.ie/realtime/realtime.asmx/getStationDataByCodeXML_WithNumMins?StationCode=BSLOE&NumMins=90
  • Woodlawn: http://api.irishrail.ie/realtime/realtime.asmx/getStationDataByCodeXML_WithNumMins?StationCode=WLAWN&NumMins=90
  • Attymon: http://api.irishrail.ie/realtime/realtime.asmx/getStationDataByCodeXML_WithNumMins?StationCode=ATMON&NumMins=90
  • Roscommon: http://api.irishrail.ie/realtime/realtime.asmx/getStationDataByCodeXML_WithNumMins?StationCode=RSCMN&NumMins=90
  • Castlerea: http://api.irishrail.ie/realtime/realtime.asmx/getStationDataByCodeXML_WithNumMins?StationCode=CSREA&NumMins=90
  • Ballyhaunis: http://api.irishrail.ie/realtime/realtime.asmx/getStationDataByCodeXML_WithNumMins?StationCode=BYHNS&NumMins=90
  • Claremorris: http://api.irishrail.ie/realtime/realtime.asmx/getStationDataByCodeXML_WithNumMins?StationCode=CLMRS&NumMins=90
  • Manulla Junction: http://api.irishrail.ie/realtime/realtime.asmx/getStationDataByCodeXML_WithNumMins?StationCode=MNLAJ&NumMins=90
  • Castlebar: http://api.irishrail.ie/realtime/realtime.asmx/getStationDataByCodeXML_WithNumMins?StationCode=CLBAR&NumMins=90
  • Westport: http://api.irishrail.ie/realtime/realtime.asmx/getStationDataByCodeXML_WithNumMins?StationCode=WPORT&NumMins=90
  • Foxford: http://api.irishrail.ie/realtime/realtime.asmx/getStationDataByCodeXML_WithNumMins?StationCode=FXFRD&NumMins=90
  • Ballina: http://api.irishrail.ie/realtime/realtime.asmx/getStationDataByCodeXML_WithNumMins?StationCode=BALNA&NumMins=90
  • Rosslare Europort: http://api.irishrail.ie/realtime/realtime.asmx/getStationDataByCodeXML_WithNumMins?StationCode=RLEPT&NumMins=90
  • Rosslare Strand: http://api.irishrail.ie/realtime/realtime.asmx/getStationDataByCodeXML_WithNumMins?StationCode=RLSTD&NumMins=90
  • Wexford: http://api.irishrail.ie/realtime/realtime.asmx/getStationDataByCodeXML_WithNumMins?StationCode=WXFRD&NumMins=90
  • Enniscorthy: http://api.irishrail.ie/realtime/realtime.asmx/getStationDataByCodeXML_WithNumMins?StationCode=ECRTY&NumMins=90
  • Gorey: http://api.irishrail.ie/realtime/realtime.asmx/getStationDataByCodeXML_WithNumMins?StationCode=GOREY&NumMins=90
  • Arklow: http://api.irishrail.ie/realtime/realtime.asmx/getStationDataByCodeXML_WithNumMins?StationCode=ARKLW&NumMins=90
  • Rathdrum: http://api.irishrail.ie/realtime/realtime.asmx/getStationDataByCodeXML_WithNumMins?StationCode=RDRUM&NumMins=90
  • Wicklow: http://api.irishrail.ie/realtime/realtime.asmx/getStationDataByCodeXML_WithNumMins?StationCode=WLOW&NumMins=90
  • Kilcoole: http://api.irishrail.ie/realtime/realtime.asmx/getStationDataByCodeXML_WithNumMins?StationCode=KCOOL&NumMins=90
  • Greystones: http://api.irishrail.ie/realtime/realtime.asmx/getStationDataByCodeXML_WithNumMins?StationCode=GSTNS&NumMins=90
  • Bray: http://api.irishrail.ie/realtime/realtime.asmx/getStationDataByCodeXML_WithNumMins?StationCode=BRAY&NumMins=90
  • Shankill: http://api.irishrail.ie/realtime/realtime.asmx/getStationDataByCodeXML_WithNumMins?StationCode=SKILL&NumMins=90
  • Killiney: http://api.irishrail.ie/realtime/realtime.asmx/getStationDataByCodeXML_WithNumMins?StationCode=KILNY&NumMins=90
  • Dalkey: http://api.irishrail.ie/realtime/realtime.asmx/getStationDataByCodeXML_WithNumMins?StationCode=DLKEY&NumMins=90
  • Glenageary: http://api.irishrail.ie/realtime/realtime.asmx/getStationDataByCodeXML_WithNumMins?StationCode=GLGRY&NumMins=90
  • Sandycove: http://api.irishrail.ie/realtime/realtime.asmx/getStationDataByCodeXML_WithNumMins?StationCode=SCOVE&NumMins=90
  • Dun Laoghaire: http://api.irishrail.ie/realtime/realtime.asmx/getStationDataByCodeXML_WithNumMins?StationCode=DLERY&NumMins=90
  • Salthill: http://api.irishrail.ie/realtime/realtime.asmx/getStationDataByCodeXML_WithNumMins?StationCode=SHILL&NumMins=90
  • Dublin Pearse: http://api.irishrail.ie/realtime/realtime.asmx/getStationDataByCodeXML_WithNumMins?StationCode=PERSE&NumMins=90
  • Tara Street: http://api.irishrail.ie/realtime/realtime.asmx/getStationDataByCodeXML_WithNumMins?StationCode=TARA&NumMins=90
  • Docklands: http://api.irishrail.ie/realtime/realtime.asmx/getStationDataByCodeXML_WithNumMins?StationCode=DCKLS&NumMins=90
  • Drumcondra: http://api.irishrail.ie/realtime/realtime.asmx/getStationDataByCodeXML_WithNumMins?StationCode=DCDRA&NumMins=90
  • Broombridge: http://api.irishrail.ie/realtime/realtime.asmx/getStationDataByCodeXML_WithNumMins?StationCode=BBRDG&NumMins=90
  • Ashtown: http://api.irishrail.ie/realtime/realtime.asmx/getStationDataByCodeXML_WithNumMins?StationCode=ASHTN&NumMins=90
  • Navan Road Parkway: http://api.irishrail.ie/realtime/realtime.asmx/getStationDataByCodeXML_WithNumMins?StationCode=PHNPK&NumMins=90
  • Castleknock: http://api.irishrail.ie/realtime/realtime.asmx/getStationDataByCodeXML_WithNumMins?StationCode=CNOCK&NumMins=90
  • Coolmine: http://api.irishrail.ie/realtime/realtime.asmx/getStationDataByCodeXML_WithNumMins?StationCode=CMINE&NumMins=90
  • Clonsilla: http://api.irishrail.ie/realtime/realtime.asmx/getStationDataByCodeXML_WithNumMins?StationCode=CLSLA&NumMins=90
  • Leixlip (Confey): http://api.irishrail.ie/realtime/realtime.asmx/getStationDataByCodeXML_WithNumMins?StationCode=LXCON&NumMins=90
  • Leixlip (Louisa Bridge): http://api.irishrail.ie/realtime/realtime.asmx/getStationDataByCodeXML_WithNumMins?StationCode=LXLSA&NumMins=90
  • Maynooth: http://api.irishrail.ie/realtime/realtime.asmx/getStationDataByCodeXML_WithNumMins?StationCode=MYNTH&NumMins=90
  • Kilcock: http://api.irishrail.ie/realtime/realtime.asmx/getStationDataByCodeXML_WithNumMins?StationCode=KCOCK&NumMins=90
  • Enfield: http://api.irishrail.ie/realtime/realtime.asmx/getStationDataByCodeXML_WithNumMins?StationCode=ENFLD&NumMins=90
  • Mullingar: http://api.irishrail.ie/realtime/realtime.asmx/getStationDataByCodeXML_WithNumMins?StationCode=MLGAR&NumMins=90
  • Edgeworthstown: http://api.irishrail.ie/realtime/realtime.asmx/getStationDataByCodeXML_WithNumMins?StationCode=ETOWN&NumMins=90
  • Longford: http://api.irishrail.ie/realtime/realtime.asmx/getStationDataByCodeXML_WithNumMins?StationCode=LFORD&NumMins=90
  • Dromod: http://api.irishrail.ie/realtime/realtime.asmx/getStationDataByCodeXML_WithNumMins?StationCode=DRMOD&NumMins=90
  • Carrick on Shannon: http://api.irishrail.ie/realtime/realtime.asmx/getStationDataByCodeXML_WithNumMins?StationCode=CKOSH&NumMins=90
  • Boyle: http://api.irishrail.ie/realtime/realtime.asmx/getStationDataByCodeXML_WithNumMins?StationCode=BOYLE&NumMins=90
  • Ballymote: http://api.irishrail.ie/realtime/realtime.asmx/getStationDataByCodeXML_WithNumMins?StationCode=BMOTE&NumMins=90
  • Collooney: http://api.irishrail.ie/realtime/realtime.asmx/getStationDataByCodeXML_WithNumMins?StationCode=COLNY&NumMins=90
  • Sligo: http://api.irishrail.ie/realtime/realtime.asmx/getStationDataByCodeXML_WithNumMins?StationCode=SLIGO&NumMins=90
  • Hansfield: http://api.irishrail.ie/realtime/realtime.asmx/getStationDataByCodeXML_WithNumMins?StationCode=HAFLD&NumMins=90
  • Dunboyne: http://api.irishrail.ie/realtime/realtime.asmx/getStationDataByCodeXML_WithNumMins?StationCode=DBYNE&NumMins=90
  • M3 Parkway: http://api.irishrail.ie/realtime/realtime.asmx/getStationDataByCodeXML_WithNumMins?StationCode=M3WAY&NumMins=90
  • Clontarf Road: http://api.irishrail.ie/realtime/realtime.asmx/getStationDataByCodeXML_WithNumMins?StationCode=CTARF&NumMins=90
  • Drogheda: http://api.irishrail.ie/realtime/realtime.asmx/getStationDataByCodeXML_WithNumMins?StationCode=DGHDA&NumMins=90
  • Dundalk: http://api.irishrail.ie/realtime/realtime.asmx/getStationDataByCodeXML_WithNumMins?StationCode=DDALK&NumMins=90

Default value: "http://api.irishrail.ie/realtime/realtime.asmx/getStationDataByCodeXML_WithNumMins?StationCode=crlow&NumMins=90"

Dependencies

  • Python 2.7
  • SimpleHTTPServer named trains.py

The MIT License (MIT)

Copyright © 2016 Darren Daly

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

The software is provided “as is”, without warranty of any kind, express or implied, including but not limited to the warranties of merchantability, fitness for a particular purpose and non infringement. In no event shall the authors or copyright holders be liable for any claim, damages or other liability, whether in an action of contract, tort or otherwise, arising from, out of or in connection with the software or the use or other dealings in the software.