Send patches - preferably formatted by git format-patch - to patches at archlinux32 dot org.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChris Oliver <excid3@gmail.com>2010-02-13 19:34:34 -0600
committerChris Oliver <excid3@gmail.com>2010-02-13 19:34:34 -0600
commitb54095add17bee85b32f97266d1e1123a088911a (patch)
treec2bc74af30d974f837412556b376104ebf869ce6
parent0ab04a77e7edb63bd87889a4361549ef554a96d6 (diff)
Added readme and index.html generation
-rw-r--r--README9
-rw-r--r--logbot.py11
2 files changed, 15 insertions, 5 deletions
diff --git a/README b/README
new file mode 100644
index 0000000..604ba7f
--- /dev/null
+++ b/README
@@ -0,0 +1,9 @@
+LogBot 0.3.0
+------------
+
+Author: Chris Oliver <chris@excid3.com>
+
+
+Usage
+-----
+python logbot.py -c conf/example.conf \ No newline at end of file
diff --git a/logbot.py b/logbot.py
index c75c846..459ddcb 100644
--- a/logbot.py
+++ b/logbot.py
@@ -154,10 +154,10 @@ class LogBot(SingleServerIRCBot):
print "%s %s" % (time, message)
channels = self.chans
+ index = os.path.join(self.folder, "index.html")
if not os.path.exists(self.folder):
# Create the log folder if we need to
os.mkdir(self.folder)
- index = os.path.join(self.folder, "index.html")
create_html_file(index, "Logged Channels")
append_to_index(index, index_header % "Logged Channels")
shutil.copy2(self.stylesheet, self.folder)
@@ -186,7 +186,7 @@ class LogBot(SingleServerIRCBot):
str = "<a href=\"#%s\" name=\"%s\" class=\"time\">[%s]</a> %s" % \
(time, time, time, message)
- append_to_index(path, str)
+ append_to_index(path, str, True)
def create_html_file(path, title):
@@ -195,9 +195,10 @@ def create_html_file(path, title):
f.close()
-def append_to_index(path, line):
- data = open(path, "rb").readlines()[:-2]
- data.append(line + "<br />\n")
+def append_to_index(path, line, br=False, back=-2):
+ data = open(path, "rb").readlines()[:back]
+ if br: data += [line + "<br />\n"]
+ else: data += [line + "\n"]
data += [" </body>\n", "</html>\n"]
f = open(path, "wb")