def warm_cache(self):
"""
Collects all dialog in your manifest and stores them in the cache
directory as well as creating entries in the cache manifest.
"""
rospy.loginfo('Warming speech cache...')
m = rospy.get_param('/needybot/speech/dialog')
for k, v in m.iteritems():
goal = SpeechGoal(key=k)
gen = self.generate_cache_payload(goal)
payload = self.fetch_from_cache(k, gen.get('hash'))
if payload is None:
payload = gen
if self.validate_payload(payload):
self.add_to_cache(payload)
self.generate_raw_speech(payload)
else:
raise TypeError('Invalid payload send to speech server')
rospy.loginfo('Speech cache is ready.')
self.warmed_pub.publish()
评论列表
文章目录