Giter Site home page Giter Site logo

lagrange-display's Introduction

lagrange-display

Raspberry Pi Setup

ssh connexion

To connect to the raspberry pi with ssh the first time, you need to create an empty file named ssh (without extension) in the root folder of the boot partition of the SD card to allow incoming connexions. To be able to connect with the user pi password raspberry, add a file named userconf.txt :

# for default 'raspberry' password
pi:$6$/4.VdYgDm7RJ0qM1$FwXCeQgDKkqrOU3RIRuDSKpauAbBvP11msq9X58c8Que2l1Dwq3vdJMgiZlQSbEXGaY5esVHGBNbCxKLVNqZW1

# for your own password
pi:$6$<your hashed password>

To generate a more secured password, you can use mkpasswd for example, and paste the output in the file.

mkpasswd -m sha-512

In Windows, go to the network settings -> Wifi network -> share -> check the box "Allow other network users to connect through this computer's Internet connection" -> select the network adapter corresponding to the raspberry pi (Ethernet) -> validate. Then, connect to the raspberry pi by typing :

Deprecated procedure :

Build the project

After cloning the project, go to the project directory and install java, maven and the libraries needed by the screen (official site). Then run

./build.sh

It will build the jar that runs the spring boot service which fetches the movies schedules and the C file that displays them on the screen.

Instead of displaying all lines one by one, the C programm will display an image containing all the text. This image is generated by the java program based on a json file and saved in the resources directory.

Run the project

Run the jar file in the background. It will periodically fetch the movies schedules and display them on the screen by calling the C program.

nohup java -jar app-1.0.0-SNAPSHOT.jar > app.log 2>&1 &

To start the app at boot startup, edit the cron file

crontab -e

and add the following line

@reboot cd /home/pi/lagrange-display && nohup java -jar app-1.0.0-SNAPSHOT.jar > app.log 2>&1 &

You can edit environment variables globally, for example

export FREQUENCY=3600000

API specifications

You can dynamically load a new schedule by calling a POST endpoint. First authenticate to get the JWT then call the POST endpoint. For instance,

[POST] /api/token

Body : 
  
{
  "username": "lagrange",
  "password": "lachancla"
}
[POST] /api/movie

Header :

  Authorization: Bearer <JWT>

Body:

  {
    "title":"Cinéma La Grange",
    "description":"Programme du cinéma La Grange à Delémont",
    "date":"2023-12-15T16:32:22.277Z",
    "movies":
      [
        {
          "title": "..."
        }
      ]
  } 

Build the project

Install all libraries needed for the monitor (official site).

Go to /c-movie-fetcher and run

make clean
make
mv ./epd ../../epd

Packages to install :

sudo apt-get update
sudo apt-get install cron
sudo apt-get install jq
sudo apt-get install chromium
sudo apt-get install imagemagick

To run the lagrange-display.sh script periodically (let's say each 2 hours) and at reboot :

crontab -e

Then add the following lines :

SHELL=/bin/bash
PATH=/usr/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/local/games:/usr/games:/usr/share/maven/bin
@reboot export DISPLAY=:0 && cd /home/pi/lagrange-display && ./lagrange-display.sh > /home/pi/app.log
35 * * * *  export DISPLAY=:0 && cd /home/pi/lagrange-display && ./lagrange-display.sh > /home/pi/app.log

lagrange-display's People

Contributors

sjobinstemys avatar sjaubain avatar luc4s avatar

Watchers

 avatar

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.