mymedia-card 0.1.2 → 0.1.3

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: 07aea605562c6a41f02924c2ca0ced397f63d3c8
4
- data.tar.gz: d6f36bd3b0c547db08c934a0edf136b9af21425e
3
+ metadata.gz: 9207708d5f7b63fd27178062a4cfca13a4726dc9
4
+ data.tar.gz: e9d752bc34639c9fc2c0c36f59de9c4b8d85f6b4
5
5
  SHA512:
6
- metadata.gz: 9a66f0b8e76c8dbaa05a4a263960eb8ea8ec620b2403a6b350a9977499ace39cad8c8aab4fbf1242342fe0e5c33e605cde1c598d48b216e1f13330c913850cf0
7
- data.tar.gz: b63aea089c1ade4057c388f3a175cb064c875f3a6f07e8ce430d720cbee34aa20134e358343fe3bb806f188a01434b6df7cd7514ea40d027967c57928bf4bced
6
+ metadata.gz: 05f8412a3873b02c6f0117eae86662201723d380d675e13fa4ccace3a8b77188ea0947e6548f56988f8c33ae83c232c364efe30abdd86b64ab315f3550752d06
7
+ data.tar.gz: 45d1c698b7c60ba5d1706c83d43b9a16ab47a61bfbe836a269c1e4237064c2f7078f384cda78530562590d5c4138d5fb604a46f9b966c674c4abe734c5e362d5
Binary file
data.tar.gz.sig CHANGED
Binary file
@@ -10,14 +10,14 @@ class MyMediaCard < MyMedia::Base
10
10
  attr_reader :kvx
11
11
 
12
12
  def initialize(opt={}, public_type: 'kvx', media_type: public_type,
13
- config: nil, prefix: 'meta', ext: nil)
13
+ config: nil, ext: nil)
14
14
 
15
15
  @public_type = public_type
16
16
  super(media_type: media_type, public_type: public_type, config: config)
17
17
 
18
18
  @media_src = "%s/media/%s" % [@home, public_type]
19
19
  @target_ext = '.xml'
20
- @prefix = prefix
20
+
21
21
  @media_type = media_type
22
22
  @ext = ext
23
23
 
@@ -37,8 +37,13 @@ class MyMediaCard < MyMedia::Base
37
37
  desc.capitalize! unless desc[0] == desc[0].upcase
38
38
  filename = raw_name.downcase + ext
39
39
 
40
+ static_path = "%s/%s/%s" % [@public_type, \
41
+ Time.now.strftime('%Y/%b/%d').downcase, filename]
42
+
43
+ raw_static_destination = "%s/%s/%s" % [@website, 'r',static_path]
44
+
40
45
  summary = {title: desc, tags: tags.join(' ')}
41
- body = {file: filename}
46
+ body = {file: raw_static_destination}
42
47
 
43
48
  kvx = Kvx.new({summary: summary, body: body}, attributes: {type: @media_type})
44
49
  meta_filename = Time.now.strftime('meta%d%m%yT%H%M') + '.txt'
@@ -78,7 +83,7 @@ class MyMediaCard < MyMedia::Base
78
83
 
79
84
  end
80
85
 
81
- if not File.basename(src_path)[/#{@prefix}\d{6}T\d{4}\.txt/] then
86
+ if not File.basename(src_path)[/meta\d{6}T\d{4}\.txt/] then
82
87
 
83
88
  xml_filename = File.basename(src_path).sub(/txt$/,'xml')
84
89
  FileUtils.cp destination, @home + "/#{@public_type}/" + xml_filename
@@ -126,6 +131,11 @@ class MyMediaCard < MyMedia::Base
126
131
 
127
132
  kvx.summary[:xslt] = @xsl unless kvx.item[:xslt]
128
133
  File.write destination, kvx.to_xml
134
+
135
+ # copy the media file to the destination
136
+ destination = kvx.body[:file][/^https?:\/\/[^\/]+(.*)/,1]
137
+ file = destination[/[^\/]+$/]
138
+ FileUtils.cp File.join(@media_src, file), File.join(@home, destination)
129
139
 
130
140
  [kvx, raw_msg]
131
141
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mymedia-card
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.2
4
+ version: 0.1.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - James Robertson
metadata.gz.sig CHANGED
Binary file