sanguinews 0.62 → 0.62.1
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
- data/lib/sanguinews.rb +46 -35
- data/lib/sanguinews/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 55d9dec66992a07b25961e5b54b801d50540eca2
|
4
|
+
data.tar.gz: f644862561feb4db752484335d365255594befad
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: bfc6823e311f763c1e6bd4bc78d7a286edbe6cfab7313f0eed3a2e4f62b21f0a67a0a2de8beef7763cbf7a0d48b2997b8682eb7b0f74d59a853900eb0e2a8e38
|
7
|
+
data.tar.gz: c1fdac5f87a68fc1b7fff70ab829139ff24c9d1811273676f36bd039ff96ba10a7ccd254150ef0218a56ca96588f58818fa7cf6316fa8b4815660dfbd07d9571
|
data/lib/sanguinews.rb
CHANGED
@@ -139,6 +139,51 @@ module Sanguinews
|
|
139
139
|
end
|
140
140
|
end
|
141
141
|
|
142
|
+
def create_upload_list(info_lock)
|
143
|
+
files = @config.files
|
144
|
+
|
145
|
+
# skip hidden files
|
146
|
+
if !@config.filemode && Dir.exists?(@config.directory)
|
147
|
+
Dir.foreach(@config.directory) do |item|
|
148
|
+
next if item.start_with?('.')
|
149
|
+
files << @config.directory+item
|
150
|
+
end
|
151
|
+
end
|
152
|
+
|
153
|
+
files_to_process = []
|
154
|
+
informed = {}
|
155
|
+
unprocessed = 0
|
156
|
+
current_file = 1
|
157
|
+
# "max" is needed only in dirmode
|
158
|
+
max = files.length
|
159
|
+
|
160
|
+
files.each do |file|
|
161
|
+
next if !File.file?(file)
|
162
|
+
|
163
|
+
informed[file.to_sym] = false
|
164
|
+
file = FileToUpload.new(
|
165
|
+
name: file, chunk_length: @config.article_size, prefix: @config.prefix,
|
166
|
+
current: current_file, last: max, filemode: @config.filemode,
|
167
|
+
from: @config.from, groups: @config.groups, nzb: @config.nzb
|
168
|
+
)
|
169
|
+
@s.to_upload += file.size
|
170
|
+
|
171
|
+
info_lock.synchronize do
|
172
|
+
unprocessed += file.chunks
|
173
|
+
end
|
174
|
+
|
175
|
+
files_to_process << file
|
176
|
+
current_file += 1
|
177
|
+
end
|
178
|
+
|
179
|
+
if files_to_process.empty?
|
180
|
+
puts "Upload list is empty! Make sure that you spelled file/directory name(s) correctly!"
|
181
|
+
exit 1
|
182
|
+
end
|
183
|
+
return files_to_process, informed, unprocessed
|
184
|
+
end
|
185
|
+
|
186
|
+
|
142
187
|
def process_and_upload(queue, nntp_pool, info_lock, informed)
|
143
188
|
stuff = queue.pop
|
144
189
|
queue.synchronize do
|
@@ -196,26 +241,10 @@ module Sanguinews
|
|
196
241
|
|
197
242
|
def run!
|
198
243
|
@config = Config.new(ARGV)
|
199
|
-
files = @config.files
|
200
|
-
|
201
|
-
# skip hidden files
|
202
|
-
if !@config.filemode
|
203
|
-
Dir.foreach(@config.directory) do |item|
|
204
|
-
next if item.start_with?('.')
|
205
|
-
files << @config.directory+item
|
206
|
-
end
|
207
|
-
end
|
208
|
-
|
209
|
-
# "max" is needed only in dirmode
|
210
|
-
max = files.length
|
211
|
-
current_file = 1
|
212
|
-
|
213
|
-
unprocessed = 0
|
214
244
|
info_lock=Mutex.new
|
215
245
|
messages = Queue.new
|
216
246
|
messages.extend(MonitorMixin)
|
217
247
|
@cond = messages.new_cond
|
218
|
-
files_to_process = []
|
219
248
|
@s = Speedometer.new(units: "KB", progressbar: true)
|
220
249
|
@s.uploaded = 0
|
221
250
|
|
@@ -228,26 +257,8 @@ module Sanguinews
|
|
228
257
|
}
|
229
258
|
|
230
259
|
thread_pool = Pool.new(@config.connections)
|
231
|
-
informed = {}
|
232
260
|
|
233
|
-
|
234
|
-
next if !File.file?(file)
|
235
|
-
|
236
|
-
informed[file.to_sym] = false
|
237
|
-
file = FileToUpload.new(
|
238
|
-
name: file, chunk_length: @config.article_size, prefix: @config.prefix,
|
239
|
-
current: current_file, last: max, filemode: @config.filemode,
|
240
|
-
from: @config.from, groups: @config.groups, nzb: @config.nzb
|
241
|
-
)
|
242
|
-
@s.to_upload += file.size
|
243
|
-
|
244
|
-
info_lock.synchronize do
|
245
|
-
unprocessed += file.chunks
|
246
|
-
end
|
247
|
-
|
248
|
-
files_to_process << file
|
249
|
-
current_file += 1
|
250
|
-
end
|
261
|
+
files_to_process, informed, unprocessed = create_upload_list(info_lock)
|
251
262
|
|
252
263
|
# let's give a little bit higher priority for file processing thread
|
253
264
|
@file_proc_thread = Thread.new {
|
data/lib/sanguinews/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: sanguinews
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 0.62.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Tadeus Dobrovolskij
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-10-
|
11
|
+
date: 2014-10-07 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: speedometer
|