Coder Social home page Coder Social logo

jfoot / bus-departure-board Goto Github PK

View Code? Open in Web Editor NEW
41.0 41.0 7.0 1.18 MB

A selection of Python programs which will retrieve live bus and rail UK open data and output it to a ER-OLEDM032 (256X64) display screen.

Home Page: https://departureboard.jonathanfoot.com/

Python 99.83% Shell 0.17%
bus bus-departure-board departure-board departure-times live-departure-boards open-data pi python railway-api raspberry-pi reading-buses train

bus-departure-board's Introduction

Linkdin Email Website Nuget Profile Google Play Microsoft Store Instagram

Hi there 👋

Welcome to my profile, I'm a software engineer at Experian and recent MSci in Computer Science graduate from the University of Nottingham.

I love developing, especially in C# and C++, some of my most popular projects include my live miniature departure board project for the Raspberry Pi, my Notts Hopper Buses android app, my Reading Buses nuget Library and a free educational program to teach and test the topic of Mathematical Transformations! I'm also a bit of a transport nerd, so have quite a few projects working with the Reading Buses API 🚌.

A full list of all my projects can be found on my website here

📄 Github Stats

bus-departure-board's People

Contributors

dependabot[bot] avatar jfoot avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

bus-departure-board's Issues

LondonUndergroundPy3.py fatal crash overnight due to item not in list.

Describe the bug
The program will completely crash and the display screen shows blank. The error logs are attached below.

To Reproduce

  1. Program set for default inactive hours.
  2. London TfL stop ID -s 490012211N --FixNextToArrive --no-console-output
  3. Next morning the screen is blank and the program has fatal error listed below.

Expected behaviour
Continues to operate waking next morning after inactive hours.

Screenshots or Error Trace
py error

Program information:

  • Pi Type: Pi 4 Model B
  • Program: LondonUndergroundPy3.py.py
  • Stop/Station ID: 490012211N
  • Program Args: --FixNextToArrive --no-console-output
  • Version: 2.5.LU

Additional context
Raspberry Pi OS (Legacy) Lite
Release date: December 5th 2023
System: 32-bit
Kernel version: 6.1
Debian version: 11 (bullseye)
Python ver 3.9.2

I think this may be the same problem as issue #2

Cheers,
Bryan.

Display is turning off after ~1 hour

Approximately 1 hour after switching on, the display will go to black, assume it's timing out in some way. The LED on the Raspberry Pi stays lit so power is still getting to the board.

To Reproduce
Install following the website's instructions and turn on.

Expected behaviour
Screen should stay on permanently whilst powered.

Screenshots or Error Trace
image

Program information:

  • Pi Type - Pi Zero WH
  • Program - LondonUndergroundPy3
  • Stop/Station ID - 940GZZLUCSM
  • Program Args - all default
  • Version - Unsure, latest version

NationalBusesPy3.py & LondonUndergroundPy3.py

Describe the bug
A clear and concise description of what the bug is.

Steps to reproduce the behaviour
raspberrybus:~ $ sudo python3 /Bus-Departure-Board/LondonUndergroundPy3.py -k xxxxxxxxxxxxxxxxxxxxxxxxx -s 940GZZLULNB -x Jubilee -p 'both'
Traceback (most recent call last):
File "/home/pi/Bus-Departure-Board/LondonUndergroundPy3.py", line 79, in
BasicFont = ImageFont.truetype("%s/resources/lower.ttf" %(os.path.dirname(os.path.abspath(inspect.getfile(inspect.currentframe()))) ),14)
AttributeError: module 'PIL.ImageFont' has no attribute 'truetype'
pi@raspberrybus:
$ sudo python3 ~/Bus-Departure-Board/NationalBusesPy3.py -k xxxxxxxxxxxxxxxxxxxxxxxxx -a yyyyyyy -s 1500IM451B -b no -y 0 -o 1 -e dim -i 23:59-09:00 -l 120 -v 8
Traceback (most recent call last):
File "/home/pi/Bus-Departure-Board/NationalBusesPy3.py", line 85, in
BasicFont = ImageFont.truetype("%s/resources/lower.ttf" % (os.path.dirname(os.path.abspath(inspect.getfile(inspect.currentframe())))),14)
AttributeError: module 'PIL.ImageFont' has no attribute 'truetype'

the display worked great a few days ago but I now getting the above error message/s. Looks like a missing or removed font.

iain

LondonUnderground.py crash with 'STAND BACK TRAIN APPROACHING' warning turned on.

