geo-activity-playground 0.26.3__py3-none-any.whl → 0.27.1__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- geo_activity_playground/__main__.py +23 -20
- geo_activity_playground/core/activities.py +1 -44
- geo_activity_playground/core/config.py +111 -0
- geo_activity_playground/core/enrichment.py +11 -2
- geo_activity_playground/core/heart_rate.py +49 -0
- geo_activity_playground/core/paths.py +6 -0
- geo_activity_playground/core/tasks.py +14 -0
- geo_activity_playground/core/tiles.py +1 -1
- geo_activity_playground/explorer/tile_visits.py +23 -11
- geo_activity_playground/importers/csv_parser.py +73 -0
- geo_activity_playground/importers/directory.py +17 -8
- geo_activity_playground/importers/strava_api.py +20 -44
- geo_activity_playground/importers/strava_checkout.py +57 -32
- geo_activity_playground/importers/test_csv_parser.py +49 -0
- geo_activity_playground/webui/activity/blueprint.py +3 -4
- geo_activity_playground/webui/activity/controller.py +40 -14
- geo_activity_playground/webui/activity/templates/activity/show.html.j2 +6 -2
- geo_activity_playground/webui/app.py +26 -26
- geo_activity_playground/webui/eddington/controller.py +1 -1
- geo_activity_playground/webui/equipment/blueprint.py +5 -2
- geo_activity_playground/webui/equipment/controller.py +5 -6
- geo_activity_playground/webui/explorer/blueprint.py +14 -2
- geo_activity_playground/webui/explorer/controller.py +21 -1
- geo_activity_playground/webui/explorer/templates/explorer/index.html.j2 +12 -1
- geo_activity_playground/webui/settings/blueprint.py +106 -0
- geo_activity_playground/webui/settings/controller.py +228 -0
- geo_activity_playground/webui/settings/templates/settings/equipment-offsets.html.j2 +44 -0
- geo_activity_playground/webui/settings/templates/settings/heart-rate.html.j2 +102 -0
- geo_activity_playground/webui/settings/templates/settings/index.html.j2 +74 -0
- geo_activity_playground/webui/settings/templates/settings/kinds-without-achievements.html.j2 +30 -0
- geo_activity_playground/webui/settings/templates/settings/metadata-extraction.html.j2 +55 -0
- geo_activity_playground/webui/settings/templates/settings/privacy-zones.html.j2 +81 -0
- geo_activity_playground/webui/{strava/templates/strava/client-id.html.j2 → settings/templates/settings/strava.html.j2} +17 -7
- geo_activity_playground/webui/templates/home.html.j2 +1 -1
- geo_activity_playground/webui/templates/page.html.j2 +5 -1
- geo_activity_playground/webui/upload/blueprint.py +10 -1
- geo_activity_playground/webui/upload/controller.py +24 -11
- geo_activity_playground/webui/upload/templates/upload/reload.html.j2 +16 -0
- {geo_activity_playground-0.26.3.dist-info → geo_activity_playground-0.27.1.dist-info}/METADATA +1 -1
- {geo_activity_playground-0.26.3.dist-info → geo_activity_playground-0.27.1.dist-info}/RECORD +43 -36
- geo_activity_playground/webui/strava/__init__.py +0 -0
- geo_activity_playground/webui/strava/blueprint.py +0 -33
- geo_activity_playground/webui/strava/controller.py +0 -49
- geo_activity_playground/webui/strava/templates/strava/connected.html.j2 +0 -14
- geo_activity_playground/webui/templates/settings.html.j2 +0 -24
- {geo_activity_playground-0.26.3.dist-info → geo_activity_playground-0.27.1.dist-info}/LICENSE +0 -0
- {geo_activity_playground-0.26.3.dist-info → geo_activity_playground-0.27.1.dist-info}/WHEEL +0 -0
- {geo_activity_playground-0.26.3.dist-info → geo_activity_playground-0.27.1.dist-info}/entry_points.txt +0 -0
@@ -1,33 +0,0 @@
|
|
1
|
-
from flask import Blueprint
|
2
|
-
from flask import redirect
|
3
|
-
from flask import render_template
|
4
|
-
from flask import request
|
5
|
-
|
6
|
-
from .controller import StravaController
|
7
|
-
|
8
|
-
|
9
|
-
def make_strava_blueprint(host: str, port: int) -> Blueprint:
|
10
|
-
strava_controller = StravaController(host, port)
|
11
|
-
blueprint = Blueprint("strava", __name__, template_folder="templates")
|
12
|
-
|
13
|
-
@blueprint.route("/setup")
|
14
|
-
def setup():
|
15
|
-
return render_template(
|
16
|
-
"strava/client-id.html.j2", **strava_controller.set_client_id()
|
17
|
-
)
|
18
|
-
|
19
|
-
@blueprint.route("/post-client-id", methods=["POST"])
|
20
|
-
def post_client_id():
|
21
|
-
client_id = request.form["client_id"]
|
22
|
-
client_secret = request.form["client_secret"]
|
23
|
-
url = strava_controller.save_client_id(client_id, client_secret)
|
24
|
-
return redirect(url)
|
25
|
-
|
26
|
-
@blueprint.route("/callback")
|
27
|
-
def strava_callback():
|
28
|
-
code = request.args.get("code", type=str)
|
29
|
-
return render_template(
|
30
|
-
"strava/connected.html.j2", **strava_controller.save_code(code)
|
31
|
-
)
|
32
|
-
|
33
|
-
return blueprint
|
@@ -1,49 +0,0 @@
|
|
1
|
-
import json
|
2
|
-
import urllib.parse
|
3
|
-
from typing import Optional
|
4
|
-
|
5
|
-
from geo_activity_playground.core.paths import strava_dynamic_config_path
|
6
|
-
|
7
|
-
|
8
|
-
class StravaController:
|
9
|
-
def __init__(self, host: str, port: int) -> None:
|
10
|
-
self._host = host
|
11
|
-
self._port = port
|
12
|
-
|
13
|
-
self._client_secret: Optional[str] = None
|
14
|
-
|
15
|
-
def set_client_id(self) -> dict:
|
16
|
-
return {"host": self._host, "port": self._port}
|
17
|
-
|
18
|
-
def save_client_id(self, client_id: str, client_secret: str) -> str:
|
19
|
-
self._client_id = client_id
|
20
|
-
self._client_secret = client_secret
|
21
|
-
|
22
|
-
payload = {
|
23
|
-
"client_id": client_id,
|
24
|
-
"redirect_uri": f"http://{self._host}:{self._port}/strava/callback",
|
25
|
-
"response_type": "code",
|
26
|
-
"scope": "activity:read_all",
|
27
|
-
}
|
28
|
-
|
29
|
-
arg_string = "&".join(
|
30
|
-
f"{key}={urllib.parse.quote(value)}" for key, value in payload.items()
|
31
|
-
)
|
32
|
-
return f"https://www.strava.com/oauth/authorize?{arg_string}"
|
33
|
-
|
34
|
-
def save_code(self, code: str) -> dict:
|
35
|
-
self._code = code
|
36
|
-
|
37
|
-
with open(strava_dynamic_config_path(), "w") as f:
|
38
|
-
json.dump(
|
39
|
-
{
|
40
|
-
"client_id": self._client_id,
|
41
|
-
"client_secret": self._client_secret,
|
42
|
-
"code": self._code,
|
43
|
-
},
|
44
|
-
f,
|
45
|
-
indent=2,
|
46
|
-
sort_keys=True,
|
47
|
-
)
|
48
|
-
|
49
|
-
return {}
|
@@ -1,14 +0,0 @@
|
|
1
|
-
{% extends "page.html.j2" %}
|
2
|
-
|
3
|
-
{% block container %}
|
4
|
-
|
5
|
-
<h1 class="mb-3">Strava Connect</h1>
|
6
|
-
|
7
|
-
<div class="row mb-3">
|
8
|
-
<div class="col">
|
9
|
-
<p>You're now connected to Strava. Please restart the webserver to start loading actvities.</p>
|
10
|
-
</div>
|
11
|
-
</div>
|
12
|
-
|
13
|
-
|
14
|
-
{% endblock %}
|
@@ -1,24 +0,0 @@
|
|
1
|
-
{% extends "page.html.j2" %}
|
2
|
-
|
3
|
-
{% block container %}
|
4
|
-
<div class="row mb-3">
|
5
|
-
<div class="col">
|
6
|
-
<h1>Settings</h1>
|
7
|
-
</div>
|
8
|
-
</div>
|
9
|
-
|
10
|
-
<div class="row mb-3">
|
11
|
-
<div class="row row-cols-1 row-cols-md-3 g-2">
|
12
|
-
<div class="col">
|
13
|
-
<div class="card">
|
14
|
-
<div class="card-body">
|
15
|
-
<h5 class="card-title">Strava API</h5>
|
16
|
-
<p class="card-text">Connect to the Strava API to download activities from there.</p>
|
17
|
-
<a href="{{ url_for('strava.setup') }}" class="btn btn-primary">Set up Strava API</a>
|
18
|
-
</div>
|
19
|
-
</div>
|
20
|
-
</div>
|
21
|
-
|
22
|
-
</div>
|
23
|
-
</div>
|
24
|
-
{% endblock %}
|
{geo_activity_playground-0.26.3.dist-info → geo_activity_playground-0.27.1.dist-info}/LICENSE
RENAMED
File without changes
|
File without changes
|
File without changes
|