mymedia-card 0.3.1 → 0.3.2

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
  SHA1:
3
- metadata.gz: b38381d519d349f8b650391aa8a1d9db8d55a50f
4
- data.tar.gz: 241e3abced2967e2c2d1640596f0f65de98a5268
3
+ metadata.gz: c478040da872c3ef77085590d2f7093af45164fd
4
+ data.tar.gz: cca9389c75cf63b5ddda8a21e182ab9ce00fb20f
5
5
  SHA512:
6
- metadata.gz: 10bc3565f7a495019d9a534a22ebf4d10f4c06a370cf3ee36551a20e7848e7bd02e2b45e996d371671af37c0607ac430bbdc4fa88f360dd7cb8d66985f46e49e
7
- data.tar.gz: 90565a73cd546cbe34cc26c617f6c376c14b9deb775c4cac0fab518fd4c8f254b82a00b87d5ccf5b873fca621ca52ff70537346327b5933bb38953acd923f0ae
6
+ metadata.gz: 5e04e94cb99bc5478d5e37f81c279a3c7d4391e578059e58223c4b974eb0a1e788d10fa0838bb1016e4995b1cff036032a5cbb2802d1e0f87bbe60614f657b12
7
+ data.tar.gz: 169cde6331f037612a6c14d9731122e7ef5691a6394a84a9e019f1e95846e15f8668ac7e06db1631aa3a53860e4912fb55dbc37307b26c87ee21937d4741fd8e
Binary file
data.tar.gz.sig CHANGED
Binary file
@@ -13,8 +13,7 @@ class MyMediaCard < MyMediaKvx
13
13
  config: nil, ext: 'txt')
14
14
 
15
15
  super(media_type: media_type, public_type: public_type,
16
- config: config, ext: ext)
17
-
16
+ config: config, ext: ext)
18
17
  @prefix = 'meta'
19
18
  @txt_filepath = File.join(@media_src, \
20
19
  Time.now.strftime('meta%d%m%yT%H%M') + '.txt' )
@@ -29,10 +28,12 @@ class MyMediaCard < MyMediaKvx
29
28
  raw_s = dir.select_by_ext(@ext).sort_by_lastmodified.last[:name]
30
29
 
31
30
  s,ext = raw_s.split(/(?=\.\w+$)/)
31
+ ext = '' if ext == '.dir'
32
32
  raw_name, raw_tags = s.split(/--/,2)
33
33
  tags = raw_tags ? raw_tags.split(/--/) : []
34
34
  desc = raw_name.gsub(/-/,' ')
35
35
  desc.capitalize! unless desc[0] == desc[0].upcase
36
+
36
37
  filename = raw_name.downcase + ext
37
38
 
38
39
  static_path = "%s/%s/%s" % [@public_type, \
@@ -43,12 +44,11 @@ class MyMediaCard < MyMediaKvx
43
44
  summary = {title: desc, tags: tags.join(' ')}
44
45
  body = {file: raw_static_destination}
45
46
 
46
- kvx = Kvx.new({summary: summary, body: body}, attributes: {type: @media_type})
47
-
47
+ kvx = Kvx.new({summary: summary, body: body}, \
48
+ attributes: {type: @media_type})
48
49
  Dir.chdir @media_src
49
-
50
50
  File.write @txt_filepath, kvx.to_s
51
-
51
+
52
52
  FileUtils.mv raw_s, filename
53
53
  end
54
54
 
@@ -58,11 +58,26 @@ class MyMediaCard < MyMediaKvx
58
58
  def copy_edit(src_path, destination, raw='')
59
59
 
60
60
  kvx, raw_msg = super(src_path, destination)
61
-
61
+
62
62
  # copy the media file to the destination
63
63
  destination = kvx.body[:file]
64
- file = destination[/[^\/]+$/]
65
- FileUtils.cp File.join(@media_src, file), File.join(@home, destination)
64
+ file = File.basename(destination)
65
+
66
+ subdir = file[/.*(?=\.\w+$)|.*/]
67
+
68
+ if File.exists? File.join(@media_src, subdir) then
69
+
70
+ FileUtils.cp_r File.join(@media_src, subdir), File.join(@home, File.dirname(destination))
71
+
72
+ if File.basename(destination) != subdir then
73
+ FileUtils.cp File.join(@media_src, file), File.join(@home, destination)
74
+ end
75
+
76
+ else
77
+
78
+ FileUtils.cp File.join(@media_src, file), File.join(@home, destination)
79
+
80
+ end
66
81
 
67
82
  [kvx, raw_msg]
68
83
  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.3.1
4
+ version: 0.3.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - James Robertson
@@ -31,7 +31,7 @@ cert_chain:
31
31
  Fel3ZehmfCVTepbDhmN9wy+aNa/pfEaGrRqjtvpPYQwVqzZBqxM39Y+hopVu2SCv
32
32
  2Atqh3hHPujBHw==
33
33
  -----END CERTIFICATE-----
34
- date: 2015-05-14 00:00:00.000000000 Z
34
+ date: 2015-06-26 00:00:00.000000000 Z
35
35
  dependencies:
36
36
  - !ruby/object:Gem::Dependency
37
37
  name: mymedia-kvx
metadata.gz.sig CHANGED
@@ -1,2 +1,2 @@
1
- L���Aj��*dZd��YqV��J�/e��4��g�
2
- p��+9_]n��,��>�`��B#FӇD��@�Nj���8m�`B��JY"��5��3O���p]-ʙ��Qe��f@v fHk)''#�Rm�/�4����{� ����&V��{=b>�
1
+ 62e�����Z
2
+ tee<�?���ƅ�_wfMz��'q���0$w��ˌٚB.Q�� u�U�� ��B����%�e l�JnK� D�J�U�K…��%!zW #(��e�,���|ln