Describe the bug
With the 'STAND BACK TRAIN APPROACHING' warning message turned the program will crash eventually.

To Reproduce

  1. Turn on the 'STAND BACK TRAIN APPROACHING' warning message.
  2. Leave running for several hours and then it might eventually crash.

Expected behaviour
It should be able to run non-stop without issue.

Screenshots

Traceback (most recent call last):
  File "/home/pi/Bus-Departure-Board/LondonUnderground.py", line 722, in <module>
    display()
  File "/home/pi/Bus-Departure-Board/LondonUnderground.py", line 670, in display
    board.tick()
  File "/home/pi/Bus-Departure-Board/LondonUnderground.py", line 591, in tick
    self.bottom.tick()
  File "/home/pi/Bus-Departure-Board/LondonUnderground.py", line 447, in tick
    self.image_composition.remove_image(self.IDestination)
  File "/usr/local/lib/python2.7/dist-packages/luma/core/image_composition.py", line 161, in remove_image
    self.composed_images.remove(image)
ValueError: list.remove(x): x not in list

Program information:

  • Pi Type - Pi Zero WH
  • Program - LondonUnderground.py
  • Version - 1.1.LU

LondonUndergroundPy3.py Via Message is partially visible when not scrolling.

Describe the bug
The start of the via message can be seen coming out of the left of the time even when not scrolling.

To Reproduce

  1. leave the display running and you might see it sometimes happen.

Expected behaviour
The via message should only be visible if animations are turned on and if it is currently the care scrolling.

Screenshots or Error Trace
Na.

Program information:

  • Pi Type - Pi Zero WH
  • Program - LondonUndergroundPy3.py
  • Version - 2.0.LU

Additional context
I suspect this is because I'm updating the card with latest information from the API and changing the date string, which can shrink in size, but then not changing the via messages location to the new location and so pokes through.

Luma.Core Dropped Support for Python 2

Describe the bug
The Luma.Core, Luma.OLED and Luma.Emulator Library has now dropped support for Python 2. I must decide if I shall upgrade the programs to Python 3 and investigate their performance metrics. Or update the website instructions to work for Python 2 instead.

Work Around
Instead of the command “sudo -H pip install –upgrade luma.oled” and “sudo pip install luma.emulator”, please can your write the following lines:

sudo pip install luma.core==1.13.0
sudo pip install luma.oled==3.4.0
sudo pip install luma.emulator==1.2.0

To Reproduce
Steps to reproduce the behaviour:

  1. Try to install the libraries and set-up a fresh pi as of November 2020.

Expected behaviour

  1. The libraries all install correctly for Python 2

Screenshots or Error Trace
If applicable, add screenshots to help explain your problem.
image

Program information:

  • Pi Type Pi Zero WH
  • Program All
  • Version NA

Additional context
I plan on fixing this the weekend of the 19th of December.

Destination disappearing

Describe the bug
When using the device to show National Rail services the destinations dissapear from the screen once the calling at animations have run

To Reproduce
Steps to reproduce the behaviour:
Upon startup of Raspberry Pi
Have tried several different stations with the same behaviour seen

Expected behaviour
Destination name should remain visible for each train service

Screenshots or Error Trace
If applicable, add screenshots to help explain your problem.

Program information:

  • Pi Type - Pi Zero WH
  • Program - NationalRail.py
  • Version - 2.6.NR

Additional context
Add any other context about the problem here
Tra.zip
.

London Underground Not Using BST Time Formats

Describe the bug
The London Underground API was giving expected arrival times in UTC format as opposed to BST/ local times, this caused issues as all times were out by one hour.

To Reproduce
Steps to reproduce the behaviour:

  1. Launch the program.

Expected behaviour
The services expected arrival time in number of min is meant to be shown, with "Due" shown only when the service is 30s away.

Program information:

  • Pi Type - Pi Zero WH
  • Program LondonUndergroundPy3
  • Version 2.2.LU

AttributeError: 'ImageDraw' object has no attribute 'textsize'

Following the steps from the guide on https://departureboard.jonathanfoot.com/SoftwareDownload.html.

Running sudo -H pip3 install -U setuptools luma.oled luma.emulator inflect nre-darwin-py it throws an error

