Commit a3046d7025bc34933089847f9e6849ac663ed542

Authored by Geoffrey PREUD'HOMME
1 parent 721af5a1

Support des règles personalisées

Showing 3 changed files with 26 additions and 4 deletions   Show diff stats
.gitignore
... ... @@ -92,3 +92,5 @@ ENV/
92 92 # Custom
93 93 *.html
94 94 *.ics
  95 +config.sh
  96 +custom.py
... ...
custom.py.example 0 → 100755
... ... @@ -0,0 +1,13 @@
  1 +#!/usr/bin/env python3
  2 +
  3 +def filterEvent(event):
  4 + print(event)
  5 + # Enlève le Renforcement TOEIC
  6 + if event.shortName == 'Renf.TOEIC':
  7 + event.active = False
  8 + # Remplace LV2 par allemand
  9 + elif event.shortName == 'LV2':
  10 + event.shortName = 'All'
  11 + print(event.longName)
  12 + event.longName = event.longName.replace('LV2', 'Allemand')
  13 +
... ...
parse.py
1 1 #!/usr/bin/env python3
2 2  
  3 +import os.path
3 4 import sys
4 5 import argparse
5 6 import datetime
... ... @@ -25,13 +26,13 @@ if args.annee == 3:
25 26 elif args.annee == 4:
26 27 url = 'http://ima3.polytech-lille.net/IMA4/' + args.edt + '.html'
27 28 SLOTS = [(( 8, 0), ( 9, 0)),
28   - (( 9, 10), (10, 10)),
  29 + (( 9, 0), (10, 00)),
29 30 ((10, 20), (11, 20)),
30   - ((11, 30), (12, 30)),
  31 + ((11, 20), (12, 20)),
31 32 ((13, 50), (14, 50)),
32   - ((15, 00), (16, 00)),
  33 + ((14, 50), (15, 50)),
33 34 ((16, 10), (17, 10)),
34   - ((17, 20), (18, 20))]
  35 + ((17, 10), (18, 10))]
35 36 DATE_FORMAT = '%d/%m/%Y'
36 37 else:
37 38 raise ValueError('Année inconnue : ' + annee)
... ... @@ -311,6 +312,12 @@ cal.add('version', '2.0')
311 312 cal.add('calscale', 'GREGORIAN')
312 313 cal.add('x-wr-calname', 'Polytech IMA ' + str(args.annee) + ' ' + args.edt)
313 314  
  315 +if os.path.isfile('custom.py'):
  316 + import custom
  317 + for event in events:
  318 + if event.active:
  319 + custom.filterEvent(event)
  320 +
314 321 for event in events:
315 322 if event.active:
316 323 print(event, file=sys.stderr)
... ...