From 553f7401c8414f3d8259307829237ed5dd698b12 Mon Sep 17 00:00:00 2001 From: Liver64 Date: Wed, 2 Feb 2022 11:11:18 +0100 Subject: [PATCH] v1.3.0 --- bin/output.cfg | 12 ++++++++++++ config/output.cfg | 3 +-- postupgrade.sh | 4 ++++ templates/index.html | 19 ++++++++++++++++--- templates/lang/tts_all_de.ini | 3 ++- templates/lang/tts_all_en.ini | 1 + webfrontend/html/tts.php | 24 +++++++++++++++--------- webfrontend/htmlauth/index.cgi | 10 ++++++++-- 8 files changed, 59 insertions(+), 17 deletions(-) create mode 100644 bin/output.cfg diff --git a/bin/output.cfg b/bin/output.cfg new file mode 100644 index 0000000..fae5b87 --- /dev/null +++ b/bin/output.cfg @@ -0,0 +1,12 @@ +NULL - Discard all samples (playback) or generate zero samples (capture) +ALSA - default Audio Device +ALSA - sysdefault Audio Device +ALSA - dmix: sample mixing device DEV=0 +ALSA - dmix: sample mixing device DEV=1 +ALSA - dsnoop: direct sample snooping device DEV=0 +ALSA - dsnoop: sample snooping device DEV=1 +ALSA - hw: Direct hardware device without any conversions DEV=0 +ALSA - hw: Direct hardware device without any conversions DEV=1 +ALSA - plughw: Hardware device with all software conversions DEV=0 +ALSA - plughw: Hardware device with all software conversions DEV=1 +USB - USB Soundcard \ No newline at end of file diff --git a/config/output.cfg b/config/output.cfg index 2b236ae..fae5b87 100644 --- a/config/output.cfg +++ b/config/output.cfg @@ -9,5 +9,4 @@ ALSA - hw: Direct hardware device without any conversions DEV=0 ALSA - hw: Direct hardware device without any conversions DEV=1 ALSA - plughw: Hardware device with all software conversions DEV=0 ALSA - plughw: Hardware device with all software conversions DEV=1 -USB - USB Soundkarte CARD=1 -USB - USB Soundkarte CARD=2 \ No newline at end of file +USB - USB Soundcard \ No newline at end of file diff --git a/postupgrade.sh b/postupgrade.sh index b778131..c2a689f 100644 --- a/postupgrade.sh +++ b/postupgrade.sh @@ -49,6 +49,10 @@ PBIN=$LBPBIN/$PDIR echo " Copy back existing config files" cp -p -v -r /tmp/$1\_upgrade/config/$3/* $5/config/plugins/$3/ +echo " Replace output.cfg config" +rm -r $5/config/plugins/$3/output.cfg +cp -p -v -r $5/bin/plugins/$3/output.cfg $5/config/plugins/$3/output.cfg + echo " Copy back existing log files" cp -p -v -r /tmp/$1\_upgrade/log/$3/* $5/log/plugins/$3/ diff --git a/templates/index.html b/templates/index.html index 252e942..ebf7691 100644 --- a/templates/index.html +++ b/templates/index.html @@ -259,8 +259,6 @@

- -
@@ -308,7 +306,22 @@

- + + + + + + + + + + diff --git a/templates/lang/tts_all_de.ini b/templates/lang/tts_all_de.ini index 59f66f9..09ce6c0 100644 --- a/templates/lang/tts_all_de.ini +++ b/templates/lang/tts_all_de.ini @@ -48,7 +48,8 @@ VOICE_ERROR2="Der API-key" VOICE_ERROR3="ist nicht valide.\n Fehler Text: Stimmenliste konnte nicht geladen werden!" AZURE_API_LINK="Hilfe für Erstellung des API-Keys (Bitte auch das Preismodell beachten)" PROBLEMS_WITH_API_KEY="Mit dem API-key scheint etwas nicht zu stimmen!" -USB_DEVICE="Device (DEV):" +USB_DEVICE="Device:" +USB_CARDNO="Card:" TTS_INSTANZ="Text-to-Speech (T2S) Instanz:" TTS_LANGUAGE="Standardsprache/-stimme für T2S:" VALIDATE_JINGLE="Bitte Jingle Datei für T2S auswählen!" diff --git a/templates/lang/tts_all_en.ini b/templates/lang/tts_all_en.ini index fa77058..19fca73 100644 --- a/templates/lang/tts_all_en.ini +++ b/templates/lang/tts_all_en.ini @@ -47,6 +47,7 @@ VOICE_ERROR3="seems to be invalid.\n Error Text: Cannot get voice list!" AZURE_API_LINK="How to get the API-Key (Please check pricing upfront)" PROBLEMS_WITH_API_KEY="Something is wrong with the API-key!" USB_DEVICE="Device (DEV):" +USB_CARDNO="Card:" TTS_INSTANZ="select text-to-speech (T2S) Provider:" TTS_LANGUAGE="Standard language / voice for T2S:" VALIDATE_JINGLE="Please select Jingle file (playgong=yes) for T2S" diff --git a/webfrontend/html/tts.php b/webfrontend/html/tts.php index 6c58cc1..dd47fb0 100644 --- a/webfrontend/html/tts.php +++ b/webfrontend/html/tts.php @@ -19,6 +19,7 @@ include("helper.php"); include('logging.php'); +require_once('output/soundcards.php'); // setze korrekte Zeitzone date_default_timezone_set(date("e")); @@ -69,6 +70,10 @@ ]; $log = LBLog::newLog($params); +#$t = New soundCard(); +#$e = $t->listSoundCards(); +#print_r($e); + // used for single logging $plugindata = LBSystem::plugindata(); @@ -220,19 +225,17 @@ alsa_ob(); break; case '012': // USB Soundcard 1 - //require_once('output/usb.php'); require_once('output/alsa.php'); - $deviceno = $config['SYSTEM']['usbdevice']; getusbcard(); - shell_exec("export AUDIODEV=".$myteccard.",1,".$deviceno); + #echo "export AUDIODEV=".$myteccard; + shell_exec("export AUDIODEV=".$myteccard); alsa_ob(); break; case '013': // USB Soundcard 2 - //require_once('output/usb.php'); require_once('output/alsa.php'); - $deviceno = $config['SYSTEM']['usbdevice']; getusbcard(); - shell_exec("export AUDIODEV=".$myteccard.",2,".$deviceno); + #echo "export AUDIODEV=".$myteccard; + shell_exec("export AUDIODEV=".$myteccard); alsa_ob(); break; default; // Soundcard bcm2835 @@ -272,10 +275,13 @@ function getusbcard() { $json = file_get_contents($lbpbindir."/hats.json"); $cfg = json_decode($json, True); $mycard = $config['SYSTEM']['usbcard']; - $myteccard = $cfg[$mycard]['output']; - return($myteccard); + if ($mycard == "usb_audio") { + $myteccard = $cfg[$mycard]['output'].$config['SYSTEM']['usbcardno'].','.$config['SYSTEM']['usbdevice']; + } else { + $myteccard = $cfg[$mycard]['output'].',DEV='.$config['SYSTEM']['usbdevice']; + } + return $myteccard; } - /** * Function : create_tts --> creates an MP3 File based on Text Input diff --git a/webfrontend/htmlauth/index.cgi b/webfrontend/htmlauth/index.cgi index e25c3fa..f07a222 100644 --- a/webfrontend/htmlauth/index.cgi +++ b/webfrontend/htmlauth/index.cgi @@ -91,8 +91,8 @@ my $azureregion = "westeurope"; # Change here if you have a Azure API key fo #my $urlfile = "https://raw.githubusercontent.com/Liver64/LoxBerry-Sonos/master/webfrontend/html/release/info.txt"; my $log = LoxBerry::Log->new ( name => 'Webinterface', - # filename => $lbplogdir ."/". $pluginlogfile, - # append => 1, + #filename => $lbplogdir ."/". $pluginlogfile, + #append => 1, addtime => 1 ); my $helplink = "https://www.loxwiki.eu/x/uoFYAg"; @@ -119,9 +119,14 @@ if (!defined $pcfg->param("MP3.splitsentences")) { if (!defined $pcfg->param("SYSTEM.usbdevice")) { $pcfg->param("SYSTEM.usbdevice", 0); $pcfg->save() or &error; +}# USB card No. +if (!defined $pcfg->param("SYSTEM.usbcardno")) { + $pcfg->param("SYSTEM.usbcardno", 1); + $pcfg->save() or &error; } + ########################################################################## # Read Settings ########################################################################## @@ -452,6 +457,7 @@ sub save $pcfg->param("SYSTEM.card", "$R::out_list"); $pcfg->param("SYSTEM.usbcard", "$R::usb_list"); $pcfg->param("SYSTEM.usbdevice", "$R::usbdeviceno"); + $pcfg->param("SYSTEM.usbcardno", "$R::usbcardno"); $pcfg->param("TTS.volume", "$R::volume"); LOGINF "Writing configuration file";