mt-from-sf-to-gh / features

0 stars 0 forks source link

SuuntoApp : change downloaded files names #190

Closed mt-from-sf-to-gh closed 2 years ago

mt-from-sf-to-gh commented 2 years ago

Hi everyone, Hi Fred, I have another request linked to Suunto cloud function. Being able to change the template name of the saved .fit files after import : either hard coded, or even better with user own template. Explanation : Suunto identified workouts with a unique key : example : 6116xxxxxxxxxxxxxxxx9a7e Then MTB save currently the .fit file : like this : 13-08-2021 08-49.fit (which is not easy to sort files)

Option1 : change name from dd-mm-yyyy hh-mm.fit to yyyy-mm-dd hh-mm.fit so that file sorting makes more sense ;) (to me) Option2 : Option1 + add Suunto initial workout type example yyyy-mm-dd hh-mm HIKING.fit Option3 : Option2 + add Suunto workout key : example : yyyy-mm-dd hh-mm HIKING 6116xxxxxxxxxxxxxxxx9a7e.fit

And finally, ever best solution : let user customize his own template like in some file manager tools, with some user template and keycharacteres : example : %MTB my suunto file name% yyyy-mm.fit

eventually reuse same custimizing WMS urls page in customs maps : (see mockup). But maybe not best solution :)

Reported by: mff73

Original Ticket: mytourbook/feature-requests/198

mt-from-sf-to-gh commented 2 years ago

Hi, Any news about this feature request ? And, question : is there any "tweak" (like a setting somewhere) to change this dowloaded file name ? I must admit i do not use so much the MTB suunto import now, because of the activity file names that are quit not clear enough and can't be sorted properly in file managers :( i would still love to use this feature.

Original comment by: mff73

mt-from-sf-to-gh commented 2 years ago

Hi Mick,

No news for this feature request but it's on my TODO list!

Frederic

Original comment by: FJBDev

mt-from-sf-to-gh commented 2 years ago

thanks for the news :)

Original comment by: mff73

mt-from-sf-to-gh commented 2 years ago

Mick,

I am starting to tackle your feature request.

A few observations so far: Here is what the Suunto API returns for a given activity attachment; filename="2/6/22 8:26 AM.fit" or sometimes attachment; filename="2018-12-02.fit"

As you can see, Suunto doesn't give much information (it doesn't return the activity type for example) for a given activity except the date, sometimes the time and the workout id.

I can try to add the same customization than for WMS map urls and add the following parts:

Would that work? thoughts ?

Frederic

Original comment by: FJBDev

mt-from-sf-to-gh commented 2 years ago

Hi Fred, really ? API only shares file with date as filename ?

in a super perfect world, i would think of : temporary open the fit file, analyze the sport type and sub sport type, and match these informations with fit sdk sport descriptions and then finalize the file saving with custom name options, defined by code or user like you suggest with customization fields (including fit sport type :) ) i guess this will lead to create some MTB internal table with fit SDK sports and sub sport types (if not already the case ?)

in a less perfect world, just customization fields like xml is nice as well , maybe i would add a custom field choice which is the MTB person name for which the suunto account is linked. Or maybe it is what you suggest with -User Text ?

But perfection is not in this world, let's do what you can without any extra complication, it could become new improvement suggestions.

Original comment by: mff73

mt-from-sf-to-gh commented 2 years ago

Mick,

Actually, I found another endpoint in Suunto's API that gives more information. See attached a plain example. I am thinking that I could use the activityId to find the name of the sport. I initially thought of having MT open the file, get the sport type etc... but that would complicate things a LOT, let alone make the download slower since every file would have to be open. But I think using the activityId to find the sport name should work though I need to do further testing.

I could add the user name if you wanted. When I mentioned "User Text", i just thought of your original screenshot that contains "My Text" so i thought you wanted to be able to enter any text ?

In the end, would those fields work ? or do you have any others that you need ?

Frederic

Original comment by: FJBDev

mt-from-sf-to-gh commented 2 years ago

Hi Fred Yes, this list is perfect thanks. For activity Type, effectively, don't complicate/slow things, if it is in JSON, good. Eager to test it 😊

Original comment by: mff73

mt-from-sf-to-gh commented 2 years ago

Great, I'll try to get that in the next version and will let you know if that list ends up being modified.

Frederic

Original comment by: FJBDev

mt-from-sf-to-gh commented 2 years ago

Original comment by: FJBDev

mt-from-sf-to-gh commented 2 years ago

Mick,

I have submitted the feature for the next version of MT (22.2). You can see a preview here

Frederic

Original comment by: FJBDev

mt-from-sf-to-gh commented 2 years ago

Looks so cool, thanks.

Original comment by: mff73

mt-from-sf-to-gh commented 2 years ago

