geo-activity-playground 0.24.2__py3-none-any.whl → 0.25.0__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 +0 -2
- geo_activity_playground/core/activities.py +71 -149
- geo_activity_playground/core/enrichment.py +164 -0
- geo_activity_playground/core/paths.py +34 -15
- geo_activity_playground/core/tasks.py +26 -3
- geo_activity_playground/explorer/tile_visits.py +78 -42
- geo_activity_playground/{core → importers}/activity_parsers.py +7 -14
- geo_activity_playground/importers/directory.py +36 -27
- geo_activity_playground/importers/strava_api.py +45 -38
- geo_activity_playground/importers/strava_checkout.py +24 -16
- geo_activity_playground/webui/activity/controller.py +2 -2
- geo_activity_playground/webui/activity/templates/activity/show.html.j2 +2 -0
- geo_activity_playground/webui/app.py +11 -31
- geo_activity_playground/webui/entry_controller.py +5 -5
- geo_activity_playground/webui/heatmap/heatmap_controller.py +6 -0
- geo_activity_playground/webui/strava/__init__.py +0 -0
- geo_activity_playground/webui/strava/blueprint.py +33 -0
- geo_activity_playground/webui/strava/controller.py +47 -0
- geo_activity_playground/webui/{templates/strava-connect.html.j2 → strava/templates/strava/client-id.html.j2} +3 -7
- geo_activity_playground/webui/strava/templates/strava/connected.html.j2 +14 -0
- geo_activity_playground/webui/templates/home.html.j2 +5 -0
- geo_activity_playground/webui/templates/page.html.j2 +3 -0
- geo_activity_playground/webui/templates/settings.html.j2 +15 -0
- geo_activity_playground/webui/upload/controller.py +12 -16
- {geo_activity_playground-0.24.2.dist-info → geo_activity_playground-0.25.0.dist-info}/METADATA +1 -1
- {geo_activity_playground-0.24.2.dist-info → geo_activity_playground-0.25.0.dist-info}/RECORD +29 -25
- geo_activity_playground/core/cache_migrations.py +0 -133
- geo_activity_playground/webui/strava_controller.py +0 -27
- {geo_activity_playground-0.24.2.dist-info → geo_activity_playground-0.25.0.dist-info}/LICENSE +0 -0
- {geo_activity_playground-0.24.2.dist-info → geo_activity_playground-0.25.0.dist-info}/WHEEL +0 -0
- {geo_activity_playground-0.24.2.dist-info → geo_activity_playground-0.25.0.dist-info}/entry_points.txt +0 -0
@@ -18,11 +18,12 @@ from .explorer.blueprint import make_explorer_blueprint
|
|
18
18
|
from .heatmap.blueprint import make_heatmap_blueprint
|
19
19
|
from .search_controller import SearchController
|
20
20
|
from .square_planner.blueprint import make_square_planner_blueprint
|
21
|
-
from .
|
21
|
+
from .strava.blueprint import make_strava_blueprint
|
22
22
|
from .summary.blueprint import make_summary_blueprint
|
23
23
|
from .tile.blueprint import make_tile_blueprint
|
24
24
|
from .upload.blueprint import make_upload_blueprint
|
25
25
|
from geo_activity_playground.core.privacy_zones import PrivacyZone
|
26
|
+
from geo_activity_playground.webui.strava.controller import StravaController
|
26
27
|
|
27
28
|
|
28
29
|
def route_search(app: Flask, repository: ActivityRepository) -> None:
|
@@ -45,35 +46,10 @@ def route_start(app: Flask, repository: ActivityRepository) -> None:
|
|
45
46
|
return render_template("home.html.j2", **entry_controller.render())
|
46
47
|
|
47
48
|
|
48
|
-
def
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
def strava_connect():
|
53
|
-
return render_template(
|
54
|
-
"strava-connect.html.j2",
|
55
|
-
host=host,
|
56
|
-
port=port,
|
57
|
-
**strava_controller.action_connect()
|
58
|
-
)
|
59
|
-
|
60
|
-
@app.route("/strava/authorize")
|
61
|
-
def strava_authorize():
|
62
|
-
client_id = request.form["client_id"]
|
63
|
-
client_secret = request.form["client_secret"]
|
64
|
-
return redirect(
|
65
|
-
strava_controller.action_authorize(host, port, client_id, client_secret)
|
66
|
-
)
|
67
|
-
|
68
|
-
@app.route("/strava/callback")
|
69
|
-
def strava_callback():
|
70
|
-
code = request.args.get("code", type=str)
|
71
|
-
return render_template(
|
72
|
-
"strava-connect.html.j2",
|
73
|
-
host=host,
|
74
|
-
port=port,
|
75
|
-
**strava_controller.action_connect()
|
76
|
-
)
|
49
|
+
def route_settings(app: Flask) -> None:
|
50
|
+
@app.route("/settings")
|
51
|
+
def settings():
|
52
|
+
return render_template("settings.html.j2")
|
77
53
|
|
78
54
|
|
79
55
|
def get_secret_key():
|
@@ -99,7 +75,7 @@ def webui_main(
|
|
99
75
|
|
100
76
|
route_search(app, repository)
|
101
77
|
route_start(app, repository)
|
102
|
-
|
78
|
+
route_settings(app)
|
103
79
|
|
104
80
|
app.config["UPLOAD_FOLDER"] = "Activities"
|
105
81
|
app.secret_key = get_secret_key()
|
@@ -136,6 +112,10 @@ def webui_main(
|
|
136
112
|
make_summary_blueprint(repository),
|
137
113
|
url_prefix="/summary",
|
138
114
|
)
|
115
|
+
app.register_blueprint(
|
116
|
+
make_strava_blueprint(host, port),
|
117
|
+
url_prefix="/strava",
|
118
|
+
)
|
139
119
|
app.register_blueprint(make_tile_blueprint(), url_prefix="/tile")
|
140
120
|
app.register_blueprint(
|
141
121
|
make_upload_blueprint(repository, tile_visit_accessor, config),
|
@@ -13,12 +13,12 @@ class EntryController:
|
|
13
13
|
self._repository = repository
|
14
14
|
|
15
15
|
def render(self) -> dict:
|
16
|
-
result = {
|
17
|
-
|
16
|
+
result = {"latest_activities": []}
|
17
|
+
|
18
|
+
if len(self._repository):
|
19
|
+
result["distance_last_30_days_plot"] = distance_last_30_days_meta_plot(
|
18
20
|
self._repository.meta
|
19
|
-
)
|
20
|
-
"latest_activities": [],
|
21
|
-
}
|
21
|
+
)
|
22
22
|
|
23
23
|
for activity in itertools.islice(
|
24
24
|
self._repository.iter_activities(dropna=True), 15
|
@@ -83,6 +83,12 @@ class HeatmapController:
|
|
83
83
|
with work_tracker(
|
84
84
|
tile_count_cache_path.with_suffix(".json")
|
85
85
|
) as parsed_activities:
|
86
|
+
if parsed_activities - activity_ids:
|
87
|
+
logger.warning(
|
88
|
+
f"Resetting heatmap cache for {kind=}/{x=}/{y=}/{z=} because activities have been removed."
|
89
|
+
)
|
90
|
+
tile_counts = np.zeros(tile_pixels, dtype=np.int32)
|
91
|
+
parsed_activities.clear()
|
86
92
|
for activity_id in activity_ids:
|
87
93
|
if activity_id in parsed_activities:
|
88
94
|
continue
|
File without changes
|
@@ -0,0 +1,33 @@
|
|
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
|
@@ -0,0 +1,47 @@
|
|
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
|
+
)
|
46
|
+
|
47
|
+
return {}
|
@@ -6,21 +6,17 @@
|
|
6
6
|
|
7
7
|
<div class="row mb-3">
|
8
8
|
<div class="col-md-4">
|
9
|
-
<form action="/strava/
|
9
|
+
<form action="/strava/post-client-id" method="POST">
|
10
10
|
<div class="mb-3">
|
11
11
|
<label for="client_id" class="form-label">Client ID</label>
|
12
|
-
<input type="text" class="form-control" id="client_id" name="client_id"
|
12
|
+
<input type="text" class="form-control" id="client_id" name="client_id" value="131693" />
|
13
13
|
</div>
|
14
14
|
<div class="mb-3">
|
15
15
|
<label for="client_secret" class="form-label">Client Secret</label>
|
16
16
|
<input type="text" class="form-control" id="client_secret" name="client_secret"
|
17
|
-
|
17
|
+
value="0ccc0100a2c218512a7ef0cea3b0e322fb4b4365" />
|
18
18
|
</div>
|
19
19
|
|
20
|
-
|
21
|
-
<input type="hidden" name="redirect_uri" value="http://{{ host }}:{{ port }}/strava/callback" />
|
22
|
-
<input type="hidden" name="response_type" value="code" />
|
23
|
-
<input type="hidden" name="scope" value="activity:read_all" />
|
24
20
|
<input type="submit" value="Connect to Strava" />
|
25
21
|
</form>
|
26
22
|
</div>
|
@@ -0,0 +1,14 @@
|
|
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-md-4">
|
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 %}
|
@@ -4,6 +4,7 @@
|
|
4
4
|
<div class="row mb-3">
|
5
5
|
</div>
|
6
6
|
|
7
|
+
{% if latest_activities %}
|
7
8
|
<div class="row mb-3">
|
8
9
|
<div class="col-md-9">
|
9
10
|
<h2>Last 30 days</h2>
|
@@ -63,5 +64,9 @@
|
|
63
64
|
{% endfor %}
|
64
65
|
</div>
|
65
66
|
{% endfor %}
|
67
|
+
{% else %}
|
68
|
+
<p>You don't have activities yet. Either put some files into a directory <tt>Activities</tt> or <a
|
69
|
+
href="{{ url_for('strava.setup') }}">set up Strava API</a>.</p>
|
70
|
+
{% endif %}
|
66
71
|
|
67
72
|
{% endblock %}
|
@@ -90,6 +90,9 @@
|
|
90
90
|
<a class="nav-link active" aria-current="page"
|
91
91
|
href="{{ url_for('upload.index') }}">Upload</a>
|
92
92
|
</li>
|
93
|
+
<li class="nav-item">
|
94
|
+
<a class="nav-link active" aria-current="page" href="{{ url_for('settings') }}">Settings</a>
|
95
|
+
</li>
|
93
96
|
</ul>
|
94
97
|
</div>
|
95
98
|
</div>
|
@@ -0,0 +1,15 @@
|
|
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="col">
|
12
|
+
<p><a href="{{ url_for('strava.setup') }}">Set up Strava API</a>.</p>
|
13
|
+
</div>
|
14
|
+
</div>
|
15
|
+
{% endblock %}
|
@@ -10,7 +10,9 @@ from flask import Response
|
|
10
10
|
from werkzeug.utils import secure_filename
|
11
11
|
|
12
12
|
from geo_activity_playground.core.activities import ActivityRepository
|
13
|
-
from geo_activity_playground.core.activities import
|
13
|
+
from geo_activity_playground.core.activities import build_activity_meta
|
14
|
+
from geo_activity_playground.core.enrichment import enrich_activities
|
15
|
+
from geo_activity_playground.core.paths import _strava_dynamic_config_path
|
14
16
|
from geo_activity_playground.explorer.tile_visits import compute_tile_evolution
|
15
17
|
from geo_activity_playground.explorer.tile_visits import compute_tile_visits
|
16
18
|
from geo_activity_playground.explorer.tile_visits import TileVisitAccessor
|
@@ -94,22 +96,16 @@ def scan_for_activities(
|
|
94
96
|
skip_strava: bool = False,
|
95
97
|
) -> None:
|
96
98
|
if pathlib.Path("Activities").exists():
|
97
|
-
import_from_directory(
|
98
|
-
repository,
|
99
|
-
config.get("kind", {}),
|
100
|
-
config.get("metadata_extraction_regexes", []),
|
101
|
-
)
|
99
|
+
import_from_directory(config.get("metadata_extraction_regexes", []))
|
102
100
|
if pathlib.Path("Strava Export").exists():
|
103
101
|
import_from_strava_checkout(repository)
|
104
|
-
if "strava" in config and not skip_strava:
|
105
|
-
import_from_strava_api(
|
102
|
+
if (_strava_dynamic_config_path.exists() or "strava" in config) and not skip_strava:
|
103
|
+
import_from_strava_api()
|
106
104
|
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
)
|
111
|
-
sys.exit(1)
|
105
|
+
enrich_activities(config.get("kind", {}))
|
106
|
+
build_activity_meta()
|
107
|
+
repository.reload()
|
112
108
|
|
113
|
-
|
114
|
-
|
115
|
-
|
109
|
+
if len(repository) > 0:
|
110
|
+
compute_tile_visits(repository, tile_visit_accessor)
|
111
|
+
compute_tile_evolution(tile_visit_accessor)
|
{geo_activity_playground-0.24.2.dist-info → geo_activity_playground-0.25.0.dist-info}/RECORD
RENAMED
@@ -1,39 +1,39 @@
|
|
1
1
|
geo_activity_playground/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
2
|
-
geo_activity_playground/__main__.py,sha256=
|
2
|
+
geo_activity_playground/__main__.py,sha256=NQDFaa1BSIdare1oIdYO0cESf0kPVnEIE3J24jlsX_E,4021
|
3
3
|
geo_activity_playground/core/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
4
|
-
geo_activity_playground/core/activities.py,sha256=
|
5
|
-
geo_activity_playground/core/activity_parsers.py,sha256=pjYjnaAXsWfUNOoomYWOmmFZO5Qs076RWM-pqNdo7BA,10905
|
6
|
-
geo_activity_playground/core/cache_migrations.py,sha256=tkGA0h69-m-0Ek7JjvfVOX45YXLXkh_ZvC2TKB_fvbA,4281
|
4
|
+
geo_activity_playground/core/activities.py,sha256=I1lsn1gO_P9eHbZCZlkCO6Lvi5sqXq_-c-1aDv6uKMs,8081
|
7
5
|
geo_activity_playground/core/config.py,sha256=YjqCiEmIAa-GM1-JfBctMEsl8-I56pZyyDdTyPduOzw,477
|
8
6
|
geo_activity_playground/core/coordinates.py,sha256=tDfr9mlXhK6E_MMIJ0vYWVCoH0Lq8uyuaqUgaa8i0jg,966
|
7
|
+
geo_activity_playground/core/enrichment.py,sha256=wRVhrUCsvs2CcVhN-BQwxk_W_0E0AFp1_hncGzWNNvo,6435
|
9
8
|
geo_activity_playground/core/heatmap.py,sha256=bRLQHzmTEsQbX8XWeg85x_lRGk272UoYRiCnoxZ5da0,4189
|
10
|
-
geo_activity_playground/core/paths.py,sha256=
|
9
|
+
geo_activity_playground/core/paths.py,sha256=ohJN_xNLh303uc0ATpL4iH01xANIE86pILRaQi4e-RQ,1893
|
11
10
|
geo_activity_playground/core/privacy_zones.py,sha256=4TumHsVUN1uW6RG3ArqTXDykPVipF98DCxVBe7YNdO8,512
|
12
11
|
geo_activity_playground/core/similarity.py,sha256=Jo8jRViuORCxdIGvyaflgsQhwu9S_jn10a450FRL18A,3159
|
13
|
-
geo_activity_playground/core/tasks.py,sha256=
|
12
|
+
geo_activity_playground/core/tasks.py,sha256=wp3Q8P0u9Frbuel1Inll6Zgi8a3GUM7SCltE14o1VXw,2495
|
14
13
|
geo_activity_playground/core/test_tiles.py,sha256=zce1FxNfsSpOQt66jMehdQRVoNdl-oiFydx6iVBHZXM,764
|
15
14
|
geo_activity_playground/core/test_time_conversion.py,sha256=Sh6nZA3uCTOdZTZa3yOijtR0m74QtZu2mcWXsDNnyQI,984
|
16
15
|
geo_activity_playground/core/tiles.py,sha256=VxPu9vdfKnxDxaYo5JSYmka9Dt3TDxg0zo3cYVJXVHc,3359
|
17
16
|
geo_activity_playground/core/time_conversion.py,sha256=9J6aTlqJhWvsknQkoECNL-CIG-8BKs6ZatJJ9XJnTsg,367
|
18
17
|
geo_activity_playground/explorer/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
19
18
|
geo_activity_playground/explorer/grid_file.py,sha256=k6j6KBEk2a2BY-onE8SV5TJsERGGyOrlY4as__meWpA,3304
|
20
|
-
geo_activity_playground/explorer/tile_visits.py,sha256=
|
19
|
+
geo_activity_playground/explorer/tile_visits.py,sha256=CLZ8bCUKc5YoxvNa23hGF9JtlinIl9Wbk9u2xN4bJpw,13457
|
21
20
|
geo_activity_playground/explorer/video.py,sha256=ROAmV9shfJyqTgnXVD41KFORiwnRgVpEWenIq4hMCRM,4389
|
22
21
|
geo_activity_playground/importers/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
23
|
-
geo_activity_playground/importers/
|
24
|
-
geo_activity_playground/importers/
|
25
|
-
geo_activity_playground/importers/
|
22
|
+
geo_activity_playground/importers/activity_parsers.py,sha256=m2SpvGlTZ8F3gG6YB24_ZFrlOAbtqbfWi-GIYspeUco,10593
|
23
|
+
geo_activity_playground/importers/directory.py,sha256=YTYuroH-oYviL2a9B7No-6Fx4RrkhMqf60Yh-7dGats,5384
|
24
|
+
geo_activity_playground/importers/strava_api.py,sha256=ihy_ezq_gYUy1V4jbtg41N6K0ilYVOEiPZE07lSiUHU,8444
|
25
|
+
geo_activity_playground/importers/strava_checkout.py,sha256=mUKfCzBk0sMF6WEmAGelnwqGnonVO1UW_uZVAtxDJVQ,8576
|
26
26
|
geo_activity_playground/importers/test_directory.py,sha256=ljXokx7q0OgtHvEdHftcQYEmZJUDVv3OOF5opklxdT4,724
|
27
27
|
geo_activity_playground/importers/test_strava_api.py,sha256=4vX7wDr1a9aRh8myxNrIq6RwDBbP8ZeoXXPc10CAbW4,431
|
28
28
|
geo_activity_playground/webui/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
29
29
|
geo_activity_playground/webui/activity/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
30
30
|
geo_activity_playground/webui/activity/blueprint.py,sha256=gGMes5ycXi2rMixVYs4NQgzTU1Vttgu50prYAe3--Hs,1749
|
31
|
-
geo_activity_playground/webui/activity/controller.py,sha256=
|
31
|
+
geo_activity_playground/webui/activity/controller.py,sha256=BSmHwO2GLyMGiFRQ0BpTsHMKDWJbz5UHnwQ9HVULN4c,16679
|
32
32
|
geo_activity_playground/webui/activity/templates/activity/day.html.j2,sha256=r3qKl9uTzOko4R-ZzyYAZt1j61JSevYP4g0Yi06HHPg,2702
|
33
33
|
geo_activity_playground/webui/activity/templates/activity/lines.html.j2,sha256=5gB1aDjRgi_RventenRfC10_FtMT4ch_VuWvA9AMlBY,1121
|
34
34
|
geo_activity_playground/webui/activity/templates/activity/name.html.j2,sha256=RDLEt6ip8_ngmdLgaC5jg92Dk-F2umGwKkd8cWmvVko,2400
|
35
|
-
geo_activity_playground/webui/activity/templates/activity/show.html.j2,sha256=
|
36
|
-
geo_activity_playground/webui/app.py,sha256=
|
35
|
+
geo_activity_playground/webui/activity/templates/activity/show.html.j2,sha256=NOsMPUBy1UQM_YebtT6RQxLSgSGvCMetqi_mspJmUjQ,5229
|
36
|
+
geo_activity_playground/webui/app.py,sha256=a6RcsPH-n1Ru6RybkAPCRENL9KnPvxfPBJI9IzsEB5U,3980
|
37
37
|
geo_activity_playground/webui/calendar/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
38
38
|
geo_activity_playground/webui/calendar/blueprint.py,sha256=rlnhgU2DWAcdLMRq7m77NzrM_aDyp4s3kuuQHuzjHhg,782
|
39
39
|
geo_activity_playground/webui/calendar/controller.py,sha256=QpSAkR2s1sbLSu6P_fNNTccgGglOzEH2PIv1XwKxeVY,2778
|
@@ -43,7 +43,7 @@ geo_activity_playground/webui/eddington/__init__.py,sha256=47DEQpj8HBSa-_TImW-5J
|
|
43
43
|
geo_activity_playground/webui/eddington/blueprint.py,sha256=evIvueLfDWVTxJ9pRguqmZ9-Pybd2WmBRst_-7vX2QA,551
|
44
44
|
geo_activity_playground/webui/eddington/controller.py,sha256=L4YssL088UMamp4qgzEtilzhaKGZsyfVUScuw-fmTjE,2888
|
45
45
|
geo_activity_playground/webui/eddington/templates/eddington/index.html.j2,sha256=XHKeUymQMS5x00PLOVlg-nSRCz_jHB2pvD8QunULWJ4,1839
|
46
|
-
geo_activity_playground/webui/entry_controller.py,sha256=
|
46
|
+
geo_activity_playground/webui/entry_controller.py,sha256=n9v4MriyL8kDR91LE9eeqc2tAvxyzFgoNMMXpr0qh4g,1906
|
47
47
|
geo_activity_playground/webui/equipment/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
48
48
|
geo_activity_playground/webui/equipment/blueprint.py,sha256=YbOAsjk05BMeUlD6wGfxE1amvlLsFjG4HMJn5SBrVRU,551
|
49
49
|
geo_activity_playground/webui/equipment/controller.py,sha256=m1LNaGCNJnW97TlKT6x9NfQcMp6RKcZ8Q0I1FTUAvss,4037
|
@@ -54,7 +54,7 @@ geo_activity_playground/webui/explorer/controller.py,sha256=8d0FFrG55ZlPQ5seQC2D
|
|
54
54
|
geo_activity_playground/webui/explorer/templates/explorer/index.html.j2,sha256=OxNt2_VwH-cmVXJrDNfeD-dNB9IrwBjdhhQEqkXxHj0,6529
|
55
55
|
geo_activity_playground/webui/heatmap/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
56
56
|
geo_activity_playground/webui/heatmap/blueprint.py,sha256=bjQu-HL3QN5UpJ6tHOifhcLGlPr_hIKvaRu78md4JqM,1470
|
57
|
-
geo_activity_playground/webui/heatmap/heatmap_controller.py,sha256=
|
57
|
+
geo_activity_playground/webui/heatmap/heatmap_controller.py,sha256=i376qEqTJrhezGsdPyKR8VsRY2N0JdEra7_kY7NmwW8,6822
|
58
58
|
geo_activity_playground/webui/heatmap/templates/heatmap/index.html.j2,sha256=YLeu6P4djl8G4qAXR6DhetseqrbOodN7aN4coocknc4,1875
|
59
59
|
geo_activity_playground/webui/search_controller.py,sha256=PzMf7b8tiJKZIZoPvQ9A2hOrzoKV9cS3jq05w2fK94c,532
|
60
60
|
geo_activity_playground/webui/square_planner/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
@@ -72,24 +72,28 @@ geo_activity_playground/webui/static/favicon.ico,sha256=uVNZlrF22zn1lcCS_9wAoWLh
|
|
72
72
|
geo_activity_playground/webui/static/mstile-150x150.png,sha256=j1ANUQJ1Xi1DR2sGqYZztob2ypfGw04eNtGpN9SxExA,11964
|
73
73
|
geo_activity_playground/webui/static/safari-pinned-tab.svg,sha256=OzoEVGY0igWRXM1NiM3SRKugdICBN7aB_XuxaC3Mu9Q,8371
|
74
74
|
geo_activity_playground/webui/static/site.webmanifest,sha256=4vYxdPMpwTdB8EmOvHkkYcjZ8Yrci3pOwwY3o_VwACA,440
|
75
|
-
geo_activity_playground/webui/
|
75
|
+
geo_activity_playground/webui/strava/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
76
|
+
geo_activity_playground/webui/strava/blueprint.py,sha256=Q2Wfxlg7bR2vjWZ3UpckPl9jWHwNB8hfP7SLBufgiUY,1055
|
77
|
+
geo_activity_playground/webui/strava/controller.py,sha256=vTspMZvhM2jt3PjnN4ey17mSRvbeoHktZ5_r9mxyfZY,1379
|
78
|
+
geo_activity_playground/webui/strava/templates/strava/client-id.html.j2,sha256=fnxr1pSZgLxrdykqy33fYqoo8jVvdWSXBj8ZDIXq_jw,849
|
79
|
+
geo_activity_playground/webui/strava/templates/strava/connected.html.j2,sha256=e0FB00AwxuKWDsENkSq6FW-822-gx1ubNMps-Sj5gsY,279
|
76
80
|
geo_activity_playground/webui/summary/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
77
81
|
geo_activity_playground/webui/summary/blueprint.py,sha256=kzQ6MDOycQKfDcVoEUmL7HYHJA_gu8DlzVHwO37-_jA,514
|
78
82
|
geo_activity_playground/webui/summary/controller.py,sha256=i6A9-S9j9Hm67FcZPzJpqMgxRVsXbDmJiVLGiRtZIqk,8805
|
79
83
|
geo_activity_playground/webui/summary/templates/summary/index.html.j2,sha256=rsII1eMY-xNugh8A9SecnEcDZqkEOWYIfiHAGroQYuM,4442
|
80
|
-
geo_activity_playground/webui/templates/home.html.j2,sha256=
|
81
|
-
geo_activity_playground/webui/templates/page.html.j2,sha256=
|
84
|
+
geo_activity_playground/webui/templates/home.html.j2,sha256=fp48MjBuO4QJfQz6YPOWH56IzStgaclx9XbwEKmUFHQ,2403
|
85
|
+
geo_activity_playground/webui/templates/page.html.j2,sha256=Dal68Juf6dZeejnG79mESfyLX_cweFXMSmLF4J1Ybk4,7489
|
82
86
|
geo_activity_playground/webui/templates/search.html.j2,sha256=FvNRoDfUlSzXjM_tqZY_fDhuhUDgbPaY73q56gdvF1A,1130
|
83
|
-
geo_activity_playground/webui/templates/
|
87
|
+
geo_activity_playground/webui/templates/settings.html.j2,sha256=HSFmNameF7ejSd5PxGVuPNBV5HgjP61Q7th8ZR0AxOU,297
|
84
88
|
geo_activity_playground/webui/tile/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
85
89
|
geo_activity_playground/webui/tile/blueprint.py,sha256=cK0o2Z3BrLycgF9zw0F8s9qF-JaYDbF5Gog-GXDtUZ8,943
|
86
90
|
geo_activity_playground/webui/tile/controller.py,sha256=PISh4vKs27b-LxFfTARtr5RAwHFresA1Kw1MDcERSRU,1221
|
87
91
|
geo_activity_playground/webui/upload/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
88
92
|
geo_activity_playground/webui/upload/blueprint.py,sha256=2l5q1LYtjgLF_3CAyPvCLx-wMebp14OJvgZBzGILdmQ,801
|
89
|
-
geo_activity_playground/webui/upload/controller.py,sha256=
|
93
|
+
geo_activity_playground/webui/upload/controller.py,sha256=FDqhCPUpK5uQMfu1xGZ19Sw7jeazL33btX0a8BV5sgo,3985
|
90
94
|
geo_activity_playground/webui/upload/templates/upload/index.html.j2,sha256=hfXkEXaz_MkM46rU56423D6V6WtK-EAXPszSY-_-Tx8,1471
|
91
|
-
geo_activity_playground-0.
|
92
|
-
geo_activity_playground-0.
|
93
|
-
geo_activity_playground-0.
|
94
|
-
geo_activity_playground-0.
|
95
|
-
geo_activity_playground-0.
|
95
|
+
geo_activity_playground-0.25.0.dist-info/LICENSE,sha256=4RpAwKO8bPkfXH2lnpeUW0eLkNWglyG4lbrLDU_MOwY,1070
|
96
|
+
geo_activity_playground-0.25.0.dist-info/METADATA,sha256=d7EZsJfNeXv7cqVnCCJ_jOoxs5-a7Wlntgw7nZTrOKM,1665
|
97
|
+
geo_activity_playground-0.25.0.dist-info/WHEEL,sha256=FMvqSimYX_P7y0a7UY-_Mc83r5zkBZsCYPm7Lr0Bsq4,88
|
98
|
+
geo_activity_playground-0.25.0.dist-info/entry_points.txt,sha256=pbNlLI6IIZIp7nPYCfAtiSiz2oxJSCl7DODD6SPkLKk,81
|
99
|
+
geo_activity_playground-0.25.0.dist-info/RECORD,,
|
@@ -1,133 +0,0 @@
|
|
1
|
-
import json
|
2
|
-
import logging
|
3
|
-
import pathlib
|
4
|
-
import shutil
|
5
|
-
|
6
|
-
import pandas as pd
|
7
|
-
from tqdm import tqdm
|
8
|
-
|
9
|
-
from geo_activity_playground.core.paths import activities_path
|
10
|
-
from geo_activity_playground.core.paths import activity_timeseries_dir
|
11
|
-
from geo_activity_playground.core.tasks import work_tracker_path
|
12
|
-
|
13
|
-
logger = logging.getLogger(__name__)
|
14
|
-
|
15
|
-
|
16
|
-
def delete_activities_per_tile() -> None:
|
17
|
-
paths = [
|
18
|
-
pathlib.Path("Cache/activities-per-tile.pickle"),
|
19
|
-
pathlib.Path("Cache/activities-per-tile-task.json"),
|
20
|
-
]
|
21
|
-
for path in paths:
|
22
|
-
path.unlink(missing_ok=True)
|
23
|
-
|
24
|
-
|
25
|
-
def delete_work_tracker(name: str):
|
26
|
-
work_tracker_path(name).unlink(missing_ok=True)
|
27
|
-
|
28
|
-
|
29
|
-
def reset_time_series_embellishment() -> None:
|
30
|
-
pathlib.Path("Cache/work-tracker-embellish-time-series.pickle").unlink(
|
31
|
-
missing_ok=True
|
32
|
-
)
|
33
|
-
|
34
|
-
|
35
|
-
def delete_tile_visits() -> None:
|
36
|
-
paths = [
|
37
|
-
pathlib.Path("Cache/activities-per-tile.pickle"),
|
38
|
-
pathlib.Path("Cache/tile-evolution-state.pickle"),
|
39
|
-
pathlib.Path("Cache/tile-history.pickle"),
|
40
|
-
pathlib.Path("Cache/tile-visits.pickle"),
|
41
|
-
pathlib.Path("Cache/work-tracker-parse-activity-files.pickle"),
|
42
|
-
pathlib.Path("Cache/work-tracker-tile-visits.pickle"),
|
43
|
-
]
|
44
|
-
for path in paths:
|
45
|
-
path.unlink(missing_ok=True)
|
46
|
-
|
47
|
-
|
48
|
-
def delete_heatmap_cache() -> None:
|
49
|
-
path = pathlib.Path("Cache/Heatmap")
|
50
|
-
if path.exists():
|
51
|
-
shutil.rmtree(path)
|
52
|
-
|
53
|
-
|
54
|
-
def delete_activity_metadata() -> None:
|
55
|
-
delete_work_tracker("parse-activity-files")
|
56
|
-
activities_path().unlink(missing_ok=True)
|
57
|
-
|
58
|
-
|
59
|
-
def convert_distances_to_km() -> None:
|
60
|
-
if activities_path().exists():
|
61
|
-
activities = pd.read_parquet(activities_path())
|
62
|
-
if not "distance_km" in activities.columns:
|
63
|
-
activities["distance_km"] = activities["distance"] / 1000
|
64
|
-
for col in ["distance", "distance/km"]:
|
65
|
-
if col in activities.columns:
|
66
|
-
del activities[col]
|
67
|
-
activities.to_parquet(activities_path())
|
68
|
-
|
69
|
-
for time_series_path in tqdm(
|
70
|
-
list(activity_timeseries_dir().glob("*.parquet")),
|
71
|
-
desc="Convert m to km",
|
72
|
-
):
|
73
|
-
time_series = pd.read_parquet(time_series_path)
|
74
|
-
if "distance" in time_series.columns:
|
75
|
-
time_series["distance_km"] = time_series["distance"] / 1000
|
76
|
-
for col in ["distance", "distance/km"]:
|
77
|
-
if col in time_series.columns:
|
78
|
-
del time_series[col]
|
79
|
-
time_series.to_parquet(time_series_path)
|
80
|
-
|
81
|
-
|
82
|
-
def add_consider_for_achievements() -> None:
|
83
|
-
activities_path = pathlib.Path("Cache/activities.parquet")
|
84
|
-
if activities_path.exists():
|
85
|
-
df = pd.read_parquet(activities_path)
|
86
|
-
if "consider_for_achievements" not in df.columns:
|
87
|
-
df["consider_for_achievements"] = True
|
88
|
-
else:
|
89
|
-
df.loc[
|
90
|
-
df["consider_for_achievements"].isna(), "consider_for_achievements"
|
91
|
-
] = True
|
92
|
-
df.to_parquet("Cache/activities.parquet")
|
93
|
-
|
94
|
-
|
95
|
-
def delete_everything() -> None:
|
96
|
-
if pathlib.Path("Cache").exists():
|
97
|
-
shutil.rmtree("Cache")
|
98
|
-
|
99
|
-
|
100
|
-
def apply_cache_migrations() -> None:
|
101
|
-
logger.info("Apply cache migration if needed …")
|
102
|
-
cache_status_file = pathlib.Path("Cache/status.json")
|
103
|
-
if cache_status_file.exists():
|
104
|
-
with open(cache_status_file) as f:
|
105
|
-
cache_status = json.load(f)
|
106
|
-
else:
|
107
|
-
cache_status = {"num_applied_migrations": 0}
|
108
|
-
|
109
|
-
migrations = [
|
110
|
-
delete_activities_per_tile,
|
111
|
-
reset_time_series_embellishment,
|
112
|
-
delete_tile_visits,
|
113
|
-
delete_heatmap_cache,
|
114
|
-
delete_activity_metadata,
|
115
|
-
delete_activity_metadata,
|
116
|
-
convert_distances_to_km,
|
117
|
-
delete_activity_metadata,
|
118
|
-
delete_tile_visits,
|
119
|
-
delete_heatmap_cache,
|
120
|
-
add_consider_for_achievements,
|
121
|
-
delete_tile_visits,
|
122
|
-
delete_heatmap_cache,
|
123
|
-
delete_tile_visits,
|
124
|
-
delete_everything,
|
125
|
-
]
|
126
|
-
|
127
|
-
for migration in migrations[cache_status["num_applied_migrations"] :]:
|
128
|
-
logger.info(f"Applying cache migration {migration.__name__} …")
|
129
|
-
migration()
|
130
|
-
cache_status["num_applied_migrations"] += 1
|
131
|
-
cache_status_file.parent.mkdir(exist_ok=True, parents=True)
|
132
|
-
with open(cache_status_file, "w") as f:
|
133
|
-
json.dump(cache_status, f)
|
@@ -1,27 +0,0 @@
|
|
1
|
-
import urllib.parse
|
2
|
-
from typing import Optional
|
3
|
-
|
4
|
-
|
5
|
-
class StravaController:
|
6
|
-
def __init__(self) -> None:
|
7
|
-
self._client_secret: Optional[str] = None
|
8
|
-
|
9
|
-
def action_connect(self) -> dict:
|
10
|
-
return {}
|
11
|
-
|
12
|
-
def action_authorize(
|
13
|
-
self, host: str, port: int, client_id: str, client_secret: str
|
14
|
-
) -> str:
|
15
|
-
self._client_secret = client_secret
|
16
|
-
|
17
|
-
payload = {
|
18
|
-
"client_id": client_id,
|
19
|
-
"redirect_uri": f"http://{host}:{port}/strava/callback",
|
20
|
-
"response_type": "code",
|
21
|
-
"scope": "activity:read_all",
|
22
|
-
}
|
23
|
-
|
24
|
-
arg_string = "&".join(
|
25
|
-
f"{key}={urllib.parse.quote(value)}" for key, value in payload.items()
|
26
|
-
)
|
27
|
-
return f"https://www.strava.com/oauth/authorize?{arg_string}"
|
{geo_activity_playground-0.24.2.dist-info → geo_activity_playground-0.25.0.dist-info}/LICENSE
RENAMED
File without changes
|
File without changes
|
File without changes
|