Features/mouth stocks (#261)

* added mouth stock display

* changed sleep length

* pep8
pull/270/head
isaacnward 2016-07-07 13:25:19 -05:00 committed by Ethan Ward
parent 8ce18f630b
commit c021bcbbb0
1 changed files with 9 additions and 0 deletions

View File

@ -16,6 +16,7 @@
# along with Mycroft Core. If not, see <http://www.gnu.org/licenses/>.
from os.path import dirname, join
import time
import requests
import xml.etree.ElementTree as ET
@ -46,7 +47,15 @@ class StockSkill(MycroftSkill):
company = message.metadata.get("Company")
try:
response = self.find_and_query(company)
self.emitter.once("recognizer_loop:audio_output_start",
self.enclosure.mouth_text(
response['symbol']+": " + response['price']))
self.enclosure.activate_mouth_listeners(False)
self.speak_dialog("stock.price", data=response)
time.sleep(12)
self.enclosure.activate_mouth_listeners(True)
self.enclosure.mouth_reset()
except:
self.speak_dialog("not.found", data={'company': company})