six-updater-web 0.17.7 → 0.18.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -22,7 +22,7 @@ case RUBY_VERSION
22
22
  end
23
23
 
24
24
  module SixUpdaterWeb
25
- VERSION = "0.17.7"
25
+ VERSION = "0.18.0"
26
26
  COMPONENT = "six-updater-web"
27
27
 
28
28
  DEFAULT_IP = "127.0.0.1" unless defined?(DEFAULT_IP)
@@ -123,34 +123,35 @@ module SixUpdaterWeb
123
123
  puts "Pings and Countries: #{geo.nil?}"
124
124
  puts ""
125
125
 
126
- q = Six::Query::GamespyMaster.new(geo)
127
- h = q.process
128
-
129
- puts ""
130
- puts "Received #{h.size} servers"
131
-
132
- puts ""
133
- puts "Updating database..."
134
-
135
- i, saved = 0, 0
136
- ids = []
137
- #hasj = Hash.new
138
- timestart = Time.now
139
- h.each_pair do |key, e|
140
- i += 1
141
- time = Time.now
142
- r = Queryserver.import(e)
143
- next unless r
144
- if r[0].changed?
145
- #hasj[r[0].id] = r[1]
146
- saved += 1
147
- r[0].save
148
- else
149
- ids << r[0].id
126
+ ["arma2oapc", "arma2pc"].each do |game|
127
+ q = Six::Query::GamespyMaster.new(geo, game)
128
+ h = q.process
129
+ puts ""
130
+ puts "Received #{h.size} servers"
131
+
132
+ puts ""
133
+ puts "Updating database..."
134
+
135
+ i, saved = 0, 0
136
+ ids = []
137
+ #hasj = Hash.new
138
+ timestart = Time.now
139
+ h.each_pair do |key, e|
140
+ i += 1
141
+ time = Time.now
142
+ r = Queryserver.import(e)
143
+ next unless r
144
+ if r[0].changed?
145
+ #hasj[r[0].id] = r[1]
146
+ saved += 1
147
+ r[0].save
148
+ else
149
+ ids << r[0].id
150
+ end
151
+ print "#{i} / #{h.keys.size}, took #{SixUpdaterWeb::stamp(time)}s\r"
150
152
  end
151
- print "#{i} / #{h.keys.size}, took #{SixUpdaterWeb::stamp(time)}s\r"
153
+ puts "Saved: #{saved}, Unchanged: #{h.keys.size - saved}. Took: #{SixUpdaterWeb::stamp(timestart)}s"
152
154
  end
153
- puts "Saved: #{saved}, Unchanged: #{h.keys.size - saved}. Took: #{SixUpdaterWeb::stamp(timestart)}s"
154
155
 
155
156
  =begin
156
157
  timestart = Time.now
@@ -17,8 +17,8 @@ module Six
17
17
  File.join(RAILS_ROOT, "config")
18
18
  end
19
19
 
20
- def initialize(geo = nil)
21
- @geo = geo
20
+ def initialize(geo = nil, game = "arma2oapc")
21
+ @geo, @game = geo, game
22
22
  end
23
23
 
24
24
  def process
@@ -33,7 +33,7 @@ module Six
33
33
  puts "Warning: GeoIP.dat database missing. Can't parse countries. #{GEOIP_PATH}"
34
34
  geo = nil
35
35
  end
36
- reply = %x[gslist -p "#{GEOIP_PATH}" -n arma2pc #{geo}-X #{PARAMS.clone.map{|e| "#{DELIMIT}#{e}"}.join("")}]
36
+ reply = %x[gslist -p "#{GEOIP_PATH}" -n #{@game} #{geo}-X #{PARAMS.clone.map{|e| "#{DELIMIT}#{e}"}.join("")}]
37
37
  reply.gsub!("\\\\\\", "") if geo
38
38
  reply.split("\n")
39
39
  end
metadata CHANGED
@@ -4,9 +4,9 @@ version: !ruby/object:Gem::Version
4
4
  prerelease: false
5
5
  segments:
6
6
  - 0
7
- - 17
8
- - 7
9
- version: 0.17.7
7
+ - 18
8
+ - 0
9
+ version: 0.18.0
10
10
  platform: ruby
11
11
  authors:
12
12
  - Sickboy
@@ -14,7 +14,7 @@ autorequire:
14
14
  bindir: bin
15
15
  cert_chain: []
16
16
 
17
- date: 2010-07-06 00:00:00 +02:00
17
+ date: 2010-07-10 00:00:00 +02:00
18
18
  default_executable:
19
19
  dependencies:
20
20
  - !ruby/object:Gem::Dependency