nickbeeton / garminstuff

Stuff for bulk analysis of Garmin FIT data
6 stars 2 forks source link

script does not seem to work anymore #3

Closed billtickel closed 4 years ago

billtickel commented 4 years ago

was working for me - not any more.

psilocybia commented 4 years ago

Same here. It seems that Strava have changed something in the way segments are created which is now causing the script to fail at the point it tries to create the new segment

nickbeeton commented 4 years ago

Will be interesting to see if the new update (version 0.6.0) does the job - try it out and keep me posted.

MrBurnsDev commented 4 years ago

Thanks Nick! I won’t be able to go for a ride until Saturday and will test after!

MrBurnsDev commented 4 years ago

Just gave it a whirl and all seems to be functioning! Will ride a new segment this weekend and retest. Thanks for all of your work Nick!

nickbeeton commented 4 years ago

Oh awesome, glad to hear! It's kind of a pain to test this out myself because I've already created pretty much all the ebike segments for places I ride, so I need to delete them to test it properly...

MrBurnsDev commented 4 years ago

Oh man. It's hanging again.

MrBurnsDev commented 4 years ago

Will post errors in a minute

MrBurnsDev commented 4 years ago

Is either stating that no segments were found or is creating one 4.3 mile long segment.

psilocybia commented 4 years ago

I had a look last night, think Strava may have changed something around timings when you change ride type. When I manually changed to ride from e-bike ride and refreshed, it was still showing the e-bike segments. I tried refreshing for a couple minutes but still didn't change to normal bike segments showing. This would cause the script to either find duplicates of the e-bike segments or if no e-bike segments exist, would find no segments.

MrBurnsDev commented 4 years ago

Makes sense. I was getting a message in debug saying "no segments exist." Strava sucks.

nickbeeton commented 4 years ago

Hm well spotted, I've had a go at fixing it, though the issue only comes up intermittently for me so it's been tricky to test. Now version 0.6.1, let me know if that helps. Seems like everytime I fix something, something new comes up!

I've also found for some reason that the mouse dragging/dropping simulation doesn't seem to work so it's reverted back to button pressing... this seems to still work ok for me but will probably cause issues for others. I'll try and deal with that properly in a future update.

MrBurnsDev commented 4 years ago

Running script now.

MrBurnsDev commented 4 years ago

It's creating all of the segments now, but with the incorrect distances. image

MrBurnsDev commented 4 years ago

The distance on the left is correct and the one on the right is miles longer.

nickbeeton commented 4 years ago

Ah, realised I'd made a bug in the drag-and-drop routines, and have now fixed those. Hopefully that will make the distance issue go away Version 0.6.2 now!

MrBurnsDev commented 4 years ago

OK. So it appears to be creating segments. One thing I'm noticing is that it is leaving converted segment windows open. So if under the normal non-pedal assist activity there are three segments, it will leave 3x windows open after script completes, one for each time the script runs. The other thing is that the distances are close by about 2/10ths of a mile but not identical to original distances.

MrBurnsDev commented 4 years ago

1/10th of a mile off.

MrBurnsDev commented 4 years ago
Screen Shot 2020-01-16 at 6 14 42 AM
MrBurnsDev commented 4 years ago

I mean... it's pretty darn close lol

MrBurnsDev commented 4 years ago

Another activity worked perfectly. Not sure about the original 3x.

MrBurnsDev commented 4 years ago
Screen Shot 2020-01-16 at 6 31 47 AM

still a 10th or a 100th of a mile off. strange.

MrBurnsDev commented 4 years ago

It is definitely better than nothing, so I'm happy. :)

nickbeeton commented 4 years ago

I'll have a look tomorrow, but it could just be the fact that where (and sometimes how often depending on signal or your device!) your device records gps locations will vary from ride to ride. So say yours records every second... if you're travelling 40km/h (about 25mph) then that's about 10m/sec, so you might expect your segment start and end points to be off by about 10m from the originally recorded one. Longer with gps error, less frequent recording, sprinting down a hill 😆 if you have the debug info send it and I can see what it's doing.

psilocybia commented 4 years ago

Much better now Nick. However, I seem to have an issue around short segments. When the script encounters one it seems to just kill the script. It isn't moving on. So that segment stays open with the error on Strava that the segment is too short
image

The script then just goes into a loop waiting as shown here from the debug... image

psilocybia commented 4 years ago

Managed to bypass by manually extending slightly until it accepted the distance. But if you could look at the code for this to fix it so that when it detects segment too short it just moves on to next, that would be ideal.

Overall, it is working for me and even with the manual workaround I am happy to have the ability to create ebike segments again. Very much appreciate your effort on this Nick !!

nickbeeton commented 4 years ago

I thought I had dealt with the "Segment too short" issue, but apparently not - should be fixed now. Version 0.6.3! And let me know how you go ir1shboy!

xudaondo commented 4 years ago

I also have problems with 0.6.3 version. I just installed Tampermonkey and this script, but nothing happens.

