git-fit 0.26.3 → 0.26.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/git_fit/sync/garmin_base.rb +24 -8
- data/lib/git_fit/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 3cea1445cb1e525a1be8c8b814b7b3f69a27aac4e4e42411b5eb993227fef373
|
|
4
|
+
data.tar.gz: f672f8bfbded7feb9484dc8a214b945338c1a7c3136c1e80f539afe66bb1db0e
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: e051bd7d24a99544a65b6f537bfb5483980cc399a1977310383f5f3a6ed8c4381bfe3a6811b0de3dc359571f9128b093379b4cc8d4ad923b8252190c7a738fce
|
|
7
|
+
data.tar.gz: 493fa21dffeb7d8aed1039e3aad0eaee0c3a4c4774129fbedf4293962923fcd456715b900b21dd64e1eee8e9167660bddffc968bb99aa0d8628c637215ed4a14
|
|
@@ -160,6 +160,21 @@ module GitFit
|
|
|
160
160
|
self.class.source_prefix
|
|
161
161
|
end
|
|
162
162
|
|
|
163
|
+
# device_info messages → label of the recording device. Lookup order:
|
|
164
|
+
# GARMIN_PRODUCT_SUPPLEMENT (full display name) → garminProduct token
|
|
165
|
+
# ("Garmin Edge 540") → "Garmin <pk>" fallback (workouts#38/#59)
|
|
166
|
+
def self.device_label(infos)
|
|
167
|
+
info = infos.find { |d| d['deviceIndex'] == 'creator' } || infos.first
|
|
168
|
+
return nil unless info
|
|
169
|
+
|
|
170
|
+
supplement = GARMIN_PRODUCT_SUPPLEMENT[info['product']]
|
|
171
|
+
return supplement if supplement
|
|
172
|
+
|
|
173
|
+
return nil unless info['garminProduct']
|
|
174
|
+
|
|
175
|
+
format_garmin_device(info['garminProduct'])
|
|
176
|
+
end
|
|
177
|
+
|
|
163
178
|
def self.format_garmin_device(token)
|
|
164
179
|
# garminProduct token (e.g. "edge540") or unresolved numeric pk →
|
|
165
180
|
# human label ("Garmin Edge 540" / "Garmin 3307")
|
|
@@ -690,6 +705,11 @@ module GitFit
|
|
|
690
705
|
# Garmin FIT garminProduct token prefix → display prefix (unlisted → capitalize)
|
|
691
706
|
GARMIN_DEVICE_PREFIXES = { 'fr' => 'Forerunner', 'hrm' => 'HRM' }.freeze
|
|
692
707
|
|
|
708
|
+
# Product pk → full display name for co-branded hardware missing from the
|
|
709
|
+
# bundled garminProduct profile; no "Garmin " prefix (Cannondale wheel
|
|
710
|
+
# sensor is Garmin-made but Cannondale-branded, workouts#59)
|
|
711
|
+
GARMIN_PRODUCT_SUPPLEMENT = { 3307 => 'Cannondale Wheel Sensor' }.freeze
|
|
712
|
+
|
|
693
713
|
def raw_path(platform_id)
|
|
694
714
|
File.join(raw_dir, platform_id, 'activity.fit')
|
|
695
715
|
end
|
|
@@ -774,18 +794,14 @@ module GitFit
|
|
|
774
794
|
false
|
|
775
795
|
end
|
|
776
796
|
|
|
777
|
-
# FIT device_info
|
|
778
|
-
# product ids missing
|
|
779
|
-
#
|
|
797
|
+
# FIT device_info → recording-device label (via self.class.device_label);
|
|
798
|
+
# product ids missing everywhere fall back to "Garmin <pk>" (workouts#38
|
|
799
|
+
# — Connect deviceTypePk has no public lookup table)
|
|
780
800
|
def extract_device(activity_id)
|
|
781
801
|
fit_path = raw_path(activity_id)
|
|
782
802
|
return nil unless File.exist?(fit_path)
|
|
783
803
|
|
|
784
|
-
|
|
785
|
-
info = infos.find { |d| d['deviceIndex'] == 'creator' } || infos.first
|
|
786
|
-
return nil unless info && info['garminProduct']
|
|
787
|
-
|
|
788
|
-
self.class.format_garmin_device(info['garminProduct'])
|
|
804
|
+
self.class.device_label(FIT::Decoder.device_info(fit_path))
|
|
789
805
|
rescue StandardError => e
|
|
790
806
|
warn "Garmin: device_info decode failed for #{activity_id}: #{e.message}"
|
|
791
807
|
nil
|
data/lib/git_fit/version.rb
CHANGED