From 67d17ba6ef61de954899e78832f65371a4100624 Mon Sep 17 00:00:00 2001 From: Ward Wouts Date: Tue, 12 Sep 2006 20:54:54 +0000 Subject: [PATCH] filtering on poster --- trunk/ripnews/CHANGELOG | 9 +++++++-- trunk/ripnews/README | 4 ++++ trunk/ripnews/TODO | 1 - trunk/ripnews/news/article.rb | 9 +++++++++ trunk/ripnews/ripnews.rb | 16 ++++++++++++++++ 5 files changed, 36 insertions(+), 3 deletions(-) diff --git a/trunk/ripnews/CHANGELOG b/trunk/ripnews/CHANGELOG index 02df063..39e214d 100644 --- a/trunk/ripnews/CHANGELOG +++ b/trunk/ripnews/CHANGELOG @@ -1,5 +1,10 @@ -# $Dwarf: CHANGELOG,v 1.39 2005/05/10 20:52:58 ward Exp $ -# $Source$ +# $Id$ +# $URL$ + +from 0.5.3 to ... + - filtering on posters useing OPT_IF, OPT_XF, OPT_MRF + - cacheconverter2 to convert caches (or just throw them away) + - OPT_CP also includes poster in combined name from 0.5.2 to 0.5.3 - fix the occasional deadlock diff --git a/trunk/ripnews/README b/trunk/ripnews/README index 0585510..1ccaeba 100644 --- a/trunk/ripnews/README +++ b/trunk/ripnews/README @@ -116,16 +116,20 @@ Supported config options: ------------------------- OPT_I= Set include pattern. +OPT_IF= Set include from pattern. Filters on poster. OPT_L= Set long filenames. OPT_C= Sets combined filenames. +OPT_CP= Sets poster combined filenames. OPT_X= Set exclude pattern. Ripnews will read articles matching this pattern but it will not attempt to download them. +OPT_XF= Set exclude from pattern. Filters on posters. OPT_MR= Set "mark read" pattern. Ripnews will place articles matching this pattern in your newsrc, afterwards they will never be present in memory again. Great for reducing memory usage when checking a group for the first time. +OPT_MRF= Set "mark read from" pattern. Filters on posters. OPT_MRR= Mark Remaining Read. If this is set to true and the article doesn't match an exclude or include pattern, the article will be diff --git a/trunk/ripnews/TODO b/trunk/ripnews/TODO index 94c04fa..d568ee5 100644 --- a/trunk/ripnews/TODO +++ b/trunk/ripnews/TODO @@ -24,7 +24,6 @@ [ ] there is a bug in handling half fetched parts, they'll be fetched twice this should be buffered until it's gotten correctly, then added to the main buffer -[ ] match on poster [ ] running without a tempdir doesn't work at all [ ] don't drop connections to servers when switching groups [ ] keep connections to newsservers alive (don't timeout) diff --git a/trunk/ripnews/news/article.rb b/trunk/ripnews/news/article.rb index c8e1e46..c892fe9 100644 --- a/trunk/ripnews/news/article.rb +++ b/trunk/ripnews/news/article.rb @@ -659,6 +659,15 @@ def get_group_subjects return @groups.keys end +def get_group_poster(subj) + group_subject_sort(subj) + unless @groups[subj]["messageinfo"] != nil && @groups[subj]["messageinfo"][0][:from] + p "ieks komt niet door lame check heen" + return false + end + return @groups[subj]["messageinfo"][0][:from] +end + def group_is_complete(subj) group_subjects unless @grouped #print "Subject: #{subj}\n" diff --git a/trunk/ripnews/ripnews.rb b/trunk/ripnews/ripnews.rb index f39ba14..9272375 100755 --- a/trunk/ripnews/ripnews.rb +++ b/trunk/ripnews/ripnews.rb @@ -570,6 +570,14 @@ def output_data(subject, mode, filename="", body="") if outfile.length > @maxfilelength outfile = filename[0...@maxfilelength] end + elsif @config[group].has_key?("-CP") and @config[group]["-CP"] + print "combinedname\n" if Debuglevel > 1 + poster = @articles.get_group_poster(subject) + outfile = sub[0...@maxfilelength-poster.length-filename.length-6] + outfile = "#{outfile} [#{poster}] [#{filename}]" + if outfile.length > @maxfilelength + outfile = filename[0...@maxfilelength] + end else print "shortname\n" if Debuglevel > 1 outfile = filename[0...@maxfilelength] @@ -704,15 +712,23 @@ def main for subj in @articles.get_group_subjects.sort{|a, b| ward_sort(a, b)} print "#{subj}\n" if Debuglevel > 2 + poster = @articles.get_group_poster(subj) # explicitly mark as read if @config[group].has_key?("-MR") and subj =~ /#{@config[group]["-MR"]}/ print "Marking '#{subj}' as read\n" _mark_read(subj) # get the juicy bits + elsif @config[group].has_key?("-MRF") and poster =~ /#{@config[group]["-MRF"]}/ + print "Marking poster '#{poster}' as read\n" + _mark_read(subj) elsif !(@config[group].has_key?("-X") and subj =~ /#{@config[group]["-X"]}/) and subj =~ /#{@config[group]["-I"]}/ print "Match: #{subj}\n" if Debuglevel > 0 _get_article(subj, group) + elsif !(@config[group].has_key?("-XF") and poster =~ /#{@config[group]["-XF"]}/) and + @config[group].has_key?("-IF") and poster =~ /#{@config[group]["-IF"]}/ + print "Poster match: #{poster}\n" if Debuglevel > 0 + _get_article(subj, group) else _mark_remaining(subj, group) end