-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathColdTurkeyBlockerPro-Activator-Windows.py
More file actions
55 lines (41 loc) · 1.75 KB
/
ColdTurkeyBlockerPro-Activator-Windows.py
File metadata and controls
55 lines (41 loc) · 1.75 KB
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
'''
** For Windows Systems Only **.
>> TO ACTIVATE THE COLD TURKEY BLOCKER RUN THIS PYTHON FILE AS FOLLOWS:
1. Move the file to "C:/ProgramData/Cold Turkey"
2. Open Terminal, cd to the folder and run "python3 ColdTurkeyBlocker-Pro.py"
3. Close Cold Turkey, Reopen it and Enjoy! (If it Doesn't Work Restart your PC and Enjoy!!!)
'''
import json
import sqlite3
import os
DB_PATH = "C:/ProgramData/Cold Turkey/data-app.db"
def activate():
try:
conn = sqlite3.connect(DB_PATH)
c = conn.cursor()
s = c.execute("SELECT value FROM settings WHERE key = 'settings'").fetchone()[0]
dat = json.loads(s)
if dat["additional"]["proStatus"] != "pro":
dat["additional"]["proStatus"] = "pro"
print("You are now a Cold Turkey Pro user.\nPlease close Cold Turkey Blocker and run again it.")
c.execute("""UPDATE settings SET value = ? WHERE "key" = 'settings'""", (json.dumps(dat),))
conn.commit()
else:
print("Looks like your copy of Cold Turkey Blocker is already activated.")
print("Deactivating it")
dat["additional"]["proStatus"] = "free"
c.execute("""UPDATE settings set value = ? WHERE "key" = 'settings'""", (json.dumps(dat),))
conn.commit()
except sqlite3.Error as e:
print("Failed to activate", e)
finally:
if conn:
conn.close()
def main():
if os.path.exists(DB_PATH):
print("Data file found.\nLet's activate your copy of Cold Turkey Blocker.")
activate()
else:
print("Looks like Cold Turkey Blocker is not installed.\n If it is installed then run it at least once.")
if __name__ == '__main__':
main()