Attempting threading for long-runing system processes

This commit is contained in:
James Barnsley
2018-11-02 10:20:32 +13:00
parent b83043ef4f
commit 4c100a9527
9 changed files with 172 additions and 54 deletions

19
mopidy_iris/system.py Executable file
View File

@ -0,0 +1,19 @@
import logging, pykka, subprocess, os
# import logger
logger = logging.getLogger(__name__)
class IrisSystemActor(pykka.ThreadingActor):
def __init__(self):
super(IrisSystemActor, self).__init__()
##
# Someone is telling us to do something
##
def run(self, action):
path = os.path.dirname(__file__)
return subprocess.check_output(["sudo "+path+"/system.sh "+action], shell=True)
actor_ref = IrisSystemActor.start()