Hi Fred and all, 22.2 installed and Suunto file names implementation is really nice, thanks. Few comments for potential future improvements :)

  1. Month and day numbers are written with only one digit --> file name sorting isn't good in case of 20211201 (1 dec 2021) > 202222 (2 feb 2022)
  2. Idem for Minutes : only one digit 15h05 gives 15h5.
  3. I can't use : (double point) as user text. After saving it is changed into - (dash) Not a big problem, but.....
  4. Activity type is really not good :( I imagine that Suunto Json data for this are not that perfect, and maybe "internal" activity numbers, and not "official" fit ones. For example, Trail Running gives 22 as activity type.

But, mainly it works very good at first glance. Will have deeper look at it soon. Thanks for this.

Original comment by: mff73

mt-from-sf-to-gh commented 2 years ago

Hey Mick,

Thanks for your feedback.

See my answers below:

  1. Month and day numbers are written with only one digit --> file name sorting isn't good in case of 20211201 (1 dec 2021) > 202222 (2 feb 2022)
  2. Idem for Minutes : only one digit 15h05 gives 15h5.

Ok, I will fix that for the next version.

  1. I can't use : (double point) as user text. After saving it is changed into - (dash) Not a big problem, but.....

It's a file name limitation. Notice that Windows doesn't allow ':' See my attached screenshot where Windows blocks the creation of a filename with ':'

  1. Activity type is really not good :( I imagine that Suunto Json data for this are not that perfect, and maybe "internal" activity numbers, and not "official" fit ones. For example, Trail Running gives 22 as activity type.

This is the list that I used to map the activity type and it's provided by Suunto. You can see that they haven't supplied any mapping for '22'

I hope that helps

Frederic

Original comment by: FJBDev

mt-from-sf-to-gh commented 2 years ago

My bad about the : (double point) :( i forgot to think it was to name a file :)

About digits changes, nice, thanks.

About Suunto activities, i may think you have mis interpreted the suunto pdf file : 22 (trail running) is in fact well in this file, in the second column Suunto App I have other activity of Ski Touring, and it is well identifyied as "31" and MTB wrote 31 as well. idem for 65, snow shoeing.

:)

is it something hard coded, or somewhere in MTB database that i could eventually try to manipulate with SQL statement ?

Original comment by: mff73

mt-from-sf-to-gh commented 2 years ago

Ah, I see. It's possible that I misinterpreted the PDF file because it worked well when I tested as I only had cycling and running activities.

I will fix that and use the "Suunto App" column. Sorry about that.

is it something hard coded, or somewhere in MTB database that i could eventually try to manipulate with SQL statement ?

It's hardcoded in MT here

Original comment by: FJBDev

mt-from-sf-to-gh commented 2 years ago

Activity type mapping fixed here

Original comment by: FJBDev

mt-from-sf-to-gh commented 2 years ago

👌👍

Original comment by: mff73

mt-from-sf-to-gh commented 2 years ago

Mick, the leading zero and activity type mapping issues have been fixed in 22.2.1 that is available today.

Let me know if it fixes both of the issues. Frederic

Original comment by: FJBDev

mt-from-sf-to-gh commented 2 years ago

Hi, thanks, but i tried to update and i can't :( Both on work or home computer. Update is found in MTB, but seems i have not enough privilèges.

Original comment by: mff73

mt-from-sf-to-gh commented 2 years ago

Try to launch MT as an administrator (if you can)

Original comment by: FJBDev

mt-from-sf-to-gh commented 2 years ago

Hi Fred, Sorry for late answer. Admin mode makes the install possible, and naming works as expected, according to your recent changes, really perfect, thanks. one small point, though, i still can't use some specific characters as user texts, like # or even _ (ash of 8) are replaced each time by - (dash of 6). Not so big deal, but....

one more strange thing, but maybe not linked to this new feature implementation : when i tried to download a lot activities at once (either my full scope (1300 activities or even a specific range of 200/300) ), MTB blocked it self, all files download are not completed, and only solution, is to kill MTB (even cancel button doesn't work). During the process, i see files created with 0kb. Other strange but not nice thing, during all my trials, i had once an activity file with 1kb size, which was strange, and another trial gives me same activity file with proper size (see screen shots).

I will try to reproduce, but could it be that some timeout happens, either with MTB either with SuuntoAPI, or maybe my network is too slow here .... i am not sure what to try or to log.

But naming works well ;)

[Edit] I deleted all files, and tried from fresh download of two years in the past (2012 to 2014), 280 activities from MTB. After 2 minutes, i have well 280 files in the directory, but MTB is blocked, and some files seems really small again (another example for one with 2kb instead of 121).

Original comment by: mff73

mt-from-sf-to-gh commented 2 years ago

Mick,

Lots of things here. First off, let's separate here what is about this feature request (SuuntoApp : change downloaded files names ) and the rest (issue downloading the file) so that we don't muddy the water.

For the file name, I am glad to read that the naming works as expected, however, I will look into your remark below to see if I can add support for those characters. I thought I had excluded only the characters forbidden by Windows (\ / : ? " < > | ) but I need to double check i still can't use some specific characters as user texts, like # or even (ash of 8) are replaced each time by - (dash of 6). Not so big deal, but....

For your issue about downloading some files, can you open a bug for it . Also, can you attach the full log (i see something called "Session closed" in your screenshot)? It seems to me that you had already mentioned that issue here and that the Suunto API was timing out ? but maybe it's a different issue? You could also try to download several weeks at a time and see if it works better than downloading several years at a time but I understand that it's not ideal.

I hope that helps Frederic

Original comment by: FJBDev

mt-from-sf-to-gh commented 2 years ago

Mick,

In the upcoming 22.3 version of MT, I have fixed the issue your reported above: "one small point, though, i still can't use some specific characters as user texts, like # or even (ash of 8) are replaced each time by - (dash of 6). Not so big deal, but...."

Original comment by: FJBDev

mt-from-sf-to-gh commented 2 years ago

Thanks Frédéric. FYI I managed to download all my activities, by selecting date ranges without more than 100/120 activities. A bit long, but done once "forever". 😊

Original comment by: mff73

mt-from-sf-to-gh commented 2 years ago

Good news! Can I close this feature request ? or do you need other modifications ?

Original comment by: FJBDev

mt-from-sf-to-gh commented 2 years ago

Hi Fred, thanks for all, it works perfectly on daily basis. And I have not yet any new ideas to busy you anymore 😂 on this. Thanks.

Original comment by: mff73

mt-from-sf-to-gh commented 2 years ago

Original comment by: FJBDev