tac_scribe 0.7.1-java → 0.7.3-java
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/CHANGELOG.md +17 -7
- data/exe/tac_scribe +21 -1
- data/lib/tac_scribe/cache.rb +14 -3
- data/lib/tac_scribe/daemon.rb +36 -3
- data/lib/tac_scribe/event_processor.rb +1 -1
- data/lib/tac_scribe/version.rb +1 -1
- data/tac_scribe.gemspec +1 -0
- metadata +15 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c39a4f860637756b22a7ce9fd09d74e2c7190478a94dbc779373ba0d213d0b35
|
4
|
+
data.tar.gz: 5abb08ea5e750d3e460ade56d89924866badb2a842b62b20672df2f0c349eb53
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0d0ba804851aa3143c0f5b563d7401706dd129b826dc5398174ead33b982a22d48d0871d0d5498eb922c4ca08c83598a7c3928e3f1a69a7cd2094a3a5acf8801
|
7
|
+
data.tar.gz: 641fe1a451dff87f915c69fdf6ea36a4053f4924d77141a3617d7019dcf27ff9d9f884f65894d20ae75414d3b18c0b2e40642d2248d9a022cc8061455855afd3
|
data/CHANGELOG.md
CHANGED
@@ -4,38 +4,48 @@ All notable changes to this project will be documented in this file.
|
|
4
4
|
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
5
5
|
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
6
6
|
|
7
|
-
## [
|
7
|
+
## [Unreleased]
|
8
|
+
|
9
|
+
## [0.7.3] - 2020-08-10
|
10
|
+
### Changed
|
11
|
+
- Bug fixes after adding CinC support.
|
12
|
+
|
13
|
+
## [0.7.2] - 2020-08-10
|
14
|
+
### Added
|
15
|
+
- Support for "Commander-In-Chief" to get airbase information
|
16
|
+
|
17
|
+
## [0.7.1] - 2020-08-10
|
8
18
|
### Changed
|
9
19
|
- Fixed issue where "name" fields were not being populated
|
10
20
|
if airfields were not being loaded first
|
11
21
|
|
12
|
-
## [0.7.0]
|
22
|
+
## [0.7.0] - 2020-07-5
|
13
23
|
### Changed
|
14
24
|
- Synced Lat/Lon calculations with DCS and fixed issue where
|
15
25
|
calculations were incorrect if only one value was updated
|
16
26
|
|
17
|
-
## [0.6.2]
|
27
|
+
## [0.6.2] - 2020-04-19
|
18
28
|
### Changed
|
19
29
|
- Fixed typo causing app to fail
|
20
30
|
|
21
|
-
## [0.6.1]
|
31
|
+
## [0.6.1] - 2020-04-19
|
22
32
|
### Changed
|
23
33
|
- Test build for gem issue
|
24
34
|
|
25
|
-
## [0.6.0]
|
35
|
+
## [0.6.0] - 2020-04-19
|
26
36
|
### Added
|
27
37
|
- Calculates and stores speed of units
|
28
38
|
|
29
39
|
### Fixed
|
30
40
|
- Made more robust against failures and more logging messages
|
31
41
|
|
32
|
-
## [0.5.0]
|
42
|
+
## [0.5.0] - 2020-03-17
|
33
43
|
### Changed
|
34
44
|
- Added missing db column to migration file
|
35
45
|
- Clear the cache on server restart
|
36
46
|
- Add more info to logging
|
37
47
|
|
38
|
-
## [0.4.0]
|
48
|
+
## [0.4.0] - 2020-03-13
|
39
49
|
### Changed
|
40
50
|
- Switch to periodic writing to the database
|
41
51
|
|
data/exe/tac_scribe
CHANGED
@@ -10,6 +10,8 @@ options = {
|
|
10
10
|
tacview_port: 42_674,
|
11
11
|
tacview_password: nil,
|
12
12
|
tacview_client_name: 'TacScribe',
|
13
|
+
cinc_enabled: false,
|
14
|
+
cinc_port: 9000,
|
13
15
|
db_host: 'localhost',
|
14
16
|
db_port: 5432,
|
15
17
|
db_name: 'tac_scribe',
|
@@ -43,6 +45,17 @@ OptionParser.new do |opts|
|
|
43
45
|
options[:tacview_client_name] = v
|
44
46
|
end
|
45
47
|
|
48
|
+
opts.separator "\nCommander-In-Chief Options"
|
49
|
+
opts.on('-b', '--enable-cinc',
|
50
|
+
'Is Cinc enabled? (Default: false)') do |_v|
|
51
|
+
options[:cinc_enabled] = true
|
52
|
+
end
|
53
|
+
opts.on('-m', '--cinc-port=port',
|
54
|
+
'Cinc server port (Default: 9001)') do |v|
|
55
|
+
options[:cinc_port] = v
|
56
|
+
end
|
57
|
+
|
58
|
+
|
46
59
|
opts.separator "\nDatabase Options"
|
47
60
|
opts.on('-o', '--db-host=host',
|
48
61
|
'Postgresql server hostname / IP (Default: localhost)') do |v|
|
@@ -92,6 +105,11 @@ end.parse!
|
|
92
105
|
exit(1)
|
93
106
|
end
|
94
107
|
|
108
|
+
if(options[:populate_airfields] && options[:cinc_enabled])
|
109
|
+
puts "You cannot populate airfields AND enable Cinc at the same time"
|
110
|
+
exit(1)
|
111
|
+
end
|
112
|
+
|
95
113
|
TacScribe::Daemon.new(
|
96
114
|
tacview_host: options[:tacview_host],
|
97
115
|
tacview_port: options[:tacview_port],
|
@@ -105,5 +123,7 @@ TacScribe::Daemon.new(
|
|
105
123
|
verbose_logging: options[:verbose],
|
106
124
|
thread_count: options[:threads].to_i,
|
107
125
|
populate_airfields: options[:populate_airfields],
|
108
|
-
whitelist: options[:whitelist]
|
126
|
+
whitelist: options[:whitelist],
|
127
|
+
cinc_enabled: options[:cinc_enabled],
|
128
|
+
cinc_port: options[:cinc_port]
|
109
129
|
).start_processing
|
data/lib/tac_scribe/cache.rb
CHANGED
@@ -23,11 +23,12 @@ module TacScribe
|
|
23
23
|
end
|
24
24
|
|
25
25
|
def write_object(object)
|
26
|
-
if reference_latitude != 0 || reference_longitude != 0
|
26
|
+
if (reference_latitude != 0 || reference_longitude != 0) && object[:type] != "Ground+Static+Aerodrome"
|
27
27
|
localize_position(object)
|
28
28
|
end
|
29
29
|
|
30
30
|
id = object[:object_id]
|
31
|
+
id ||= object[:id].to_s
|
31
32
|
object[:id] = id
|
32
33
|
|
33
34
|
cache_object = @@cache[id]
|
@@ -39,7 +40,9 @@ module TacScribe
|
|
39
40
|
end
|
40
41
|
|
41
42
|
# https://wiki.hoggitworld.com/view/DCS_singleton_coalition
|
42
|
-
|
43
|
+
# Tacview returns a string, CinC returns an integer so we
|
44
|
+
# only do the conversion if there is a string.
|
45
|
+
if object[:coalition] && object[:coalition].is_a?(String)
|
43
46
|
object[:coalition] = case object[:coalition]
|
44
47
|
when 'Enemies' # Enemies is Bluefor
|
45
48
|
2
|
@@ -50,7 +53,15 @@ module TacScribe
|
|
50
53
|
end
|
51
54
|
end
|
52
55
|
|
53
|
-
if
|
56
|
+
if object[:type] = "Ground+Static+Aerodrome"
|
57
|
+
object[:heading] = object[:wind_heading] ? object[:wind_heading] : 0
|
58
|
+
object[:speed] = object[:wind_speed] ? object[:wind_speec] : 0
|
59
|
+
object.delete(:wind_heading)
|
60
|
+
object.delete(:wind_speed)
|
61
|
+
object.delete(:category)
|
62
|
+
cache_object = object
|
63
|
+
# No-op
|
64
|
+
elsif cache_object
|
54
65
|
object[:heading] = calculate_heading(cache_object, object)
|
55
66
|
object[:speed] = calculate_speed(cache_object, object)
|
56
67
|
cache_object.merge!(object)
|
data/lib/tac_scribe/daemon.rb
CHANGED
@@ -3,6 +3,7 @@
|
|
3
3
|
require 'json'
|
4
4
|
require 'tacview_client'
|
5
5
|
require 'set'
|
6
|
+
require 'cinc'
|
6
7
|
require_relative 'datastore'
|
7
8
|
require_relative 'cache'
|
8
9
|
require_relative 'event_queue'
|
@@ -15,7 +16,7 @@ module TacScribe
|
|
15
16
|
def initialize(db_host:, db_port:, db_name:, db_user:, db_password:,
|
16
17
|
tacview_host:, tacview_port:, tacview_password:,
|
17
18
|
tacview_client_name:, verbose_logging:, thread_count:,
|
18
|
-
populate_airfields:, whitelist: nil)
|
19
|
+
populate_airfields:, whitelist: nil, cinc_enabled:, cinc_port:)
|
19
20
|
Datastore.instance.configure do |config|
|
20
21
|
config.host = db_host
|
21
22
|
config.port = db_port
|
@@ -34,13 +35,20 @@ module TacScribe
|
|
34
35
|
@threads = {}
|
35
36
|
@whitelist = Set.new(IO.read(whitelist).split) if whitelist
|
36
37
|
|
37
|
-
@
|
38
|
+
@tacview_client = TacviewClient::Client.new(
|
38
39
|
host: tacview_host,
|
39
40
|
port: tacview_port,
|
40
41
|
password: tacview_password,
|
41
42
|
processor: @event_queue,
|
42
43
|
client_name: tacview_client_name
|
43
44
|
)
|
45
|
+
|
46
|
+
if cinc_enabled
|
47
|
+
@cinc_client = Cinc::Client.new(
|
48
|
+
host: tacview_host,
|
49
|
+
port: cinc_port
|
50
|
+
)
|
51
|
+
end
|
44
52
|
end
|
45
53
|
|
46
54
|
# Starts processing and reconnects if the client was disconnected.
|
@@ -55,13 +63,14 @@ module TacScribe
|
|
55
63
|
Datastore.instance.truncate_table
|
56
64
|
Cache.instance.clear
|
57
65
|
start_processing_threads
|
66
|
+
start_cinc_thread
|
58
67
|
start_db_sync_thread
|
59
68
|
start_reporting_thread
|
60
69
|
populate_airfields if @populate_airfields
|
61
70
|
@threads.each_pair do |key, _value|
|
62
71
|
puts "#{key} thread started"
|
63
72
|
end
|
64
|
-
@
|
73
|
+
@tacview_client.connect
|
65
74
|
# If this code is executed it means we have been disconnected without
|
66
75
|
# exceptions. We will still sleep to stop a retry storm. Just not as
|
67
76
|
# long.
|
@@ -103,6 +112,30 @@ module TacScribe
|
|
103
112
|
@threads[:processing] = event_processor_thread
|
104
113
|
end
|
105
114
|
|
115
|
+
def start_cinc_thread
|
116
|
+
return unless @cinc_client
|
117
|
+
cinc_thread = Thread.new do
|
118
|
+
loop do
|
119
|
+
@cinc_client.connect
|
120
|
+
while true
|
121
|
+
@cinc_client.get_airbases.each do |airbase|
|
122
|
+
@event_queue.update_object Hash[airbase.map{ |k, v| [k.to_sym, v] }]
|
123
|
+
end
|
124
|
+
sleep 60
|
125
|
+
end
|
126
|
+
rescue StandardError => e
|
127
|
+
puts 'Exception in cinc thread'
|
128
|
+
puts e.message
|
129
|
+
puts e.backtrace
|
130
|
+
sleep 30
|
131
|
+
next
|
132
|
+
end
|
133
|
+
end
|
134
|
+
|
135
|
+
cinc_thread.name = 'Cinc Processor'
|
136
|
+
@threads[:cinc] = cinc_thread
|
137
|
+
end
|
138
|
+
|
106
139
|
def start_db_sync_thread
|
107
140
|
db_write_thread = Thread.new do
|
108
141
|
loop do
|
@@ -70,7 +70,7 @@ module TacScribe
|
|
70
70
|
|
71
71
|
# Hack to make sure the :name field is present so that it is included
|
72
72
|
# in the SQL
|
73
|
-
event[:name] =
|
73
|
+
event[:name] = nil unless event.has_key?(:name)
|
74
74
|
event[:game_time] = time
|
75
75
|
|
76
76
|
self.events_processed += 1
|
data/lib/tac_scribe/version.rb
CHANGED
data/tac_scribe.gemspec
CHANGED
@@ -43,6 +43,7 @@ Gem::Specification.new do |spec|
|
|
43
43
|
spec.add_dependency 'haversine', '~>0.3'
|
44
44
|
spec.add_dependency 'sequel-postgis-georuby', '0.1.2'
|
45
45
|
spec.add_dependency 'tacview_client', '~>0.1'
|
46
|
+
spec.add_dependency 'cinc', '~>0.1'
|
46
47
|
|
47
48
|
spec.add_development_dependency 'bundler', '~> 2.0'
|
48
49
|
spec.add_development_dependency 'rake', '~> 10.0'
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: tac_scribe
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.7.
|
4
|
+
version: 0.7.3
|
5
5
|
platform: java
|
6
6
|
authors:
|
7
7
|
- Jeffrey Jones
|
@@ -108,6 +108,20 @@ dependencies:
|
|
108
108
|
- - "~>"
|
109
109
|
- !ruby/object:Gem::Version
|
110
110
|
version: '0.1'
|
111
|
+
- !ruby/object:Gem::Dependency
|
112
|
+
requirement: !ruby/object:Gem::Requirement
|
113
|
+
requirements:
|
114
|
+
- - "~>"
|
115
|
+
- !ruby/object:Gem::Version
|
116
|
+
version: '0.1'
|
117
|
+
name: cinc
|
118
|
+
prerelease: false
|
119
|
+
type: :runtime
|
120
|
+
version_requirements: !ruby/object:Gem::Requirement
|
121
|
+
requirements:
|
122
|
+
- - "~>"
|
123
|
+
- !ruby/object:Gem::Version
|
124
|
+
version: '0.1'
|
111
125
|
- !ruby/object:Gem::Dependency
|
112
126
|
requirement: !ruby/object:Gem::Requirement
|
113
127
|
requirements:
|