Browse Source

Fix debug/GSM_powerkey.sh do not stop key if is started. Replace by . Add .install/templates/2b/gammu-smsdrc

poka 7 months ago
parent
commit
3e8a824d89

+ 1 - 0
.install/.GPATH

@@ -0,0 +1 @@
+GPATH=/home/pi/G1sms+

+ 1 - 1
.install/2-configure_ipfs_layer.sh

@@ -8,7 +8,7 @@
 MY_PATH="`dirname \"$0\"`"              # relative
 MY_PATH="`( cd \"$MY_PATH\" && pwd )`"  # absolutized and normalized
 stamp=$(date +%s)
-templates="$MY_PATH/templates/2"
+templates="$MY_PATH/templates/2a"
 
 #######################################
 # CONFIGURE IPFS for G1sms+ Pi NODES

+ 34 - 0
.install/2b-configure_gammu.sh

@@ -0,0 +1,34 @@
+#!/bin/bash
+
+MY_PATH="`dirname \"$0\"`"              # relative
+MY_PATH="`( cd \"$MY_PATH\" && pwd )`"  # absolutized and normalized
+source $MY_PATH/../.install/.GPATH
+
+## Récupère les données du profile
+[[ -f $MY_PATH/../.profile ]] && source $MY_PATH/../.profile
+
+## Désactive les processus écoutant le tty1
+[[ $(sudo systemctl status getty@tty1.service | grep "loaded") ]] && sudo systemctl stop getty@tty1.service && sudo systemctl disable getty@tty1.service
+
+## Copie et sed de /etc/gammu-smsdrc
+[[ -f /etc/gammu-smsdrc ]] && sudo mv /etc/gammu-smsdrc /etc/gammu-smsdrc.old && echo "/etc/gammu-smsdrc a été renommé en /etc/gammu-smsdrc.old"
+sudo cp $MY_PATH/templates/2b/gammu-smsdrc /etc/
+
+GPATHS=$(echo $GPATH | sed 's./.\\/.g')
+sudo sed -i "s/_GPATH/$GPATHS/g" /etc/gammu-smsdrc
+sudo sed -i "s/_PIN/$PIN/g" /etc/gammu-smsdrc
+
+## Configure correctement le UART
+
+[[ ! $(grep enable_uart=1 /boot/config.txt) ]] && echo "enable_uart=1" | sudo tee -a /boot/config.txt
+[[ $(grep "console=serial0" /boot/cmdline.txt) ]] && sudo sed -i "s/console=serial0,115200//g" /boot/cmdline.txt
+[[ $(grep "console=serial0" /boot/cmdline.txt) ]] && echo -e "${c_red}Attention, console=serial0 est toujours présent dans /boot/cmdline.txt !$c_" && err=1
+
+## Configure rc.local
+
+
+
+## Redémarre gammu-smsd
+sudo service gammu-smsd restart && echo -e "${c_green}Gammu a été correctement configuré$c_" || echo -e "${c_green}Un problème est survenu lors de la configuration de gammu$c_"
+
+exit 0

+ 14 - 0
.install/5-install_rompr.sh

@@ -0,0 +1,14 @@
+#!/bin/bash
+MY_PATH="`dirname \"$0\"`"              # relative
+MY_PATH="`( cd \"$MY_PATH\" && pwd )`"  # absolutized and normalized
+source $MY_PATH/../.install/.GPATH
+
+GPATHS=$(echo $GPATH | sed 's./.\\/.g')
+
+sudo cp $MY_PATH/templates/5/youtube-dl.php $GPATH/www/rompr/REC/youtube-dl.php
+sudo sed -i "s/_GPATH/$GPATHS/g" $GPATH/www/rompr/REC/youtube-dl.php
+
+## TODO
+# Tout les reste ...
+
+exit 0

+ 1 - 0
.install/templates/.profile

@@ -2,4 +2,5 @@ ADMINPSEUDO=_ADMINPSEUDO
 ADMINPHONE=_ADMINPHONE
 MASTERPHONE=_MASTERPHONE
 ADRESSE="_ADRESSE"
+PIN=_PIN
 KSMS_DOMAIN=

.install/templates/2/swarm.key → .install/templates/2a/swarm.key


+ 26 - 0
.install/templates/2b/gammu-smsdrc

