From 5c6523d7a20107e036cac1fe788f73154fb9dc17 Mon Sep 17 00:00:00 2001 From: erebion Date: Tue, 6 Jan 2026 20:58:16 +0100 Subject: [PATCH] cleaning this all up a bit further... --- README.md | 4 + .../templates/subscription_s4.json.j2 | 77 ------------------ .../templates/update_subscription.json.j2 | 78 ------------------- .../zuginfo_api_subscribe_s4.yml | 46 ----------- .../zuginfo_api_update_subscription.yml | 25 ------ 5 files changed, 4 insertions(+), 226 deletions(-) delete mode 100644 zuginfo_playbooks/templates/subscription_s4.json.j2 delete mode 100644 zuginfo_playbooks/templates/update_subscription.json.j2 delete mode 100644 zuginfo_playbooks/zuginfo_api_subscribe_s4.yml delete mode 100644 zuginfo_playbooks/zuginfo_api_update_subscription.yml diff --git a/README.md b/README.md index 306ee59..3c86804 100644 --- a/README.md +++ b/README.md @@ -59,6 +59,10 @@ account: to do +### Updating a subscription + +to do + ## Random Notes - `user_id` seems to change when all subscriptions are deleted and a new one is added diff --git a/zuginfo_playbooks/templates/subscription_s4.json.j2 b/zuginfo_playbooks/templates/subscription_s4.json.j2 deleted file mode 100644 index 3afa639..0000000 --- a/zuginfo_playbooks/templates/subscription_s4.json.j2 +++ /dev/null @@ -1,77 +0,0 @@ -{ - "id": "{{ mysterious_id }}", - "ver": "1.24", - "lang": "deu", - "auth": { - "type": "AID", - "aid": "{{ aid }}" - }, - "client": { - "id": "HAFAS", - "type": "WEB", - "name": "webapp", - "l": "vs_webapp", - "v": 10104 - }, - "formatted": false, - "ext": "VRR.1", - "svcReqL": [ - { - "meth": "SubscrCreate", - "req": { - "statSubscr": { - "hysteresis": { - "himFltrL": [ - { - "type": "HIMCAT", - "mode": "INC", - "value": "0" - }, - { - "type": "HIMCAT", - "mode": "INC", - "value": "4" - }, - { - "type": "HIMCAT", - "mode": "INC", - "value": "2" - }, - { - "type": "HIMCAT", - "mode": "INC", - "value": "3" - }, - { - "type": "HIMCAT", - "mode": "INC", - "value": "1" - } - ] - }, - "jnyFltrL": [ - { - "type": "LINEID", - "mode": "INC", - "value": 92404 - } - ], - "serviceDays": { - "selectedWeekdays": "1111111", - "beginDate": "20250615", - "endDate": "20331211", - "beginTime": "000000", - "endTime": "235959" - } - }, - "userId": "{{ user_id }}", - "channels": [ - { - "channelId": "{{ channel_id }}" - } - ] - }, - "id": "1|5|" - } - ] -} diff --git a/zuginfo_playbooks/templates/update_subscription.json.j2 b/zuginfo_playbooks/templates/update_subscription.json.j2 deleted file mode 100644 index 440cf69..0000000 --- a/zuginfo_playbooks/templates/update_subscription.json.j2 +++ /dev/null @@ -1,78 +0,0 @@ -{ - "id": "{{ mysterious_id }}", - "ver": "1.24", - "lang": "deu", - "auth": { - "type": "AID", - "aid": "{{ aid }}" - }, - "client": { - "id": "HAFAS", - "type": "WEB", - "name": "webapp", - "l": "vs_webapp", - "v": 10104 - }, - "formatted": false, - "ext": "VRR.1", - "svcReqL": [ - { - "meth": "SubscrUpdate", - "req": { - "userId": "{{ user_id }}", - "subscrId": {{ subscription_id }}, - "statSubscr": { - "hysteresis": { - "himFltrL": [ - { - "type": "HIMCAT", - "mode": "INC", - "value": "0" - }, - { - "type": "HIMCAT", - "mode": "INC", - "value": "4" - }, - { - "type": "HIMCAT", - "mode": "INC", - "value": "2" - }, - { - "type": "HIMCAT", - "mode": "INC", - "value": "3" - }, - { - "type": "HIMCAT", - "mode": "INC", - "value": "1" - } - ] - }, - "jnyFltrL": [ - { - "type": "LINEID", - "mode": "INC", - "value": 92404 - } - ], - "serviceDays": { - "selectedWeekdays": "1111110", - "beginDate": "20250615", - "endDate": "20331211", - "beginTime": "00000000", - "endTime": "00235959" - } - }, - "channels": [ - { - "channelId": "{{ channel_id }}" - } - ] - }, - "id": "1|12|" - } - ] -} diff --git a/zuginfo_playbooks/zuginfo_api_subscribe_s4.yml b/zuginfo_playbooks/zuginfo_api_subscribe_s4.yml deleted file mode 100644 index dff6dd0..0000000 --- a/zuginfo_playbooks/zuginfo_api_subscribe_s4.yml +++ /dev/null @@ -1,46 +0,0 @@ ---- - -- name: "Zuginfo.nrw API" - hosts: localhost - vars: - unix_time_millis: "1762342729099" - aid: "" - mysterious_id: "" - - tasks: - - name: "Subscribe to info for S4" - ansible.builtin.uri: - url: "https://www.zuginfo.nrw/gate/?requestId={{ mysterious_id }}&hciMethod=SubscrCreate&hciVersion=1.24&hciClientType=WEB&hciClientVersion=10104&aid={{ aid }}&rnd={{ unix_time_millis }}" - method: POST - body: "{{ lookup('ansible.builtin.template','subscription_s4.json.j2') }}" - headers: - Accept-Encoding: gzip, deflate, br, zstd - Content-Type: application/json - Origin: https://www.zuginfo.nrw/ - Referer: https://www.zuginfo.nrw/ - TE: trailers - register: subscribe_s4 - - - name: "Print Result: Subscribe to S4" - ansible.builtin.debug: - msg: "{{ subscribe_s4 }}" - - - set_fact: - subscription_id: "{{ subscribe_s4.json.svcResL[0].res.subscrId }}" - - - name: "Verify Subscription" - ansible.builtin.uri: - url: "https://www.zuginfo.nrw/gate/?requestId={{ mysterious_id }}&hciMethod=SubscrDetails&hciVersion=1.24&hciClientType=WEB&hciClientVersion=10104&aid={{ aid }}&rnd={{ unix_time_millis }}" - method: POST - body: "{{ lookup('ansible.builtin.template','verify_subscription.json.j2') }}" - headers: - Accept-Encoding: gzip, deflate, br, zstd - Content-Type: application/json - Origin: https://www.zuginfo.nrw/ - Referer: https://www.zuginfo.nrw/ - TE: trailers - register: verify_subscription - - - name: "Print Result: Verify Subscription" - ansible.builtin.debug: - msg: "{{ verify_subscription }}" diff --git a/zuginfo_playbooks/zuginfo_api_update_subscription.yml b/zuginfo_playbooks/zuginfo_api_update_subscription.yml deleted file mode 100644 index 47b0868..0000000 --- a/zuginfo_playbooks/zuginfo_api_update_subscription.yml +++ /dev/null @@ -1,25 +0,0 @@ ---- - -- name: "Zuginfo.nrw API" - hosts: localhost - vars: - unix_time_millis: "1762342729099" - aid: "" - mysterious_id: "" - - tasks: - - name: "Update Subscription (no messages on S4 concerning Sundays)" - ansible.builtin.uri: - url: "https://www.zuginfo.nrw/gate/?requestId={{ mysterious_id }}&hciMethod=SubscrUpdate&hciVersion=1.24&hciClientType=WEB&hciClientVersion=10104&aid={{ aid }}&rnd={{ unix_time_millis }}" - method: POST - body: "{{ lookup('ansible.builtin.template','update_subscription.json.j2') }}" - headers: - Accept-Encoding: gzip, deflate, br, zstd - Content-Type: application/json - Origin: https://www.zuginfo.nrw/ - Referer: https://www.zuginfo.nrw/ - register: update_subscription - - - name: "Print Result of Updating Subscription" - ansible.builtin.debug: - msg: "{{ update_subscription }}"