Skip to content

Commit

Permalink
Merge pull request #490 from alexylem/beta
Browse files Browse the repository at this point in the history
Beta
  • Loading branch information
alexylem authored Mar 20, 2017
2 parents 090cc71 + 8a0eee0 commit e4e5510
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 7 deletions.
1 change: 1 addition & 0 deletions jarvis-config-default.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ conversation_mode=true
dictionary="stt_engines/pocketsphinx/jarvis-dictionary.dic"
gain="0"
google_speech_api_key=""
jv_branch="master"
phrase_failed="This command has returned an error"
phrase_triggered=""
phrase_welcome="Hello"
Expand Down
13 changes: 10 additions & 3 deletions jarvis.sh
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,7 @@ configure () {
'dictionary'
'gain'
'google_speech_api_key'
'jv_branch'
'language'
'language_model'
'trigger_mode'
Expand Down Expand Up @@ -164,6 +165,12 @@ configure () {
dictionary) eval "$1=\"$(dialog_input "PocketSphinx dictionary file" "${!1}")\"";;
gain) eval "$1=\"$(dialog_input "Microphone gain\nCan be positive of negative integer, ex: -5, 0, 10...\nAdjust it by steps of 5, or less to finetune" "${!1}" true)\"";;
google_speech_api_key) eval "$1=\"$(dialog_input "Google Speech API Key\nHow to get one: http://stackoverflow.com/a/26833337" "${!1}")\"";;
jv_branch) options=("master" "beta")
eval "$1=\"$(dialog_select "Repository branch to use for Jarvis updates\nRecommended: master" options[@] "${!1}")\""
git checkout $jv_branch || {
jv_error "ERROR: an error has occured while checking out $jv_branch branch"
jv_press_enter_to_continue
};;
program_startup) editor hooks/$1;;
program_exit) editor hooks/$1;;
entering_cmd) editor hooks/$1;;
Expand Down Expand Up @@ -404,7 +411,7 @@ jv_start_in_background () {
Jarvis has been launched in background
To view Jarvis output:
tail -f jarvis.log
./jarvis.sh and select "View output"
To check if jarvis is running:
pgrep -lf jarvis.sh
To stop Jarvis:
Expand Down Expand Up @@ -512,7 +519,7 @@ if [ "$just_execute" == false ]; then
if jv_is_started; then
options=('Show Jarvis output' 'Stop Jarvis')
case "$(dialog_menu 'Jarvis is already running\nWhat would you like to do? (Cancel to let it run)' options[@])" in
Show*) cat jarvis.log;;
Show*) tail -f jarvis.log;;
Stop*) jv_kill_jarvis;;
esac
exit
Expand Down Expand Up @@ -547,7 +554,7 @@ if [ "$just_execute" == false ]; then
fi
[ "$rec_hw" != "false" ] && microphone=$(lsusb -d $(cat /proc/asound/card${rec_hw:3:1}/usbid) | cut -c 34-) || microphone="Default"
echo -e "$_gray\n------------ Config ------------"
for parameter in jv_version jv_arch jv_os_name jv_os_version language play_hw rec_hw speaker microphone trigger_stt command_stt tts_engine; do
for parameter in jv_branch jv_version jv_arch jv_os_name jv_os_version language play_hw rec_hw speaker microphone recorder trigger_stt command_stt tts_engine; do
printf "%-20s %s \n" "$parameter" "${!parameter}"
done
echo -e "--------------------------------\n$_reset"
Expand Down
2 changes: 2 additions & 0 deletions utils/menu.sh
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ jv_main_menu () {
"Conversation mode ($conversation_mode)"
"Language ($language)"
"Check Updates on Startup ($check_updates)"
"Repository Branch ($jv_branch)"
"Usage Statistics ($send_usage_stats)")
case "`dialog_menu 'Configuration > General' options[@]`" in
Username*) configure "username";;
Expand All @@ -61,6 +62,7 @@ jv_main_menu () {
Conversation*) configure "conversation_mode";;
Language*) configure "language";;
Check*Updates*) configure "check_updates";;
Repository*Branch*) configure "jv_branch";;
Usage*Statistics*) configure "send_usage_stats";;
*) break;;
esac
Expand Down
8 changes: 5 additions & 3 deletions utils/utils.sh
Original file line number Diff line number Diff line change
Expand Up @@ -323,22 +323,24 @@ jv_check_updates () {
local force=${2:-false} # false default value if $2 is empty
cd "$repo_path"
local repo_name="$(basename $(pwd))"
local is_jarvis="$([ "$repo_name" == "jarvis" ] && echo "true" || echo "false")"
local branch="$( $is_jarvis && echo "$jv_branch" || echo "master")"
printf "Checking updates for $repo_name..."
read < <( git fetch origin -q & echo $! ) # suppress bash job control output
jv_spinner $REPLY
case `git rev-list HEAD...origin/master --count || echo e` in
case $(git rev-list HEAD...origin/$branch --count || echo e) in
"e") jv_error "Error";;
"0") jv_success "Up-to-date";;
*) jv_warning "New version available"
changes=$(git fetch -q 2>&1 && git log HEAD..origin/master --oneline --format="- %s (%ar)" | head -5)
changes=$(git fetch -q 2>&1 && git log HEAD..origin/$branch --oneline --format="- %s (%ar)" | head -5)
if $force || dialog_yesno "A new version of $repo_name is available, recent changes:\n$changes\n\nWould you like to update?" true >/dev/null; then
# display recent commits in non-interactive mode
$force && echo -e "Recent changes:\n$changes"

#git reset --hard HEAD >/dev/null # don't override local changes (config.sh)

local jv_config_changed=false
if [ "$repo_name" == "jarvis" ]; then
if $is_jarvis; then
# inform jarvis is updated to ask for restart
jv_jarvis_updated=true
elif [ 1 -eq $(git diff --name-only ..origin/master config.sh | wc -l) ]; then
Expand Down
2 changes: 1 addition & 1 deletion version.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
17.03.18
17.03.19

0 comments on commit e4e5510

Please sign in to comment.