Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

publish-barshare-gbfs: add index/overview page #3

Merged
merged 3 commits into from
Apr 7, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 6 additions & 3 deletions moqoToGBFS.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@

configs = {
'BARshare': {
'publication_base_url': 'https://data.mfdz.de/gbfs/barshare',
'publication_base_url': 'https://opendata.bbnavi.de/barshare',
'team_id': '460276220',
'team_id_bike': '514091075',
'system_information_data' : {
Expand All @@ -34,7 +34,7 @@
"url": "https://www.barshare.de/",
"purchase_url": "https://portal.moqo.de/js_sign_up/barshare#/team-selection",
"email": "[email protected]",
"feed_contact_email": "info@mfdz.de",
"feed_contact_email": "kontakt@digital-agentur.de",
"terms_url": "https://barshare.de/images/page/download/Agb_07_2020.pdf",
"terms_last_updated": "2020-07-01",
"privacy_url": "https://barshare.de/datenschutz",
Expand Down Expand Up @@ -484,9 +484,12 @@ def write_gbfs_feed(config, destFolder, info, status, vehicle_types, vehicles, b
if form_factor:
base_url = "{}/{}".format(base_url, form_factor)
destFolder = "{}/{}".format(destFolder, form_factor)
Path(destFolder).mkdir(parents=True, exist_ok=True)
(info, status, vehicle_types, vehicles, pricing_plans) = filter_by_form_factor(info, status, vehicle_types, vehicles, pricing_plans, form_factor)
system_information["system_id"] = system_information["system_id"]+"-"+form_factor
else:
base_url = "{}/{}".format(base_url, 'all')
destFolder = "{}/{}".format(destFolder, 'all')
Path(destFolder).mkdir(parents=True, exist_ok=True)

propagate_rental_uris(vehicles, info)
timestamp = int(datetime.timestamp(datetime.now()))
Expand Down
1 change: 1 addition & 0 deletions publish-barshare-gbfs/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ RUN apk add --no-cache --update tree
COPY --from=mc /usr/bin/mc /usr/bin/mc

COPY main.sh ./
COPY index.html ./

# prevent inheriting `python` as entrypoint
ENTRYPOINT []
Expand Down
85 changes: 85 additions & 0 deletions publish-barshare-gbfs/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
<!DOCTYPE html>

<html lang="de">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>BARShare Open Data</title>
<style type="text/css">
body {
margin: 1rem;
font-size: 100%;
font-family: sans-serif;
line-height: 1.35;
}
header {
margin-bottom: 2rem;
}
footer {
margin-top: 5rem;
}
a, a:visited {
color: #da1b1b;
}
h1, h2, h3 {
font-weight: 500;
margin-bottom: .8em;
}
#bbnavi-logo {
display: inline-block;
text-decoration: none;
font-size: 2rem;
}
#bbnavi-logo svg {
display: inline-block;
width: 3rem;
vertical-align: bottom;
}
footer ul {
list-style: none;
padding-left: 0;
}
</style>
</head>
<body>
<header>
<a id="bbnavi-logo" href="https://bbnavi.de/">
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 75 75">
<defs>
<style>
.cls-1{fill: #da1b1b;}.cls-2{fill: #fff;}
</style>
</defs>
<rect class="cls-1" x="5" y="5" width="65" height="65" rx="10"/>
<path class="cls-2" d="M41,48.91l7.17-20.44,1.05-3a12.77,12.77,0,0,0,.25-2.5,12.15,12.15,0,1,0-24.29,0,12.35,12.35,0,0,0,.32,2.81l.84,2.38,7.28,20.75C19,49.42,7.81,52.62,7.81,56.51c0,4.22,13.29,7.65,29.69,7.65s29.69-3.43,29.69-7.65C67.19,52.58,55.72,49.35,41,48.91ZM37.05,61c-12.92,0-23.39-2.12-23.39-4.73,0-2.44,9.12-4.44,20.84-4.7L36.41,57a.9.9,0,0,0,1.69,0L40,51.59c11.53.3,20.44,2.28,20.44,4.69C60.44,58.89,50,61,37.05,61Z"/>
</svg>
bbnavi
</a>
<h1>BARShare Open Data</h1>
</header>
<h2>GBFS-Feeds mit Verfügbarkeit von Leihfahrrädern & -autos</h2>
<p><a href="https://github.com/NABSA/gbfs/blob/v2.2/README.md" rel="noreferrer noopener">Mehr Informationen zum GBFS-Format (Englisch)</a></p>
<h3>Feed mit <em>allen</em> Fahrzeugen</h3>
<ul>
<li><a href="./gbfs.json"><code>gbfs.json</code></a> (<a href="https://creativecommons.org/publicdomain/zero/1.0/"><code>CC0-1.0</code></a>)</li>
</ul>
<h3>Feed mit Leihfahrrädern</h3>
<ul>
<li><a href="./bicycle/gbfs.json"><code>gbfs.json</code></a> (<a href="https://creativecommons.org/publicdomain/zero/1.0/"><code>CC0-1.0</code></a>)</li>
</ul>
<h3>Feed mit Carsharing-Fahrzeugen</h3>
<ul>
<li><a href="./car/gbfs.json"><code>gbfs.json</code></a> (<a href="https://creativecommons.org/publicdomain/zero/1.0/"><code>CC0-1.0</code></a>)</li>
</ul>
<h3>Feed mit sonstigen Fahrzeugen (derzeit insbesondere Lastenräder, für die in GBFS 2.2 noch kein form_factor definiert ist.)</h3>
<ul>
<li><a href="./other/gbfs.json"><code>gbfs.json</code></a> (<a href="https://creativecommons.org/publicdomain/zero/1.0/"><code>CC0-1.0</code></a>)</li>
</ul>
<footer>
<ul>
<li><a href="https://bbnavi.de/impressum/">Impressum</a></li>
<li><a href="https://bbnavi.de/datenschutzerklaerung/">Datenschutz</a></li>
</ul>
</footer>
</body>
</html>
2 changes: 2 additions & 0 deletions publish-barshare-gbfs/main.sh
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@ dir="$(mktemp -d -t barshare-gbfs.XXXXXX)"

set -x

mc cp -q index.html bbnavi/barshare/

while true; do
# We sleep first so that, if the GBFS generation fails contantly, we don't DOS the Moqo API.
sleep "$PUBLISH_INTERVAL"
Expand Down