Skip to content

Commit

Permalink
set default file_suffix = gpx (yihong0618#609)
Browse files Browse the repository at this point in the history
* set default file_suffix = gpx

* fix: lint

Signed-off-by: yihong0618 <zouzou0208@gmail.com>

---------

Signed-off-by: yihong0618 <zouzou0208@gmail.com>
Co-authored-by: yihong0618 <zouzou0208@gmail.com>
  • Loading branch information
2 people authored and Kugin committed Sep 13, 2024
1 parent 5dd11e1 commit 00d8a30
Show file tree
Hide file tree
Showing 14 changed files with 31 additions and 15 deletions.
6 changes: 3 additions & 3 deletions run_page/codoon_sync.py
Original file line number Diff line number Diff line change
Expand Up @@ -346,9 +346,9 @@ def __call__(self, r):
r.headers["timestamp"] = timestamp
if "refresh_token" in params:
r.headers["authorization"] = "Basic " + basic_auth
r.headers[
"content-type"
] = "application/x-www-form-urlencode; charset=utf-8"
r.headers["content-type"] = (
"application/x-www-form-urlencode; charset=utf-8"
)
else:
r.headers["authorization"] = "Bearer " + self.token
r.headers["content-type"] = "application/json; charset=utf-8"
Expand Down
1 change: 1 addition & 0 deletions run_page/endomondo_sync.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
need to download the files from endomondo
and store it in Workous dir in running_page
"""

import json
import os
from collections import namedtuple
Expand Down
1 change: 1 addition & 0 deletions run_page/garmin_to_strava_sync.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
new garmin ids to strava;
not the same logic as nike_to_strava_sync
"""

import argparse
import asyncio
import os
Expand Down
1 change: 1 addition & 0 deletions run_page/gpxtrackposter/circular_drawer.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Draw a circular Poster."""

# Copyright 2016-2019 Florian Pigorsch & Contributors. All rights reserved.
#
# Use of this source code is governed by a MIT-style
Expand Down
1 change: 1 addition & 0 deletions run_page/gpxtrackposter/grid_drawer.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Draw a grid poster."""

# Copyright 2016-2019 Florian Pigorsch & Contributors. All rights reserved.
#
# Use of this source code is governed by a MIT-style
Expand Down
1 change: 1 addition & 0 deletions run_page/gpxtrackposter/poster.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Create a poster from track data."""

import gettext
import locale
from collections import defaultdict
Expand Down
23 changes: 14 additions & 9 deletions run_page/gpxtrackposter/track.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Create and maintain info about a given activity track (corresponding to one GPX file)."""

# Copyright 2016-2019 Florian Pigorsch & Contributors. All rights reserved.
# 2019-now yihong0618 Florian Pigorsch & Contributors. All rights reserved.
# Use of this source code is governed by a MIT-style
Expand Down Expand Up @@ -247,9 +248,11 @@ def _load_fit_data(self, fit: dict):
# moving_dict
self.moving_dict["distance"] = message["total_distance"]
self.moving_dict["moving_time"] = datetime.timedelta(
seconds=message["total_moving_time"]
if "total_moving_time" in message
else message["total_timer_time"]
seconds=(
message["total_moving_time"]
if "total_moving_time" in message
else message["total_timer_time"]
)
)
self.moving_dict["elapsed_time"] = datetime.timedelta(
seconds=message["total_elapsed_time"]
Expand Down Expand Up @@ -309,9 +312,11 @@ def _get_moving_data(gpx):
"elapsed_time": datetime.timedelta(
seconds=(moving_data.moving_time + moving_data.stopped_time)
),
"average_speed": moving_data.moving_distance / moving_data.moving_time
if moving_data.moving_time
else 0,
"average_speed": (
moving_data.moving_distance / moving_data.moving_time
if moving_data.moving_time
else 0
),
}

def to_namedtuple(self):
Expand All @@ -324,9 +329,9 @@ def to_namedtuple(self):
"start_date_local": self.start_time_local.strftime("%Y-%m-%d %H:%M:%S"),
"end_local": self.end_time_local.strftime("%Y-%m-%d %H:%M:%S"),
"length": self.length,
"average_heartrate": int(self.average_heartrate)
if self.average_heartrate
else None,
"average_heartrate": (
int(self.average_heartrate) if self.average_heartrate else None
),
"map": run_map(self.polyline_str),
"start_latlng": self.start_latlng,
}
Expand Down
3 changes: 1 addition & 2 deletions run_page/gpxtrackposter/track_loader.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
"""Handle parsing of GPX files"""


# Copyright 2016-2019 Florian Pigorsch & Contributors. All rights reserved.
# 2019-now Yihong0618
#
Expand Down Expand Up @@ -67,7 +66,7 @@ def __init__(self):
"fit": load_fit_file,
}

def load_tracks(self, data_dir, file_suffix):
def load_tracks(self, data_dir, file_suffix="gpx"):
"""Load tracks data_dir and return as a List of tracks"""
file_names = [x for x in self._list_data_files(data_dir, file_suffix)]
print(f"{file_suffix.upper()} files: {len(file_names)}")
Expand Down
1 change: 1 addition & 0 deletions run_page/gpxtrackposter/tracks_drawer.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Contains the base class TracksDrawer, which other Drawers inherit from."""

# Copyright 2016-2019 Florian Pigorsch & Contributors. All rights reserved.
#
# Use of this source code is governed by a MIT-style
Expand Down
1 change: 1 addition & 0 deletions run_page/gpxtrackposter/utils.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Assorted utility methods for use in creating posters."""

# Copyright 2016-2019 Florian Pigorsch & Contributors. All rights reserved.
#
# Use of this source code is governed by a MIT-style
Expand Down
1 change: 1 addition & 0 deletions run_page/gpxtrackposter/value_range.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Represent a range of numerical values"""

# Copyright 2016-2019 Florian Pigorsch & Contributors. All rights reserved.
#
# Use of this source code is governed by a MIT-style
Expand Down
1 change: 1 addition & 0 deletions run_page/gpxtrackposter/xy.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Represent x,y coords with properly overloaded operations."""

# Copyright 2016-2019 Florian Pigorsch & Contributors. All rights reserved.
#
# Use of this source code is governed by a MIT-style
Expand Down
1 change: 1 addition & 0 deletions run_page/gpxtrackposter/year_range.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Represent a range of years, with ability to update based on a track"""

# Copyright 2016-2019 Florian Pigorsch & Contributors. All rights reserved.
#
# Use of this source code is governed by a MIT-style
Expand Down
4 changes: 3 additions & 1 deletion run_page/joyrun_sync.py
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,9 @@ def __update_loginInfo(self):
self.session.headers.update({"ypcookie": loginCookie})
self.session.cookies.clear()
self.session.cookies.set("ypcookie", quote(loginCookie).lower())
self.session.headers.update(self.device_info_headers) # 更新设备信息中的 uid 字段
self.session.headers.update(
self.device_info_headers
) # 更新设备信息中的 uid 字段

def login_by_phone(self):
params = {
Expand Down

0 comments on commit 00d8a30

Please sign in to comment.