Updated some stuff hey

This commit is contained in:
RussellChamp committed 2017-03-30 21:39:44 +00:00
1 parent 57485f6ffd
commit d9eac44b35
24 files changed
+292 -57

No files matched your search

+5 -3
View File
@@ -8,15 +8,17 @@ import shutil
logfile = "/home/jumblesale/Code/irc/log"
outfile = "/home/krowbar/logs/chatcloud.json"
#outfile = "/home/krowbar/logs/chatcloud_2016_01.json"
#outfile = "/home/krowbar/logs/chatcloud_2016_10.json"
bannedUsersFile = "/home/krowbar/Code/python/bannedUsers"
bannedWordsFile = "/home/krowbar/Code/python/bannedWords"
wordData = {} # keyed by "word" that contains a count
#we only care about recent chats, let's say for the past sixteen hours
timeTo = calendar.timegm(time.gmtime())
#timeTo = calendar.timegm(time.strptime("1 Feb 16", "%d %b %y"))
#timeTo = calendar.timegm(time.strptime("1 Nov 16", "%d %b %y"))
timeCutoff = timeTo - (16 * 60 * 60)
#timeCutoff = calendar.timegm(time.strptime("1 Jan 16", "%d %b %y"))
#timeCutoff = calendar.timegm(time.strptime("1 Oct 16", "%d %b %y"))
print "Generating word cloud based off words from " + str(timeCutoff) + " to " + str(timeTo)
minOccurance = 3 #we'll have to reduce the minOccurances if we reduce the timeCutoff
minLength = 3 #number of letters long
+12
View File
@@ -4,10 +4,15 @@ import json
import time
import calendar
import shutil
import re
logfile = "/home/jumblesale/Code/irc/log"
outfile = "/home/krowbar/logs/chatStats.json"
userData = {} #hash keyed by "user" that contains a start timestamp, last timestamp, last said string, chat count, letter count, and word count
#also now happy emotes and sad emotes
rejectRegexp = "http[s]?://|[0-9]{2}[;:][0-9]{2}"
happyRegexp = ":[-]?[])}]"
sadRegexp = ":[-]?[[({]"
nameFix = {
'jumblesal': 'jumblesale',
'hardmath1': 'kc',
@@ -68,10 +73,17 @@ with open(logfile, "r") as log:
userData[user]['lastMention'] = 0
userData[user]['responseTime'] = 0
userData[user]['botUse'] = 0
userData[user]['happyEmotes'] = 0
userData[user]['sadEmotes'] = 0
lastUser = user;
if message.rstrip() and message[0] == '!':
userData[user]['botUse'] += 1
if not re.search(rejectRegexp, message):
if re.search(happyRegexp, message):
userData[user]['happyEmotes'] += 1
if re.search(sadRegexp, message):
userData[user]['sadEmotes'] += 1
try:
if message.rstrip() and message.split()[0][-1] == ':': #last character of first word