In dev console, it just shows: "Tampermonkey started" when the site is reloaded, and Tampermonkey says in the icon: "This script was executed 1 time(s)".

in my ebike activity, does not appear any bike segments... https://www.strava.com/activities/3024641079

This activity in bike modality, has a lot of segments created.

Thanks for your work!

This is my console log: image

nickbeeton commented 4 years ago

Hi xudaondo - so the orange buttons "Copy Bike Segments to PUBLIC Ebike Segments" and "Copy Bike Segments to PRIVATE Ebike Segments" don't appear on your ebike activity page at all? That's odd... all I can think of is do you have any kind of popup blocker, ad blocker or other app that might interfere with the script? (they shouldn't, but I really can't think what else would do this...)

xudaondo commented 4 years ago

The orange buttons does not appear, but in the Debug Console script has run:

SCRIPT RUN TIME[Convert bike segments to ebike segments on Strava]: 1.43310546875ms (I have debuged your script and it does a lot of things, but no new windows or tabs appear, I think it is not executing complete methods)

I haven't got any popup blocker, only "Strava GPX downloader" as a Chrome extension. I have latest version of Chrome browser and Windows 10.

How can I debug your tammpermonkey script to see more log details? where can I add breakpoints to be sure that script is doing something?

Regards,

xudaondo commented 4 years ago

I think this condition is not valid, because it is not finding title E-Bike Ride

