mymedia 0.6.0 → 0.6.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: e0e73232af677ec81115b33b8c13c8df4b5eb54c79f0af3c063afd7169db3c9c
4
- data.tar.gz: e12bf14b0cedfb4689f58ab44cad8213e7f70f4e7859b72ce3301d2e5a1a8554
3
+ metadata.gz: 02b5ffbf1ed71c431dc65112e3ab5a5b05c52b01a2a537e0457b3045f672751d
4
+ data.tar.gz: c238a9c94a91f8d4e0037a0f0fe5e268f68d28a147f37d15c75c93f080b8534d
5
5
  SHA512:
6
- metadata.gz: 35a2248a7b2ac7cb7007d7d349d2cfd223324597ae1cc67b7282804a948c78b21b602bb60ab2783f2bec13074f59aa538f1bbb644ba200224d8463b998176123
7
- data.tar.gz: 90a8cfb9aece78804c4812b3d6f7c2861e9296d8fd756bfabcba27609da5e0019dd0c928c53cad9f826e160878a8810cb43db8ba873f5b18f36c712fe209218c
6
+ metadata.gz: 803e7329a524b7825f447fd3260eee37525c96b4c6713ff44ba175978d679e7d08cd6731ff30cc497dafbae0af1a92ce9fae4ad21bb5ceb5d502f604ad46b856
7
+ data.tar.gz: 9130e7e15377c05b99677637ae158c3f105f40dcf6fe1f66d49c1c65b7f8464ad44c0d0f4255b91581893f374ffd2011a808bb227a2228c55afdba866510e889
checksums.yaml.gz.sig CHANGED
Binary file
data/lib/mymedia.rb CHANGED
@@ -14,6 +14,9 @@ require 'rxfileio'
14
14
  require 'wordsdotdat'
15
15
 
16
16
 
17
+ require 'rxfileio'
18
+ require 'wordsdotdat'
19
+
17
20
  module StringFilter
18
21
 
19
22
  def normalize(s)
@@ -35,9 +38,10 @@ module MyMedia
35
38
  class Publisher
36
39
  include RXFReadWriteModule
37
40
 
38
- def initialize(opts={})
41
+ def initialize(opts={}, debug: false)
39
42
  @index_page = true
40
43
  @opts = opts
44
+ @debug = debug
41
45
  end
42
46
 
43
47
  protected
@@ -50,7 +54,10 @@ module MyMedia
50
54
  dynarex = if FileX.exists? dynarex_filepath then
51
55
  Dynarex.new(dynarex_filepath)
52
56
  else
53
- Dynarex.new(@schema)
57
+ puts '@schema: ' + @schema.inspect if @debug
58
+ dx = Dynarex.new(@schema)
59
+ dx.xslt_schema = @xslt_schema
60
+ dx
54
61
  end
55
62
 
56
63
  dynarex.create record, id: opt[:id]
@@ -145,7 +152,7 @@ module MyMedia
145
152
 
146
153
  def find(keyword)
147
154
 
148
- json_filepath = "%s/%s/dynarex.json" % [@home, @public_type]
155
+ json_filepath = File.join(@home, @www, @public_type, 'dynarex.json')
149
156
 
150
157
  if FileX.exists? json_filepath then
151
158
 
@@ -164,7 +171,7 @@ module MyMedia
164
171
 
165
172
  def search(keyword)
166
173
 
167
- json_filepath = "%s/%s/dynarex.json" % [@home, @public_type]
174
+ json_filepath = File.join(@home, @www, @public_type, 'dynarex.json')
168
175
 
169
176
  if FileX.exists? json_filepath then
170
177
 
@@ -183,7 +190,7 @@ module MyMedia
183
190
 
184
191
  def find_sourcefile(id)
185
192
 
186
- json_filepath = "%s/%s/dynarex.json" % [@home, @public_type]
193
+ json_filepath = File.join(@home, @www, @public_type, 'dynarex.json')
187
194
 
188
195
  if FileX.exists? json_filepath then
189
196
 
@@ -250,8 +257,8 @@ module MyMedia
250
257
 
251
258
  def add_feed_item(raw_msg, record, options={})
252
259
 
253
- dynarex_filepath = File.join([@home, @public_type, 'dynarex.xml'])
254
- id = Increment.update(File.join([@home, @public_type, 'counter.txt']))
260
+ dynarex_filepath = File.join([@home, @www, @public_type, 'dynarex.xml'])
261
+ id = Increment.update(File.join([@home, @www, @public_type, 'counter.txt']))
255
262
  static_url = @static_baseurl + id
256
263
  record[:uri] = static_url
257
264
 
@@ -418,18 +425,24 @@ module MyMedia
418
425
 
419
426
  class Frontpage < Publisher
420
427
 
421
- def initialize(config: nil, public_type: '', rss: nil)
428
+ def initialize(config: nil, public_type: '', rss: nil, debug: false)
422
429
 
423
430
  raise FrontpageException, "no config found" if config.nil?
424
431
 
432
+ @debug = debug
433
+
425
434
  c = SimpleConfig.new(config).to_h
426
435
 
427
436
  @home = c[:home]
437
+ @www = c[:www]
428
438
  @index_page = c[:index_page] == 'true'
429
439
  @public_type = public_type
430
440
  @rss = rss
431
441
  @sps = c[:sps]
432
442
  @opts = {username: c[:username], password: c[:password]}
443
+ @schema = 'posts/post(url, title, meta)'
444
+ @xslt_schema = 'channel[title:title,description:desc]/' + \
445
+ 'item(title:title,link:url)'
433
446
 
434
447
  end
435
448
 
@@ -449,13 +462,19 @@ module MyMedia
449
462
  raw_msg, static_url, target_url = \
450
463
  record[:title], record[:url], record[:static_url]
451
464
 
465
+ puts 'vars: ' + [@home, @www, @public_type].inspect if @debug
466
+
452
467
  dynarex_filepath = File.join(@home, @www, @public_type, 'dynarex.xml')
453
468
  raw_dynarex_filepath = File.join(@home, @www, 'r', @public_type, 'dynarex.xml')
454
469
 
455
470
  publish_dynarex(dynarex_filepath, record, {rss: @rss || false})
456
471
  publish_dynarex(raw_dynarex_filepath, record, {rss: @rss || false})
457
472
 
458
- publish_timeline(raw_msg, static_url, target_url)
473
+ # 26-feb-2023 the following line was disabled because there's a
474
+ # better alternative to updating a timeline using the noticesys gem.
475
+ # to-do: Somehow integrate this with the new system.
476
+ #
477
+ #publish_timeline(raw_msg, static_url, target_url)
459
478
  send_message(msg: 'publish_to_lists completed')
460
479
 
461
480
  end
data.tar.gz.sig CHANGED
Binary file
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mymedia
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.6.0
4
+ version: 0.6.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - James Robertson
@@ -36,7 +36,7 @@ cert_chain:
36
36
  XV2ORsrE0BA5hbgbfiQFazW2d62rWKrt3CTi36GNST95GXGBpapX9CyezadYE+5i
37
37
  D3/VNb1+lseG5sGSOWMV8J01/J89XOfp5Gk=
38
38
  -----END CERTIFICATE-----
39
- date: 2023-02-26 00:00:00.000000000 Z
39
+ date: 2023-03-01 00:00:00.000000000 Z
40
40
  dependencies:
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: dir-to-xml
metadata.gz.sig CHANGED
Binary file