@@ -0,0 +1,26 @@
+# Configuration file for Gammu SMS Daemon
+
+[gammu]
+port = /dev/ttyS0
+synchronizetime = yes
+gammucoding = utf8
+connection = at
+# Debugging
+logformat = textall
+
+# SMSD configuration, see gammu-smsdrc(5)
+[smsd]
+service = files
+
+logfile = /var/log/gammu-smsd.log
+PIN = _PIN
+
+# Paths where messages are stored (Not use if service = sql)
+inboxpath = /var/spool/gammu/inbox/
+outboxpath = /var/spool/gammu/outbox/
+sentsmspath = /var/spool/gammu/sent/
+errorsmspath = /var/spool/gammu/error/
+
+RunOnReceive = _GPATH/sms_received.sh
+#IncludeSMSCFile = _GPATH/debug/smsc.txt
+debuglevel = 3

+ 128 - 0
.install/templates/5/youtube-dl.php

@@ -0,0 +1,128 @@
+<?php
+/*
+DONE!!!?  WRITE THAT CODE IN infobar2.js : arrount line 158 before "return lines;"
+// ZEEBOX HACK ZONE
+    var reclink = '/REC/youtube-dl.php?q=REC&artist=' + escape(encodeURIComponent(npinfo.Artist)) + '&title=' + escape(encodeURIComponent(npinfo.Title)) + '&radio='+ escape(encodeURIComponent(npinfo.stream)) +'&maxResults=1';
+    var zcopylink = ' <a id="REC" title="Enregistrer sur Youtube" href="#" onclick=\'javascript:window.open("'+ reclink +'","REC","menubar=no, scrollbars=no, top=10, left=10, width=384, height=546");return false;\'>[REC]</a>';
+    zcopylink += ' <a title="RECHERCHE LIBRE" href="/REC/youtube-dl.php" target="youtube">*</a>';
+    lines[0].text += zcopylink;
+// ZEEBOX HACK ZONE
+*/
+// RUN CLI if($argc>1) parse_str(implode('&',array_slice($argv, 1)), $_REQUEST);
+$search=$radio=$artist=$title=$lnk=$lnkform=$cmd=$len="";
+$search = trim(urldecode($_REQUEST['q']));
+
+$radio = urldecode($_REQUEST['radio']);
+$artist =  urldecode($_REQUEST['artist']);
+$title = urldecode($_REQUEST['title']);
+$lnk = trim(urldecode($_REQUEST['lnk']));
+$cmd="$radio|$artist|$title";
+$len=strlen($artist.$title);
+
+//$result='<a href="#null" onclick="javascript:window.close();"><img src="/REC/REC.png"></a><br>';
+$result='<a href="https://www.copylaradio.com" target="copylaradio"><img src="/REC/REC.png"></a><br>';
+if( $radio == "" ) { $radio = "CopyLaRadio"; }
+if( $radio == "Nova zz" ) {
+	$artist = "undefined";
+	$title = "undefined";
+}
+// Write request for copy.sh triggering
+if( $search == "REC" ) {
+///////////////////
+	$result.='<h2>♫ '.$radio.' ♫</h2>';
+	// LINK RECEIVED
+	if ($lnk) {
+		$artist="";
+		shell_exec('_GPATH/_CopyLaRadio/parle.sh "Lien reçu."');
+		// Not making double request
+	    if( ! exec('grep '.escapeshellarg($lnk).' /tmp/ytdl.list') ) {
+			file_put_contents("/tmp/ytdl.list","CopyLibre||$lnk\n", FILE_APPEND);
+		}
+		$result.='<p><a href="'.$lnk.'" target="check">LIEN: '.$lnk.'</a></p>';
+///////////////////
+	// TRACK COPY (not for undefined or local file)
+	} else if ($radio && $artist != $title && $artist != "undefined" && $title != "undefined" && strlen(explode(".", $title)[1]) != 3 && explode(".", $title)[1] != "opus" ) {
+		// Not making double request
+	 	if( ! exec('grep '.escapeshellarg($cmd).' /tmp/ytdl.list') ) {
+		 	shell_exec('_GPATH/_CopyLaRadio/parle.sh "Enregistrement ajouté."');
+	    	file_put_contents("/tmp/ytdl.list","$cmd\n", FILE_APPEND);
+		} else {
+			shell_exec('_GPATH/_CopyLaRadio/parle.sh "Copie déjà lancée"');
+		}
+		$result.='<a style="color:#FFFFFF" href="https://www.youtube.com/results?search_query='.urlencode($artist).'%20'.urlencode($title).'" target="check">
+<h4>'.$artist.' / '.$title.'</h4>
+</a>';
+///////////////////
+	// RADIO EXTERNAL TRACK SCRAPER
+	} else if($radio != "" && $artist == "undefined" && $title == "undefined" ){
+		shell_exec('_GPATH/_CopyLaRadio/parle.sh "Recherche externe pour '.$radio.'"');
+		file_put_contents("/tmp/youtube-dl.log", "_GPATH/_CopyLaRadio/libradio/".escapeshellcmd($radio).".php".PHP_EOL, FILE_APPEND);
+		if ( file_exists("_GPATH/_CopyLaRadio/libradio/".escapeshellcmd($radio).".php") ) {
+			file_put_contents("/tmp/ytdl.list","$radio||".PHP_EOL, FILE_APPEND);
+		} else {
+			shell_exec('_GPATH/_CopyLaRadio/parle.sh "Aucun module"');
+		}
+
+	} else {
+			shell_exec('_GPATH/_CopyLaRadio/parle.sh "Identification imprécise. Podcast? Fichier local?"');
+	}
+
+}
+
+$ytform = '<form action="/REC/youtube-dl.php"  method="GET">
+<div>
+<h3>ARTISTE: <input type="search" id="artist" name="artist" size="17" placeholder="Indiquez un artiste" value="'.$artist.'"></h3>
+<h3>TITRE: <input type="search" id="title" name="title" size="20" placeholder="Titre de la chanson" value="'.$title.'"></h3>
+</div>
+<input type="hidden" id="radio" name="radio" value="'.$radio.'">
+<input type="hidden" id="q" name="q" value="REC">
+<br>
+<input type="submit" value="♫ Copie Youtube ♫">
+</form>
+';
+
+$lnkform.='<form action="/REC/youtube-dl.php"  method="GET">
+<a href="https://youtube.com" target="search"><img src="/REC/youtube.png"></a>
+<p><h1>youtube-dl</h1>
+<a style="color:#FFFFFF" href="https://ytdl-org.github.io/youtube-dl/supportedsites.html" target="_blank">- Sites compatibles -</a>
+<input type="search" id="lnk" name="lnk" placeholder="Inscrivez le lien à copier" value="" size="40">
+<input type="hidden" id="q" name="q" value="REC">
+</p>
+<div>
+<input type="submit" value="Copie du Lien">
+</div>
+</form>';
+
+?>
+<!doctype html>
+<html>
+  <head>
+  <meta name="viewport" content="width=device-width, initial-scale=1.0">
+  <meta name="description" content="">
+  <meta name="author" content="fred" >
+  <meta http-equiv="Content-Type" content="text/html; charset=utf-8" >
+  <title><?php echo $search;?> - Recherche YouTube & Copie privée</title>
+	<link href="/REC/bootstrap.css" rel="stylesheet">
+  </head>
+  <body style='background: url("/REC/fond.jpg") no-repeat scroll center center / cover rgb(0, 0, 0); color:#FFFFFF;'>
+   <section class="content-section text-center">
+          <div class="container-fluid">
+            <div class="container" id="result" >
+                <div class="col-lg-8 col-lg-offset-2 page-scroll">
+				<ul>
+	  					<?php echo $result; ?>
+				<hr>
+				</ul>
+            <ul>
+					<?php echo $ytform; ?>
+					<hr>
+					<?php echo $lnkform; ?>
+				<hr>
+				</ul>
+
+			</div>
+		</div>
+	</div>
+   </section>
+</body>
+</html>

