restructure a bit to make threading easier
This commit is contained in:
parent
5998913c87
commit
638c945a55
1 changed files with 21 additions and 19 deletions
|
|
@ -1,6 +1,6 @@
|
|||
#!/usr/local/bin/ruby -w
|
||||
|
||||
# $Dwarf: ripnews.rb,v 1.64 2003/06/15 22:01:43 ward Exp $
|
||||
# $Dwarf: ripnews.rb,v 1.65 2003/06/16 10:56:11 ward Exp $
|
||||
# $Source$
|
||||
|
||||
require 'date'
|
||||
|
|
@ -290,7 +290,8 @@ def get_single(subj, group)
|
|||
print " Unknown encoding (not UU, not yEnc), skipping...\n"
|
||||
return false
|
||||
end
|
||||
return mode, filename, body
|
||||
output_data(i, mode, filename, body)
|
||||
return true
|
||||
end
|
||||
|
||||
def get_multi(subj, group)
|
||||
|
|
@ -314,7 +315,8 @@ def get_multi(subj, group)
|
|||
print " Unknown encoding (not UU, not yEnc), skipping...\n"
|
||||
return false
|
||||
end
|
||||
return mode, filename, body
|
||||
output_data(i, mode, filename, body)
|
||||
return true
|
||||
else
|
||||
body = @articles.get_group_body_first(subj)
|
||||
if UUEncode.is_uuencoded(body) or YEnc.is_yencoded(body)
|
||||
|
|
@ -339,13 +341,21 @@ def get_multi(subj, group)
|
|||
print " YDecoding...\n"
|
||||
mode, filename, body = YEnc.ydecode(file, fileout)
|
||||
end
|
||||
|
||||
# horrible cheat to not lose the outputted file
|
||||
body = fileout.path
|
||||
bodybase = body.sub(/\/[^\/]*$/, "")
|
||||
File.move(body, "#{bodybase}/ripnewsdecode")
|
||||
body = "#{bodybase}/ripnewsdecode"
|
||||
bodybase = body.sub(/\/[^\/]*$/, "/ripnewsdecode")
|
||||
i = 1
|
||||
while Filetest.exists?("#{bodybase}-#{i}")
|
||||
i += 1
|
||||
end
|
||||
File.move(body, "#{bodybase}-#{i}")
|
||||
body = "#{bodybase}-#{i}"
|
||||
file.close
|
||||
fileout.close(false)
|
||||
return mode, filename, body
|
||||
|
||||
output_data(i, mode, filename, body)
|
||||
return true
|
||||
else
|
||||
print " Unknown encoding (not UU, not yEnc), skipping...\n"
|
||||
return false
|
||||
|
|
@ -472,13 +482,7 @@ end
|
|||
for group in @config.keys.sort
|
||||
print "\nGetting articles for #{group}\n"
|
||||
@articles = Article.new(@config[group]["NNTPSERVER"], group, @config[group]["NEWSRCNAME"])
|
||||
# begin
|
||||
@articles.get_articles(@config[group]["CACHEDIR"])
|
||||
# rescue Article::
|
||||
# print "Caught something: #{$!}\n"
|
||||
# @articles.quit
|
||||
# next
|
||||
# end
|
||||
|
||||
unless FileTest.directory?("#{@config[group]["DATADIR"]}/#{group}") or
|
||||
Dir.mkdir("#{@config[group]["DATADIR"]}/#{group}", @config[group]["PERMISSION"].oct)
|
||||
|
|
@ -498,14 +502,12 @@ for group in @config.keys.sort
|
|||
if @articles.group_is_complete(i)
|
||||
begin
|
||||
if @articles.group_is_singlepart(i)
|
||||
mode, filename, body = get_single(i, group)
|
||||
succes = get_single(i, group)
|
||||
elsif @articles.group_is_multipart(i)
|
||||
mode, filename, body = get_multi(i, group)
|
||||
succes = get_multi(i, group)
|
||||
end
|
||||
if mode == false
|
||||
if succes == false
|
||||
print " Skipping article...\n"
|
||||
else
|
||||
output_data(i, mode, filename, body)
|
||||
end
|
||||
rescue Article::TempError, Article::PermError
|
||||
print "#{$!}\n"
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue