comtec-dr 0.1.0 → 0.3.0

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: a7e5e2efb1839024b647e1b4e77ff5aa53fd35a1
4
- data.tar.gz: e3b2a4f6889b4cd28f959ab91e6fc1abb0e1a762
3
+ metadata.gz: c74a683bfdc83ede96d433fead7b21daabd90d19
4
+ data.tar.gz: 0cd484b3e4f7e722aa12809c45edd9847984df33
5
5
  SHA512:
6
- metadata.gz: bf682caf491ee6a9c87f58a9aa42bad38d288d4f174701adafdacd51b90ba8925300bdce54b93d86bbb4c3fa0787a85478b7a95b73db9f1a278492fc1d8e7c84
7
- data.tar.gz: 012c9d5a2efa6d7432cf85ac640903ef6b98d9b880ff4bc3b2e7219966c22210321bc04a9830afe0443c2521e4154e3e05086f45ae34155e915fd51f65089e79
6
+ metadata.gz: ca73f21d56a4bb3a22dbd02e24aab1ab9e7c4184efcbdd9c940ba70c98e4f3c1e92d9a3dbe1ba2a47e5c4ca5a291acf0a3f37c3bf20072205f51d20f4d6840d9
7
+ data.tar.gz: 7e30ce78e2915a33b6bd27bad126ea9de86f3bc56cfc42e835b464800d22211470172592f97a1a387fbd647e28a9f76601b59d97b3fc0a7a0cfddb06cdbf2290
@@ -0,0 +1,18 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require "bundler/setup"
4
+ require 'pathname'
5
+ require "comtec-dr"
6
+
7
+ ARGV.each do |arg|
8
+ path = Pathname arg
9
+ if path.file? && path.basename.to_s.end_with?('.MOV')
10
+ puts ComtecDR::MovDemuxer.demux path.to_s
11
+ elsif path.directory?
12
+ path.children.each do |child_path|
13
+ if child_path.file? && child_path.basename.to_s.end_with?('.MOV')
14
+ puts ComtecDR::MovDemuxer.demux child_path.to_s
15
+ end
16
+ end
17
+ end
18
+ end
@@ -0,0 +1,29 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require "bundler/setup"
4
+ require 'pathname'
5
+ require 'csv'
6
+ require "comtec-dr"
7
+
8
+ ARGV.each do |arg|
9
+ path = Pathname arg
10
+ if path.file? && path.basename.to_s.end_with?('.MOV')
11
+ CSV.open("#{path.basename.to_s}.csv",'w') do |csv|
12
+ ComtecDR::UdatAnalyzer.analyze(ComtecDR::MovDemuxer.demux path.to_s).each do |line|
13
+ log = GpsLog.new *line
14
+ csv << log.csv_line
15
+ end
16
+ end
17
+ elsif path.directory?
18
+ CSV.open("#{path.basename.to_s}.csv",'w') do |csv|
19
+ path.children.each do |child_path|
20
+ if child_path.file? && child_path.basename.to_s.end_with?('.MOV')
21
+ ComtecDR::UdatAnalyzer.analyze(ComtecDR::MovDemuxer.demux child_path.to_s).each do |line|
22
+ log = GpsLog.new *line
23
+ csv << log.csv_line
24
+ end
25
+ end
26
+ end
27
+ end
28
+ end
29
+ end
data/lib/comtec-dr.rb CHANGED
@@ -1,4 +1,6 @@
1
+ require "time"
1
2
  require "comtec-dr/version"
3
+ require "comtec-dr/gps_log"
2
4
  require "comtec-dr/mov_demuxer"
3
5
  require "comtec-dr/udat_analyzer"
4
6
 
@@ -0,0 +1,53 @@
1
+ class GpsLog
2
+ def initialize lat, lat_s, lon, lon_s, speed, jst, time, x_a, y_a, z_a
3
+ @lat = lat
4
+ @lat_sign = lat_s
5
+ @lon = lon
6
+ @lon_sign = lon_s
7
+ @speed = speed
8
+ @jst = jst
9
+ @time = time
10
+ @x_acceleration = x_a
11
+ @y_acceleration = y_a
12
+ @z_acceleration = z_a
13
+ end
14
+
15
+ def lat
16
+ (dmm_to_dms(@lat) * (@lat_sign == 'N' ? 1 : -1)).to_f
17
+ end
18
+
19
+ def lon
20
+ (dmm_to_dms(@lon) * (@lon_sign == 'E' ? 1 : -1)).to_f
21
+ end
22
+
23
+ def speed
24
+ @speed.to_i
25
+ end
26
+
27
+ def jst
28
+ Time.parse "20#{@jst}}+0900"
29
+ end
30
+
31
+ def x_acceleration
32
+ @x_acceleration.to_f/10000
33
+ end
34
+
35
+ def y_acceleration
36
+ @y_acceleration.to_f/10000
37
+ end
38
+
39
+ def z_acceleration
40
+ @z_acceleration.to_f/10000
41
+ end
42
+
43
+ def csv_line
44
+ [lat, lon, speed, jst, x_acceleration, y_acceleration, z_acceleration]
45
+ end
46
+
47
+ private
48
+ # DMM形式から変換
49
+ def dmm_to_dms str
50
+ number, fractional = str.split('.')
51
+ number[0...-2].to_r + "#{number[-2..-1]}.#{fractional}".to_r / 60
52
+ end
53
+ end
@@ -1,6 +1,6 @@
1
1
  module ComtecDR
2
2
  MAJOR = 0
3
- MINOR = 1
3
+ MINOR = 3
4
4
  PATCH = 0
5
5
  VERSION = [MAJOR, MINOR, PATCH].compact.join('.')
6
6
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: comtec-dr
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Shogo Kawaguchi
@@ -55,7 +55,9 @@ dependencies:
55
55
  description: comtec drive recorder analyzer
56
56
  email:
57
57
  - platycod0n.ramosa@gmail.com
58
- executables: []
58
+ executables:
59
+ - comtec_mov_demux
60
+ - comtec_mov_extract_csv
59
61
  extensions: []
60
62
  extra_rdoc_files: []
61
63
  files:
@@ -68,7 +70,10 @@ files:
68
70
  - bin/console
69
71
  - bin/setup
70
72
  - comtec-dr.gemspec
73
+ - exe/comtec_mov_demux
74
+ - exe/comtec_mov_extract_csv
71
75
  - lib/comtec-dr.rb
76
+ - lib/comtec-dr/gps_log.rb
72
77
  - lib/comtec-dr/mov_demuxer.rb
73
78
  - lib/comtec-dr/udat_analyzer.rb
74
79
  - lib/comtec-dr/version.rb