---Reply to mail from Erich Neuwirth about Auto-starting a document in the viewer

> Currently, he has the QOTD on the opening screen, and i is a JPG picture.
> What tools would be necessary to convert this into a pdb on the server?

Like this:

#!/usr/bin/python2.2

"""
qotd.py

Builds a local HTML page from www.qotd.org

Copyright (C) 2004, Christopher R. Hawks <[EMAIL PROTECTED]>

Distributable under the GNU General Public License Version 2 or newer.
"""

import sys
import os
import re
import urllib
import string

verbose = 1

quote_pattern = re.compile("<b>A randomly.*?<a href", re.MULTILINE | re.IGNORECASE | 
re.DOTALL)

site = "http://www.qotd.org";

if verbose:
    print "Fetching Page %s" %site
path = urllib.URLopener()
conn = path.open(site)
page = conn.read()
conn.close()

conn = path.open(site + "/top.gif")
image = conn.read()
conn.close()

myfile = open("top.gif", 'w')
myfile.write(image)
myfile.close()

name = quote_pattern.search(page)
quote = name.group()
quote = quote[:-7]

myfile = open("qotd.html", 'w')
myfile.write("<HTML><HEAD><TITLE>Quote of the Day</TITLE></HEAD>\n")
myfile.write("<H1>Quote of the Day.</H1>\n")
myfile.write("<IMG SRC=\"top.gif\"><BR>\n")
myfile.write(quote)
myfile.write("\n</HTML>\n")
myfile.close()

Works for me.

---End reply

Christopher R. Hawks
HAWKSoft
-------------------------------------------------------------------------
You may now return to bashing UNIX and its smug complacent users. We in
return will return to our smug complacency -- after all, we don't have any
machines to disinfect this weekend.
    -- Jim Hill





_______________________________________________
plucker-list mailing list
[EMAIL PROTECTED]
http://lists.rubberchicken.org/mailman/listinfo/plucker-list

Reply via email to