|
|
|
@ -40,13 +40,6 @@ class MycroftOS(MycroftSkill):
|
|
|
|
|
self.snapclient_enabled = self.settings.get('snapclient')
|
|
|
|
|
self.snapserver_enabled = self.settings.get('snapserver')
|
|
|
|
|
self.mpd_enabled = self.settings.get('mpd')
|
|
|
|
|
self.airplay_started = False
|
|
|
|
|
self.sshd_started = False
|
|
|
|
|
self.spotify_started = False
|
|
|
|
|
self.btspeaker_started = False
|
|
|
|
|
self.snapclient_started = False
|
|
|
|
|
self.snapserver_started = False
|
|
|
|
|
self.mpd_started = False
|
|
|
|
|
|
|
|
|
|
def initialize(self):
|
|
|
|
|
""" Perform initalization.
|
|
|
|
@ -344,162 +337,6 @@ class MycroftOS(MycroftSkill):
|
|
|
|
|
self.mpd_started = False
|
|
|
|
|
self.speak_dialog('DisabledMPD')
|
|
|
|
|
|
|
|
|
|
def start_ssh(self):
|
|
|
|
|
os.system('sudo systemctl start sshd.service')
|
|
|
|
|
self.speak_dialog('StartedSSH')
|
|
|
|
|
|
|
|
|
|
def stop_ssh(self):
|
|
|
|
|
os.system('sudo systemctl stop sshd.service')
|
|
|
|
|
self.speak_dialog('StoppedSSH')
|
|
|
|
|
|
|
|
|
|
def start_airplay(self):
|
|
|
|
|
os.system('sudo systemctl start shairport-sync.service')
|
|
|
|
|
self.speak_dialog('StartedAirplay')
|
|
|
|
|
|
|
|
|
|
def stop_airplay(self):
|
|
|
|
|
os.system('sudo systemctl stop shairport-sync.service')
|
|
|
|
|
self.speak_dialog('StoppedAirplay')
|
|
|
|
|
|
|
|
|
|
def start_spotify(self):
|
|
|
|
|
os.system('sudo systemctl start spotifyd.service')
|
|
|
|
|
self.speak_dialog('StartedSpotify')
|
|
|
|
|
|
|
|
|
|
def stop_spotify(self):
|
|
|
|
|
os.system('sudo systemctl stop spotifyd.service')
|
|
|
|
|
self.speak_dialog('StoppedSpotify')
|
|
|
|
|
|
|
|
|
|
def start_btspeaker(self):
|
|
|
|
|
os.system('sudo systemctl start btspeaker.service')
|
|
|
|
|
self.speak_dialog('StartedBTspeaker')
|
|
|
|
|
|
|
|
|
|
def stop_btspeaker(self):
|
|
|
|
|
os.system('sudo systemctl stop btspeaker.service')
|
|
|
|
|
self.speak_dialog('StoppedBTspeaker')
|
|
|
|
|
|
|
|
|
|
def start_snapclient(self):
|
|
|
|
|
os.system('sudo systemctl start snapclient.service')
|
|
|
|
|
self.speak_dialog('StartedSnapclient')
|
|
|
|
|
|
|
|
|
|
def stop_snapclient(self):
|
|
|
|
|
os.system('sudo systemctl stop snapclient.service')
|
|
|
|
|
self.speak_dialog('StoppedSnapclient')
|
|
|
|
|
|
|
|
|
|
def start_snapserver(self):
|
|
|
|
|
os.system('sudo systemctl start snapserver.service')
|
|
|
|
|
self.speak_dialog('StartedSnapserver')
|
|
|
|
|
|
|
|
|
|
def stop_snapserver(self):
|
|
|
|
|
os.system('sudo systemctl stop snapserver.service')
|
|
|
|
|
self.speak_dialog('StoppedSnapserver')
|
|
|
|
|
|
|
|
|
|
def start_mpd(self):
|
|
|
|
|
os.system('sudo systemctl start mpd.service')
|
|
|
|
|
self.speak_dialog('StartedMPD')
|
|
|
|
|
|
|
|
|
|
def stop_mpd(self):
|
|
|
|
|
os.system('sudo systemctl stop mpd.service')
|
|
|
|
|
self.speak_dialog('StoppedMPD')
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# Intent handlers
|
|
|
|
|
@intent_file_handler('StartSSH.intent')
|
|
|
|
|
def on_start_ssh(self, message):
|
|
|
|
|
if self.sshd_started is False:
|
|
|
|
|
self.start_ssh()
|
|
|
|
|
else:
|
|
|
|
|
self.speak_dialog('AlreadyStartedSSH')
|
|
|
|
|
|
|
|
|
|
@intent_file_handler('StopSSH.intent')
|
|
|
|
|
def on_stop_ssh(self, message):
|
|
|
|
|
if self.sshd_started is True:
|
|
|
|
|
self.stop_ssh()
|
|
|
|
|
else:
|
|
|
|
|
self.speak_dialog('AlreadyStoppedSSH')
|
|
|
|
|
|
|
|
|
|
@intent_file_handler('StartAirPlay.intent')
|
|
|
|
|
def on_start_airplay(self, message):
|
|
|
|
|
if self.airplay_started is False:
|
|
|
|
|
self.start_airplay()
|
|
|
|
|
else:
|
|
|
|
|
self.speak_dialog('AlreadyStartedAirPlay')
|
|
|
|
|
|
|
|
|
|
@intent_file_handler('StopAirPlay.intent')
|
|
|
|
|
def on_stop_airplay(self, message):
|
|
|
|
|
if self.airplay_started is True:
|
|
|
|
|
self.stop_airplay()
|
|
|
|
|
else:
|
|
|
|
|
self.speak_dialog('AlreadyStoppedAirPlay')
|
|
|
|
|
|
|
|
|
|
@intent_file_handler('StartSpotify.intent')
|
|
|
|
|
def on_start_spotify(self, message):
|
|
|
|
|
if self.spotify_started is False:
|
|
|
|
|
self.start_spotify()
|
|
|
|
|
else:
|
|
|
|
|
self.speak_dialog('AlreadyStartedSpotify')
|
|
|
|
|
|
|
|
|
|
@intent_file_handler('StopSpotify.intent')
|
|
|
|
|
def on_stop_spotify(self, message):
|
|
|
|
|
if self.spotify_started is True:
|
|
|
|
|
self.stop_spotify()
|
|
|
|
|
else:
|
|
|
|
|
self.speak_dialog('AlreadyStoppedSpotify')
|
|
|
|
|
|
|
|
|
|
@intent_file_handler('StartBTspeaker.intent')
|
|
|
|
|
def on_start_btspeaker(self, message):
|
|
|
|
|
if self.btspeaker_started is False:
|
|
|
|
|
self.start_btspeaker()
|
|
|
|
|
else:
|
|
|
|
|
self.speak_dialog('AlreadyStartedBTspeaker')
|
|
|
|
|
|
|
|
|
|
@intent_file_handler('StopBTspeaker.intent')
|
|
|
|
|
def on_stop_btspeaker(self, message):
|
|
|
|
|
if self.btspeaker_started is True:
|
|
|
|
|
self.stop_btspeaker()
|
|
|
|
|
else:
|
|
|
|
|
self.speak_dialog('AlreadyStoppedBTspeaker')
|
|
|
|
|
|
|
|
|
|
@intent_file_handler('StartSnapclient.intent')
|
|
|
|
|
def on_start_snapclient(self, message):
|
|
|
|
|
if self.snapclient_started is False:
|
|
|
|
|
self.start_snapclient()
|
|
|
|
|
else:
|
|
|
|
|
self.speak_dialog('AlreadyStartedSnapclient')
|
|
|
|
|
|
|
|
|
|
@intent_file_handler('StopSnapclient.intent')
|
|
|
|
|
def on_stop_snapclient(self, message):
|
|
|
|
|
if self.snapclient_started is True:
|
|
|
|
|
self.stop_snapclient()
|
|
|
|
|
else:
|
|
|
|
|
self.speak_dialog('AlreadyStoppedSnapclient')
|
|
|
|
|
|
|
|
|
|
@intent_file_handler('StartSnapserver.intent')
|
|
|
|
|
def on_start_snapserver(self, message):
|
|
|
|
|
if self.snapserver_started is False:
|
|
|
|
|
self.start_snapserver()
|
|
|
|
|
else:
|
|
|
|
|
self.speak_dialog('AlreadyStartedSnapserver')
|
|
|
|
|
|
|
|
|
|
@intent_file_handler('StopSnapserver.intent')
|
|
|
|
|
def on_stop_snapserver(self, message):
|
|
|
|
|
if self.snapserver_started is True:
|
|
|
|
|
self.stop_snapserver()
|
|
|
|
|
else:
|
|
|
|
|
self.speak_dialog('AlreadyStoppedSnapserver')
|
|
|
|
|
|
|
|
|
|
@intent_file_handler('StartMPD.intent')
|
|
|
|
|
def on_start_mpd(self, message):
|
|
|
|
|
if self.mpd_started is False:
|
|
|
|
|
self.start_mpd()
|
|
|
|
|
else:
|
|
|
|
|
self.speak_dialog('AlreadyStartedMPD')
|
|
|
|
|
|
|
|
|
|
@intent_file_handler('StopMPD.intent')
|
|
|
|
|
def on_stop_mpd(self, message):
|
|
|
|
|
if self.mpd_started is True:
|
|
|
|
|
self.stop_mpd()
|
|
|
|
|
else:
|
|
|
|
|
self.speak_dialog('AlreadyStoppedMPD')
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def create_skill():
|
|
|
|
|
return MycroftOS()
|