Skip to content

The aim of this repository is to make a script which converts an image (screenshot) of the timetable of my university (VIT) to a calendar which can be synced with my personal/work google calendar with a simple click.

License

Notifications You must be signed in to change notification settings

Lyon03/Image_To_Calendar

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Timetable_To_Calendar

The aim of this repository is to make a script which converts an image (screenshot) of the timetable of my university (VIT) to a calendar which can be synced with my personal/work google calendar with a simple click.

Setup

This script was developed with Python 3.9.7, if you haven't installed python check out this guide

Installing The Required Libraries

  1. Pip, a package manager for python is essential to download/upgrade the required libraries to run this script. To check whether it is installed run pip --version in your command line (cmd), if pip is not installed make sure to install with the help of this guide
  2. We will now need to install the required modules, to do so enter pip install -r requirements.txt in the cmd, which would open the requirements.txt file and install accordingly the modules neccessary.

Setting up the APIs

There are two APIs in use for this script to run successfully

  • Nanonets, which is given the image of the timetable and returns a json file.
  • Google Calendar API, which adds the events to the user's google calendar.

Setting Up Nanonets

Create an account if you don't have one in Nanonets. We essentially need two things - your API key and Model ID, which need to be stored in a text file in seperate lines respectively in the same directory as your script.

i) After Logging in, create a new model by clicking on the New Model button nanonetsimageoffrontpage ii) Select Tables as we are converting a jpeg/png file to a tabular format (csv) nanonetsTableExtractor

  1. Getting the API Key

i) Click on Documentation nanonetsDocumentation

ii) Click on follow this link nanonetsAPILinkFollow

iii) Create a txt file named nanonetsInfo.txt and copy the API Key into first line of the text file. nanonetsAPIKeyFinal

  1. Getting the Model ID

i) Click Model Settings which would give you your model ID nanonetsModelSettings

ii) Make sure to copy your modelID and save it in the text file named nanonetsInfo.txt in the second line nanonetsModelId

Setting Up Google Calendar API

  1. Create a google cloud account (different from a regular google account) if you don't have an existing one.
  2. Go to this link where you will need to create a project and enable calendar API.
  3. Go to Credentials and create an OAuth2.0 client, in this script's case you would need to select it Desktop app and feel free to name it whatever you feel is apt.
  4. After doing so, download the credentials as a json file (which is the default) and rename it to client_secret.json in the same directory/folder as the the python files. For more information regarding this setup you may follow this tutorial

Customising & Running The Code

  1. Make sure to have the screenshot of the timetable in the highest quality possible in the same directory as your python files.
  2. Change the value of pathOfImage to the absolute or relative path of the image, by default the name of the file is to be 'timetable.png'
  3. You may change the variable calendarName to change the name of the calendar which appears in your calendar calendarName

Contact Me

If you face any issues or have any questions feel free to contact me on LinkedIn : www.linkedin.com/in/joel-james-318593220

About

The aim of this repository is to make a script which converts an image (screenshot) of the timetable of my university (VIT) to a calendar which can be synced with my personal/work google calendar with a simple click.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages