-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1
(For those of you just tuning in, lds.org official ward websites now support picture directories, but they're ugly and paper-wasting to print. So I wrote a scraper that .tex formats them for printing. Then I got a little crazy.) http://www.lunkwill.org/tmp/warddir.tgz Ahem, today was a hack day. I present, for your pleasure, WardDir 2.0, which features: * Even more cruft than the first version * WWW::Mechanize automatic lds.org login * A CGI wrapper that takes a login and password and spits out a .pdf and .tex * A CGI wrapper that takes a login and password and spits out a .pdf and .tex * A CGI wrapper that takes a login and password and spits out a .pdf and .tex Did you catch that last feature? That means that anybody in the church crazy enough to trust me with their login/pw can get a picture directory. I'm kind of proud of that one. If you are such a crazy person, and don't mind submitting your password to a known hax0r via an unsecured link, and you have an lds.org ward website with pictures, etc., you can even try it (after which you should probably change your password): http://erg.no-ip.org:1337/cgi-bin/dirwrap.cgi It even works with Lynx. The WWW::Mechanize perl library, incidentally, is teh l33t. Like, it 0wns 4ll my b4se. Here's all it takes to login to lds.org: =================================================================== #!/usr/bin/perl use WWW::Mechanize 'autocheck => 1'; my $mech = WWW::Mechanize->new(autocheck => 1); # Go to login screen $mech->get('https://secure.lds.org/units'); # Fill in the form you find there $mech->submit_form( fields => { username => brigham, password => aybabtjh } ); # Follow the link with text "Membership Directory" $mech->follow_link(text_regex => qr/Membership Directory/); # Grab the relative URL from the silly javascript ($photo_link) = ($mech->content() =~ /javascript:confirm_photo\('(.*?)'/); # Mech r0x0rs! Handles the relative URL just fine! $mech->get($photo_link); $html = $mech->content(); if($html !~ /Membership Directory/s) { debug("Couldn't load membership directory. Password wrong?"); exit 1; } print $mech->content(); ==================================================================== Anyway, here's the readme for WardDir 2.0: WardDir 2.0 Jason E. Holt <[EMAIL PROTECTED]> Copyleft 2004 This whole mess is licensed under the GNU GPL 2.0. See the file COPYING included in the archive for details. This is an extremely quick and ugly hack which scrapes the picture directory from lds.org and converts it into a .tex file which makes for much nicer printing. Obviously, the first requirement is that you have an account at lds.org and a ward that maintains a website, presumably one with pictures. If anybody uses it, I might even improve it over time, so you had better email me if you do. Jason Holt <[EMAIL PROTECTED]> Requires: Perl The Image::Magick perl module (debian users: apt-get install perlmagick) ImageMagick's "convert" utility LaTeX Probably some assorted TeX utilities for converting .tex to .pdf A .pdf viewer: xpdf or Acrobat Perl modules WWW::Mechanize and CGI if you want to use the CGI wrapper To use standalone: Uncompress into a directory Load lds.org in Mozilla, and go to your ward web site Select "picture directory", then Save as... Web page (complete) Save it as picdir.html in the directory you uncompressed into (Mozilla will create a picdir_files/ with all the images and change all the links in the .html. Neat, eh?) Convert all the .jpg pics to .ps. Takes a long time (and a lot of disk space): Run cd picdir_files ; ../jpg2ps.pl Generate the .tex: Run ./dir.pl picdir.html Hopefully it'll generate a file called warddir.tex Run latex warddir.tex Run dvipdf warddir.dvi Run xpdf warddir.pdf To use the CGI wrapper(!): Unpack the tarball somewhere. Create a subdirectory "sessions/" Fix the #!/usr/bin/perl if that's not where you keep perl Put dirwrap.cgi in your CGI directory Fix the paths in dirwrap.cgi to point at the directory you unpacked in. Make sure that sessions/ and the temporary web directory where the finished products should go are writeable by the web server! Point your browser at dirwrap.cgi, fill in the username and password, and away you go. -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.2.3 (GNU/Linux) iD8DBQFAx/MOnwLgjivV2NERAr9eAKDXWmbgKt7FZfk9PTMETnDy2e1yeACgh6Pr YxrCrLyxm854/e419+roT7M= =fcfO -----END PGP SIGNATURE----- ____________________ BYU Unix Users Group http://uug.byu.edu/ ___________________________________________________________________ List Info: http://uug.byu.edu/cgi-bin/mailman/listinfo/uug-list