+ 7 - 3
.install/templates/init.sh

@@ -4,6 +4,11 @@
 # Version: 0.1
 # License: GPL (http://www.google.com/search?q=GPL)
 ##################################################################
+
+MY_PATH="`dirname \"$0\"`"              # relative
+MY_PATH="`( cd \"$MY_PATH\" && pwd )`"  # absolutized and normalized
+source $MY_PATH/.install/.GPATH
+
 # Adapter les valeurs au contexte spatio-temporel du NODE G1SMS
 function log () {
 # log ($1=text)
@@ -31,8 +36,7 @@ fi
 
 
 	export YOU=$(ps auxf --sort=+utime | grep -w ipfs | grep -v -E 'color=auto|grep' | tail -n 1 | cut -d " " -f 1);
-    export CHEMIN="/home/$YOU/G1sms+"
-    cd $CHEMIN
+    cd $GPATH
     ##################################################################
     # Activate logging to /tmp/g1sms.log (YES/NO)
     export DOLOG="YES"
@@ -75,5 +79,5 @@ fi
 
     # TODO Use latest Silkaj from "sudo fredp3 install silkaj"
     # export SILKAJ="/usr/local/bin/silkaj"
-    source $CHEMIN/shell/init_keys.sh
+    source $GPATH/shell/init_keys.sh
 

+ 0 - 10
GSM_POWERKEY.py

@@ -1,10 +0,0 @@
-import RPi.GPIO as GPIO
-import time
-GPIO.setmode(GPIO.BOARD)
-GPIO.setup(7, GPIO.OUT)
-while True:
-	GPIO.output(7, GPIO.LOW)
-	time.sleep(4)
-	GPIO.output(7, GPIO.HIGH)
-	break
-GPIO.cleanup()

+ 6 - 2
_CopyLaRadio/copy.sh

@@ -1,5 +1,9 @@
 #!/bin/bash
 
+MY_PATH="`dirname \"$0\"`"              # relative
+MY_PATH="`( cd \"$MY_PATH\" && pwd )`"  # absolutized and normalized
+source $MY_PATH/../.install/.GPATH
+
 # Clean /tmp/ytdl.list
 #echo > /tmp/ytdl.list
 
@@ -74,9 +78,9 @@ elif [[ "$radio" != ""  && "$artist" == "" && "$song" == "" ]]; then
 	# EXTERNAL PARSER: ADD SCRAPERS IN ./libradio
 	~/parle.sh "Recherche RADIO ${radio}"
 	echo "External search: ${radio}" >> /tmp/youtube-dl.log 2>&1
-	if [[ -f /home/pi/G1sms+/_CopyLaRadio/libradio/${radio}.php ]]; then
+	if [[ -f $GPATH/_CopyLaRadio/libradio/${radio}.php ]]; then
 		~/parle.sh "Module existant"
-		php "/home/pi/G1sms+/_CopyLaRadio/libradio/${radio}.php"
+		php "$GPATH/_CopyLaRadio/libradio/${radio}.php"
 	else
 		~/parle.sh "Aucun module de décodage pour cette radio."
 	fi

+ 10 - 3
GSM_powerkey.sh

@@ -1,9 +1,16 @@
 #!/bin/bash
+
+MY_PATH="`dirname \"$0\"`"
+MY_PATH="`( cd \"$MY_PATH\" && pwd )`"
+
 if [ ! -e /sys/class/gpio/gpio4 ]; then
-    echo "File exists."
+    echo "File doesn't exists."
     echo "4" > /sys/class/gpio/export
 fi
+
 echo "out" > /sys/class/gpio/gpio4/direction
-echo "0" > /sys/class/gpio/gpio4/value
-sleep 2
 echo "1" > /sys/class/gpio/gpio4/value
+
+sleep 3 && $MY_PATH/gammu-restart.sh
+
+exit 0

+ 5 - 0
debug/smsc.txt

@@ -0,0 +1,5 @@
++33695000695
++33695000647
++33695000646
++33695000643
++33695000636

+ 13 - 2
install.sh

@@ -6,6 +6,10 @@
 ################################################################################
 MY_PATH="`dirname \"$0\"`"              # relative
 MY_PATH="`( cd \"$MY_PATH\" && pwd )`"  # absolutized and normalized
+
+echo "GPATH=$MY_PATH" > $MY_PATH/.install/.GPATH
+source $MY_PATH/.install/.GPATH
+
 init_loc="$MY_PATH/shell/init.sh"
 now=$(date +%Y-%m-%d)
 unset err
@@ -47,7 +51,7 @@ $MY_PATH/.install/export_colors.sh
 if [[ $force_req == "o" || -z $(which ipfs) || -z $(which gammu) ]];then
     echo -e "${c_yellow}IPFS ou gammu n'ont pas été détectés sur votre machine, nous allons installer tous les prérequis...$c_"
     $MY_PATH/.install/1-install_requirements.sh silkaj ipfs gammu || err+=1
-    $MY_PATH/.install/2-configure_ipfs_layer.sh || err+=1
+    $MY_PATH/.install/2a-configure_ipfs_layer.sh || err+=1
 else
     echo -e "${c_green}IPFS et gammu sont déjà installé !$c_"
 fi
@@ -66,7 +70,10 @@ if [[ -f $MY_PATH/.install/templates/init.sh ]]; then
 
     [[ ! $ADRESSE ]] && echo -e "${c_light}L'adresse où se trouve votre G1Node pour indiquer où venir chercher ses G1Tag (ex: au G1FabLab de Toulouse)$c_" && read ADRESSE
 
-    echo -e "ADMINPSEUDO: $ADMINPSEUDO\nADMINPHONE: $ADMINPHONE\nMASTERPHONE: $MASTERPHONE\nADRESSE: $ADRESSE"
+	[[ ! $PIN ]] && echo -e "${c_light}Le code PIN de votre carte SIM ? (ex: 1234)$c_" && read PIN
+	[[ "$PIN" == "" ]] && PIN="1234"
+
+    echo -e "ADMINPSEUDO: $ADMINPSEUDO\nADMINPHONE: $ADMINPHONE\nMASTERPHONE: $MASTERPHONE\nADRESSE: $ADRESSE\nPIN: $PIN"
     [[ $noask != "o" ]] && echo -e "${c_light}${c_blue}LES PARAMETRES SONT BONS? Appliquer? ENTER ou CTRL-C ? (Editez le fichier .profile si incorrect)$c_" && read
 
     [[ -f shell/init.sh ]] && mv shell/init.sh shell/init.sh.old
@@ -83,6 +90,7 @@ if [[ -f $MY_PATH/.install/templates/init.sh ]]; then
 		sed -i s/_ADRESSE/$ADRESSE/g $MY_PATH/.profile
 		sed -i s/_ADMINPHONE/$ADMINPHONE/g $MY_PATH/.profile
 		sed -i s/_ADMINPSEUDO/$ADMINPSEUDO/g $MY_PATH/.profile
+		sed -i s/_PIN/$PIN/g $MY_PATH/.profile
 	fi
 
 else
@@ -91,6 +99,9 @@ else
     exit 1
 fi
 
+## Configuration de gammu
+$MY_PATH/.install/2b-configure_gammu.sh || err=1
+
 ## Installations optionnels
 
 repOld=$repOption

+ 2 - 2
search

@@ -2,7 +2,7 @@
 clear
 echo "------------------------------------------------------------------------------"
 if [ "$1" == "" ]; then
-	echo "  Nothing to search for!"  
+	echo "  Nothing to search for!"
 else
 	echo "  Searching for "$1" recursively. Please Wait..."
 	echo "------------------------------------------------------------------------------"
@@ -10,7 +10,7 @@ else
 fi
 echo "------------------------------------------------------------------------------"
 if [ "$2" != "" ]; then
-        echo "  To replace \"$1\" whith \"$2\", please run"
+	echo "  To replace \"$1\" whith \"$2\", please run"
 	echo "  grep -rl '$1' ./  | xargs sed -i 's/$1/$2/g'"
 fi
 

+ 6 - 2
shell/cron_MINUTE.sh

@@ -7,10 +7,14 @@
 # CE FICHIER cron_MINUTE.sh EST EXECUTE TOUTES LES MINUTES
 # IL CONSTITUE LE BATEMENT DE COEUR DU SYSTEME
 ################################################################################
+
+MY_PATH="`dirname \"$0\"`"              # relative
+MY_PATH="`( cd \"$MY_PATH\" && pwd )`"  # absolutized and normalized
+source $MY_PATH/../.install/.GPATH
+
 YOU=$(ps aux --sort=+utime | grep ipfs | tail -n 1 | cut -d " " -f 1)
 IPFSNODEID=$(su $YOU -c "ipfs id -f='<id>\n'")
-CHEMIN="/home/$YOU/G1sms+"
-cd $CHEMIN
+cd $GPATH
 source ./shell/init.sh
 source ./shell/functions.sh
 

+ 7 - 3
shell/init.sh.old

@@ -5,6 +5,11 @@
 # License: GPL (http://www.google.com/search?q=GPL)
 ##################################################################
 # Adapter les valeurs au contexte spatio-temporel du NODE G1SMS
+
+MY_PATH="`dirname \"$0\"`"              # relative
+MY_PATH="`( cd \"$MY_PATH\" && pwd )`"  # absolutized and normalized
+source $MY_PATH/../.install/.GPATH
+
 function log () {
 # log ($1=text)
 	if [ "$DOLOG" == "YES" ]
@@ -31,8 +36,7 @@ fi
 
 
     export YOU=$(ps aux --sort=+utime | grep ipfs | tail -n 1 | cut -d " " -f 1)
-    export CHEMIN="/home/$YOU/G1sms+"
-    cd $CHEMIN
+    cd $GPATH
     ##################################################################
     # Activate logging to /tmp/g1sms.log (YES/NO)
     export DOLOG="YES"
@@ -75,5 +79,5 @@ fi
 
     # TODO Use latest Silkaj from "sudo fredp3 install silkaj"
     # export SILKAJ="/usr/local/bin/silkaj"
-    source $CHEMIN/shell/init_keys.sh
+    source $GPATH/shell/init_keys.sh
 

+ 12 - 8
shell/init_keys.sh

@@ -6,9 +6,13 @@
 ##################################################################
 # CHECK & WARN | CREATE Keys (gpg encrypt, G1wallet, IPNS publish)
 ##################################################################
+
+MY_PATH="`dirname \"$0\"`"              # relative
+MY_PATH="`( cd \"$MY_PATH\" && pwd )`"  # absolutized and normalized
+source $MY_PATH/.install/.GPATH
+
 YOU=$(ps aux --sort=+utime | grep ipfs | tail -n 1 | cut -d " " -f 1)
 # TODO Make it directory independant. (for now it is tested for pi running ipfs and code in $HOME/G1sms+
-CHEMIN="/home/$YOU/G1sms+"
 
 ##################################################################
 # G1sms+ Node KEYS (G1wallet, gpg, IPNS)
@@ -20,17 +24,17 @@ if [ ! $GPGPASS ]; then echo "FATAL ERROR:: IPFS Node.Identity.PrivKey GPGPASS E
 # G1sms+ Swarm KEYS
 ##################################################################
 # G1sms Service - G1Wallet
-if [[ -f "${CHEMIN}/g1sms.pub.key" && -f "${CHEMIN}/g1sms.priv.key" ]]; then
-    chown root:root ${CHEMIN}/g1sms.priv.key
-    chmod 600 ${CHEMIN}/g1sms.priv.key
-	export MASTERPUB=$(cat "${CHEMIN}/g1sms.pub.key")
-    export MASTERKEYFILE="${CHEMIN}/g1sms.priv.key"
+if [[ -f "${GPATH}/g1sms.pub.key" && -f "${GPATH}/g1sms.priv.key" ]]; then
+    chown root:root ${GPATH}/g1sms.priv.key
+    chmod 600 ${GPATH}/g1sms.priv.key
+	export MASTERPUB=$(cat "${GPATH}/g1sms.pub.key")
+    export MASTERKEYFILE="${GPATH}/g1sms.priv.key"
 else
     echo "ATTENTION!! Vous devez posséder la clef du G1 Wallet utilisé par le SWARM G1sms!!"
     ./shell/parle.sh "Les clefs du portefeuille essaim G1 SMS sont absente. Au revoir."
     echo "Fichiers manquants:"
-    echo "${CHEMIN}/g1sms.pub.key"
-    echo "${CHEMIN}/g1sms.priv.key"
+    echo "${GPATH}/g1sms.pub.key"
+    echo "${GPATH}/g1sms.priv.key"
     echo "Contactez nous sur https://g1sms.fr"
     gammu-smsd-inject -l TEXT "$ADMINPHONE" -text "Clef de G1Wallet du SWARM g1sms.priv.key manquante! contactez-nous pour la recevoir https://g1sms.fr" 1>&2
     exit

+ 2 - 1
shell/sms_EMAIL.sh

@@ -7,9 +7,10 @@
 # sudo apt install ssmtp mpack
 # Configure in /etc/ssmtp
 # Send email with file attachement: mpack -s "Logo G1Tag" /home/pi/G1sms+/G1Tag.png dest@email.ext
- 
+
 source ./shell/init.sh
 source ./shell/functions.sh
+
 log "__SUB:sms_EMAIL.sh.sh: START ($1=phone, $2=mail)"
 
 phone="$1"

+ 6 - 4
sms_received.sh

@@ -27,14 +27,16 @@
 # License: GPL (http://www.google.com/search?q=GPL)
 ################################################################################
 
+MY_PATH="`dirname \"$0\"`"              # relative
+MY_PATH="`( cd \"$MY_PATH\" && pwd )`"  # absolutized and normalized
+
 # Execute Kalkun daemon
 [[ -f /var/www/kalkun/scripts/daemon.sh ]] && /var/www/kalkun/scripts/daemon.sh
 
 export YOU=$(ps aux --sort=+utime | grep ipfs | tail -n 1 | cut -d " " -f 1)
-export CHEMIN="/home/$YOU/G1sms+"
-cd $CHEMIN
-source ./shell/init.sh
-source ./shell/functions.sh
+cd $GPATH
+source $MY_PATH/shell/init.sh
+source $MY_PATH/shell/functions.sh
 
 ##################################################################
 # Get global variables from gammu-smsd

+ 8 - 8
www/rompr/REC/youtube-dl.php

@@ -1,11 +1,11 @@
 <?php
 /*
 DONE!!!?  WRITE THAT CODE IN infobar2.js : arrount line 158 before "return lines;"
-// ZEEBOX HACK ZONE
-    var reclink = '/REC/youtube-dl.php?q=REC&artist=' + escape(encodeURIComponent(npinfo.Artist)) + '&title=' + escape(encodeURIComponent(npinfo.Title)) + '&radio='+ escape(encodeURIComponent(npinfo.stream)) +'&maxResults=1';
-    var zcopylink = ' <a id="REC" title="Enregistrer sur Youtube" href="#" onclick=\'javascript:window.open("'+ reclink +'","REC","menubar=no, scrollbars=no, top=10, left=10, width=384, height=546");return false;\'>[REC]</a>';
+// ZEEBOX HACK ZONE
+    var reclink = '/REC/youtube-dl.php?q=REC&artist=' + escape(encodeURIComponent(npinfo.Artist)) + '&title=' + escape(encodeURIComponent(npinfo.Title)) + '&radio='+ escape(encodeURIComponent(npinfo.stream)) +'&maxResults=1';
+    var zcopylink = ' <a id="REC" title="Enregistrer sur Youtube" href="#" onclick=\'javascript:window.open("'+ reclink +'","REC","menubar=no, scrollbars=no, top=10, left=10, width=384, height=546");return false;\'>[REC]</a>';
     zcopylink += ' <a title="RECHERCHE LIBRE" href="/REC/youtube-dl.php" target="youtube">*</a>';
-    lines[0].text += zcopylink;
+    lines[0].text += zcopylink;
 // ZEEBOX HACK ZONE
 */
 // RUN CLI if($argc>1) parse_str(implode('&',array_slice($argv, 1)), $_REQUEST);
@@ -22,7 +22,7 @@ $len=strlen($artist.$title);
 //$result='<a href="#null" onclick="javascript:window.close();"><img src="/REC/REC.png"></a><br>';
 $result='<a href="https://www.copylaradio.com" target="copylaradio"><img src="/REC/REC.png"></a><br>';
 if( $radio == "" ) { $radio = "CopyLaRadio"; }
-if( $radio == "Nova zz" ) { 
+if( $radio == "Nova zz" ) {
 	$artist = "undefined";
 	$title = "undefined";
 }
@@ -62,7 +62,7 @@ if( $search == "REC" ) {
 		} else {
 			shell_exec('/home/pi/G1sms+/_CopyLaRadio/parle.sh "Aucun module"');
 		}
-		
+
 	} else {
 			shell_exec('/home/pi/G1sms+/_CopyLaRadio/parle.sh "Identification imprécise. Podcast? Fichier local?"');
 	}
@@ -116,10 +116,10 @@ $lnkform.='<form action="/REC/youtube-dl.php"  method="GET">
             <ul>
 					<?php echo $ytform; ?>
 					<hr>
-					<?php echo $lnkform; ?>			
+					<?php echo $lnkform; ?>
 				<hr>
 				</ul>
-				
+
 			</div>
 		</div>
 	</div>