Interesting filename filtering tip
"gerardlanois" <[email protected]> Sun, 05 Sep 2004 18:47:55 -0000
| Newsgroups | gmane.network.ubh |
|---|---|
| Message-ID | <[email protected]> |
I was playing with ubh over the weekend and noticed some
unnecessary downloading going on. It took some thinking,
but I came up with a good workaround.
Here's the problem:
People are posting files with filenames formatted like this -
xxxxxxxxxxxx.bbb.zzz
If you have 'bbb' in your MULTI/SINGLE_EXT, what will happen
is that ubh will download such articles, but reject them after
decoding when it notices the decoded file has an unwanted
extension ('.zzz).
To me it seemed unnecessary to download this article in the first
place. What is happening is ubh is searching for extensions,
and if it thinks it sees one, it goes ahead and downloads
the article.
Here's the solution:
Initially I wanted to modify the code to fix this, but I came
up with a better general-purpose solution: use a negative
lookahead assertion to filter out .bbb.zzz files.
Up until now, your ubhrc probably looks something like this:
SINGLE_EXT = (?i)aaa|bbb|ccc
MULTI_EXT = (?i)aaa|bbb|ccc
What you want to do is tell Perl to filter out .bbb files
which are followed by some other extension - beginning with
a '.'.
SINGLE_EXT = (?i)aaa|bbb(?!\.)|ccc
MULTI_EXT = (?i)aaa|bbb(?!\.)|ccc
This will cause ubh to skip downloading all .bbb.* files,
which is what I wanted it this case. But ubh will still
download all .bbb files.
This trick saves alot of time, not to mention downloading
bandwidth.
Hope this helps somebody out there.
-Gerard
------------------------ Yahoo! Groups Sponsor --------------------~-->
Make a clean sweep of pop-up ads. Yahoo! Companion Toolbar.
Now with Pop-Up Blocker. Get it for free!
http://us.click.yahoo.com/L5YrjA/eSIIAA/yQLSAA/IHFolB/TM
--------------------------------------------------------------------~->
Yahoo! Groups Links
<*> To visit your group on the web, go to:
http://groups.yahoo.com/group/ubh/
<*> To unsubscribe from this group, send an email to:
[email protected]
<*> Your use of Yahoo! Groups is subject to:
http://docs.yahoo.com/info/terms/