Commits

Rune Halvorsen committed 686903c

Use command line args for user, pass, title and keywords

Comments (0)

Files changed (2)

geist/__init__.py

 @route('/')
 @view('index')
 def index():
-    return {}
+    return {"title": title}
+
 
 
 @route('/settings')
 def index():
     return {}
 
-
 @route('/tweets')
 def tweets():
     tweets = stream.get_tweets()
     return static_file(filename, root=join(appdir, "static"))
 
 
-
-
-
 def parse_options():
     parser = optparse.OptionParser()
     parser.add_option("-u", "--user", dest="user")
                       default=8080, type="int")
     parser.add_option("-c", "--css", dest="stylesheet")
     parser.add_option("-j", "--js", dest="javascript")
+    parser.add_option("-t", "--title", dest="title", default="")
 
     options, args = parser.parse_args()
 
         if not options.password:
             parser.error("Password required")
 
-    parser.error("Bad User")
+    if not args:
+        parser.error("No keywords given")
 
+    args = (" ").join(args).split(",")
+    return args, options
 
 update_interval = 5
 stream = None
+title = ""
+
 def main():
-    #words, options = parse_options()
+    words, options = parse_options()
+    print "Will track terms:", words
 
-
-
-    words = ["opera dragonfly"]
-    words = ["opera"]
-    words = ["love","hate"]
-
-    global stream
-    stream = TrackStreamThread("xxx", "yyy", words)
+    global stream, title
+    title = options.title
+    stream = TrackStreamThread(options.user, options.password, words)
     stream.start()
     debug(True)
 

geist/templates/index.tpl

 <script src="/config"></script>
 <script src="/static/script.js"></script>
 <script src="/static/unbose.js"></script>
-<h1>Tweets</h1>
+% if title:
+<h1>{{ title }}</h1>
+% end
 <ol id="tweets"></ol>