Giter Club home page Giter Club logo

gyft's Introduction

Contributors Forks Stargazers Issues MIT License Wiki


GYFT

Get Your Freaking Timetable
Report Bug · Request Feature

Table of Contents

About The Project

Gets your timetable from ERP and adds it to your Google Calendar or gives you an ICS file which you can add in any common calendar application.

Note All updates to this repo should reflect, with appropriate refactorisation, in gyft-serve

(back to top)

Getting Started

To set up a local instance of the application, follow the steps below.

Prerequisites

The following prerequisites are required to be installed for the project to function properly:

  • Python 3
  • IIT-KGP Student ERP Account

(back to top)

Installation

Now that the environment has been set up and configured to properly compile and run the project, the next step is to install and configure the project locally on your system.

  1. Clone the repository
    git clone --depth 1 https://github.com/metakgp/gyft
  2. Change the current directory to the project directory
    cd gyft
  3. Install the dependencies
    pip install -r requirements.txt

(back to top)

Usage

  1. Run the script

    python3 gyft.py
  2. Enter your roll number, password, security answer, and OTP (if required) when prompted

  3. Now you can choose between 2 options, which will be prompted to you:

    • Add to Google Calendar:

      • For this, you have to get your credentials.json and save it as client_secret.json to the current directory by following the Step 1 from here
      • Also note that adding to Google Calendar requires an Internet connection
    • Generate ICS file:

      • This will generate an ICS file which you can import into any calendar application.
      • For importing to Google Calendar, follow the instructions given here.

  • Optional flags:
    • To delete all the recurring events added by the CLI or GYFT Web Application (uses a property of recurrence to identify events to delete), you can run gyft.py with the --del-events flag:
      python3 gyft.py --del-events
    • To specify the output file (.ics) to which the ICS file will be written, use the --output flag.
      python3 gyft.py --output autumn_2023.ics

(back to top)

Development Notes

This project utilizes the iitkgp-erp-login package to handle ERP login functionality.

Updates To Be Made Each Sem

The following procedure is to be followed each new semester by the maintainer for updating GYFT to work properly.

  • Download the academic calendar for the particular year.
  • New semester dates need to be updated in utils/dates.py
  • The format for the date-time is (YYYY, MM, DD, HH, MM).
  • Raise a pull request once the dates are updated.

(back to top)

Contributing

Please read CONTRIBUTING.md guide to know more.

Maintainer(s)

gyft's People

Contributors

acakshay avatar ashwinpra avatar athityakumar avatar ayushk4 avatar chirag-ghosh avatar defcon-007 avatar dependabot[bot] avatar devadeut avatar devansh-bit avatar godzilla5111 avatar harshkhandeparkar avatar icskzmrinal avatar icyflame avatar kunalvrm555 avatar nishnik avatar proffapt avatar rohitner avatar sahil-shubham avatar shikharish avatar tanush-128 avatar thealphadollar avatar themousepotato avatar vector-013 avatar xypnox avatar yashsirvi 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  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

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

gyft's Issues

Add offline support - integrate with `Timetable`

If internet connection doesn't exist, store the event to be added to calendar in some json file. And later when there's internet connection, sync it to Google calendar.

