Skip to content

Iterative syncing every n #1

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
Tilogorn opened this issue Jul 28, 2021 · 4 comments
Open

Iterative syncing every n #1

Tilogorn opened this issue Jul 28, 2021 · 4 comments

Comments

@Tilogorn
Copy link

Hi Michał,

awesome project! Exactly what I was looking for. Just a few questions:

As I am no Python developer (but PHP and JS), I want to ask beforehand: My use case is a sync on daily basis from Komoot to Strava, as I like the navigation and UI by Komoot more but my friends/userbase is on strava (besides that, the analytics are better). There are devices that can upload to both services (Garmin etc.), but my smartphone can not (I would have to start recording every track in both apps, which seems kind of stupid). Right now I am doing a manual sync, which means downloading GPX data from Komoot and uploading them via webform to strava. Horrible experience...

  1. Is there any diffing algorithm involved or do your scripts always sync the whole komoot content to strava? So if you would run it twice, would you have every track twice on your strava account?

  2. The komoot API seems poorly documented - but don't you think with the appropiate credentials one is able to download his own tracks without setting them to public?

@michaltkacz
Copy link
Owner

Hi Daniel,
thank you for your interest. As I see, we share a very much common use case. I have been using Komoot mostly as a navigation (love the maps and route planning) for about a year now and I have recently started using Strava for stats and socials. I also use only my smartphone for recording and I don't find running two apps simultaniously a good idea.

Answering your first question:
My initial plan was to write a scripts basically for one use - transfer all my activites from Komoot to Strava, and abandon the Komoot, so I did not care about the code quality that much. Therefore there is no any diffing alorithm involved. Scripts always download from Komoot all the routes that are not yet on your computer and upload all of them to Strava. I have not tested what would happen, if I would run it twice (though I was fully aware of this possible use case) - but I am almost sure that it would just upload them twice. I am not entirely sure, because in POST request the external_id is specified (which is tour ID from Komoot) and maybe Strava API will detect duplications and return some error.
However, I think that implementing such an algorithm would be quite an easy task. For example:

  1. Fetch info (id, date, name, etc.) of all the Komoot activities from Komoot API.
  2. Fetch info of all the Strava activities from Strava API.
  3. Compare data - for example Komoot tour_id with Strava external_id (which should be equal, because in POST we specify the external_id as the tour_id from Komoot).
  4. Upload only these activities, that are not on Strava yet.

Answering your second question:
Yes, Komoot API is very poorly documented; however, if you would get the credentials, I am convinced that you would be able to get all the tracks - no matter if public or private, but it would also require an authorization from user (oauth2). As far as I know, you can apply for credentials here:
https://www.komoot.com/b2b/connect#profileconnect

To sum up, I am also no Python developer. I am aware, that my scripts are written quite poorly (no errors handling, diffing algorithm, no tests, etc.); however, as I said, it was created basically for one use - to migrate from Komoot to Strava. However, I like Komoot too much and - from my experience - its route planning is superior to the one of Strava. Now I am also stuck with a manual sync via webform.

I imagine that a very nice solution would be to create for example a web app with user friendly GUI, that would allow to authorize both for Komoot and Strava, and that would let the users choose, which routes they want to sync and additionaly maybe tweak some options for them (like changing the name or ride type).

If you have any more questions, please feel free to ask.

@Tilogorn
Copy link
Author

Indeed, a common use case! Maybe we can share some free time for this.

Do you know by heart if manually uploaded Komoot tracks to Strava also have an external_id? I guess yes. Just to be sure not to mess up my Strava account when testing :-)

The UI is a great idea, although questioning the target group: if it's just a project on Github, I guess most of the developers are happy with just running the scripts and not having to set up a local web server. But if you meant an end-user ready project on a hosted platform, that would indeed be great.

Final question: as you are no python developer either: I am a professional PHP and Node.js dev, do you mind if I port the existing code to another language? Are you familiar with one of the two languages? I would be capable of running a prototype way earlier than thinking myself into a new language.
There also exist Strava libraries e.g. PHP for all three of them, I think, that would make at least one side way easier to implement.
There are also some Komoot API classes e.g. PHP, but not sure how good/maintained/recent they are.

@michaltkacz
Copy link
Owner

Indeed, a common use case! Maybe we can share some free time for this.

Unfortunetly, currently I am putting all my focus on my personal, importnat project, so I will probably have no much time for any other project.

Do you know by heart if manually uploaded Komoot tracks to Strava also have an external_id? I guess yes. Just to be sure not to mess up my Strava account when testing :-)

According to this documentation the data filename will be used by default but it should be unique.

The UI is a great idea, although questioning the target group: if it's just a project on Github, I guess most of the developers are happy with just running the scripts and not having to set up a local web server. But if you meant an end-user ready project on a hosted platform, that would indeed be great.

About the UI app idea - you are absolutely correct. It totaly depends on the target group.

Final question: as you are no python developer either: I am a professional PHP and Node.js dev, do you mind if I port the existing code to another language? Are you familiar with one of the two languages? I would be capable of running a prototype way earlier than thinking myself into a new language.

Yes, of course! You can do whatever you want with this code :)

There also exist Strava libraries e.g. PHP for all three of them, I think, that would make at least one side way easier to implement.

Yes, I have seen this project, but I did not dive deeper into it. As far as I know, it makes working with Strava API much, much easier.

There are also some Komoot API classes e.g. PHP, but not sure how good/maintained/recent they are.

I am not familiar with this one, but I think there is a high chance, that it is still up to date.

@AlexanderMcColl
Copy link

I just wanted to say thank you really. Same situation as you and decided to be more 'social'. You've helped me save a ton of time.

The whole thing still works in June 2023. Very quick and easy.

Strava is definitely detecting duplicates because I knew I was going to import some and they were silently rejected.

I found that the authorization_code has a very short timeout (within 10 minutes) of getting it that you need to start using it, or I got a 'Bad response'. This will be the main stumbling block to automating the script in its current state.

Oh and the API now allows "200 requests every 15 minutes, 2,000 daily" so that's a bonus.

If I have some time I will take a look at forking and doing something with it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants