diff --git a/norme.py b/norme.py deleted file mode 100644 index 49dfb6b..0000000 --- a/norme.py +++ /dev/null @@ -1,44 +0,0 @@ -import re -import os -import subprocess - -def launch(s, sender, msgpart): - result = re.match(".*((dans|in) (la |the )?bran?ch?e?|(dans|in) (la |the )?bran?c?he?) +([^ ]+).*", msgpart) - if result is not None: - branch = "acu/" + result.group(6); - else: - branch = "master" - - result = re.match(".*(dans|in) (la |the |le fichier |le dossier )?([^b][^r][^ ]+).*", msgpart) - if result is not None and re.search("(^/|.*\.\..*)", result.group(3)) is None: - checkpath = result.group(3) - if not os.path.exists(checkpath): - if os.path.exists("./src/" + checkpath): - checkpath = "./src/" + checkpath - else: - dirList = os.listdir("./src/") - for f in dirList: - if os.path.exists("./src/" + os.path.basename(f) + "/" + checkpath): - checkpath = "./src/" + os.path.basename(f) + "/" + checkpath - break - - if not os.path.exists(checkpath): - s.send("PRIVMSG %s :I don't find %s in branch %s\r\n" % (sender[0], checkpath, branch)) - return - else: - checkpath = "./src/" - - if subprocess.call(["git", "checkout", branch]) == 0: - try: - #s.send("PRIVMSG %s :Let me check %s in %s\r\n" % (sender[0], branch, checkpath)) - faults = subprocess.check_output(["/home/nemunaire/workspace_/moulinette/main.py", checkpath]) - lines = faults.split('\n') - for l in lines: - if len(l) > 1: - #print l - #print sender - s.send("PRIVMSG %s :%s\r\n" % (sender[0], l)) - except: - s.send("PRIVMSG %s :An error occurs, all is broken\r\n" % sender[0]) - else: - s.send("PRIVMSG %s :I haven't the branch %s here.\r\n" % (sender[0], branch)) diff --git a/ontime.py b/ontime.py deleted file mode 100644 index bed04a7..0000000 --- a/ontime.py +++ /dev/null @@ -1,53 +0,0 @@ -# coding=utf-8 -from datetime import datetime -import time - -import newyear - -def sync(sec): - print "Time thread synchronization..." - - time.sleep(((60 + sec) - datetime.now().second - 1) % 60) - - while datetime.now().second % sec != 0: - time.sleep (0.1) - - time.sleep (0.4) - - print "Synchonized on {0}={1} seconds...".format(sec, datetime.now().second) - - -def startThread(s, ndate, sentences, CHANLIST): - sync (60); - while 1: - minute = datetime.now ().minute - - if minute == 0 and datetime.now ().hour == 0 and datetime.now ().day == 1 and datetime.now ().month == 1: - print("Happy new year!") - for chan in CHANLIST.split(): - newyear.special (s, chan) - - elif minute == 0 and datetime.now ().hour == 6 and datetime.now ().day == 18 and datetime.now ().month == 1: - print("WikiEnd!") - for chan in CHANLIST.split(): - newyear.special (s, chan) - - elif minute == 0 and datetime.now ().hour == 0 and datetime.now ().day == 23 and datetime.now ().month == 2: - print("Anniv Xetal!") - for chan in CHANLIST.split(): - newyear.special (s, chan) - - if minute == 18: - for chan in CHANLIST.split(): - newyear.launch (s, chan, datetime(2012, 1, 18, 6, 0, 1), sentences, 0) - - if minute == 42: - sync(42) - print("42!") -# for chan in CHANLIST.split(): -# s.send("PRIVMSG %s :42 !\r\n" % chan) - - if datetime.now ().second != 0: - sync(60) - else: - time.sleep(60)