From 65c3a135047e31618130900ceefa1257c1cb3e23 Mon Sep 17 00:00:00 2001 From: Chris Oliver Date: Sat, 11 Dec 2010 16:33:47 -0600 Subject: Fixed uploading a bit --- logbot.py | 21 ++++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) (limited to 'logbot.py') diff --git a/logbot.py b/logbot.py index 424f91b..020cec5 100644 --- a/logbot.py +++ b/logbot.py @@ -51,14 +51,16 @@ DEBUG = False SERVER = "irc.freenode.net" PORT = 6667 SERVER_PASS = None -CHANNELS=["#keryx"] +CHANNELS=["#excid3"] NICK = "timber" NICK_PASS = "" -FTP_SERVER = "" -FTP_USER = "" -FTP_PASS = "" -FTP_FOLDER = "" +FTP_SERVER = "excid3.fivebean.net" +FTP_USER = "excidfiv" +FTP_PASS = "./:j7JW}y*;.a4'8/|kBA.tUC" +FTP_FOLDER = "public_html/excid3.com/logs" +FTP_WAIT = 25 +# Only upload every 25 messages default_format = { "action" : '* %user% %message%', @@ -189,13 +191,16 @@ class Logbot(SingleServerIRCBot): if self.ftp and self.count > 25: self.count = 0 - + print "Uploading to FTP..." for root, dirs, files in os.walk("logs"): #TODO: Create folders for fname in files: full_fname = os.path.join(root, fname) - self.ftp.storbinary("STOR %s" % fname, open(full_fname, "rb")) + + remote_fname = "/".join(full_fname.split("/")[1:]) + self.ftp.storbinary("STOR %s" % remote_fname, open(full_fname, "rb")) + print "Finished uploading" def append_log_msg(self, channel, msg): print "%s >>> %s" % (channel, msg) @@ -288,6 +293,7 @@ class Logbot(SingleServerIRCBot): self.write_event("pubnotice", e) def on_privmsg(self, c, e): + print nm_to_n(e.source()), e.arguments() c.privmsg(nm_to_n(e.source()), self.format["help"]) def on_quit(self, c, e): @@ -308,6 +314,7 @@ def main(): try: # Connect to FTP if FTP_SERVER: + print "Using FTP %s..." % (FTP_SERVER) f = FTP(FTP_SERVER, FTP_USER, FTP_PASS) f.cwd(FTP_FOLDER) bot.set_ftp(f) -- cgit v1.2.3-54-g00ecf