diff --git a/trunk/ripnews/news/article.rb b/trunk/ripnews/news/article.rb index 8a45a02..c61efcb 100644 --- a/trunk/ripnews/news/article.rb +++ b/trunk/ripnews/news/article.rb @@ -654,6 +654,28 @@ def group_percentage_primary(subj) return percentage end +def group_percentage_fallback(subj) + group_subjects unless @grouped + groupsize = @groups[subj]["messageinfo"].length + fallbackcount = 0 + if @serverlist[-1] == @serverlist[0] + return 0 + end + onmain = {} + @groups[subj]["messageinfo"].each {|x| + if x[:server] != @serverlist[-1] && onmain[x[:subject]].nil? + onmain[x[:subject]] = 1 + end + } + @groups[subj]["messageinfo"].each {|x| + if x[:server] == @serverlist[-1] && onmain[x[:subject]].nil? + fallbackcount += 1 + end + } + percentage = ((100.0/groupsize)*fallbackcount).to_i + return percentage +end + def group_is_singlepart(subj) @groups[subj]["total"].to_i == 1 end diff --git a/trunk/ripnews/ripnews.rb b/trunk/ripnews/ripnews.rb index 19134ac..db28d0f 100755 --- a/trunk/ripnews/ripnews.rb +++ b/trunk/ripnews/ripnews.rb @@ -699,8 +699,20 @@ def main i =~ /#{@config[group]["-I"]}/ print "Match: #{i}\n" if Debuglevel > 0 if @articles.group_is_complete(i) - if @config[group].has_key?("PRIMARYTHRES") && - ( @articles.group_percentage_primary(i) >= @config[group]["PRIMARYTHRES"].to_i ) + skip = 0 + if @config[group].has_key?("PRIMARYTHRES") + if ( @articles.group_percentage_primary(i) < @config[group]["PRIMARYTHRES"].to_i ) + print "Only #{@articles.group_percentage_primary(i)}% of post on primary server, skipping #{i}\n" + skip = 1 + end + end + if @config[group].has_key?("FALLBACKTHRES") + if ( @articles.group_percentage_fallback(i) > @config[group]["FALLBACKTHRES"].to_i ) + print "#{@articles.group_percentage_fallback(i)}% of post only on fallback server, skipping #{i}\n" + skip = 1 + end + end + if ! skip begin if @articles.group_is_singlepart(i) get_single(i, group) @@ -713,8 +725,6 @@ def main #print "Caught #{$!.class}\n" #print "Error: #{$!}\n" end - else - print "Only #{@articles.group_percentage_primary(i)}% of post on primary server, skipping #{i}\n" end else print "Not complete: #{i}\n"