--- /dev/null
+import json
+import os
+import sys
+
+def print_chronodose(basedir, dept):
+ print('------ %d' % (dept))
+ filename = os.path.join(basedir, '%d.json' % dept)
+ with open(filename) as f:
+ jdata = json.load(f)
+
+ for centre in jdata['centres_disponibles']:
+ appointment_schedules = centre.get('appointment_schedules')
+ if not appointment_schedules:
+ continue
+ for appointment_schedule in appointment_schedules:
+ name = appointment_schedule.get('name')
+ total = appointment_schedule.get('total')
+ if name == 'chronodose' and total != 0:
+ break
+ else:
+ continue
+
+ print(centre['nom'])
+ print(f' {total} creneau(x) chronodose')
+ print(f' {centre["url"]}')
+ print(' %s' % ', '.join(centre["vaccine_type"]))
+
+basedir = sys.argv[1]
+print_chronodose(basedir, 59)
+print_chronodose(basedir, 62)
--- /dev/null
+#!/bin/sh
+
+ROOTDIR=$(dirname $(readlink -e $0))
+touch ${ROOTDIR}/last
+other_pids=$(pidof -x -o $$ vitemadose-check.sh)
+[ -n "${other_pids}" ] && kill ${other_pids}
+
+while true; do
+ mv ${ROOTDIR}/last ${ROOTDIR}/prev
+ #git pull --rebase
+ rm -f ${ROOTDIR}/rdv.zip
+ rm -rf ${ROOTDIR}/rdv
+ wget -O ${ROOTDIR}/rdv.zip https://gitlab.com/ViteMaDose/vitemadose/-/jobs/artifacts/main/download?job=trouver_les_rdv
+ mkdir ${ROOTDIR}/rdv
+ cd ${ROOTDIR}/rdv
+ unzip ../rdv.zip
+ cd ${ROOTDIR}
+ python3 vitemadose-check.py ${ROOTDIR}/rdv/data/output > ${ROOTDIR}/last
+ if ! cmp -s last prev; then
+ echo "nouveaux creneaux"
+ notify-send -i $PWD/vitemadose.png "nouveaux creneaux"
+ fi
+ echo ==================
+ cat last
+ echo ==================
+ sleep 120
+done