From 329f69a4cca111d186e964f9ae968398103898c9 Mon Sep 17 00:00:00 2001 From: Hoseong Son Date: Tue, 29 Aug 2023 22:40:32 +0900 Subject: [PATCH] =?UTF-8?q?=EC=88=98=EC=97=85=20=EC=9D=B4=EB=A6=84?= =?UTF-8?q?=EA=B3=BC=20=EC=9E=A5=EC=86=8C=EB=A5=BC=20=EA=B0=80=EB=A6=B4=20?= =?UTF-8?q?=EC=88=98=20=EC=9E=88=EB=8A=94=20=EC=98=B5=EC=85=98=20=EC=B6=94?= =?UTF-8?q?=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- convert.py | 6 +++--- every2cal.py | 3 ++- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/convert.py b/convert.py index cf16354..eae5bd8 100644 --- a/convert.py +++ b/convert.py @@ -40,17 +40,17 @@ def get_subjects(self): return result - def get_calendar(self, timetable, start_date, end_date): + def get_calendar(self, timetable, start_date, end_date, hide_details=False): cal = Calendar() for item in timetable: for time in item["info"]: event = Event() - event.add('summary', item["name"]) + event.add('summary', item["name"] if not hide_details else "수업") event.add('dtstart', parser.parse("%s %s" % (self.get_nearest_date(start_date, time["day"]), time["startAt"]))) event.add('dtend', parser.parse("%s %s" % (self.get_nearest_date(start_date, time["day"]), time["endAt"]))) event.add('rrule', {'freq': 'WEEKLY', 'until': parser.parse(end_date)}) - if time["place"] != "": + if time["place"] != "" and not hide_details: event.add('location', time["place"]) cal.add_component(event) diff --git a/every2cal.py b/every2cal.py index 8eb0c6f..890b3ea 100644 --- a/every2cal.py +++ b/every2cal.py @@ -15,6 +15,7 @@ def main(): parser.add_argument("--begin", type=str, help="Semester beginning date", required=True) parser.add_argument("--end", type=str, help="Semester ending date", required=True) parser.add_argument("--output", type=str, help="Output file path", required=False) + parser.add_argument("--hide-details", action="store_true", help="Hide subject name", required=False) args = parser.parse_args() xml = "" @@ -27,7 +28,7 @@ def main(): xml = e.get_timetable() c = Convert(xml) - cal = c.get_calendar(c.get_subjects(), args.begin, args.end) + cal = c.get_calendar(c.get_subjects(), args.begin, args.end, args.hide_details) output_path = args.output if (args.output) else os.path.join('', 'calendar.ics') c.export_calender_as_ics(cal, output_path)