mns_subscriber 0.7.1 → 0.7.2
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
- checksums.yaml.gz.sig +0 -0
- data/lib/mns_subscriber.rb +27 -17
- data.tar.gz.sig +0 -0
- metadata +4 -4
- metadata.gz.sig +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d423aeed6fde9fb4b40f93118cdd02873b3d1c06725b03be6b85c39d854e1e41
|
4
|
+
data.tar.gz: 48073f7faea2f5874fb85ec995751196829a24c64f0b0a8813933fc61d9b2e55
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 72a1b222c7f4093c7f94b76c806b17d503645536fdb8b0bd7f024190274ea8e85ae85d0b22564e5cd33a2e158fc339315a66a9c0cd04ea8cc4cd1506691b94e1
|
7
|
+
data.tar.gz: 177387347a89ef47d2f927a7f34eb24a922c63b151d642912ac85a2a7b731315c4512c385e43880df50f97bc45659769f8214a9186948863cbe58343189ad3a0
|
checksums.yaml.gz.sig
CHANGED
Binary file
|
data/lib/mns_subscriber.rb
CHANGED
@@ -16,7 +16,7 @@ module MNSSubscriber
|
|
16
16
|
include RXFHelperModule
|
17
17
|
using ColouredText
|
18
18
|
|
19
|
-
def initialize(sps=nil, dir: '.', options: {}, timeline: nil,
|
19
|
+
def initialize(sps=nil, dir: '.', db_path: '.', options: {}, timeline: nil,
|
20
20
|
hashtag_url: nil, log: nil, debug: false)
|
21
21
|
|
22
22
|
@sps, @log, @debug = sps, log, debug
|
@@ -33,7 +33,7 @@ module MNSSubscriber
|
|
33
33
|
}.merge(options)
|
34
34
|
|
35
35
|
|
36
|
-
@filepath, @timeline = dir, timeline
|
36
|
+
@filepath, @db_path, @timeline = dir, db_path, timeline
|
37
37
|
|
38
38
|
@index = nil
|
39
39
|
@hashtags = nil
|
@@ -44,8 +44,9 @@ module MNSSubscriber
|
|
44
44
|
@hashtag_url = @options[:url_base] + hashtag_url.sub(/^\//,'')
|
45
45
|
|
46
46
|
hashtag_path = File.join(dir, 'hashtag')
|
47
|
-
tagdb = File.join(
|
48
|
-
|
47
|
+
tagdb = File.join(db_path, 'hashtag', 'index.db')
|
48
|
+
tagdb_dir = File.join(hashtag_path, 'index.db')
|
49
|
+
FileX.mkdir_p File.dirname(tagdb_dir)
|
49
50
|
|
50
51
|
h = {hashtags: {id: '', tag: '', topic: '', noticeid: ''}}
|
51
52
|
@hashtags = RecordxSqlite.new(tagdb, table: h )
|
@@ -111,6 +112,7 @@ module MNSSubscriber
|
|
111
112
|
file
|
112
113
|
|
113
114
|
end
|
115
|
+
|
114
116
|
puts 'scale: ' + scale.inspect
|
115
117
|
index = scale[2] ? 2 : (scale[1] ? 1 : 0)
|
116
118
|
file1 = scale[index]
|
@@ -185,13 +187,20 @@ module MNSSubscriber
|
|
185
187
|
def add_notice(topic, raw_msg, raw_id=nil, card=nil)
|
186
188
|
|
187
189
|
@log.info 'mns_subscriber/add_notice: active' if @log
|
190
|
+
|
191
|
+
if @log then
|
192
|
+
@log.debug 'mns_subscriber/add_notice: @db_path:' + @db_path.inspect
|
193
|
+
end
|
194
|
+
|
188
195
|
topic_dir = File.join(@filepath, 'u', topic)
|
196
|
+
topic_db_dir = File.join(@db_path, 'u', topic)
|
197
|
+
|
189
198
|
|
190
199
|
options = @options.clone
|
191
200
|
options.delete :local_media_path
|
192
201
|
options.delete :url_media_path
|
193
202
|
|
194
|
-
notices = DailyNotices.new topic_dir, options.merge(identifier: topic,
|
203
|
+
notices = DailyNotices.new topic_dir, **options.merge(identifier: topic,
|
195
204
|
title: topic.capitalize + ' daily notices', log: @log)
|
196
205
|
|
197
206
|
t = Time.now
|
@@ -250,7 +259,7 @@ module MNSSubscriber
|
|
250
259
|
|
251
260
|
return if return_status == :duplicate
|
252
261
|
|
253
|
-
rxnotices = RecordxSqlite.new(File.join(
|
262
|
+
rxnotices = RecordxSqlite.new(File.join(topic_db_dir, 'notices.db'),
|
254
263
|
table: {notices: {id: 0, description: '', message: ''}})
|
255
264
|
|
256
265
|
begin
|
@@ -262,7 +271,7 @@ module MNSSubscriber
|
|
262
271
|
if raw_json then
|
263
272
|
|
264
273
|
record = JSON.parse(raw_json)
|
265
|
-
index = RecordxSqlite.new(File.join(
|
274
|
+
index = RecordxSqlite.new(File.join(topic_db_dir, 'index.db'),
|
266
275
|
table: {items: record})
|
267
276
|
index.create record
|
268
277
|
|
@@ -279,17 +288,18 @@ module MNSSubscriber
|
|
279
288
|
def delete_notice(topic, msg)
|
280
289
|
|
281
290
|
topic_dir = File.join(@filepath, topic)
|
291
|
+
topic_db_dir = File.join(@db_path, topic)
|
282
292
|
|
283
293
|
id = msg.to_i
|
284
294
|
|
285
295
|
feed = DailyNotices.new topic_dir, log: @log
|
286
296
|
feed.delete id
|
287
297
|
|
288
|
-
notices = RecordxSqlite.new(File.join(
|
298
|
+
notices = RecordxSqlite.new(File.join(topic_db_dir, 'notices.db'),
|
289
299
|
table: 'notices')
|
290
300
|
notices.delete id
|
291
301
|
|
292
|
-
indexdb = File.join(
|
302
|
+
indexdb = File.join(topic_db_dir, 'index.db')
|
293
303
|
|
294
304
|
if File.exists? indexdb then
|
295
305
|
|
@@ -385,7 +395,7 @@ module MNSSubscriber
|
|
385
395
|
def update_attributes(attribute, topic, value)
|
386
396
|
|
387
397
|
topic_dir = File.join(@filepath, topic)
|
388
|
-
notices = DailyNotices.new topic_dir,
|
398
|
+
notices = DailyNotices.new topic_dir, **@options.merge(identifier: topic)
|
389
399
|
notices.method((attribute.to_s + '=').to_sym).call(value)
|
390
400
|
notices.save
|
391
401
|
|
@@ -394,7 +404,7 @@ module MNSSubscriber
|
|
394
404
|
def update_profile(topic, h)
|
395
405
|
|
396
406
|
topic_dir = File.join(@filepath, topic)
|
397
|
-
notices = DailyNotices.new topic_dir,
|
407
|
+
notices = DailyNotices.new topic_dir, **@options.merge(identifier: topic)
|
398
408
|
|
399
409
|
valid_keys = %i(title identifier image bio location website banner_image)
|
400
410
|
|
@@ -416,20 +426,20 @@ module MNSSubscriber
|
|
416
426
|
|
417
427
|
class Client < SPSSub
|
418
428
|
|
419
|
-
def initialize(host: 'sps', port: 59000, dir: '.',
|
420
|
-
|
429
|
+
def initialize(host: 'sps', port: 59000, dir: '.', db_path: '.',
|
430
|
+
options: {}, timeline: nil, log: nil, hashtag_url: nil)
|
421
431
|
|
422
432
|
@log = log
|
423
433
|
log.info 'mns_subscriber/initialize: active' if log
|
424
|
-
@nm = NoticeMgr.new(self, dir: dir, options: options, timeline: timeline,
|
425
|
-
hashtag_url: hashtag_url, debug: true)
|
434
|
+
@nm = NoticeMgr.new(self, dir: dir, db_path: db_path, options: options, timeline: timeline,
|
435
|
+
hashtag_url: hashtag_url, log: log, debug: true)
|
426
436
|
|
427
437
|
super(host: host, port: port, log: log)
|
428
438
|
|
429
439
|
end
|
430
440
|
|
431
|
-
def subscribe(
|
432
|
-
super(topic)
|
441
|
+
def subscribe(topicx='notice/*', topic: topicx)
|
442
|
+
super(topic: topic)
|
433
443
|
end
|
434
444
|
|
435
445
|
private
|
data.tar.gz.sig
CHANGED
Binary file
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: mns_subscriber
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.7.
|
4
|
+
version: 0.7.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- James Robertson
|
@@ -35,7 +35,7 @@ cert_chain:
|
|
35
35
|
yOAycOYzp7fxmPl3/HV5D0YOJwuy1XslA50GQJwq12A5vMyUGUCHuxH/zKZcM/zr
|
36
36
|
0QZaKiVqq5ZeGvni0eQSavhQ
|
37
37
|
-----END CERTIFICATE-----
|
38
|
-
date: 2022-01-
|
38
|
+
date: 2022-01-19 00:00:00.000000000 Z
|
39
39
|
dependencies:
|
40
40
|
- !ruby/object:Gem::Dependency
|
41
41
|
name: mtlite
|
@@ -86,7 +86,7 @@ dependencies:
|
|
86
86
|
version: '0.7'
|
87
87
|
- - ">="
|
88
88
|
- !ruby/object:Gem::Version
|
89
|
-
version: 0.7.
|
89
|
+
version: 0.7.3
|
90
90
|
type: :runtime
|
91
91
|
prerelease: false
|
92
92
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -96,7 +96,7 @@ dependencies:
|
|
96
96
|
version: '0.7'
|
97
97
|
- - ">="
|
98
98
|
- !ruby/object:Gem::Version
|
99
|
-
version: 0.7.
|
99
|
+
version: 0.7.3
|
100
100
|
- !ruby/object:Gem::Dependency
|
101
101
|
name: recordx_sqlite
|
102
102
|
requirement: !ruby/object:Gem::Requirement
|
metadata.gz.sig
CHANGED
Binary file
|