Advertisement
Guest User

HotChicken

a guest
Mar 29th, 2022
10,881
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.52 KB | None | 0 0
  1. import json
  2. import sqlite3
  3. import os
  4.  
  5. DB_PATH = "C:/ProgramData/Cold Turkey/data-app.db" #change this to your install directory
  6.  
  7. def activate():
  8. try:
  9. conn = sqlite3.connect(DB_PATH)
  10. c = conn.cursor()
  11. s = c.execute("SELECT value FROM settings WHERE key = 'settings'").fetchone()[0]
  12. dat = json.loads(s)
  13. if dat["additional"]["proStatus"] != "pro":
  14. print("Your version of Cold Turkey Blocker is not activated.")
  15. dat["additional"]["proStatus"] = "pro"
  16. print("But now it is activated.\nPlease close Cold Turkey Blocker and run it again.")
  17. c.execute("""UPDATE settings SET value = ? WHERE "key" = 'settings'""", (json.dumps(dat),))
  18. conn.commit()
  19. else:
  20. print("Looks like your copy of Cold Turkey Blocker is already activated.")
  21. print("Deactivating it now.")
  22. dat["additional"]["proStatus"] = free
  23. c.execute("UPDATE settings set value = WHERE key = 'settings'", (json.dumps(dat),))
  24. conn.commit()
  25. except sqlite3.Error as e:
  26. print("Failed to activate", e)
  27. finally:
  28. if conn:
  29. conn.close()
  30.  
  31. def main():
  32. if os.path.exists(DB_PATH):
  33. print("Data file found.\nLet's activate your copy of Cold Turkey Blocker.")
  34. activate()
  35. else:
  36. print("Looks like Cold Turkey Blocker is not installed.\n If it is installed then run it at least once.")
  37.  
  38. if __name__ == '__main__':
  39. main()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement