geo-activity-playground 0.33.2__py3-none-any.whl → 0.33.3__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 +1 -1
- geo_activity_playground/webui/app.py +1 -1
- geo_activity_playground/webui/entry_controller.py +1 -1
- geo_activity_playground/webui/templates/home.html.j2 +3 -2
- geo_activity_playground/webui/{upload/controller.py → upload_blueprint.py} +40 -33
- {geo_activity_playground-0.33.2.dist-info → geo_activity_playground-0.33.3.dist-info}/METADATA +1 -1
- {geo_activity_playground-0.33.2.dist-info → geo_activity_playground-0.33.3.dist-info}/RECORD +12 -14
- geo_activity_playground/webui/upload/__init__.py +0 -0
- geo_activity_playground/webui/upload/blueprint.py +0 -44
- /geo_activity_playground/webui/{upload/templates → templates}/upload/index.html.j2 +0 -0
- /geo_activity_playground/webui/{upload/templates → templates}/upload/reload.html.j2 +0 -0
- {geo_activity_playground-0.33.2.dist-info → geo_activity_playground-0.33.3.dist-info}/LICENSE +0 -0
- {geo_activity_playground-0.33.2.dist-info → geo_activity_playground-0.33.3.dist-info}/WHEEL +0 -0
- {geo_activity_playground-0.33.2.dist-info → geo_activity_playground-0.33.3.dist-info}/entry_points.txt +0 -0
@@ -13,7 +13,7 @@ from geo_activity_playground.core.config import import_old_strava_config
|
|
13
13
|
from geo_activity_playground.explorer.tile_visits import TileVisitAccessor
|
14
14
|
from geo_activity_playground.explorer.video import explorer_video_main
|
15
15
|
from geo_activity_playground.webui.app import web_ui_main
|
16
|
-
from geo_activity_playground.webui.
|
16
|
+
from geo_activity_playground.webui.upload_blueprint import scan_for_activities
|
17
17
|
|
18
18
|
logger = logging.getLogger(__name__)
|
19
19
|
|
@@ -22,7 +22,7 @@ from .search.blueprint import make_search_blueprint
|
|
22
22
|
from .square_planner.blueprint import make_square_planner_blueprint
|
23
23
|
from .summary.blueprint import make_summary_blueprint
|
24
24
|
from .tile.blueprint import make_tile_blueprint
|
25
|
-
from .
|
25
|
+
from .upload_blueprint import make_upload_blueprint
|
26
26
|
from geo_activity_playground.core.config import Config
|
27
27
|
from geo_activity_playground.core.config import ConfigAccessor
|
28
28
|
from geo_activity_playground.webui.auth.blueprint import make_auth_blueprint
|
@@ -16,10 +16,10 @@ class EntryController:
|
|
16
16
|
self._config = config
|
17
17
|
|
18
18
|
def render(self) -> dict:
|
19
|
-
kind_scale = make_kind_scale(self._repository.meta, self._config)
|
20
19
|
result = {"latest_activities": []}
|
21
20
|
|
22
21
|
if len(self._repository):
|
22
|
+
kind_scale = make_kind_scale(self._repository.meta, self._config)
|
23
23
|
result["distance_last_30_days_plot"] = distance_last_30_days_meta_plot(
|
24
24
|
self._repository.meta, kind_scale
|
25
25
|
)
|
@@ -58,8 +58,9 @@
|
|
58
58
|
</div>
|
59
59
|
{% endfor %}
|
60
60
|
{% else %}
|
61
|
-
<p>You don't have activities yet. Either put some files into a directory <tt>Activities</tt
|
62
|
-
href="{{ url_for('settings.strava') }}">set up
|
61
|
+
<p>You don't have activities yet. Either put some files into a directory <tt>Activities</tt>, <a
|
62
|
+
href="{{ url_for('upload.index') }}">upload activities</a> or <a href="{{ url_for('settings.strava') }}">set up
|
63
|
+
Strava API</a>.</p>
|
63
64
|
{% endif %}
|
64
65
|
|
65
66
|
{% endblock %}
|
@@ -1,53 +1,51 @@
|
|
1
|
-
import logging
|
2
1
|
import os
|
3
2
|
import pathlib
|
4
3
|
|
4
|
+
from flask import Blueprint
|
5
5
|
from flask import flash
|
6
6
|
from flask import redirect
|
7
|
+
from flask import render_template
|
7
8
|
from flask import request
|
8
|
-
from flask import Response
|
9
9
|
from flask import url_for
|
10
|
-
from werkzeug.utils import secure_filename
|
11
10
|
|
12
|
-
from
|
13
|
-
from
|
11
|
+
from ..core.activities import ActivityRepository
|
12
|
+
from ..core.activities import build_activity_meta
|
13
|
+
from ..explorer.tile_visits import compute_tile_evolution
|
14
|
+
from ..explorer.tile_visits import compute_tile_visits_new
|
15
|
+
from ..explorer.tile_visits import TileVisitAccessor
|
14
16
|
from geo_activity_playground.core.config import Config
|
15
17
|
from geo_activity_playground.core.enrichment import enrich_activities
|
16
|
-
from geo_activity_playground.explorer.tile_visits import compute_tile_evolution
|
17
|
-
from geo_activity_playground.explorer.tile_visits import compute_tile_visits_new
|
18
|
-
from geo_activity_playground.explorer.tile_visits import TileVisitAccessor
|
19
18
|
from geo_activity_playground.importers.directory import get_file_hash
|
20
19
|
from geo_activity_playground.importers.directory import import_from_directory
|
21
20
|
from geo_activity_playground.importers.strava_api import import_from_strava_api
|
22
21
|
from geo_activity_playground.importers.strava_checkout import (
|
23
22
|
import_from_strava_checkout,
|
24
23
|
)
|
24
|
+
from geo_activity_playground.webui.authenticator import Authenticator
|
25
|
+
from geo_activity_playground.webui.authenticator import needs_authentication
|
25
26
|
|
26
27
|
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
tile_visit_accessor: TileVisitAccessor,
|
35
|
-
config: Config,
|
36
|
-
) -> None:
|
37
|
-
self._repository = repository
|
38
|
-
self._tile_visit_accessor = tile_visit_accessor
|
39
|
-
self._config = config
|
28
|
+
def make_upload_blueprint(
|
29
|
+
repository: ActivityRepository,
|
30
|
+
tile_visit_accessor: TileVisitAccessor,
|
31
|
+
config: Config,
|
32
|
+
authenticator: Authenticator,
|
33
|
+
) -> Blueprint:
|
34
|
+
blueprint = Blueprint("upload", __name__, template_folder="templates")
|
40
35
|
|
41
|
-
|
36
|
+
@blueprint.route("/")
|
37
|
+
@needs_authentication(authenticator)
|
38
|
+
def index():
|
39
|
+
pathlib.Path("Activities").mkdir(exist_ok=True, parents=True)
|
42
40
|
directories = []
|
43
41
|
for root, dirs, files in os.walk("Activities"):
|
44
42
|
directories.append(root)
|
45
43
|
directories.sort()
|
46
|
-
return
|
47
|
-
"directories": directories,
|
48
|
-
}
|
44
|
+
return render_template("upload/index.html.j2", directories=directories)
|
49
45
|
|
50
|
-
|
46
|
+
@blueprint.route("/receive", methods=["POST"])
|
47
|
+
@needs_authentication(authenticator)
|
48
|
+
def receive():
|
51
49
|
# check if the post request has the file part
|
52
50
|
if "file" not in request.files:
|
53
51
|
flash("No file could be found. Did you select a file?", "warning")
|
@@ -74,25 +72,34 @@ class UploadController:
|
|
74
72
|
assert target_path.is_relative_to("Activities")
|
75
73
|
file.save(target_path)
|
76
74
|
scan_for_activities(
|
77
|
-
|
78
|
-
|
79
|
-
|
75
|
+
repository,
|
76
|
+
tile_visit_accessor,
|
77
|
+
config,
|
80
78
|
skip_strava=True,
|
81
79
|
)
|
82
80
|
activity_id = get_file_hash(target_path)
|
83
81
|
flash(f"Activity was saved with ID {activity_id}.", "success")
|
84
82
|
return redirect(f"/activity/{activity_id}")
|
85
83
|
|
86
|
-
|
84
|
+
@blueprint.route("/refresh")
|
85
|
+
@needs_authentication(authenticator)
|
86
|
+
def reload():
|
87
|
+
return render_template("upload/reload.html.j2")
|
88
|
+
|
89
|
+
@blueprint.route("/execute-reload")
|
90
|
+
@needs_authentication(authenticator)
|
91
|
+
def execute_reload():
|
87
92
|
scan_for_activities(
|
88
|
-
|
89
|
-
|
90
|
-
|
93
|
+
repository,
|
94
|
+
tile_visit_accessor,
|
95
|
+
config,
|
91
96
|
skip_strava=True,
|
92
97
|
)
|
93
98
|
flash("Scanned for new activities.", category="success")
|
94
99
|
return redirect(url_for("index"))
|
95
100
|
|
101
|
+
return blueprint
|
102
|
+
|
96
103
|
|
97
104
|
def scan_for_activities(
|
98
105
|
repository: ActivityRepository,
|
{geo_activity_playground-0.33.2.dist-info → geo_activity_playground-0.33.3.dist-info}/RECORD
RENAMED
@@ -1,5 +1,5 @@
|
|
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=qbKjs7IsJwF2gB3b0lh7tGt6uraPqq5w-xGBIxrgoHI,3988
|
3
3
|
geo_activity_playground/core/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
4
4
|
geo_activity_playground/core/activities.py,sha256=MiQev1L7NnSVnxgbArlT-FpWTESTwnKh7pyT1tcEHqU,6926
|
5
5
|
geo_activity_playground/core/config.py,sha256=uqiwk7CgcuGx8JemHSsRKjRwyNT1YTb7V0gX0OJhfaI,5109
|
@@ -37,7 +37,7 @@ geo_activity_playground/webui/activity/templates/activity/edit.html.j2,sha256=ck
|
|
37
37
|
geo_activity_playground/webui/activity/templates/activity/lines.html.j2,sha256=_ZDg1ruW-9UMJfOudy1-uY_-IcSSaagq7tPCih5Bb8g,1079
|
38
38
|
geo_activity_playground/webui/activity/templates/activity/name.html.j2,sha256=tKviMqMouHEGv3xBQVIsJgwj_hjwAsmGVefM3UMqlYg,2437
|
39
39
|
geo_activity_playground/webui/activity/templates/activity/show.html.j2,sha256=bEx37UGSTeeJl7gN4fjyOpINFQwZ5Zm-HOKpLqcJGfs,6905
|
40
|
-
geo_activity_playground/webui/app.py,sha256=
|
40
|
+
geo_activity_playground/webui/app.py,sha256=KghChBgJvRZ9Cx7Z5wmqx6X0Q6GH-2hi97eaKEE_Zvc,5118
|
41
41
|
geo_activity_playground/webui/auth/blueprint.py,sha256=Lx-ZvMnfHLC1CMre1xPQI3k_pCtQoZvgRhtmafULzoE,812
|
42
42
|
geo_activity_playground/webui/auth/templates/auth/index.html.j2,sha256=ILQ5HvTEYc3OrtOAIFt1VrqWorVD70V9DC342znmP70,579
|
43
43
|
geo_activity_playground/webui/authenticator.py,sha256=k278OEVuOfAmTGT4F2X4pqSTwwkK_FA87EIhAeysEqc,1416
|
@@ -50,7 +50,7 @@ geo_activity_playground/webui/eddington/__init__.py,sha256=47DEQpj8HBSa-_TImW-5J
|
|
50
50
|
geo_activity_playground/webui/eddington/blueprint.py,sha256=evIvueLfDWVTxJ9pRguqmZ9-Pybd2WmBRst_-7vX2QA,551
|
51
51
|
geo_activity_playground/webui/eddington/controller.py,sha256=ly7JSkSS79kO4CL_xugB62uRuuWKVqOjbN-pheelv94,2910
|
52
52
|
geo_activity_playground/webui/eddington/templates/eddington/index.html.j2,sha256=XHKeUymQMS5x00PLOVlg-nSRCz_jHB2pvD8QunULWJ4,1839
|
53
|
-
geo_activity_playground/webui/entry_controller.py,sha256=
|
53
|
+
geo_activity_playground/webui/entry_controller.py,sha256=McxbyouKWHJ3a2R9agPazZoG7VHiFO1RvnkBr08dMH8,2168
|
54
54
|
geo_activity_playground/webui/equipment/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
55
55
|
geo_activity_playground/webui/equipment/blueprint.py,sha256=_NIhRJuJNbXpEd_nEPo01AqnUqPgo1vawFn7E3yoeng,636
|
56
56
|
geo_activity_playground/webui/equipment/controller.py,sha256=Sx9i2RCK7m4W6FgpDfRMewcH64VBQfUhHJdTSCwMqOU,4079
|
@@ -102,18 +102,16 @@ geo_activity_playground/webui/summary/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCe
|
|
102
102
|
geo_activity_playground/webui/summary/blueprint.py,sha256=tfA2aPF19yKwkQOb5lPQBySoQYYhTn49Iuh0SYvsGP8,593
|
103
103
|
geo_activity_playground/webui/summary/controller.py,sha256=V3zBLNL_Yc_Ft-ZBaWnlLXhr8VsvTpipPUZ-G9sgUXs,9312
|
104
104
|
geo_activity_playground/webui/summary/templates/summary/index.html.j2,sha256=ctOx3Qjx6nRDpUtFf1DlJhK_gtU77Vwx_S6euLz9-W4,5183
|
105
|
-
geo_activity_playground/webui/templates/home.html.j2,sha256=
|
105
|
+
geo_activity_playground/webui/templates/home.html.j2,sha256=IdCqI_LLcYrpUjjCO-tbXR4s05XYrPOateiJ4idF3bo,2202
|
106
106
|
geo_activity_playground/webui/templates/page.html.j2,sha256=znTbtD2NALrhmUN_Q-F1ElGlKtecoUv8vOCcUtojrdI,11134
|
107
|
+
geo_activity_playground/webui/templates/upload/index.html.j2,sha256=I1Ix8tDS3YBdi-HdaNfjkzYXVVCjfUTe5PFTnap1ydc,775
|
108
|
+
geo_activity_playground/webui/templates/upload/reload.html.j2,sha256=YZWX5eDeNyqKJdQAywDBcU8DZBm22rRBbZqFjrFrCvQ,556
|
107
109
|
geo_activity_playground/webui/tile/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
108
110
|
geo_activity_playground/webui/tile/blueprint.py,sha256=q0sw_F8L367Df01yjZijikEIglFBgg9lN61sbTAEOKQ,1018
|
109
111
|
geo_activity_playground/webui/tile/controller.py,sha256=XjUTbyAMeQET1D3mFtT8r5-xMcMOaELPZWtQ1Xp7Cuw,1428
|
110
|
-
geo_activity_playground/webui/
|
111
|
-
geo_activity_playground/
|
112
|
-
geo_activity_playground/
|
113
|
-
geo_activity_playground
|
114
|
-
geo_activity_playground/
|
115
|
-
geo_activity_playground-0.33.
|
116
|
-
geo_activity_playground-0.33.2.dist-info/METADATA,sha256=chmAY_tnW0Ptk7ZqbgDYeiL1pVSfh_4Fc9Zpac9bcZI,1612
|
117
|
-
geo_activity_playground-0.33.2.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
|
118
|
-
geo_activity_playground-0.33.2.dist-info/entry_points.txt,sha256=pbNlLI6IIZIp7nPYCfAtiSiz2oxJSCl7DODD6SPkLKk,81
|
119
|
-
geo_activity_playground-0.33.2.dist-info/RECORD,,
|
112
|
+
geo_activity_playground/webui/upload_blueprint.py,sha256=topLI9ytDUFkqCc9AlOqDkjhABUwnPJ1tX_7XrBPbxc,4412
|
113
|
+
geo_activity_playground-0.33.3.dist-info/LICENSE,sha256=4RpAwKO8bPkfXH2lnpeUW0eLkNWglyG4lbrLDU_MOwY,1070
|
114
|
+
geo_activity_playground-0.33.3.dist-info/METADATA,sha256=eUVURIw-QgIO2bQUHVXXrPNf35-v_XEywE9iwQ6mfa8,1612
|
115
|
+
geo_activity_playground-0.33.3.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
|
116
|
+
geo_activity_playground-0.33.3.dist-info/entry_points.txt,sha256=pbNlLI6IIZIp7nPYCfAtiSiz2oxJSCl7DODD6SPkLKk,81
|
117
|
+
geo_activity_playground-0.33.3.dist-info/RECORD,,
|
File without changes
|
@@ -1,44 +0,0 @@
|
|
1
|
-
from flask import Blueprint
|
2
|
-
from flask import render_template
|
3
|
-
|
4
|
-
from ...core.activities import ActivityRepository
|
5
|
-
from ...explorer.tile_visits import TileVisitAccessor
|
6
|
-
from .controller import UploadController
|
7
|
-
from geo_activity_playground.core.config import Config
|
8
|
-
from geo_activity_playground.webui.authenticator import Authenticator
|
9
|
-
from geo_activity_playground.webui.authenticator import needs_authentication
|
10
|
-
|
11
|
-
|
12
|
-
def make_upload_blueprint(
|
13
|
-
repository: ActivityRepository,
|
14
|
-
tile_visit_accessor: TileVisitAccessor,
|
15
|
-
config: Config,
|
16
|
-
authenticator: Authenticator,
|
17
|
-
) -> Blueprint:
|
18
|
-
blueprint = Blueprint("upload", __name__, template_folder="templates")
|
19
|
-
|
20
|
-
upload_controller = UploadController(repository, tile_visit_accessor, config)
|
21
|
-
|
22
|
-
@blueprint.route("/")
|
23
|
-
@needs_authentication(authenticator)
|
24
|
-
def index():
|
25
|
-
return render_template(
|
26
|
-
"upload/index.html.j2", **upload_controller.render_form()
|
27
|
-
)
|
28
|
-
|
29
|
-
@blueprint.route("/receive", methods=["POST"])
|
30
|
-
@needs_authentication(authenticator)
|
31
|
-
def receive():
|
32
|
-
return upload_controller.receive()
|
33
|
-
|
34
|
-
@blueprint.route("/refresh")
|
35
|
-
@needs_authentication(authenticator)
|
36
|
-
def reload():
|
37
|
-
return render_template("upload/reload.html.j2")
|
38
|
-
|
39
|
-
@blueprint.route("/execute-reload")
|
40
|
-
@needs_authentication(authenticator)
|
41
|
-
def execute_reload():
|
42
|
-
return upload_controller.execute_reload()
|
43
|
-
|
44
|
-
return blueprint
|
File without changes
|
File without changes
|
{geo_activity_playground-0.33.2.dist-info → geo_activity_playground-0.33.3.dist-info}/LICENSE
RENAMED
File without changes
|
File without changes
|
File without changes
|