if (window.document.getElementsByClassName("title")[0].innerHTML.search("E-Bike Ride") > 0 & window.document.getElementsByClassName("icon-edit").length > 0){ // your own ebike ride window.tms = (window.document.getElementsByClassName("alert-message").length > 0)

Maybe, it is because I have Strava in Spanish? and window.document.getElementsByClassName("title")[0]

Is: Xabier U. – Bicicleta eléctrica

xudaondo commented 4 years ago

I have changed this line of code:

window.document.getElementsByClassName("title")[0].innerHTML.search("Bicicleta eléctrica")

and other error appear:

SCRIPT RUN TIME[Convert bike segments to ebike segments on Strava]: 42195.1826171875ms content.js:10 content: detected load b68a020d-f664-4108-ae7c-4805f39a2f52 userscript.html?id=189108c9-ea8e-4a95-be46-0c5589644972:21 window.f started userscript.html?id=189108c9-ea8e-4a95-be46-0c5589644972:46 Original segment Sube y Baja Los Caños start 3013 end 3031 userscript.html?id=189108c9-ea8e-4a95-be46-0c5589644972:63 Uncaught (in promise) TypeError: Cannot set property 'onload' of null at window.f (userscript.html?id=189108c9-ea8e-4a95-be46-0c5589644972:63) at HTMLButtonElement.window.f1 (userscript.html?id=189108c9-ea8e-4a95-be46-0c5589644972:400)

I will try to use it in English

xudaondo commented 4 years ago

Now, with Chrome in English, the scripts run, change activity to Bike Ride, Loads a lot of segments, but fails again in line 161:

This is the log of the script:

SCRIPT RUN TIME[Convert bike segments to ebike segments on Strava]: 2.43701171875ms content.js:10 content: detected load dfd8b2ad-cf38-4099-adb3-9a1128a895a8 userscript.html?id=189108c9-ea8e-4a95-be46-0c5589644972:21 window.f started userscript.html?id=189108c9-ea8e-4a95-be46-0c5589644972:46 Original segment Sube y Baja Los Caños start 3013 end 3031 userscript.html?id=189108c9-ea8e-4a95-be46-0c5589644972:102 window.ff started userscript.html?id=189108c9-ea8e-4a95-be46-0c5589644972:68 window.z started userscript.html?id=189108c9-ea8e-4a95-be46-0c5589644972:71 timeout activated userscript.html?id=189108c9-ea8e-4a95-be46-0c5589644972:68 window.z started userscript.html?id=189108c9-ea8e-4a95-be46-0c5589644972:71 timeout activated userscript.html?id=189108c9-ea8e-4a95-be46-0c5589644972:68 window.z started userscript.html?id=189108c9-ea8e-4a95-be46-0c5589644972:71 timeout activated userscript.html?id=189108c9-ea8e-4a95-be46-0c5589644972:68 window.z started userscript.html?id=189108c9-ea8e-4a95-be46-0c5589644972:71 timeout activated userscript.html?id=189108c9-ea8e-4a95-be46-0c5589644972:68 window.z started userscript.html?id=189108c9-ea8e-4a95-be46-0c5589644972:71 timeout activated userscript.html?id=189108c9-ea8e-4a95-be46-0c5589644972:68 window.z started userscript.html?id=189108c9-ea8e-4a95-be46-0c5589644972:71 timeout activated userscript.html?id=189108c9-ea8e-4a95-be46-0c5589644972:90 activity changed userscript.html?id=189108c9-ea8e-4a95-be46-0c5589644972:116 window.h started userscript.html?id=189108c9-ea8e-4a95-be46-0c5589644972:123 timeout activated userscript.html?id=189108c9-ea8e-4a95-be46-0c5589644972:144 Index: 159 userscript.html?id=189108c9-ea8e-4a95-be46-0c5589644972:154 Loaded segment C/Santutxu userscript.html?id=189108c9-ea8e-4a95-be46-0c5589644972:154 Loaded segment Santu userscript.html?id=189108c9-ea8e-4a95-be46-0c5589644972:154 Loaded segment Calle De Kareaga Goikoa, 3 19 Climb userscript.html?id=189108c9-ea8e-4a95-be46-0c5589644972:154 Loaded segment PUENTE CAMARERO userscript.html?id=189108c9-ea8e-4a95-be46-0c5589644972:154 Loaded segment Sixta climb userscript.html?id=189108c9-ea8e-4a95-be46-0c5589644972:154 Loaded segment Túnel-descanso por Arantzille userscript.html?id=189108c9-ea8e-4a95-be46-0c5589644972:154 Loaded segment presa userscript.html?id=189108c9-ea8e-4a95-be46-0c5589644972:154 Loaded segment Rampa cemento Aranzelai userscript.html?id=189108c9-ea8e-4a95-be46-0c5589644972:154 Loaded segment Series SS 8'- RBI 5' userscript.html?id=189108c9-ea8e-4a95-be46-0c5589644972:154 Loaded segment Basabe Auzoa Climb userscript.html?id=189108c9-ea8e-4a95-be46-0c5589644972:154 Loaded segment dh golf userscript.html?id=189108c9-ea8e-4a95-be46-0c5589644972:154 Loaded segment moros 2 userscript.html?id=189108c9-ea8e-4a95-be46-0c5589644972:154 Loaded segment Palitos trail userscript.html?id=189108c9-ea8e-4a95-be46-0c5589644972:154 Loaded segment Enlace entre bajada userscript.html?id=189108c9-ea8e-4a95-be46-0c5589644972:154 Loaded segment Bajada Guapa userscript.html?id=189108c9-ea8e-4a95-be46-0c5589644972:154 Loaded segment Erabiki userscript.html?id=189108c9-ea8e-4a95-be46-0c5589644972:154 Loaded segment vivero userscript.html?id=189108c9-ea8e-4a95-be46-0c5589644972:154 Loaded segment Bajada bunkers userscript.html?id=189108c9-ea8e-4a95-be46-0c5589644972:154 Loaded segment EAC_Senda_Carretera userscript.html?id=189108c9-ea8e-4a95-be46-0c5589644972:154 Loaded segment bajadafron´ton userscript.html?id=189108c9-ea8e-4a95-be46-0c5589644972:154 Loaded segment Sendero Vivero userscript.html?id=189108c9-ea8e-4a95-be46-0c5589644972:154 Loaded segment ElgoienAzpuru userscript.html?id=189108c9-ea8e-4a95-be46-0c5589644972:154 Loaded segment BAJADA PRESA - ETXEBARRI XTREM userscript.html?id=189108c9-ea8e-4a95-be46-0c5589644972:154 Loaded segment Repecho Legizamon userscript.html?id=189108c9-ea8e-4a95-be46-0c5589644972:154 Loaded segment Paseo de Los Caños desde Bolueta userscript.html?id=189108c9-ea8e-4a95-be46-0c5589644972:154 Loaded segment 2ª Parte (Subida) userscript.html?id=189108c9-ea8e-4a95-be46-0c5589644972:154 Loaded segment mudo userscript.html?id=189108c9-ea8e-4a95-be46-0c5589644972:154 Loaded segment Cuesta Cemento Presa Arantxille userscript.html?id=189108c9-ea8e-4a95-be46-0c5589644972:154 Loaded segment Moros TC2 userscript.html?id=189108c9-ea8e-4a95-be46-0c5589644972:154 Loaded segment Moros 3 userscript.html?id=189108c9-ea8e-4a95-be46-0c5589644972:161 Uncaught TypeError: Cannot set property 'onload' of null at eval (userscript.html?id=189108c9-ea8e-4a95-be46-0c5589644972:161)

nickbeeton commented 4 years ago

@xudaondo I'll have a proper look if I get time tomorrow... In the meantime, can you check what happens if you add "/edit" to the original ride URL in your browser? It should open the edit window for the ride, but something seems to be going wrong on yours. Don't know if it's another language issue that Chrome in English isn't helping with...

xudaondo commented 4 years ago

Finally, I change Chrome languaje to English, then disable Debug Mode, and disable Chrome PopUp Blocker (Second time the web browser opens a new tab automatically, it detects as SPAM), and it works correctly for one of my activities.

It was good if it is possible to run it in Spanish or other languajes, but now I can'tt test it again because i have exceded the limit of segments created a day in Strava.

Tomorrow More. Thanks for your time!

nickbeeton commented 4 years ago

No problem - glad we at least got it working for you. I'll see what I can do about running it in other langauges, though it may be tricky to test...

xudaondo commented 4 years ago

if you want I can test it in Spanish. I have a lot of activities now, whitout eBike Segments (And a lot of bike segments) and the limit is 10 segments a day (I think)