filtering on poster

This commit is contained in:
Ward Wouts 2006-09-12 20:54:54 +00:00
parent 7720fca967
commit 67d17ba6ef
5 changed files with 36 additions and 3 deletions

View file

@ -1,5 +1,10 @@
# $Dwarf: CHANGELOG,v 1.39 2005/05/10 20:52:58 ward Exp $ # $Id$
# $Source$ # $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 from 0.5.2 to 0.5.3
- fix the occasional deadlock - fix the occasional deadlock

View file

@ -116,16 +116,20 @@ Supported config options:
------------------------- -------------------------
OPT_I=<pattern> Set include pattern. OPT_I=<pattern> Set include pattern.
OPT_IF=<patter> Set include from pattern. Filters on poster.
OPT_L=<bool> Set long filenames. OPT_L=<bool> Set long filenames.
OPT_C=<bool> Sets combined filenames. OPT_C=<bool> Sets combined filenames.
OPT_CP=<bool> Sets poster combined filenames.
OPT_X=<pattern> Set exclude pattern. Ripnews will read articles OPT_X=<pattern> Set exclude pattern. Ripnews will read articles
matching this pattern but it will not attempt matching this pattern but it will not attempt
to download them. to download them.
OPT_XF=<pattern> Set exclude from pattern. Filters on posters.
OPT_MR=<pattern> Set "mark read" pattern. Ripnews will place OPT_MR=<pattern> Set "mark read" pattern. Ripnews will place
articles matching this pattern in your newsrc, articles matching this pattern in your newsrc,
afterwards they will never be present in memory afterwards they will never be present in memory
again. Great for reducing memory usage when again. Great for reducing memory usage when
checking a group for the first time. checking a group for the first time.
OPT_MRF=<patter> Set "mark read from" pattern. Filters on posters.
OPT_MRR=<bool> Mark Remaining Read. If this is set to OPT_MRR=<bool> Mark Remaining Read. If this is set to
true and the article doesn't match an exclude or true and the article doesn't match an exclude or
include pattern, the article will be include pattern, the article will be

View file

@ -24,7 +24,6 @@
[ ] there is a bug in handling half fetched parts, they'll be fetched [ ] there is a bug in handling half fetched parts, they'll be fetched
twice this should be buffered until it's gotten correctly, then twice this should be buffered until it's gotten correctly, then
added to the main buffer added to the main buffer
[ ] match on poster
[ ] running without a tempdir doesn't work at all [ ] running without a tempdir doesn't work at all
[ ] don't drop connections to servers when switching groups [ ] don't drop connections to servers when switching groups
[ ] keep connections to newsservers alive (don't timeout) [ ] keep connections to newsservers alive (don't timeout)

View file

@ -659,6 +659,15 @@ def get_group_subjects
return @groups.keys return @groups.keys
end 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) def group_is_complete(subj)
group_subjects unless @grouped group_subjects unless @grouped
#print "Subject: #{subj}\n" #print "Subject: #{subj}\n"

View file

@ -570,6 +570,14 @@ def output_data(subject, mode, filename="", body="")
if outfile.length > @maxfilelength if outfile.length > @maxfilelength
outfile = filename[0...@maxfilelength] outfile = filename[0...@maxfilelength]
end 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 else
print "shortname\n" if Debuglevel > 1 print "shortname\n" if Debuglevel > 1
outfile = filename[0...@maxfilelength] outfile = filename[0...@maxfilelength]
@ -704,15 +712,23 @@ def main
for subj in @articles.get_group_subjects.sort{|a, b| ward_sort(a, b)} for subj in @articles.get_group_subjects.sort{|a, b| ward_sort(a, b)}
print "#{subj}\n" if Debuglevel > 2 print "#{subj}\n" if Debuglevel > 2
poster = @articles.get_group_poster(subj)
# explicitly mark as read # explicitly mark as read
if @config[group].has_key?("-MR") and subj =~ /#{@config[group]["-MR"]}/ if @config[group].has_key?("-MR") and subj =~ /#{@config[group]["-MR"]}/
print "Marking '#{subj}' as read\n" print "Marking '#{subj}' as read\n"
_mark_read(subj) _mark_read(subj)
# get the juicy bits # 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 elsif !(@config[group].has_key?("-X") and subj =~ /#{@config[group]["-X"]}/) and
subj =~ /#{@config[group]["-I"]}/ subj =~ /#{@config[group]["-I"]}/
print "Match: #{subj}\n" if Debuglevel > 0 print "Match: #{subj}\n" if Debuglevel > 0
_get_article(subj, group) _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 else
_mark_remaining(subj, group) _mark_remaining(subj, group)
end end