From d1d097bf53584b86d451ccd60e817e56bf1e5f60 Mon Sep 17 00:00:00 2001 From: blueShard-dev <63594396+blueShard-dev@users.noreply.github.com> Date: Sun, 28 Jun 2020 11:16:41 +0000 Subject: [PATCH] Add files via upload --- README.md | 122 +++++++++++++++++++++++++++++++++++++++++++++++++ aion | 13 ++++++ install.sh | 130 +++++++++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 265 insertions(+) create mode 100644 README.md create mode 100644 aion create mode 100644 install.sh diff --git a/README.md b/README.md new file mode 100644 index 0000000..f668a00 --- /dev/null +++ b/README.md @@ -0,0 +1,122 @@ +**_aion_ - a python programmed digital assistant** + +- [Introduction](#introduction) +- [Installation](#installation) +- [Start](#start) +- [Tutorial](#tutorial) +- [Todo](#todo) +- [Other Projects](#other-projects) +- [License](#license) + +# Introduction + +**aion** is an python3 based digital assistant (voice assistant). It requires python 3.6 or higher and only runs on Linux / UNIX systems + +# Installation + +The installation need 1 - 2 GB free space + +To install **aion** for Linux / UNIX (only tested on Raspberry Pi 3B+ with Raspberry Pi OS), type: + +``` +$ sudo apt-get upgrade && sudo apt-get update +$ sudo apt-get install git +$ sudo git clone https://github.com/blueshard-dev/aion_project +$ cd aion_project +$ sudo ./install.sh # if this won't work, type 'sudo bash install.sh' instead +``` + +This will take a while (depending on your internet speed) and installs all required components + +After the installation is completed, reboot your system + +# Start + +To start / run aion, type: +``` +$ aion start +``` +or +``` +$ aion run +``` + +# Tutorial + +- [Voice Commands](#voice-commands) +- [Command Line Commands](#command-line-commands) + +### Voice Commands + +To start aion say the activation word (`aion` default) and then a voice command, e.g. `aion, whats the current time?`. +To change your activation word, visit https://snowboy.kitt.ai/, create a `.pmdl` file with your new activation word +and place it into `/usr/local//etc/` and change the text of the `hotword_file` key in `/etc/aion_data` to `/usr/local//etc/` + +- en_US + - cpu usage - gives the cpu usage back (after 10 test seconds) + - ip address - gives the current ip address back (won't work properly when device is offline) + - play - plays given song on youtube (may won't play the correct song) + - ram usage - gives the ram usage back (after 10 test seconds) + - tell & about - gives wikipedia article about the searched person, topic or something else back + - time - gives the current time back + +- de_DE + - erzähle & über - gibt den Wikipedia Artikel über das Gesuchte zurück + - ip-addresse - gibt die aktuelle IP Adresse zurück (wird nicht richtig funktionieren, wenn das Gerät kein Internet hat) + - prozessor auslastung - gibt die Prozessorauslastung zurück (nach 10 Sekunden Testzeit) + - spiele - spielt gegebenes Lied auf Youtube ab (wird eventuell nicht das richtige Lied abspielen) + - uhr - gibt die aktuelle Zeit zurück + - zeit - gibt die aktuelle Zeit zurück + +See `/etc/aion_data/language/.acph` for all voice commands (the xml tags are the voice commands) + +### Command Line Commands + +``` +Usage: + aion [command] + +Commands: + start starts aion + run runs aion + + install installs a skill or plugin + uninstall uninstalls a skill or plugin + remove removes a skill or plugin + update updates a skill or plugin + version version of a skill or plugin + + save saves the current aion_data directory (with a name) + load [name] loads a saved aion_data directory (add optional name to save the current aion_data directory with this name) + saves shows all saved aion_data directory + + pid shows the pid from the running aion process + kill kills aion + stop stops aion + + pack packs the given directory with a custom skill or plugin into one standalone file for installation +``` + +# Todo + +-[ ] LED support for respeaker users +-[ ] other logger +-[ ] bluetooth module to connect with phone and play music +-[ ] better commandline support +-[ ] spotify support (for the "play" voice command) +-[ ] watcher process to monitor the main process +-[ ] tutorials +-[ ] better description for the classes and functions +-[ ] ai based speech recognition engine +-[ ] ai based text-to-speech engine + +# Other Projects + +-[x] support library (see [aionlib](https://github.com/blueShard-dev/aionlib)) +-[ ] gui interface +-[ ] aion for windows +-[ ] (android) app for phones + +# License + +This project is licensed under the GNU General Public License v3.0 (GPL-3.0) - see the [LICENSE](License) file for more details diff --git a/aion b/aion new file mode 100644 index 0000000..8cd4068 --- /dev/null +++ b/aion @@ -0,0 +1,13 @@ +#!/usr/bin/python3 +# -*- coding: utf-8 -*- +import glob +import re +import sys + +sys.path.insert(1, glob.glob("/usr/local/aion-*/aion_core/shell")[0]) + +from shell import main + +if __name__ == '__main__': + sys.argv[0] = re.sub(r"(-script\.pyw?|\.exe)?$", "", sys.argv[0]) + sys.exit(main()) diff --git a/install.sh b/install.sh new file mode 100644 index 0000000..ba383b6 --- /dev/null +++ b/install.sh @@ -0,0 +1,130 @@ +#!/bin/bash + +current_directory=$PWD + +printf "\n-----copying aion shell to /usr/bin...-----\n" + +if [ ! -f /usr/bin/aion ]; then + cp aion /usr/bin/ +fi + +printf "\n-----copying aion to /usr/local...-----\n" + +cp -r aion-* /usr/local/ + +printf "\n-----copying aion_data to /etc...-----\n" + +if [ ! -d "/etc/aion_data/" ]; then + cp -r aion_data /etc/ +fi + +printf "\n-----creating directories if not existent\n" + +if [ ! -d "/etc/aion_data/saves/" ]; then + mkdir /etc/aion_data/saves/ +fi + +printf "\n-----moving install directory to /tmp...-----\n" + +mkdir /tmp/aion_install +cd /tmp/aion_install + +printf "\n-----updating the package list...-----\n" + +apt-get -y update + +printf "\n-----creating usb mountpoint...-----\n" + +mkdir /mnt/usbstick + +printf "\n-----installing and upgrading all required linux packages...-----\n" + +apt-get -y install bison build-essential espeak ffmpeg flac git libasound2-dev libatlas-base-dev libpulse-dev python python-dev python-pip python3 python3-dev python3-pip python3-pyaudio sox subversion swig vlc wget +apt-get -y upgrade + +printf "\n-----patching vlc...-----\n" + +sed -i 's/geteuid/getppid/' /usr/bin/vlc + +rm -r /usr/lib/arm-linux-gnueabihf/vlc/lua/ +svn checkout https://github.com/videolan/vlc/trunk/share/lua +mv lua/ /usr/lib/arm-linux-gnueabihf/vlc/ + +printf "\n-----setting audio volume...-----\n" + +amixer cset numid=1 70% + +printf "\n-----installing sphinxbase...-----\n" + +wget https://sourceforge.net/projects/cmusphinx/files/sphinxbase/5prealpha/sphinxbase-5prealpha.tar.gz/download -O sphinxbase.tar.gz + +tar -xzvf sphinxbase.tar.gz + +cd sphinxbase-5prealpha +./configure --enable-fixed +make +make install +cd .. + +printf "\n-----installing pocketsphinx...-----\n" + +wget https://sourceforge.net/projects/cmusphinx/files/pocketsphinx/5prealpha/pocketsphinx-5prealpha.tar.gz/download -O pocketsphinx.tar.gz + +tar -xzvf pocketsphinx.tar.gz + +cd pocketsphinx-5prealpha +./configure +make +make install +cd .. + +printf "\n-----installing snowboy...-----\n" + +git clone https://github.com/Kitt-AI/snowboy + +cd snowboy +python3 setup.py install + +cd swig/Python3 +make +cp -r snowboydetect.py _snowboydetect.so /usr/local/aion-* +cd ../.. + +cp -r resources /usr/local/aion-* + +cd examples/Python3 +cp snowboydecoder.py /usr/local/aion-* +cd ../../.. + +sed -i "s/from . import snowboydetect/import snowboydetect/g" /usr/local/aion-*/snowboydecoder.py + +printf "\n-----installing pico2wave...-----\n" + +wget http://ftp.us.debian.org/debian/pool/non-free/s/svox/libttspico0_1.0+git20130326-9_armhf.deb +wget http://ftp.us.debian.org/debian/pool/non-free/s/svox/libttspico-utils_1.0+git20130326-9_armhf.deb +apt-get -y install -f ./libttspico0_1.0+git20130326-9_armhf.deb ./libttspico-utils_1.0+git20130326-9_armhf.deb + +printf "\n-----installing & upgrading all required python3 packages...-----\n" + +yes | pip3 install --upgrade colorama pafy pocketsphinx psutil pyaudio pyudev SpeechRecognition Wikipedia-API youtube_dl + +printf "\n-----changing permission-----\n" + +chmod +x /usr/bin/aion + +chmod +002 /etc/aion_data/config.xml +chmod -R 777 /etc/aion_data/config.xml + +chmod +002 /etc/aion_data/language/ +chmod -R 777 /etc/aion_data/language/ + +chmod +002 /etc/aion_data/logs/ +chmod -R 777 /etc/aion_data/logs/ + +printf "\n-----removing the install directory from /tmp/...-----\n" + +cd $current_directory + +rm -r /tmp/aion_install + +printf "\nInstallation completed. Please reboot the system to save all the changes\n"