2020-09-17 16:19:57 +00:00
|
|
|
'''
|
|
|
|
This file is part of JANINE.
|
|
|
|
|
|
|
|
JANINE is free software: you can redistribute it and/or modify
|
|
|
|
it under the terms of the GNU General Public License as published by
|
|
|
|
the Free Software Foundation, either version 3 of the License, or
|
|
|
|
(at your option) any later version.
|
|
|
|
|
|
|
|
JANINE is distributed in the hope that it will be useful,
|
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
GNU General Public License for more details.
|
|
|
|
|
|
|
|
You should have received a copy of the GNU General Public License
|
|
|
|
along with JANINE. If not, see <https://www.gnu.org/licenses/>.
|
|
|
|
'''
|
|
|
|
|
2020-08-22 13:09:59 +00:00
|
|
|
class WarningSources:
|
|
|
|
'''
|
|
|
|
A collection of sources of the BBK
|
|
|
|
'''
|
|
|
|
@staticmethod
|
|
|
|
def bbk_dwd():
|
|
|
|
return 'https://warnung.bund.de/bbk.dwd/unwetter.json'
|
|
|
|
|
|
|
|
@staticmethod
|
|
|
|
def bbk_mowas():
|
|
|
|
return 'https://warnung.bund.de/bbk.mowas/gefahrendurchsagen.json'
|
|
|
|
|
|
|
|
@staticmethod
|
|
|
|
def bbk_biwapp():
|
|
|
|
return 'https://warnung.bund.de/bbk.biwapp/warnmeldungen.json'
|
|
|
|
|
|
|
|
@staticmethod
|
|
|
|
def bbk_ihp():
|
|
|
|
return 'https://warnung.bund.de/bbk.lhp/hochwassermeldungen.json'
|
|
|
|
|
|
|
|
@staticmethod
|
|
|
|
def source_by_name(name):
|
|
|
|
return {
|
|
|
|
'IHP': WarningSources.bbk_ihp(),
|
|
|
|
'DWD': WarningSources.bbk_dwd(),
|
|
|
|
'MOWAS': WarningSources.bbk_mowas(),
|
|
|
|
'BIWAPP': WarningSources.bbk_biwapp()
|
|
|
|
}[name]
|
|
|
|
|
2020-08-31 11:06:24 +00:00
|
|
|
class MiscDataSources:
|
|
|
|
'''
|
|
|
|
A collection of other data sources for various use cases
|
|
|
|
'''
|
|
|
|
@staticmethod
|
|
|
|
def channels():
|
|
|
|
'''
|
|
|
|
These are the valid names to retrieve warnings for
|
|
|
|
'''
|
|
|
|
return 'https://warnung.bund.de/assets/json/suche_channel.json'
|
|
|
|
|
2020-08-22 13:09:59 +00:00
|
|
|
def sources_from_config(config):
|
|
|
|
sources = []
|
|
|
|
for module in ('IHP', 'DWD', 'BIWAPP', 'MOWAS'):
|
2020-08-22 13:11:55 +00:00
|
|
|
option = config['General'].get(module, 'n')
|
|
|
|
|
2020-08-22 13:09:59 +00:00
|
|
|
if option == 'y':
|
|
|
|
sources.append(WarningSources.source_by_name(module))
|
|
|
|
|
|
|
|
return sources
|