-
Notifications
You must be signed in to change notification settings - Fork 156
Creating A Plugin
Creating plugins in Palaver is rather easy. First go into your Palaver directory.
In my case:
bmandesigns@desktop:~$ cd Palaver
You can now run the sdk command. For this tutorial I will create a plugin to display the date
bmandesigns@desktop:~/Palaver$ ./sdk -c dateDisplay
Creating new plugin
Created plugin in /home/bmandesigns/Plugins_SDK/dateDisplay/
A new plugin was set-up in the directory displayed.
Inside the Plugins_SDK/dateDisplay/ folder is three sub folders and a plugin.info file
The three folders: bin, config, and modes will store executables, configuration files and voice commands respectively.
Inside the bin folder is a file named the same as the plugin, in my case dateDisplay.
This is the file that will be executed when your command is said.
Inside the config folder is the file “settings.conf”. More config files may be added.
This file is used to store any settings your plugin needs.
A settings.conf is not required and can be removed later.
Inside the modes folder is the file “main.dic”.
This will store all the commands your program needs.
A program can have more than one dictionary but main.dic is required.
My program will have the command “what is the date”. I have changed the contents of main.dic to:
<w,W>hat is the date
dateDisplay
When the user says “what is the date” the program will execute dateDisplay.
I have changed the contents of dateDisplay in the bin folder to the following:
#!/bin/bash
i=$(date)
echo $i >> Microphone/result
./pycmd result
This will get the date and write it to the result file that will be displayed after the program is done executing.
I can now go back into the Palaver folder and run:
./sdk -p dateDisplay
A file will appear, this is the plugin.info file. I have changed mine to the following:
#Plugin.info automatically generated
name = dateDisplay
version = 1.0 #Used for updating
file = dateDisplay
configs = #I have left this blank because my program never used settings.conf
author = Brett Mayson
description = Display the current date
actions =
what is the date, display the current date #voice command, description. Each command on it's own line
After you save the file ./sdk displays: Packaged to /home/bmandesigns/Plugins_SDK/dateDisplay/dateDisplay.sp
I can now run:
./plugins -i /home/bmandesigns/Plugins_SDK/dateDisplay/dateDisplay.sp
Confirm the installation and your plugin is now installed. If someone else wants to use your plugin you just need to send them the .sp file.