mymedia 0.5.2 → 0.5.5

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: 6db4be538139117711e0efb648d7e93873b129692f1319cf82523e9caf96d1cf
4
- data.tar.gz: 494646f0e3e962bbb9764aa64b683f6ac04b985b8df375f5d80b2f57261d875c
3
+ metadata.gz: 9524fd31dc71743e9163c15572ccb65ee1d3cad4a9e9753a4e7bea39cf2caf1b
4
+ data.tar.gz: a60ca935a57e95a523182a7ad2fc43f35289dc5cb25210b98084e4455c6e982e
5
5
  SHA512:
6
- metadata.gz: 044a56092a8239fe598563ece75a9e288526201883fb8083f6aa8cce40ff6a79bca679133a49da2730c14b55066ed6ac5ed1539ddbb472d7bbc8d3b8139bdbed
7
- data.tar.gz: c296255f7b2f2e43c719ddfc1cdbae91314fe7dd6fc73c5e396027fad0ed4be5f969534fcc63e0e253b593478d79fd5b76a619cdccfee9ff8b696a66dfee87ce
6
+ metadata.gz: 9c26f58519f36dd058cd791002217404c6710479c1255e4217885d8aaff0d04820b11e5313b1f65d1c8a6284bcba3a49a7f61b39edf8a08d10d731fa73897f6c
7
+ data.tar.gz: d0c6a852d647c5caf91bc282814f40ff718edf53815f0404f390e120bcbcc38b4f4d0e6d7cbc395e45490378d34cedfd5fdc4c493603289962d90748efba8014
checksums.yaml.gz.sig CHANGED
Binary file
data/lib/mymedia.rb CHANGED
@@ -11,6 +11,7 @@ require 'dataisland'
11
11
  require 'increment'
12
12
  require 'simple-config'
13
13
  require 'rxfileio'
14
+ require 'wordsdotdat'
14
15
 
15
16
 
16
17
  module MyMedia
@@ -75,7 +76,7 @@ module MyMedia
75
76
  dynarex = if FileX.exists? dynarex_filepath then
76
77
  DxLite.new(dynarex_filepath)
77
78
  else
78
- DxLite.new(@schema, order: 'descending')
79
+ DxLite.new(@schema, order: 'descending', debug: @debug)
79
80
  end
80
81
 
81
82
  dynarex.create record
@@ -95,14 +96,55 @@ module MyMedia
95
96
  module IndexReader
96
97
  include RXFRead
97
98
 
98
- def browse()
99
+ def browse(startswith=nil)
99
100
 
100
101
  json_filepath = "%s/%s/dynarex.json" % [@home, @public_type]
101
102
 
102
103
  if FileX.exists? json_filepath then
103
104
 
104
105
  dx = DxLite.new(json_filepath)
105
- return dx.all
106
+
107
+ if startswith then
108
+
109
+ @stopwords = WordsDotDat.stopwords
110
+ q = startswith
111
+
112
+ r = dx.all.select do |x|
113
+
114
+ found = x.title.scan(/\b\w+/).select do |raw_word|
115
+
116
+ word = raw_word.downcase
117
+ word[0..(q.length-1)] == q and not @stopwords.include? word
118
+
119
+ end
120
+
121
+ found.any?
122
+ end
123
+
124
+ else
125
+
126
+ return dx.all
127
+
128
+ end
129
+
130
+ end
131
+
132
+ end
133
+
134
+ def find(keyword)
135
+
136
+ json_filepath = "%s/%s/dynarex.json" % [@home, @public_type]
137
+
138
+ if FileX.exists? json_filepath then
139
+
140
+ dx = DxLite.new(json_filepath)
141
+
142
+ return dx.all.find do |x|
143
+
144
+ regex = keyword.is_a?(String) ? /#{keyword}/i : keyword
145
+ x.title =~ regex
146
+
147
+ end
106
148
 
107
149
  end
108
150
 
@@ -115,7 +157,27 @@ module MyMedia
115
157
  if FileX.exists? json_filepath then
116
158
 
117
159
  dx = DxLite.new(json_filepath)
118
- return dx.all.select {|x| x.title =~ /#{keyword}/i}
160
+
161
+ return dx.all.select do |x|
162
+
163
+ regex = keyword.is_a?(String) ? /#{keyword}/i : keyword
164
+ x.title =~ regex
165
+
166
+ end
167
+
168
+ end
169
+
170
+ end
171
+
172
+ def find_sourcefile(id)
173
+
174
+ json_filepath = "%s/%s/dynarex.json" % [@home, @public_type]
175
+
176
+ if FileX.exists? json_filepath then
177
+
178
+ dx = DxLite.new(json_filepath)
179
+ rx = dx.find_by_id(id)
180
+ Kvx.new(@home + rx.meta).file
119
181
 
120
182
  end
121
183
 
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.5.2
4
+ version: 0.5.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - James Robertson
@@ -35,7 +35,7 @@ cert_chain:
35
35
  bL55NDdi8BFHkNVohRBak7aqxsw41LJKy3UTP+4TzU5vyluDJMiscK6JJFaM4JiS
36
36
  xtlAM0O5ZFe9QflatP+P8JnB
37
37
  -----END CERTIFICATE-----
38
- date: 2022-03-19 00:00:00.000000000 Z
38
+ date: 2022-05-05 00:00:00.000000000 Z
39
39
  dependencies:
40
40
  - !ruby/object:Gem::Dependency
41
41
  name: dir-to-xml
@@ -117,6 +117,26 @@ dependencies:
117
117
  - - ">="
118
118
  - !ruby/object:Gem::Version
119
119
  version: 0.7.2
120
+ - !ruby/object:Gem::Dependency
121
+ name: wordsdotdat
122
+ requirement: !ruby/object:Gem::Requirement
123
+ requirements:
124
+ - - "~>"
125
+ - !ruby/object:Gem::Version
126
+ version: '0.2'
127
+ - - ">="
128
+ - !ruby/object:Gem::Version
129
+ version: 0.2.0
130
+ type: :runtime
131
+ prerelease: false
132
+ version_requirements: !ruby/object:Gem::Requirement
133
+ requirements:
134
+ - - "~>"
135
+ - !ruby/object:Gem::Version
136
+ version: '0.2'
137
+ - - ">="
138
+ - !ruby/object:Gem::Version
139
+ version: 0.2.0
120
140
  description:
121
141
  email: digital.robertson@gmail.com
122
142
  executables: []
metadata.gz.sig CHANGED
Binary file