slowtable 1.0.1
Timetable calculator
To use this package, run the following command in your project's root directory:
Manual usage
Put the following dependency into your project's dependences section:
slowtable
Tool to clean up timetable sent by FAST NUCES.
Features
- Regex based filtering
- Filtering based on course(s) and/or section(s)
- Negating courses, sections, and course-section combo
- Colored output (per section)
Prerequisites
- Libreoffice (headless) or google sheets - to convert xlsx to ods
- A D compiler, and
dub
- both can be downloaded from here git
- to clone repo, or you can download the code from github
Building
Run the following to clone and build:
git clone https://github.com/Nafees10/slowtable
cd slowtable
dub build -b=release
This will create a binary named slowtable
.
Usage
First to convert an xlsx timetable file to ods, run the following:
libreoffice --headless --convert-to ods path/to/timetable.xlsx
Or alternatively, you can upload the xlsx file to google sheets, and Download in OpenDocument format (ods).
From there onwards, slowtable can be run:
./slowtable path/to/converted/timetable.ods [commands] > output.html
Running the above will generate a HTML file containing exact same contents as original timetable. Use filters (read below) to filter out irrelevant courses and sections. The generated HTML file can be opened by a web browser.
JSON output
Alternatively, the filtered or interpreted data can be printed as JSON values,
for example, to be used in another program etc.
This is done using the -f json
option. For example:
./slowtable input.ods -cs 'database (SE-4A)' -f json > classes.json
Will produce the following content in classes.json
file:
{
"classes": [
{
"day": "mon",
"duration": 170,
"name": "database systems lab",
"section": "BSE-4A",
"time": "08:30:00",
"venue": "Lab(CS-4)"
},
{
"day": "tue",
"duration": 80,
"name": "database systems",
"section": "BSE-4A",
"time": "11:30:00",
"venue": "E&M-2"
},
{
"day": "thu",
"duration": 80,
"name": "database systems",
"section": "BSE-4A",
"time": "11:30:00",
"venue": "E&M-2"
}
]
}
Filtering
The parser ignores any non-alphanumeric characters in courses names, to make
filtering easier, and it also lowercases all course names. But section names are
kept as it is.
For example, the course Software Design & Architecture
will be read as
software design architecture
.
All filters are regular expressions.
When no -s
, -c
, or -cs
filters are provided, the -c
filter is defaulted
to be .*
so it includes all courses of all sections. So any negating filters
can be used without the -s
, -c
, or -cs
filters.
-s section
Use the -s
flag to filter for sections.
For example, to only include courses for all sections of BSE-4
, run the
following:
./slowtable input.ods -s BSE-4 > table.html
To only include courses for BSE-4A
and BCS-4A
, run the following:
./slowtable input.ods -s BSE-4A BCS-4A > table.html
-ns section
Use the -ns
flag to filter out a section.
For example, to exclude all Masters courses, while keeping all BS courses:
./slowtable input.ods -ns 'M\S\S-' > table.html
this uses the regex filter M\S\S
to match any section that begins with M
followed by 2 alphabets followed by a -
.
-c course
Use the -c
flag to filter for courses, i.e: include all sections of a
specific course.
For example, to include all sections of Object Oriented Programming, run the
following:
./slowtable input.ods -c 'Object Oriented Programming' > table.html
-nc course
Use the -nc
flag to filter out a course.
For example, to include all courses of BSE-4, except for Data Structures
:
./slowtable input.ods -s BSE-4 -nc 'Data Structures' > table.html
-cs course (section)
Use the -cs
flag to include a specific course of a specific section.
For example, to include all BSE-4A
courses, along with
Database Systems (BSE-4B)
:
./slowtable input.ods -s BSE-4A -cs 'Database (BSE-4B)' > table.html
-ncs course (section)
Use the -cs
flag to exclude a specific course of a specific section.
For example, to include all BSE-4
courses, except for
Software Design .. (BSE-4B)
:
./slowtable input.ods -s BSE-4 -ncs 'Software Design (BSE-4B)' > table.html
Acknowledgments
This program uses TransientResponse's dlang-ods
library.
- Registered by Nafees Hassan
- 1.0.1 released a year ago
- Nafees10/slowtable
- MIT
- Copyright © 2023, nafees