quotes/create_quote.py
changeset 0 d9b71931f372
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/quotes/create_quote.py	Thu May 27 13:10:09 2010 +0200
     1.3 @@ -0,0 +1,22 @@
     1.4 +#!/usr/bin/python
     1.5 +
     1.6 +import sys
     1.7 +import subprocess
     1.8 +from subprocess import PIPE
     1.9 +
    1.10 +SCRIPT_FILE = "../script.js"
    1.11 +
    1.12 +if __name__ == "__main__":
    1.13 +   if len(sys.argv) < 3:
    1.14 +      print "not enough arguments provided"
    1.15 +      print "usage: %s \"quote text\" author" % sys.argv[0]
    1.16 +   quote = sys.argv[1]
    1.17 +   author = sys.argv[2]
    1.18 +   quote_num = int(subprocess.Popen("ls quote*.html | wc -l", shell=True, stdout=PIPE).communicate()[0]) + 1
    1.19 +   file = open("quote%s.html" % str(quote_num), "w")
    1.20 +   try:
    1.21 +      file.write("<p>&quot;%s&quot; </p><p class=\"align-right\">- %s</p>" % (quote, author))
    1.22 +   finally:
    1.23 +      file.close()
    1.24 +      
    1.25 +