ERROR: Command errored out with exit status 1:
     command: /usr/bin/python3 /tmp/tmp4etdzu6q_in_process.py prepare_metadata_for_build_wheel /tmp/tmpxj0fhdwm
         cwd: /tmp/pip-install-0eb2p37u/pydantic-core_1834ada08082489c8b5abc5d7143bf23
    Complete output (6 lines):

    Cargo, the Rust package manager, is not installed or is not on PATH.
    This package requires Rust and Cargo to compile extensions. Install it through
    the system's package manager or via https://rustup.rs/

    Checking for Rust toolchain....
    ----------------------------------------

when I continue and get to the python3 DemoPy3.py it then throws another error

Traceback (most recent call last):
  File "/home/pi/Bus-Departure-Board/DemoPy3.py", line 626, in <module>
    board = boardFixed(image_composition,Args.Delay,device)
  File "/home/pi/Bus-Departure-Board/DemoPy3.py", line 516, in __init__
    self.setInitalCards()
  File "/home/pi/Bus-Departure-Board/DemoPy3.py", line 527, in setInitalCards
    self.top = ScrollTime(image_composition, len(self.Services) >= 1 and self.Services[0] or LiveTimeStud(),LiveTimeStud(), self.scroll_delay, self.synchroniser, device, 0, self)
  File "/home/pi/Bus-Departure-Board/DemoPy3.py", line 292, in __init__
    self.generateCard(service)
  File "/home/pi/Bus-Departure-Board/DemoPy3.py", line 314, in generateCard
    displayTimeTemp = TextImage(device, service.DisplayTime)
  File "/home/pi/Bus-Departure-Board/DemoPy3.py", line 178, in __init__
    self.width = 5 + draw.textsize(text, BasicFont)[0]
AttributeError: 'ImageDraw' object has no attribute 'textsize'

NationalBuses.py fatal crash due to item not in list.

Describe the bug
The program will completely crash and the display screen shows blank. The error logs are attached below.

To Reproduce
Steps to reproduce the behaviour:

  1. Leave the program running for several days and eventually it might crash.

Expected behaviour
The program continues to run continuously.

Screenshots
image

Program information:

  • Pi Type - Pi Zero WH
  • Program - NationalBuses.py
  • Version - 1.6.OT

Additional context
I believe this to be an issue around when the number of buses expected at a stop becomes less than three.

[NR3 2.2] Long Station Names with Statuses

Describe the bug
Long station names such as "Aylesbury Vale Parkway" can interfere with status such as "Cancelled" and "On Time" as the text is right up against "On Time" and "Cancelled" is layered on top. Potentially station name should be less wide, and scroll?

To Reproduce
Steps to reproduce the behaviour:

  1. Run NationalRail3 v2.2, with station code AYS

Expected behaviour
There should be some gap between station name for the train destination, and the status of the train, and should not get overlayed with other longer statuses such as Cancellled

Screenshots or Error Trace
Appears as "Aylesbury Vale ParkwaOn time" on the display

Program information:

  • Pi Type [e.g. Pi Zero WH]
  • Program [e.g. NationalRail3.py]
  • Version [e.g. 2.2NR]

Additional context
This only seems to be an issue with longer station names of course.

Reading Buses API Switch Off Planned.

R2P group have announced the Reading Buses API being deprecated from the 6th of April 2021, as such the ReadingBusesPy3.py program will cease working.

A new replacement API can be found here: https://reading-opendata.r2p.com

Work will be completed to update the program to use this new API feed, but until this time the Reading Buses departure board will no longer work from the 6th of April onwards.

NationalRail.py fatal crash due to type error, expected integer but got float.

Describe the bug
The program will completely crash and the display screen shows blank. The error logs are attached below.

To Reproduce
Steps to reproduce the behaviour:

  • Leave the program running for several days and eventually it might crash.

Expected behaviour
The program should be able to run indefinitely.

Screenshots or Error Trace

TypeError: integer argument expected, got float
<urlopen error [Errno -3] Temporary failure in name resolution>
Traceback (most recent call last):
  File "/home/pi/Bus-Departure-Board/NationalRailPy3.py", line 787, in <module>
    display()
  File "/home/pi/Bus-Departure-Board/NationalRailPy3.py", line 737, in display
    image_composition.refresh()
  File "/usr/local/lib/python3.7/dist-packages/luma/core/image_composition.py", line 179, in refresh
    img.position)
  File "/usr/local/lib/python3.7/dist-packages/PIL/Image.py", line 1506, in paste
    self.im.paste(im, box)
TypeError: integer argument expected, got float

Program information:

  • Pi Type - Pi Zero WH
  • Program - NationalRailPy3.py
  • Version 2.0.NR

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.