It'a a python script that converts xml file of teachers generated by FET software to .ics format that can be further used in import in Google Calendar.
Now let's understand this:
- First of all we have import necessary libraries then we have input a xml file that contains timetable of teacher.
- After that data is read using for loop and we have open a .ics file whose name will be stored with teachers name. As we are generating different file for different teachers.
- Then we have write begin tag BEGIN:VCALENDAR to start file then time is split using regular expression.
- The start and end time is written in the file according to the format accepted by ics format.Actually the input time(starting and ending of lecture) was according to Indian time zone but by default icalendar pick time according to UTC hence we have added TZID=Asia/Kolkata.
- Next step we have written a day in the file.
- As the last step location has been written i.e Room no. and summary of teacher's lecture(contains subject name, activity name i.e. lecture or tutorial or lab, class name) is written in ics file.
- If the location is not specified i.e that field is empty then else condition will be used otherwise we will get an error.
- After that end tag has been written in ics file END:VCALENDAR.
- Open Google Calendar on a computer. Note: You can only import from a computer, not a phone or tablet.
- In the top right, click the Gear icon and select "Settings".
- Click on the "Import and Export" from left hand side.
- Click "Choose File" and select the file you exported. The file should end in .ICS or .CSV.
- Choose which calendar to add the imported events to. By default, events will be imported into your primary calendar.
- Click "Import".