From 7e4839bbe5c05a82aec605581a55b7580f8516e9 Mon Sep 17 00:00:00 2001 From: Gerrit Linnemann Date: Mon, 9 Nov 2015 10:33:52 +0100 Subject: [PATCH] mplayer call to shell script --- kitchenradio/app.js | 2 +- kitchenradio/app/radio.js | 8 ++------ kitchenradio/bin/_inc/def_text_coloring.sh | 15 +++++++++++++++ kitchenradio/bin/start_radio.sh | 18 ++++++++++++++++++ 4 files changed, 36 insertions(+), 7 deletions(-) create mode 100755 kitchenradio/bin/_inc/def_text_coloring.sh create mode 100755 kitchenradio/bin/start_radio.sh diff --git a/kitchenradio/app.js b/kitchenradio/app.js index ba8b656..1b7e75d 100644 --- a/kitchenradio/app.js +++ b/kitchenradio/app.js @@ -27,7 +27,7 @@ app.use(bodyParser.json()); app.use(bodyParser.urlencoded({ extended: false })); app.use(cookieParser()); app.use(express.static(path.join(__dirname, 'public'))); -app.set('tools_root', __dirname + '/'); +app.set('tools_root', __dirname + '/bin/'); Log.init(app); diff --git a/kitchenradio/app/radio.js b/kitchenradio/app/radio.js index 4d2d968..f1bdd45 100644 --- a/kitchenradio/app/radio.js +++ b/kitchenradio/app/radio.js @@ -102,12 +102,8 @@ exports.play = function(idx) { }*/ var Child = spawn( - 'mplayer', - [ - '-slave', - '-quiet', - stream2play - ] + App.get('tools_root')+'start_radio.sh', + [] ); // listen for any response from the child diff --git a/kitchenradio/bin/_inc/def_text_coloring.sh b/kitchenradio/bin/_inc/def_text_coloring.sh new file mode 100755 index 0000000..6ff3b89 --- /dev/null +++ b/kitchenradio/bin/_inc/def_text_coloring.sh @@ -0,0 +1,15 @@ +#!/bin/sh +# V0.1 + + +RCol='\033[0m' # Text Reset + +# Regular Bold Underline High Intensity BoldHigh Intens Background High Intensity Backgrounds +Bla='\033[0;30m'; BBla='\033[1;30m'; UBla='\033[4;30m'; IBla='\033[0;90m'; BIBla='\033[1;90m'; On_Bla='\033[40m'; On_IBla='\033[0;100m'; +Red='\033[0;31m'; BRed='\033[1;31m'; URed='\033[4;31m'; IRed='\033[0;91m'; BIRed='\033[1;91m'; On_Red='\033[41m'; On_IRed='\033[0;101m'; +Gre='\033[0;32m'; BGre='\033[1;32m'; UGre='\033[4;32m'; IGre='\033[0;92m'; BIGre='\033[1;92m'; On_Gre='\033[42m'; On_IGre='\033[0;102m'; +Yel='\033[0;33m'; BYel='\033[1;33m'; UYel='\033[4;33m'; IYel='\033[0;93m'; BIYel='\033[1;93m'; On_Yel='\033[43m'; On_IYel='\033[0;103m'; +Blu='\033[0;34m'; BBlu='\033[1;34m'; UBlu='\033[4;34m'; IBlu='\033[0;94m'; BIBlu='\033[1;94m'; On_Blu='\033[44m'; On_IBlu='\033[0;104m'; +Pur='\033[0;35m'; BPur='\033[1;35m'; UPur='\033[4;35m'; IPur='\033[0;95m'; BIPur='\033[1;95m'; On_Pur='\033[45m'; On_IPur='\033[0;105m'; +Cya='\033[0;36m'; BCya='\033[1;36m'; UCya='\033[4;36m'; ICya='\033[0;96m'; BICya='\033[1;96m'; On_Cya='\033[46m'; On_ICya='\033[0;106m'; +Whi='\033[0;37m'; BWhi='\033[1;37m'; UWhi='\033[4;37m'; IWhi='\033[0;97m'; \ No newline at end of file diff --git a/kitchenradio/bin/start_radio.sh b/kitchenradio/bin/start_radio.sh new file mode 100755 index 0000000..bb6fbe1 --- /dev/null +++ b/kitchenradio/bin/start_radio.sh @@ -0,0 +1,18 @@ +#!/bin/sh +# V0.1 + + +### DEFINITIONS + +MY_PATH="$(pwd)" +. $MY_PATH/_inc/def_text_coloring.sh +stream2play=`cat config.txt` + + +### PRORGAM + +echo +echo "${BGre}Start playing ...${RCol}" +echo + +mplayer -slave -quiet $stream2play \ No newline at end of file