forked from Charcoal-SE/SmokeDetector
/
globalvars.py
190 lines (176 loc) · 9.57 KB
/
globalvars.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
# -*- coding: utf-8 -*-
import os
from datetime import datetime
from ChatExchange.chatexchange.client import Client
import HTMLParser
import md5
import ConfigParser
class GlobalVars:
false_positives = []
whitelisted_users = []
blacklisted_users = []
ignored_posts = []
auto_ignored_posts = []
startup_utc = datetime.utcnow().strftime("%H:%M:%S")
latest_questions = []
blockedTime = 0
charcoal_room_id = "11540"
meta_tavern_room_id = "89"
socvr_room_id = "41570"
site_filename = {"electronics.stackexchange.com": "ElectronicsGood.txt",
"gaming.stackexchange.com": "GamingGood.txt", "german.stackexchange.com": "GermanGood.txt",
"italian.stackexchange.com": "ItalianGood.txt", "math.stackexchange.com": "MathematicsGood.txt",
"spanish.stackexchange.com": "SpanishGood.txt", "stats.stackexchange.com": "StatsGood.txt"}
experimental_reasons = ["Code block"] # Don't widely report these
parser = HTMLParser.HTMLParser()
wrap = Client("stackexchange.com")
wrapm = Client("meta.stackexchange.com")
wrapso = Client("stackoverflow.com")
privileged_users = {charcoal_room_id: ["117490", # Normal Human
"66258", # Andy
"31768", # ManishEarth
"103081", # hichris123
"73046", # Undo
"88521", # ProgramFOX
"59776", # Doorknob
"31465", # Seth
"88577", # Santa Claus
"34124", # Andrew Leach
"54229", # apnorton
"20459", # S.L. Barth
"32436", # tchrist
"30477", # Brock Adams
"145208"], # Robert Longson
meta_tavern_room_id: ["259867", # Normal Human
"244519", # Roombatron5000
"244382", # TGMCians
"194047", # Jan Dvorak
"158100", # rene
"178438", # Manishearth
"237685", # hichris123
"215468", # Undo
"229438", # ProgramFOX
"180276", # Doorknob
"161974", # Lynn Crumbling
"186281", # Andy
"266094", # Unihedro
"245167", # Infinite Recursion
"230261", # Jason C
"213575", # Braiam
"241919", # Andrew T.
"203389", # backwards-Seth
"202832", # Mooseman
"160017", # bwDraco
"201151", # bummi
"188558", # Frank
"229166", # Santa Claus
"159034", # Kevin Brown
"203972", # PeterJ
"188673", # Alexis King
"258672", # AstroCB
"227577", # Sam
"255735", # cybermonkey
"279182", # Ixrec
"271104", # James
"220428", # Qantas 94 Heavy
"153355", # tchrist
"238426", # Ed Cottrell
"166899", # Second Rikudo
"287999", # ASCIIThenANSI
"208518", # JNat
"284141", # michaelpri
"260312", # vaultah
"244062", # SouravGhosh
"152859", # Shadow Wizard
"201314", # apnorton
"280934", # M.A.Ramezani
"200235", # durron597
"148310", # Awesome Poodles / Brock Adams
"168333", # S.L. Barth
"257207", # United States of America aka Unicorns are Very Very Yummy
"244282", # DroidDev
"163250", # Cupcake
"298265", # BoomsPlus
"253560", # josilber
"244254", # misterManSam
"188189", # Robert Longson
"174699", # Ilmari Karonen
"202362"], # chmod 666 telkitty
socvr_room_id: [
"1849664", # Undo
"2581872", # hichris123
"1198729", # Manishearth
"3717023", # Normal Human aka 1999
"2619912", # ProgramFOX
"578411", # rene
"1043380", # gunr2171
"2246344", # Sam
"2756409", # TylerH
"1768232", # durron597
"359284", # Kevin Brown
"258400", # easwee
"3622940", # Unihedron
"3204551", # Deduplicator
"4342498", # NathanOliver
"4639281", # Tiny Giant
"3093387", # josilber
"1652962", # cimmanon
"1677912", # Mogsdad
"656243", # Lynn Crumbling
"3933332", # Rizier123
"2422013", # cybermonkey
"3478852", # Nisse Engström
"2302862", # Siguza
"1324", # Paul Roub
"1743880", # Tunaki
"1663001", # DavidG
"2415822", # JAL
"4174897", # Kyll
"5299236", # Kevin Guan
"4050842", # Thaillie
"1816093", # Drew
"874188", # Triplee
"880772", # approxiblue
"1835379", # Cerbrus
"1843331"] # Tim Castelijns
}
smokeDetector_user_id = {charcoal_room_id: "120914", meta_tavern_room_id: "266345",
socvr_room_id: "3735529"}
censored_committer_names = {"3f4ed0f38df010ce300dba362fa63a62": "Undo1"}
commit = os.popen('git log --pretty=format:"%h" -n 1').read()
commit_author = os.popen('git log --pretty=format:"%cn" -n 1').read()
if md5.new(commit_author).hexdigest() in censored_committer_names:
commit_author = censored_committer_names[md5.new(commit_author).hexdigest()]
commit_with_author = os.popen('git log --pretty=format:"%h (' + commit_author + ': *%s*)" -n 1').read()
on_master = os.popen("git rev-parse --abbrev-ref HEAD").read().strip() == "master"
charcoal_hq = None
tavern_on_the_meta = None
socvr = None
s = ""
s_reverted = ""
specialrooms = []
bayesian_testroom = None
apiquota = -1
bodyfetcher = None
se_sites = []
tavern_users_chatting = []
frequent_sentences = []
why_data = []
notifications = []
config = ConfigParser.RawConfigParser()
config.read('config')
latest_smokedetector_messages = {meta_tavern_room_id: [], charcoal_room_id: [],
socvr_room_id: []}
location = config.get("Config", "location")
print location
try:
metasmoke_host = config.get("Config", "metasmoke_host")
print metasmoke_host
except ConfigParser.NoOptionError:
metasmoke_host = None
print "metasmoke host not found. Set it as metasmoke_host in the config file. See https://github.com/Charcoal-SE/metasmoke."
try:
metasmoke_key = config.get("Config", "metasmoke_key")
except ConfigParser.NoOptionError:
metasmoke_key = ""
print "No metasmoke key found, which is okay if both are running on the same host"