Internet connection can be determined by posting a request to Google.com or something (neglecting the probability of Google's server being down) & checking it's response...

Also, is a terminal version of this possible for offline cases? I mean, can ALL the events be stored into json and be accessed with bash commands with tab auto_complete feature?

Implement REGEX Check With RollNo

Currently, we do not check for the validation of roll numbers entered.

In practicality it is not feasible to verify if the roll number is correct but
we can surely filter wrong formatted rolls numbers using REGEX check.

https://regexone.com/

[Discussion] Increasing the scope of the project

This issue is not about a specific post. I'd rather like to discuss a few things that increase the scope of the project.

  • 'Export' calender (*.ics files, I believe) or create a per user link that people can add to their own calender.
  • Having worked on naarad, we can scrape events from most of the society pages periodically and create calender events - no need to do anything manually. This, too, can be offered as an exported calender.

I do not know what are the specific issues in implementing these, but I think that the above combined with a resolution of existing issues will really pack a punch.

Ideas?

cc/ @athityakumar @DefCon-007 @icyflame @hargup

Only Add Holidays For The Semester

The generated ics file includes institute holidays for the whole year. Due to this, some holidays may be repeated if gyft is used for both semesters. Adding holidays only relevant to the semester will be better.

Additionally, having an option to add holiday events or not would be nice.

Sync to Google calendar - select dates intelligently

Improvisation in selecting date periods :

(1) The Sync should be made to the Google Calendar, only till beginning of end-semester exams. Currently, the sync is made for all weeks after the current week.
(2) The week of mid-semester / end-semester exams should be left vacant at least, or even better - be filled with the user's mid-semester / end-semester timetable.

Wrong classification of classes & labs

Just because some classes are not included in subjects.json , the class is being classified as a lab. Instead, how about checking the number of hours of the class on that day?

if number_of_hours < 3 => class
else => lab

Issue with some first year courses

When logging in with a first year roll number, the following error occurred:

ss:
image

P.S.: only checked with one first year roll number (mine).

Upgrade requests

Current request library comes with a security threat. We need to use: requests>=2.20.0.

Update it in the requirements.txt file.

Better README

  • Changes made in #96 - solved in #98
  • Make instructions more organised and concise - using better format, preferably this - solved in #110
  • A logo?

Upgrade urllib3

There is a vulnerability in the urllib3 version we currently use.

Update it to urllib3>=1.23

Make it image compatible

Currently we ask the user to input password and, for obvious reasons, it's a bad practice.

A better way to do this would be using OCR and identifying elements by reading the image of time table taken using any device, or in the very least, just the actual timetable.

@ghostwriternr Any other spec you'd like to see? Assign to me :)

Ask the user about generating ics file

Instead of just printing to use generate_ics.py in the end of gyft.py, prompt the user for confirmation whether they want ics file or not and if yes we can just directly execute the generate_ics.py script.

Same goes for add_events.py

And integrate del_events.py via a cli argument what they want to do. Basically one should only use gyft.py for whatever their need be

Note I am not clear about the role of del_events.py so let's first of al complete the first two tasks and if you know what the other file does please tell me.

Integrate with iitkgp-erp-login properly

Network.py has various things which are already handled by the package itself, like:

  • Specifying cookies separately anywhere (this is handled well enough internally)
  • No need to "refresh_cookies" - not sure, test this claim

Thus the functions of interest are:

  • refresh_cookies -> Not needed
  • post -> Remove usage of cookies
  • login -> Update accordingly

Not repeating weekly

after adding to Google calendar, its default setting it to repeat till 2018
can be repeated till the week end

Connection Timed out

ConnectionRefusedError: [WinError 10061] No connection could be made because the target machine actively refused it

AddEvents Not Working Behind Proxy

The script doesn't work behind proxy; I guess the error is in the building of the drive application which uses httplib2 to establish the connection.

screenshot from 2019-01-05 15-29-25

Error if the whole day is empty

If there are no events on a given day, the program throws the following error:

Traceback (most recent call last):
  File "gyft.py", line 114, in <module>
    txt = tds[a].find('b').text.strip()
AttributeError: 'NoneType' object has no attribute 'text'

Import Error in Google Calendar

ICS file generated from Gyft cannot be imported to Google Calendar.

Steps to reproduce:

  1. Generate .ics file from gyft.
  2. Go to google calendar on desktop. Click Settings icon on the top right.
  3. Go to Import and Export tab.
  4. Upload the downloaded file.
  5. Click import.

Screenshot:

2020-01-03_23-59

Unable to access timetable

In the 1st format of timetable I am able to store the timetable to data.txt
24172300_767665296757199_811219488_n

While in the 2nd format it generates an error
24172705_767665293423866_2133369572_n

The error is following:
24273086_767665473423848_1914279008_n

Migrating from the concept of subject.json

The idea is pretty simple, we don't have to maintain a subjects.json for fetching the name of the course. We can directly fetch it from erp itslef.

Possible solutions:

  • Using department timetable, with some trickery to get it
  • Using the concept from gyfe

Enable gyft to create the recurrence schedule from given set of date and times

The script will begin with the following list of lists:

[ [ BEGIN_1, END_1 ], [ BEGIN_2, END_2 ], [ BEGIN_3, END_3 ], ...]

The events that are created will be created only in between these dates. i.e. timetable events won't be created for the time between END_1 and BEGIN_2 etc.

Once implemented, this can be easily improved to include both vacations (Durga Puja), mid-term, end-term, holidays (from the holiday list).

Do this in both the available flows:

  • ICS generation
  • Google Calendar Sync

no module named bs4

On typing
python3 gyft.py
we get
Traceback (most recent call last):
File "C:\Users\Anindita\OneDrive\Desktop\gyft\gyft.py", line 2, in
from timetable import delete_calendar, create_calendar, build_courses, generate_ics
File "C:\Users\Anindita\OneDrive\Desktop\gyft\timetable_init_.py", line 1, in
from timetable.extractor import *
File "C:\Users\Anindita\OneDrive\Desktop\gyft\timetable\extractor.py", line 4, in
from bs4 import BeautifulSoup
ModuleNotFoundError: No module named 'bs4'

BUG: Unable to run `add_events.py`

The error is:

$ python3 add_events.py 
Traceback (most recent call last):
  File "add_events.py", line 6, in <module>
    from apiclient import discovery
ImportError: cannot import name 'discovery'
  1. apiclient is not listed in the present requirements.txt file. I added the line apiclient==1.0.3 and then ran pip3 install -r requirements.txt

  2. I tried to import "discovery" inside a Python 3 shell, but it didn't work there either. I think they have dropped this submodule (?)

This issue has been faced before: shazow/apiclient#9 (comment)

Also, the author says

Possibly? Though I don't recall there ever being a discovery submodule.

Honestly this library is not very maintained anymore. It's very simple in what it does, so I haven't touched > it in years.

So, maybe you can use another library or fix this.

cc @athityakumar @nishnik @DefCon-007

Remove `data.txt` as a middleware

It might be useful back then but not now.
If required to create something other than just timetable.ics (Like - time table pdf or timetable CLI representation) we can directly use timetable_dict.

This is just an overhead at this point

Using insti proxy with httplib2

Currently, line 77 of add_events.py throws socket error due to insti proxy.

Modification required is :
http = credentials.authorize(httplib2.Http(proxy_info = httplib2.ProxyInfo(httplib2.socks.PROXY_TYPE_HTTP_NO_TUNNEL, '10.3.100.207', 8080)))

Make webapp

Current web app is based on the password model which will be replaced with the OCR model and hence we require a new web app.

Under this web app, the user will be able to submit an image and download the ICS file after all the backend work is done.

@ghostwriternr assign me please.

delete_events.py doesn't all events

I'm not sure what the problem is, but I think there is some API restriction or something, due to which the program ended (by Nov 11) , whereas it should have deleted all events till Nov 20.

Add location for classrooms/venues

LIke currently it shows N241 and likewise.
If we add the proper lat-lng, it can be shown in Google Maps.
TODO:

  • Add latitude-longitude of all the departments (possibly on wiki)
  • Store the same in this repo as a json
  • load the json in the program and add it to the google calendar event

User preference file

Add a user preference file which contains the semantics of the message to be added onto the Google Calendar. This will preferably be a yaml / json / md file - which will be gitignore-d.

class: "Class of "
lab: "Lab of "

On the web portal of gyft, this can be taken as input (rather than a file) from the user before syncing.

Add more holidays

Currently the timeline only includes endsems and midsems. We can extend that to:

  • Durga Pooja and other breaks mentioned in Academic Calendar
  • Institute holidays from here. Possibly scrape them directly?

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.