Git Product home page Git Product logo

egareye's Introduction

egareye

The Egareye has three folders

  1. client
  2. server
  3. monitor_script

Setup a .env file like below

AUTH_ID = ************ # plivo auth_id
AUTH_TOKEN = ********************* # plivo auth_token

# below credentials are required if you are using a virtual machine
# to run the scripts in monitor_script, else you can ignore these and run the scripts
# in your local machine
MONITOR_VM_HOST = **.**.**.** 
MONITOR_VM_PORT = **
MONITOR_VM_USERNAME = uname
MONITOR_VM_PASSWORD = password

client

  • Frontend is written using React
  • To run frontend
cd egareye-client
npm install
npm run dev

server

  • naviagte to server folder
  • Run following commands
python3 -m venv venv
source venv/bin/activate
pip install -r requirements.txt
  • To run the backend
python3 manage.py runserver
  • Open views.py inside the egareye folder
    • Here monitorMovie() function is written in two ways
    • Comment anyone -> one id for when monitoring script is run in your vm, the other is for when the script runs in your local machine. Read the comments to understand which is which
  • Backend runs at http://127.0.0.1:8000/
  • Try
    • http://127.0.0.1:8000/running/hyderabad
    • http://127.0.0.1:8000/upcoming/hyderabad
    • http://127.0.0.1:8000/allmovies/hyderabad

monitor_script

  • The api calls start.py script for eg: python3 start.py <movie> <city> <phnNo>
  • start.py handles phoneNumbers.json and processId.json to keep track of which all scripts are responsible for which all phonenumbers and movies
  • monitor.py is the script responsible for constantly monitoring the website to check if the movie has opened booking and if yes it forwards a call to all those who have subscribed to the movie
Note: These scripts should be uploaded to your vm and the path values in monitor.py and start.py should also be changed to the vm paths if you are using a vm for running the scripts.

Project Overview

This project aims to create a platform where users can receive phone call notifications for their favorite movies when booking opens. The frontend, built with React.js and styled with Tailwind CSS, provides a form where users can enter their name, phone number, city, and select a movie. The form dynamically updates the movie list based on the selected city, fetched via API calls to the Django backend.

Backend Functionality

Endpoints:

  1. GET /allmovies/<cityname>: Returns a list of all upcoming and currently running movies in a specific city.
  2. GET /running/<cityname>: Returns a list of currently running movies in a specific city.
  3. GET /upcoming/<cityname>: Returns a list of upcoming movies in a specific city.
  4. POST /monitor: Accepts form data (name, phone number, selected movie, selected city) to set up phone call notifications.

Workflow:

  • When the user submits the form, a POST request is sent to /monitor with the user's information.
  • The backend's monitorMovie() function is triggered, which connects to an Azure virtual machine (VM) running Ubuntu.
  • The start.py script is executed on the VM with movie, city, and URL arguments.
  • start.py checks if a monitoring process for the movie in the city is already running. If yes, it updates the phone number list. If not, a new process is initiated.
  • The monitor.py script, running infinitely, checks every 30 minutes if the bookings for the specified movie in the city are open.
  • If bookings are open, monitor.py notifies all subscribed phone numbers using the PLIVO API for phone call notifications.
  • After notifications are sent, data in phoneNumbers.json and processId.json is cleared, and the process is terminated.

Key Components and Technologies

  • Frontend: React.js, Tailwind CSS
  • Backend: Django REST Framework
  • External Services: PLIVO for phone call notifications
  • Scraping: BeautifulSoup for scraping movie booking links from https://ticketnew.com/

Design Decisions

  • The frontend provides an intuitive form for user input, dynamically updating movie options based on selected city.
  • Backend API endpoints allow fetching movie data for specific cities and subscribing users for notifications.
  • Azure VM is used for running the monitoring scripts, ensuring the execution environment is separate and scalable.
  • PLIVO API integration enables automated phone call notifications for users.

Improvements and Future Work

  • Implement error handling and logging for better monitoring of the system.
  • Enhance frontend with additional features, such as user authentication and subscription management.
  • Optimize the monitoring process to reduce the frequency of API calls for improved performance and cost efficiency.

egareye's People

Contributors

armgp 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.