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 +4 -4
- checksums.yaml.gz.sig +0 -0
- data.tar.gz.sig +0 -0
- data/lib/mymedia-card.rb +14 -4
- metadata +1 -1
- metadata.gz.sig +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9207708d5f7b63fd27178062a4cfca13a4726dc9
|
4
|
+
data.tar.gz: e9d752bc34639c9fc2c0c36f59de9c4b8d85f6b4
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 05f8412a3873b02c6f0117eae86662201723d380d675e13fa4ccace3a8b77188ea0947e6548f56988f8c33ae83c232c364efe30abdd86b64ab315f3550752d06
|
7
|
+
data.tar.gz: 45d1c698b7c60ba5d1706c83d43b9a16ab47a61bfbe836a269c1e4237064c2f7078f384cda78530562590d5c4138d5fb604a46f9b966c674c4abe734c5e362d5
|
checksums.yaml.gz.sig
CHANGED
Binary file
|
data.tar.gz.sig
CHANGED
Binary file
|
data/lib/mymedia-card.rb
CHANGED
@@ -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
|
-
|
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
|
-
|
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:
|
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)[
|
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
metadata.gz.sig
CHANGED
Binary file
|