From a3046d7025bc34933089847f9e6849ac663ed542 Mon Sep 17 00:00:00 2001 From: Geoffrey Frogeye Date: Mon, 4 Sep 2017 18:20:33 +0200 Subject: [PATCH] Support des règles personalisées --- .gitignore | 2 ++ custom.py.example | 13 +++++++++++++ parse.py | 15 +++++++++++---- 3 files changed, 26 insertions(+), 4 deletions(-) create mode 100755 custom.py.example diff --git a/.gitignore b/.gitignore index bfc2329..7ad3d0d 100644 --- a/.gitignore +++ b/.gitignore @@ -92,3 +92,5 @@ ENV/ # Custom *.html *.ics +config.sh +custom.py diff --git a/custom.py.example b/custom.py.example new file mode 100755 index 0000000..ee19e83 --- /dev/null +++ b/custom.py.example @@ -0,0 +1,13 @@ +#!/usr/bin/env python3 + +def filterEvent(event): + print(event) + # Enlève le Renforcement TOEIC + if event.shortName == 'Renf.TOEIC': + event.active = False + # Remplace LV2 par allemand + elif event.shortName == 'LV2': + event.shortName = 'All' + print(event.longName) + event.longName = event.longName.replace('LV2', 'Allemand') + diff --git a/parse.py b/parse.py index b2a851e..845e953 100755 --- a/parse.py +++ b/parse.py @@ -1,5 +1,6 @@ #!/usr/bin/env python3 +import os.path import sys import argparse import datetime @@ -25,13 +26,13 @@ if args.annee == 3: elif args.annee == 4: url = 'http://ima3.polytech-lille.net/IMA4/' + args.edt + '.html' SLOTS = [(( 8, 0), ( 9, 0)), - (( 9, 10), (10, 10)), + (( 9, 0), (10, 00)), ((10, 20), (11, 20)), - ((11, 30), (12, 30)), + ((11, 20), (12, 20)), ((13, 50), (14, 50)), - ((15, 00), (16, 00)), + ((14, 50), (15, 50)), ((16, 10), (17, 10)), - ((17, 20), (18, 20))] + ((17, 10), (18, 10))] DATE_FORMAT = '%d/%m/%Y' else: raise ValueError('Année inconnue : ' + annee) @@ -311,6 +312,12 @@ cal.add('version', '2.0') cal.add('calscale', 'GREGORIAN') cal.add('x-wr-calname', 'Polytech IMA ' + str(args.annee) + ' ' + args.edt) +if os.path.isfile('custom.py'): + import custom + for event in events: + if event.active: + custom.filterEvent(event) + for event in events: if event.active: print(event, file=sys.stderr) -- libgit2 0.21.2