run.py 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. # GPL3 or later
  2. # This is the initialization script. It will start other scripts.
  3. # I could use threading ( since all of them are written in python ) but it
  4. # seems to be very broken using threading. So instead I will do it as separate
  5. # scripts. Thought the users shouldn't care about it very much.
  6. import time
  7. import json
  8. import subprocess
  9. from modules.ui import *
  10. from modules import setup
  11. # Modules that are required might be missing
  12. try:
  13. import simplematrixbotlib as botlib
  14. except:
  15. center("Missing module 'simplematrixbotlib'!", "bdrd")
  16. print("Please use: sudo pip install simplematrixbotlib")
  17. exit()
  18. try:
  19. import youtube_dl
  20. except:
  21. center("Missing module 'youtube_dl'!", "bdrd")
  22. print("Please use: sudo pip install --upgrade youtube_dl")
  23. exit()
  24. # Setting up the program
  25. try:
  26. with open('stuff.json') as json_file:
  27. stuff = json.load(json_file)
  28. except:
  29. setup.run()
  30. subprocess.Popen(["gnome-terminal", "--", "python3", "modules/matrix_bot.py"])
  31. subprocess.Popen(["gnome-terminal", "--", "python3", "modules/http_server.py"])
  32. time.sleep(2)
  33. interface = subprocess.Popen(["gnome-terminal","--hide-menubar","--full-screen", "--", "python3", "modules/interface.py"])