Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
4d1dd75c9d | ||
|
|
1bd6e0c905 |
@@ -29,7 +29,12 @@ async function main() {
|
||||
if (blackList[id]) {
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
if (!["walking", "cycling"].includes(act.activityType?.typeKey)) {
|
||||
console.error("Skipping", act.activityId, `(${act.activityType?.typeKey} activity not supported)`);
|
||||
blackList[id] = true;
|
||||
continue;
|
||||
}
|
||||
if (!act.startTimeLocal.startsWith(todayDate)) {
|
||||
console.error("Skipping", act.activityId, "(not today)");
|
||||
blackList[id] = true;
|
||||
@@ -45,9 +50,11 @@ async function main() {
|
||||
blackList[id] = true;
|
||||
continue;
|
||||
}
|
||||
|
||||
console.log("Going ahead with", act.activityId, act.activityType.typeKey)
|
||||
|
||||
await garmin.downloadOriginalActivityData(act, "/tmp/", "tcx")
|
||||
const input = await generateTrimlogInput(`/tmp/${act.activityId}.tcx`, act.activityName)
|
||||
const input = await generateTrimlogInput(`/tmp/${act.activityId}.tcx`, act.activityName, act.activityType?.typeKey)
|
||||
|
||||
input.tags.push({key: "gc:ActivityID", value: id})
|
||||
|
||||
|
||||
+2
-2
@@ -1,7 +1,7 @@
|
||||
import * as fs from "fs/promises";
|
||||
import { parseString } from "xml2js";
|
||||
|
||||
export function generateTrimlogInput(filename, name = "Walk") {
|
||||
export function generateTrimlogInput(filename, name = "Walk", type = "walk") {
|
||||
return new Promise(async(resolve, reject) => {
|
||||
parseString(await fs.readFile(filename, "utf-8"), (err, res) => {
|
||||
if (err != null) {
|
||||
@@ -45,7 +45,7 @@ export function generateTrimlogInput(filename, name = "Walk") {
|
||||
const out = {
|
||||
date: dateStr,
|
||||
contents: [{rawActivity: {
|
||||
kind: "Walking",
|
||||
kind: type === "cycling" ? "Biking" : "Walking",
|
||||
sets: [],
|
||||
effortScale: 1,
|
||||
weight: 0,
|
||||
|
||||
Reference in New Issue
Block a user