Skip to content

Commit

Permalink
add latest corrections, spotify, fitbit, install and startup scripts
Browse files Browse the repository at this point in the history
  • Loading branch information
sdetweil committed Oct 25, 2021
1 parent d80eb30 commit 535d20d
Show file tree
Hide file tree
Showing 16 changed files with 31 additions and 22 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ main_index.html
motion
package-lock.json
app/locales/??c.json
app/css/local.css
.gitignore
.prettierrc
.editorconfig
2 changes: 1 addition & 1 deletion app/css/newfile.css
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ dt {
left: 0px;
width: 100%;
height: 100%;
pointer-events: none;
/*pointer-events: none; */
margin: 0px;
border: none;
}
Expand Down
7 changes: 6 additions & 1 deletion app/js/controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,9 +47,11 @@
//Initialize the speech service

var resetCommandTimeout;
var listeningTimeout;
SpeechService.init({
listening: function (listening) {
$scope.listening = listening;
listeningTimeout= $timeout(clearListening,12000)
if (listening && !AutoSleepService.woke) {
AutoSleepService.wake();
$scope.focus = AutoSleepService.scope;
Expand All @@ -62,6 +64,7 @@
finalResult: function (result) {
if (typeof result !== "undefined") {
$scope.partialResult = result;
$timeout.cancel(listeningTimeout);
resetCommandTimeout = $timeout(restCommand, 5000);
}
},
Expand Down Expand Up @@ -91,7 +94,9 @@
AutoSleepService.startAutoSleepTimer();
}
}

var clearListening = function(){
$scope.listening = false;
}
// Reset the command text
var restCommand = function () {
$translate("home.commands").then(function (translation) {
Expand Down
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@
"wiredep-cli": "^0.1.0"
},
"dependencies": {
"snowboy": "git+https://github.com/leon-ai/snowboy.git",
"@google-cloud/speech": "^4.2.0",
"@grpc/grpc-js": "^1.2.11",
"alphavantage": "1.2.6",
Expand All @@ -60,9 +59,11 @@
"pretty-ms": "^7.0.1",
"recorder": "git+https://[email protected]/sdetweil/recorder.git",
"rss-parser": "^3.12.0",
"snowboy": "git+https://github.com/leon-ai/snowboy.git",
"socket.io": "2.3.0",
"sonus": "git+https://[email protected]/sdetweil/sonus.git",
"spotify-web-api-node": "^5.0.0",
"waitprocess": "git+https://github.com/sdetweil/waitprocess.git",
"winston": "^3.3.3",
"youtube-api": "^3.0.1"
},
Expand Down
2 changes: 1 addition & 1 deletion plugins/fitbit/config.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@
"tokenPath": "/oauth2/token"
},
"authorization_uri": {
"redirect_uri": "http://localhost:4100/fitbit_auth_callback/",
"redirect_uri": "http://localhost:4000/fitbit_auth_callback/",
"response_type": "code",
"scope": "activity nutrition profile settings sleep social weight heartrate",
"state": "3(#0/!~"
Expand Down
2 changes: 1 addition & 1 deletion plugins/spotify/locales/de.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
},
"spotify_forward": {
"text": "spiele das nächste Lied auf spotify",
"voice": "(fragen | erzählen) spotify (to) (überspringen) (goto) next (song on) (song)",
"voice": "(fragen) (erzählen) spotify (to) (überspringen) (goto) next (song on) (song)",
"description": "Spielen Sie das nächste Lied auf Spotify."
},
"spotify_back": {
Expand Down
2 changes: 1 addition & 1 deletion plugins/spotify/locales/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
},
"spotify_forward": {
"text": "play next song on spotify",
"voice": "(ask| tell) spotify (to) (skip) (goto) next (song on) (song)",
"voice": "(ask) (tell) spotify (to) (skip) (goto) next (song on) (song)",
"description": "Play next song on Spotify."
},
"spotify_back": {
Expand Down
2 changes: 1 addition & 1 deletion plugins/spotify/locales/es.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
},
"spotify_forward": {
"text": "reproducir la siguiente canción en spotify",
"voice": "(preguntar | decir) spotify (para) (saltar) (ir) siguiente (canción en) (canción)",
"voice": "(preguntar) (decir) spotify (para) (saltar) (ir) siguiente (canción en) (canción)",
"description": "Reproduce la siguiente canción en Spotify."
},
"spotify_back": {
Expand Down
2 changes: 1 addition & 1 deletion plugins/spotify/locales/fr.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
},
"spotify_forward": {
"text": "jouer la chanson suivante sur spotify",
"voice": "(demander | dire) spotify (to) (skip) (goto) next (song on) (song)",
"voice": "(demander) (dire) spotify (to) (skip) (goto) next (song on) (song)",
"description": "Jouez la chanson suivante sur Spotify."
},
"spotify_back": {
Expand Down
2 changes: 1 addition & 1 deletion plugins/spotify/locales/ko.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
},
"spotify_forward": {
"text": "Spotify에서 다음 노래 재생",
"voice": "(ask | tell) spotify (to) (skip) (goto) next (song on) (song)",
"voice": "(질문) (말하다) spotify (to) (skip) (goto) next (song on) (song)",
"description": "Spotify에서 다음 노래를 재생합니다."
},
"spotify_back": {
Expand Down
2 changes: 1 addition & 1 deletion plugins/spotify/locales/pt.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
},
"spotify_forward": {
"text": "toque a próxima música no spotify",
"voice": "(perguntar | dizer) spotify (to) (pular) (ir para) next (song on) (song)",
"voice": "(perguntar) (dizer) spotify (to) (pular) (ir para) next (song on) (song)",
"description": "Toque a próxima música no Spotify."
},
"spotify_back": {
Expand Down
6 changes: 3 additions & 3 deletions plugins/spotify/service.js
Original file line number Diff line number Diff line change
Expand Up @@ -56,10 +56,10 @@ let _spotpath = document.currentScript.src.substring(
spotify = new Spotify({
clientId: client_id,
clientSecret: client_secret,
redirectUri: "http://localhost:4000/spotify_auth_callback",
redirectUri: "http://localhost:4100/spotify_auth_callback",
});

// In a browser, visit http://localhost:4000/spotify to authorize a user for the first time.
// In a browser, visit http://localhost:4100/spotify to authorize a user for the first time.
app.get("/authorize_spotify", function (req, res) {
let uri = spotify.createAuthorizeURL(auth_scope, auth_state);
// is this coming from the same machine
Expand Down Expand Up @@ -100,7 +100,7 @@ let _spotpath = document.currentScript.src.substring(
}

service.init = function (cb) {
var port = process.env.PORT || 4000;
var port = process.env.PORT || 4100;
console.debug("Express is listening on port: " + port);
app.listen(port);

Expand Down
6 changes: 3 additions & 3 deletions remote/config.schema.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ function getConfigSchema(config, cb) {
let currentLangInfo=JSON.parse(fs.readFileSync("app/locales/"+config.general.language.substring(0,2)+"c.json"))

let configSchema = { schema: {}, form: [], value: {} };
exec("LC_ALL=c arecord -l | grep -w 'card'", function (arecerr, stdout) {
exec("arecord -l | grep -w 'card'", function (arecerr, stdout) {
fs.readdir(pluginDir, function (err, files) {
let l = files.length;
for (var index = 0; index < files.length; ++index) {
Expand Down Expand Up @@ -165,7 +165,7 @@ function translateForm(pn, items, formdata){
items[key]=formdata[pn]['config'][datakey]
}
catch(error){
console.log(" language file lookup error="+error)
console.log(" language file lookup error="+error+" schema="+pn)
}
}
}
Expand All @@ -179,4 +179,4 @@ function translateForm(pn, items, formdata){
}
}

module.exports = getConfigSchema
module.exports = getConfigSchema
4 changes: 3 additions & 1 deletion scripts/bash-start.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
#!/bin/bash
export DISPLAY=:0
export XAUTHORITY=/home/pi/.Xauthority
cd /home/pi/smart-mirror && npm start

# cd /home/pi/smart-mirror &&
npm start
6 changes: 3 additions & 3 deletions scripts/pi-install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@

#set -e

# Supported versions of node: v4.x, v5.x, v6.x, v7.x, 8.x, 10.x
NODE_MINIMUM_VERSION="v10.0.0"
NODE_STABLE_VERSION="10.x"
# Supported versions of node: v4.x, v5.x, v6.x, v7.x, 8.x, 10.x, 14.x
NODE_MINIMUM_VERSION="v14.0.0"
NODE_STABLE_VERSION="14.x"
NPM_TESTED="V6.0.0"
PM2_FILE=pm2_smart_mirror.json

Expand Down
4 changes: 2 additions & 2 deletions scripts/pm2_smart-mirror.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
{
"apps" : [{
"name" : "smart-mirror",
"script" : "/home/sam/sm-new/scripts/run.sh",
"watch" : ["/home/sam/sm-new/config.json"],
"script" : "/home/pi/smart-mirror.evan/scripts/bash-start.sh",
"watch" : ["/home/pi/smart-mirror.evan/config.json"],
"autorestart" : true
}]
}

0 comments on commit 535d20d

Please sign in to comment.