From 69b6cdf5ee040c8b7ebcbe3f926a86ce144c0b2d Mon Sep 17 00:00:00 2001 From: Philipp Spitzer Date: Sun, 22 May 2022 17:46:24 +0200 Subject: [PATCH] =?utf8?q?Parse=20"Tiroler=20Naturrodelbahn=20G=C3=BCtesie?= =?utf8?q?gel".?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- bots/sledrun_wikitext_to_json.py | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/bots/sledrun_wikitext_to_json.py b/bots/sledrun_wikitext_to_json.py index 7ee83ca..92484fd 100644 --- a/bots/sledrun_wikitext_to_json.py +++ b/bots/sledrun_wikitext_to_json.py @@ -426,6 +426,31 @@ class SledrunWikiTextToJsonBot( sledrun_json['allow_reports'] = True + def _tiroler_naturrodelbahn_guetesiegel(): + for gst in wikicode.filter_templates(): + if gst.name.strip() != 'Tiroler Naturrodelbahn Gütesiegel': + continue + gsj = {} + keys = { + 'Anlagename': 'name', + 'Organisation': 'organization', + 'Erstverleihung': 'first_issued', + 'Verlängerung': 'valid_from', + 'Forum': 'forum_id', + 'Thread': 'thread_id', + } + numeric = ['first_issued', 'valid_from', 'forum_id', 'thread_id'] + for key, value in keys.items(): + if gst.has(key): + v = gst.get(key).value.strip() + if v != '': + if value in numeric: + v = int(v) + gsj[value] = v + if len(gsj) > 0: + sledrun_json['tiroler_naturrodelbahn_gütesiegel'] = gsj + _tiroler_naturrodelbahn_guetesiegel() + impressions = None sledrun_impressions_page = Page(self.site, self.current_page.title() + '/Impressionen') if sledrun_impressions_page.exists(): -- 2.39.5