2021-11-20 14:40:07 +00:00
|
|
|
#!/usr/bin/env python3
|
|
|
|
|
|
|
|
from classes.config import MonsterConfig
|
|
|
|
from classes.vesselthread import VesselThread
|
2021-11-22 10:14:38 +00:00
|
|
|
from classes.shorethread import ShoreThread
|
2021-11-20 14:40:07 +00:00
|
|
|
|
|
|
|
from multiprocessing import Manager
|
|
|
|
|
|
|
|
import pathlib
|
2021-11-22 10:14:38 +00:00
|
|
|
import time
|
2021-11-20 14:40:07 +00:00
|
|
|
|
2021-11-22 10:14:38 +00:00
|
|
|
if __name__ == '__main__':
|
|
|
|
config_path = pathlib.Path(__file__).parent.absolute() / "settings.ini"
|
|
|
|
config = MonsterConfig.fromFile(config_path)
|
2021-11-20 14:40:07 +00:00
|
|
|
|
2021-11-22 10:14:38 +00:00
|
|
|
with Manager() as manager:
|
|
|
|
files = manager.list()
|
2021-11-20 14:40:07 +00:00
|
|
|
|
2021-11-22 10:14:38 +00:00
|
|
|
threads = []
|
|
|
|
|
|
|
|
for vessel in config.vessels:
|
|
|
|
thread = VesselThread(vessel, files)
|
|
|
|
thread.start()
|
|
|
|
threads.append(thread)
|
|
|
|
|
|
|
|
try:
|
|
|
|
shore = ShoreThread(files)
|
|
|
|
shore.run()
|
|
|
|
except KeyboardInterrupt:
|
|
|
|
print("Keyboard interrupt received - stopping threads")
|
|
|
|
for thread in threads:
|
|
|
|
thread.kill()
|
|
|
|
exit()
|